Sha256: 7e984c593f365df542fd7a618c2b6ca7314ec92f0d8f156cb63f54ac02a27dbd

Contents?: true

Size: 1.28 KB

Versions: 28

Compression:

Stored size: 1.28 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
    , n = 1
    , passes = 0
    , failures = 0;

  runner.on('start', function(){
    var total = runner.grepTotal(runner.suite);
    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){
    passes++;
    console.log('ok %d %s', n, title(test));
  });

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

  runner.on('end', function(){
    console.log('# tests ' + (passes + failures));
    console.log('# pass ' + passes);
    console.log('# fail ' + failures);
  });
}

/**
 * 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

28 entries across 28 versions & 1 rubygems

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