min.js 747 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use strict';
  2. /**
  3. * @module Min
  4. */
  5. /**
  6. * Module dependencies.
  7. */
  8. var Base = require('./base');
  9. var inherits = require('../utils').inherits;
  10. /**
  11. * Expose `Min`.
  12. */
  13. exports = module.exports = Min;
  14. /**
  15. * Initialize a new `Min` minimal test reporter (best used with --watch).
  16. *
  17. * @public
  18. * @class
  19. * @memberof Mocha.reporters
  20. * @extends Mocha.reporters.Base
  21. * @api public
  22. * @param {Runner} runner
  23. */
  24. function Min(runner) {
  25. Base.call(this, runner);
  26. runner.on('start', function() {
  27. // clear screen
  28. process.stdout.write('\u001b[2J');
  29. // set cursor position
  30. process.stdout.write('\u001b[1;3H');
  31. });
  32. runner.once('end', this.epilogue.bind(this));
  33. }
  34. /**
  35. * Inherit from `Base.prototype`.
  36. */
  37. inherits(Min, Base);