source: Dev/trunk/node_modules/mocha/lib/reporters/dot.js

Last change on this file was 484, checked in by hendrikvanantwerpen, 11 years ago

Commit node_modules, to make checkouts and builds more deterministic.

File size: 1.2 KB
Line 
1
2/**
3 * Module dependencies.
4 */
5
6var Base = require('./base')
7  , color = Base.color;
8
9/**
10 * Expose `Dot`.
11 */
12
13exports = module.exports = Dot;
14
15/**
16 * Initialize a new `Dot` matrix test reporter.
17 *
18 * @param {Runner} runner
19 * @api public
20 */
21
22function Dot(runner) {
23  Base.call(this, runner);
24
25  var self = this
26    , stats = this.stats
27    , width = Base.window.width * .75 | 0
28    , n = 0;
29
30  runner.on('start', function(){
31    process.stdout.write('\n  ');
32  });
33
34  runner.on('pending', function(test){
35    process.stdout.write(color('pending', Base.symbols.dot));
36  });
37
38  runner.on('pass', function(test){
39    if (++n % width == 0) process.stdout.write('\n  ');
40    if ('slow' == test.speed) {
41      process.stdout.write(color('bright yellow', Base.symbols.dot));
42    } else {
43      process.stdout.write(color(test.speed, Base.symbols.dot));
44    }
45  });
46
47  runner.on('fail', function(test, err){
48    if (++n % width == 0) process.stdout.write('\n  ');
49    process.stdout.write(color('fail', Base.symbols.dot));
50  });
51
52  runner.on('end', function(){
53    console.log();
54    self.epilogue();
55  });
56}
57
58/**
59 * Inherit from `Base.prototype`.
60 */
61
62Dot.prototype.__proto__ = Base.prototype;
Note: See TracBrowser for help on using the repository browser.