| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- 'use strict';
- /**
- * 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 * 0.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.comma));
- });
- 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.bang));
- });
- runner.on('end', function () {
- console.log();
- self.epilogue();
- });
- }
- /**
- * Inherit from `Base.prototype`.
- */
- inherits(Dot, Base);
|