lib/reporters/doc.js
function Doc(runner, options) {
  Base.call(this, runner, options);

  var indents = 2;

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

  runner.on(EVENT_SUITE_BEGIN, 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(EVENT_SUITE_END, function(suite) {
    if (suite.root) {
      return;
    }
    console.log('%s</dl>', indent());
    --indents;
    console.log('%s</section>', indent());
    --indents;
  });

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

  runner.on(EVENT_TEST_FAIL, function(test, err) {
    console.log(
      '%s  <dt class="error">%s</dt>',
      indent(),
      utils.escape(test.title)
    );
    var code = utils.escape(utils.clean(test.body));
    console.log(
      '%s  <dd class="error"><pre><code>%s</code></pre></dd>',
      indent(),
      code
    );
    console.log('%s  <dd class="error">%s</dd>', indent(), utils.escape(err));
  });
}
function Doc(runner, options) {
  Base.call(this, runner, options);

  var indents = 2;

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

  runner.on(EVENT_SUITE_BEGIN, 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(EVENT_SUITE_END, function(suite) {
    if (suite.root) {
      return;
    }
    console.log('%s</dl>', indent());
    --indents;
    console.log('%s</section>', indent());
    --indents;
  });

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

  runner.on(EVENT_TEST_FAIL, function(test, err) {
    console.log(
      '%s  <dt class="error">%s</dt>',
      indent(),
      utils.escape(test.title)
    );
    var code = utils.escape(utils.clean(test.body));
    console.log(
      '%s  <dd class="error"><pre><code>%s</code></pre></dd>',
      indent(),
      code
    );
    console.log('%s  <dd class="error">%s</dd>', indent(), utils.escape(err));
  });
}
function Doc ( runner , options ) { Base . call ( this , runner , options ) ; var indents = 2 ; function indent ( ) { return Array ( indents ) . join ( '  ' ) ; } runner . on ( EVENT_SUITE_BEGIN , 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 ( EVENT_SUITE_END , function ( suite ) { if ( suite . root ) { return ; } console . log ( '%s</dl>' , indent ( ) ) ; -- indents ; console . log ( '%s</section>' , indent ( ) ) ; -- indents ; } ) ; runner . on ( EVENT_TEST_PASS , function ( test ) { console . log ( '%s  <dt>%s</dt>' , indent ( ) , utils . escape ( test . title ) ) ; var code = utils . escape ( utils . clean ( test . body ) ) ; console . log ( '%s  <dd><pre><code>%s</code></pre></dd>' , indent ( ) , code ) ; } ) ; runner . on ( EVENT_TEST_FAIL , function ( test , err ) { console . log ( '%s  <dt class="error">%s</dt>' , indent ( ) , utils . escape ( test . title ) ) ; var code = utils . escape ( utils . clean ( test . body ) ) ; console . log ( '%s  <dd class="error"><pre><code>%s</code></pre></dd>' , indent ( ) , code ) ; console . log ( '%s  <dd class="error">%s</dd>' , indent ( ) , utils . escape ( err ) ) ; } ) ; }
Constructs a new `Doc` reporter instance.

@public
@class
@memberof Mocha.reporters
@extends Mocha.reporters.Base
@param {Runner} runner - Instance triggers reporter actions.
@param {Object} [options] - runner options
Constructs a new Doc reporter instance .