Skip to content

Commit d974e07

Browse files
committed
Docs. Dependency version bump.
1 parent 98f9c50 commit d974e07

File tree

6 files changed

+130
-60
lines changed

6 files changed

+130
-60
lines changed

Gruntfile.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,12 @@ module.exports = function (grunt) {
9898
options: {
9999
header: 'dalekjs/dalekjs.com/master/assets/header.html',
100100
footer: 'dalekjs/dalekjs.com/master/assets/footer.html',
101-
target: 'report/docs'
101+
target: 'report/docs',
102+
vars: {
103+
title: 'DalekJS - Documentation - Reporter - Console',
104+
desc: 'DalekJS - Documentation - Reporter - Console',
105+
docs: true
106+
}
102107
},
103108
src: ['index.js']
104109
},

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dalek-reporter-console
1212
[![unstable](https://rawgithub.com/hughsk/stability-badges/master/dist/unstable.svg)](http://github.com/hughsk/stability-badges)
1313

1414
[![NPM](https://nodei.co/npm/dalek-reporter-console.png)](https://nodei.co/npm/dalek-reporter-console/)
15+
[![NPM](https://nodei.co/npm-dl/dalek-reporter-console.png)](https://nodei.co/npm/dalek-reporter-console/)
1516

1617
## Ressources
1718

@@ -24,6 +25,21 @@ dalek-reporter-console
2425
[Homepage](http://dalekjs.com) -
2526
[Twitter](http://twitter.com/dalekjs)
2627

28+
## Docs
29+
30+
Daleks basic reporter, all the lovely colors & symbols you see when running dalek.
31+
The reporter will be installed by default.
32+
33+
```bash
34+
$ dalek your_test.js -r console,junit
35+
```
36+
37+
or you can add it to your Dalekfile
38+
39+
```js
40+
"reporter": ["console", "junit"]
41+
```
42+
2743
## Help Is Just A Click Away
2844

2945
### #dalekjs on FreeNode.net IRC
@@ -57,7 +73,7 @@ requests that implement the feature).
5773
other, better channels for seeking assistance, like StackOverflow and the
5874
Google Groups mailing list.
5975

60-
![DalekJS](https://raw.github.com/dalekjs/dalekjs.com/master/img/logo.jpg)
76+
![DalekJS](https://raw.github.com/dalekjs/dalekjs.com/master/img/logo.png)
6177

6278
## Legal FooBar (MIT License)
6379

index.js

Lines changed: 74 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,25 @@
2828
var reporter = null;
2929

3030
/**
31-
* Console reporter
31+
* Daleks basic reporter, all the lovely colors & symbols you see when running dalek.
32+
* The reporter will be installed by default.
33+
*
34+
* If you would like to use the reporter in addition to another one,
35+
* you can start dalek with a special command line argument
36+
*
37+
* ```bash
38+
* $ dalek your_test.js -r console,junit
39+
* ```
40+
*
41+
* or you can add it to your Dalekfile
42+
*
43+
* ```javascript
44+
* "reporter": ["console", "junit"]
45+
* ```
3246
*
3347
* @class Reporter
3448
* @constructor
35-
* @part console
49+
* @part Console
3650
* @api
3751
*/
3852

@@ -56,56 +70,62 @@ module.exports = function (opts) {
5670
return reporter;
5771
};
5872

59-
/**
60-
* Imports an output module with the correct log state
61-
*
62-
* @method importLogModule
63-
* @param {object} data
64-
* @chainable
65-
*/
66-
67-
Reporter.prototype.importLogModule = function () {
68-
var logModule = require('./lib/loglevel/level' + this.level);
69-
var methods = Object.keys(logModule.prototype);
70-
71-
methods.forEach(function (method) {
72-
this[method] = logModule.prototype[method];
73-
}.bind(this));
74-
return this;
75-
};
76-
77-
/**
78-
* Connects to all the event listeners
79-
*
80-
* @method startListening
81-
* @param {object} data
82-
* @chainable
83-
*/
84-
85-
Reporter.prototype.startListening = function () {
86-
// assertion & action status
87-
this.events.on('report:assertion', this.outputAssertionResult.bind(this));
88-
this.events.on('report:assertion:status', this.outputAssertionExpecation.bind(this));
89-
this.events.on('report:action', this.outputAction.bind(this));
90-
91-
// test status
92-
this.events.on('report:test:finished', this.outputTestFinished.bind(this));
93-
this.events.on('report:test:started', this.outputTestStarted.bind(this));
94-
95-
// runner status
96-
this.events.on('report:runner:started', this.outputRunnerStarted.bind(this));
97-
this.events.on('report:runner:finished', this.outputRunnerFinished.bind(this));
98-
99-
// session & browser status
100-
this.events.on('report:run:browser', this.outputRunBrowser.bind(this));
101-
this.events.on('report:driver:status', this.outputOSVersion.bind(this));
102-
this.events.on('report:driver:session', this.outputBrowserVersion.bind(this));
103-
104-
// logs
105-
this.events.on('report:log:system', this.outputLogUser.bind(this, 'system'));
106-
this.events.on('report:log:driver', this.outputLogUser.bind(this, 'driver'));
107-
this.events.on('report:log:browser', this.outputLogUser.bind(this, 'browser'));
108-
this.events.on('report:log:user', this.outputLogUser.bind(this, 'user'));
109-
110-
return this;
73+
Reporter.prototype = {
74+
75+
/**
76+
* Imports an output module with the correct log state
77+
*
78+
* @method importLogModule
79+
* @param {object} data
80+
* @chainable
81+
*/
82+
83+
importLogModule: function () {
84+
var logModule = require('./lib/loglevel/level' + this.level);
85+
var methods = Object.keys(logModule.prototype);
86+
87+
methods.forEach(function (method) {
88+
this[method] = logModule.prototype[method];
89+
}.bind(this));
90+
return this;
91+
},
92+
93+
/**
94+
* Connects to all the event listeners
95+
*
96+
* @method startListening
97+
* @param {object} data
98+
* @chainable
99+
*/
100+
101+
startListening: function () {
102+
// assertion & action status
103+
this.events.on('report:assertion', this.outputAssertionResult.bind(this));
104+
this.events.on('report:assertion:status', this.outputAssertionExpecation.bind(this));
105+
this.events.on('report:action', this.outputAction.bind(this));
106+
107+
// test status
108+
this.events.on('report:test:finished', this.outputTestFinished.bind(this));
109+
this.events.on('report:test:started', this.outputTestStarted.bind(this));
110+
111+
// runner status
112+
this.events.on('report:runner:started', this.outputRunnerStarted.bind(this));
113+
this.events.on('report:runner:finished', this.outputRunnerFinished.bind(this));
114+
115+
// session & browser status
116+
this.events.on('report:run:browser', this.outputRunBrowser.bind(this));
117+
this.events.on('report:driver:status', this.outputOSVersion.bind(this));
118+
this.events.on('report:driver:session', this.outputBrowserVersion.bind(this));
119+
120+
// logs
121+
this.events.on('report:log:system', this.outputLogUser.bind(this, 'system'));
122+
this.events.on('report:log:driver', this.outputLogUser.bind(this, 'driver'));
123+
this.events.on('report:log:browser', this.outputLogUser.bind(this, 'browser'));
124+
this.events.on('report:log:user', this.outputLogUser.bind(this, 'user'));
125+
126+
// written reports
127+
this.events.on('report:written', this.outputReportWritten.bind(this));
128+
129+
return this;
130+
}
111131
};

lib/levelbase.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ LevelBase.prototype.symbol = function (symbol) {
123123
case '>':
124124
symbol = '▶';
125125
break;
126+
case '->':
127+
symbol = '↝';
128+
break;
126129
case '<>':
127130
symbol = '☁';
128131
break;
@@ -273,3 +276,15 @@ LevelBase.prototype.outputBrowserVersion = function () {
273276
LevelBase.prototype.outputOSVersion = function () {
274277
return this;
275278
};
279+
280+
/**
281+
* Does nothing
282+
*
283+
* @method outputReportWritten
284+
* @param {object} data
285+
* @chainable
286+
*/
287+
288+
LevelBase.prototype.outputReportWritten = function () {
289+
return this;
290+
};

lib/loglevel/level3.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ LogLevel3.prototype.outputBrowserVersion = function (data) {
7070
};
7171

7272
/**
73-
* Outpots operating system information
73+
* Outputs operating system information
7474
*
7575
* @method outputOSVersion
7676
* @param {object} data
@@ -82,3 +82,17 @@ LogLevel3.prototype.outputOSVersion = function (data) {
8282
this.echo(data.os.name + ' ' + data.os.version + ' ' + data.os.arch, {foreground: 'yellowBright'});
8383
return this;
8484
};
85+
86+
/**
87+
* Outputs operating system information
88+
*
89+
* @method outputOSVersion
90+
* @param {object} data
91+
* @chainable
92+
*/
93+
94+
LogLevel3.prototype.outputReportWritten = function (data) {
95+
this.echo(this.symbol('->'), {nl: true, ec: true, foreground: 'yellow'});
96+
this.echo('Report type "' + data.type + '" written to "' + data.dest + '"', {foreground: 'yellow'});
97+
return this;
98+
};

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
"devDependencies": {
3232
"grunt": "~0.4.1",
3333
"grunt-contrib-clean": "~0.5.0",
34-
"grunt-contrib-jshint": "~0.6.0",
34+
"grunt-contrib-jshint": "~0.6.2",
3535
"grunt-contrib-yuidoc": "~0.4.0",
3636
"grunt-contrib-compress": "~0.5.2",
37-
"grunt-mocha-test": "~0.6.1",
37+
"grunt-mocha-test": "~0.6.2",
3838
"grunt-complexity": "~0.1.3",
3939
"grunt-plato": "~0.2.1",
4040
"grunt-documantix": "~0.0.3",
4141
"grunt-include-replace": "~1.1.0",
4242
"blanket": "~1.1.5",
43-
"chai": "~1.7.0"
43+
"chai": "~1.7.2"
4444
}
4545
}

0 commit comments

Comments
 (0)