Sha256: 23dc40337c157a25fe25a375bd2a97c4ee92b9d7ae4a7eaa58e1f27c36979342

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

/**
 * Module dependencies.
 */

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

/**
 * Expose `TAP`.
 */

exports = module.exports = TAP;

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

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

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

  runner.on('start', function(){
    console.log('%d..%d', 1, total);
  });

  runner.on('test end', function(){
    ++n;
  });

  runner.on('pending', function(test){
    console.log('ok %d %s # SKIP -', n, title(test));
  });

  runner.on('pass', function(test){
    console.log('ok %d %s', n, title(test));
  });

  runner.on('fail', function(test, err){
    console.log('not ok %d %s', n, title(test));
    console.log(err.stack.replace(/^/gm, '  '));
  });
}

/**
 * Return a TAP-safe title of `test`
 *
 * @param {Object} test
 * @return {String}
 * @api private
 */

function title(test) {
  return test.fullTitle().replace(/#/g, '');
}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
stylus-source-0.29.0 vendor/node_modules/mocha/lib/reporters/tap.js
stylus-source-0.28.2 vendor/node_modules/mocha/lib/reporters/tap.js
stylus-source-0.28.1 vendor/node_modules/mocha/lib/reporters/tap.js
stylus-source-0.28.0 vendor/node_modules/mocha/lib/reporters/tap.js
stylus-source-0.27.2 vendor/node_modules/mocha/lib/reporters/tap.js
stylus-source-0.27.1 vendor/node_modules/mocha/lib/reporters/tap.js
stylus-source-0.27.0 vendor/node_modules/mocha/lib/reporters/tap.js
stylus-source-0.26.1 vendor/node_modules/mocha/lib/reporters/tap.js
stylus-source-0.26.0 vendor/node_modules/mocha/lib/reporters/tap.js
stylus-source-0.25.0 vendor/node_modules/mocha/lib/reporters/tap.js