Skip to content

Commit

Permalink
Docs. Dependency version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
asciidisco committed Aug 1, 2013
1 parent 98f9c50 commit d974e07
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 60 deletions.
7 changes: 6 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ module.exports = function (grunt) {
options: {
header: 'dalekjs/dalekjs.com/master/assets/header.html',
footer: 'dalekjs/dalekjs.com/master/assets/footer.html',
target: 'report/docs'
target: 'report/docs',
vars: {
title: 'DalekJS - Documentation - Reporter - Console',
desc: 'DalekJS - Documentation - Reporter - Console',
docs: true
}
},
src: ['index.js']
},
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dalek-reporter-console
[![unstable](https://rawgithub.com/hughsk/stability-badges/master/dist/unstable.svg)](http://github.com/hughsk/stability-badges)

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

## Ressources

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

## Docs

Daleks basic reporter, all the lovely colors & symbols you see when running dalek.
The reporter will be installed by default.

```bash
$ dalek your_test.js -r console,junit
```

or you can add it to your Dalekfile

```js
"reporter": ["console", "junit"]
```

## Help Is Just A Click Away

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

![DalekJS](https://raw.github.com/dalekjs/dalekjs.com/master/img/logo.jpg)
![DalekJS](https://raw.github.com/dalekjs/dalekjs.com/master/img/logo.png)

## Legal FooBar (MIT License)

Expand Down
128 changes: 74 additions & 54 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,25 @@
var reporter = null;

/**
* Console reporter
* Daleks basic reporter, all the lovely colors & symbols you see when running dalek.
* The reporter will be installed by default.
*
* If you would like to use the reporter in addition to another one,
* you can start dalek with a special command line argument
*
* ```bash
* $ dalek your_test.js -r console,junit
* ```
*
* or you can add it to your Dalekfile
*
* ```javascript
* "reporter": ["console", "junit"]
* ```
*
* @class Reporter
* @constructor
* @part console
* @part Console
* @api
*/

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

/**
* Imports an output module with the correct log state
*
* @method importLogModule
* @param {object} data
* @chainable
*/

Reporter.prototype.importLogModule = function () {
var logModule = require('./lib/loglevel/level' + this.level);
var methods = Object.keys(logModule.prototype);

methods.forEach(function (method) {
this[method] = logModule.prototype[method];
}.bind(this));
return this;
};

/**
* Connects to all the event listeners
*
* @method startListening
* @param {object} data
* @chainable
*/

Reporter.prototype.startListening = function () {
// assertion & action status
this.events.on('report:assertion', this.outputAssertionResult.bind(this));
this.events.on('report:assertion:status', this.outputAssertionExpecation.bind(this));
this.events.on('report:action', this.outputAction.bind(this));

// test status
this.events.on('report:test:finished', this.outputTestFinished.bind(this));
this.events.on('report:test:started', this.outputTestStarted.bind(this));

// runner status
this.events.on('report:runner:started', this.outputRunnerStarted.bind(this));
this.events.on('report:runner:finished', this.outputRunnerFinished.bind(this));

// session & browser status
this.events.on('report:run:browser', this.outputRunBrowser.bind(this));
this.events.on('report:driver:status', this.outputOSVersion.bind(this));
this.events.on('report:driver:session', this.outputBrowserVersion.bind(this));

// logs
this.events.on('report:log:system', this.outputLogUser.bind(this, 'system'));
this.events.on('report:log:driver', this.outputLogUser.bind(this, 'driver'));
this.events.on('report:log:browser', this.outputLogUser.bind(this, 'browser'));
this.events.on('report:log:user', this.outputLogUser.bind(this, 'user'));

return this;
Reporter.prototype = {

/**
* Imports an output module with the correct log state
*
* @method importLogModule
* @param {object} data
* @chainable
*/

importLogModule: function () {
var logModule = require('./lib/loglevel/level' + this.level);
var methods = Object.keys(logModule.prototype);

methods.forEach(function (method) {
this[method] = logModule.prototype[method];
}.bind(this));
return this;
},

/**
* Connects to all the event listeners
*
* @method startListening
* @param {object} data
* @chainable
*/

startListening: function () {
// assertion & action status
this.events.on('report:assertion', this.outputAssertionResult.bind(this));
this.events.on('report:assertion:status', this.outputAssertionExpecation.bind(this));
this.events.on('report:action', this.outputAction.bind(this));

// test status
this.events.on('report:test:finished', this.outputTestFinished.bind(this));
this.events.on('report:test:started', this.outputTestStarted.bind(this));

// runner status
this.events.on('report:runner:started', this.outputRunnerStarted.bind(this));
this.events.on('report:runner:finished', this.outputRunnerFinished.bind(this));

// session & browser status
this.events.on('report:run:browser', this.outputRunBrowser.bind(this));
this.events.on('report:driver:status', this.outputOSVersion.bind(this));
this.events.on('report:driver:session', this.outputBrowserVersion.bind(this));

// logs
this.events.on('report:log:system', this.outputLogUser.bind(this, 'system'));
this.events.on('report:log:driver', this.outputLogUser.bind(this, 'driver'));
this.events.on('report:log:browser', this.outputLogUser.bind(this, 'browser'));
this.events.on('report:log:user', this.outputLogUser.bind(this, 'user'));

// written reports
this.events.on('report:written', this.outputReportWritten.bind(this));

return this;
}
};
15 changes: 15 additions & 0 deletions lib/levelbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ LevelBase.prototype.symbol = function (symbol) {
case '>':
symbol = '▶';
break;
case '->':
symbol = '↝';
break;
case '<>':
symbol = '☁';
break;
Expand Down Expand Up @@ -273,3 +276,15 @@ LevelBase.prototype.outputBrowserVersion = function () {
LevelBase.prototype.outputOSVersion = function () {
return this;
};

/**
* Does nothing
*
* @method outputReportWritten
* @param {object} data
* @chainable
*/

LevelBase.prototype.outputReportWritten = function () {
return this;
};
16 changes: 15 additions & 1 deletion lib/loglevel/level3.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ LogLevel3.prototype.outputBrowserVersion = function (data) {
};

/**
* Outpots operating system information
* Outputs operating system information
*
* @method outputOSVersion
* @param {object} data
Expand All @@ -82,3 +82,17 @@ LogLevel3.prototype.outputOSVersion = function (data) {
this.echo(data.os.name + ' ' + data.os.version + ' ' + data.os.arch, {foreground: 'yellowBright'});
return this;
};

/**
* Outputs operating system information
*
* @method outputOSVersion
* @param {object} data
* @chainable
*/

LogLevel3.prototype.outputReportWritten = function (data) {
this.echo(this.symbol('->'), {nl: true, ec: true, foreground: 'yellow'});
this.echo('Report type "' + data.type + '" written to "' + data.dest + '"', {foreground: 'yellow'});
return this;
};
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-jshint": "~0.6.0",
"grunt-contrib-jshint": "~0.6.2",
"grunt-contrib-yuidoc": "~0.4.0",
"grunt-contrib-compress": "~0.5.2",
"grunt-mocha-test": "~0.6.1",
"grunt-mocha-test": "~0.6.2",
"grunt-complexity": "~0.1.3",
"grunt-plato": "~0.2.1",
"grunt-documantix": "~0.0.3",
"grunt-include-replace": "~1.1.0",
"blanket": "~1.1.5",
"chai": "~1.7.0"
"chai": "~1.7.2"
}
}

0 comments on commit d974e07

Please sign in to comment.