min.js 939 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. var constants = require('../runner').constants;
  11. var EVENT_RUN_END = constants.EVENT_RUN_END;
  12. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  13. /**
  14. * Expose `Min`.
  15. */
  16. exports = module.exports = Min;
  17. /**
  18. * Initialize a new `Min` minimal test reporter (best used with --watch).
  19. *
  20. * @public
  21. * @class
  22. * @memberof Mocha.reporters
  23. * @extends Mocha.reporters.Base
  24. * @param {Runner} runner
  25. */
  26. function Min(runner) {
  27. Base.call(this, runner);
  28. runner.on(EVENT_RUN_BEGIN, function() {
  29. // clear screen
  30. process.stdout.write('\u001b[2J');
  31. // set cursor position
  32. process.stdout.write('\u001b[1;3H');
  33. });
  34. runner.once(EVENT_RUN_END, this.epilogue.bind(this));
  35. }
  36. /**
  37. * Inherit from `Base.prototype`.
  38. */
  39. inherits(Min, Base);
  40. Min.description = 'essentially just a summary';