'use strict';
/**
* @module Doc
*/
/**
* Module dependencies.
*/
var Base = require('./base');
var utils = require('../utils');
/**
* Expose `Doc`.
*/
exports = module.exports = Doc;
/**
* Initialize a new `Doc` reporter.
*
* @class
* @memberof Mocha.reporters
* @extends {Base}
* @public
* @param {Runner} runner
* @api public
*/
function Doc(runner) {
Base.call(this, runner);
var indents = 2;
function indent() {
return Array(indents).join(' ');
}
runner.on('suite', function(suite) {
if (suite.root) {
return;
}
++indents;
console.log('%s%s
', indent(), utils.escape(suite.title));
console.log('%s', indent());
});
runner.on('suite end', function(suite) {
if (suite.root) {
return;
}
console.log('%s
', indent());
--indents;
console.log('%s
%s
%s