Sha256: 868b6e15fd5b6aeb5e6b3e9572ea7933a79f119460fcd28a593837eeda51c597

Contents?: true

Size: 1.03 KB

Versions: 38

Compression:

Stored size: 1.03 KB

Contents

/**
 * Module dependencies.
 */

var Base = require('./base')
  , color = Base.color;

/**
 * Expose `List`.
 */

exports = module.exports = List;

/**
 * Initialize a new `List` test reporter.
 *
 * @param {Runner} runner
 * @api public
 */

function List(runner) {
  Base.call(this, runner);

  var self = this
    , stats = this.stats
    , total = runner.total;

  runner.on('start', function(){
    console.log(JSON.stringify(['start', { total: total }]));
  });

  runner.on('pass', function(test){
    console.log(JSON.stringify(['pass', clean(test)]));
  });

  runner.on('fail', function(test, err){
    console.log(JSON.stringify(['fail', clean(test)]));
  });

  runner.on('end', function(){
    process.stdout.write(JSON.stringify(['end', self.stats]));
  });
}

/**
 * Return a plain-object representation of `test`
 * free of cyclic properties etc.
 *
 * @param {Object} test
 * @return {Object}
 * @api private
 */

function clean(test) {
  return {
      title: test.title
    , fullTitle: test.fullTitle()
    , duration: test.duration
  }
}

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
stylus-source-0.42.2 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.42.1 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.42.0 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.41.3 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.41.2 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.41.1 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.41.0 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.40.3 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.40.2 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.40.1 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.40.0 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.39.4 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.39.3 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.39.2 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.39.1 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.39.0 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.38.0 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.37.0 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.36.1 vendor/node_modules/mocha/lib/reporters/json-stream.js
stylus-source-0.36.0 vendor/node_modules/mocha/lib/reporters/json-stream.js