Sha256: e674c331b827bf6e564c25cb99b9d8ae93d1e35e5e77fc50d8fde9f121a05ee3

Contents?: true

Size: 1.13 KB

Versions: 31

Compression:

Stored size: 1.13 KB

Contents

/**
 * Module dependencies.
 */

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

/**
 * Expose `Doc`.
 */

exports = module.exports = Doc;

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

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

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

  function indent() {
    return Array(indents).join('  ');
  }

  runner.on('suite', function(suite){
    if (suite.root) return;
    ++indents;
    console.log('%s<section class="suite">', indent());
    ++indents;
    console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
    console.log('%s<dl>', indent());
  });

  runner.on('suite end', function(suite){
    if (suite.root) return;
    console.log('%s</dl>', indent());
    --indents;
    console.log('%s</section>', indent());
    --indents;
  });

  runner.on('pass', function(test){
    console.log('%s  <dt>%s</dt>', indent(), utils.escape(test.title));
    var code = utils.escape(utils.clean(test.fn.toString()));
    console.log('%s  <dd><pre><code>%s</code></pre></dd>', indent(), code);
  });
}

Version data entries

31 entries across 31 versions & 1 rubygems

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