123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- /**
- * Module dependencies.
- */
- var Base = require('./base');
- var inherits = require('../utils').inherits;
- var color = Base.color;
- /**
- * Expose `Dot`.
- */
- exports = module.exports = Dot;
- /**
- * Initialize a new `Dot` matrix test reporter.
- *
- * @api public
- * @param {Runner} runner
- */
- function Dot(runner) {
- Base.call(this, runner);
- var self = this;
- var width = Base.window.width * .75 | 0;
- var n = -1;
- runner.on('start', function() {
- process.stdout.write('\n');
- });
- runner.on('pending', function() {
- if (++n % width === 0) {
- process.stdout.write('\n ');
- }
- process.stdout.write(color('pending', Base.symbols.dot));
- });
- runner.on('pass', function(test) {
- if (++n % width === 0) {
- process.stdout.write('\n ');
- }
- if (test.speed === 'slow') {
- process.stdout.write(color('bright yellow', Base.symbols.dot));
- } else {
- process.stdout.write(color(test.speed, Base.symbols.dot));
- }
- });
- runner.on('fail', function() {
- if (++n % width === 0) {
- process.stdout.write('\n ');
- }
- process.stdout.write(color('fail', Base.symbols.dot));
- });
- runner.on('end', function() {
- console.log();
- self.epilogue();
- });
- }
- /**
- * Inherit from `Base.prototype`.
- */
- inherits(Dot, Base);
|