| 1 | "use strict"; |
| 2 | |
| 3 | /** |
| 4 | * @typedef {import('../runner.js')} Runner |
| 5 | */ |
| 6 | |
| 7 | /** |
| 8 | * @module Min |
| 9 | */ |
| 10 | /** |
| 11 | * Module dependencies. |
| 12 | */ |
| 13 | |
| 14 | var Base = require("./base"); |
| 15 | var inherits = require("../utils").inherits; |
| 16 | var constants = require("../runner").constants; |
| 17 | var EVENT_RUN_END = constants.EVENT_RUN_END; |
| 18 | var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN; |
| 19 | |
| 20 | /** |
| 21 | * Expose `Min`. |
| 22 | */ |
| 23 | |
| 24 | exports = module.exports = Min; |
| 25 | |
| 26 | /** |
| 27 | * Constructs a new `Min` reporter instance. |
| 28 | * |
| 29 | * @description |
| 30 | * This minimal test reporter is best used with '--watch'. |
| 31 | * |
| 32 | * @public |
| 33 | * @class |
| 34 | * @memberof Mocha.reporters |
| 35 | * @extends Mocha.reporters.Base |
| 36 | * @param {Runner} runner - Instance triggers reporter actions. |
| 37 | * @param {Object} [options] - runner options |
| 38 | */ |
| 39 | function Min(runner, options) { |
| 40 | Base.call(this, runner, options); |
| 41 | |
| 42 | runner.on(EVENT_RUN_BEGIN, function () { |
| 43 | // clear screen |
| 44 | process.stdout.write("\u001b[2J"); |
| 45 | // set cursor position |
| 46 | process.stdout.write("\u001b[1;3H"); |
| 47 | }); |
| 48 | |
| 49 | runner.once(EVENT_RUN_END, this.epilogue.bind(this)); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Inherit from `Base.prototype`. |
| 54 | */ |
| 55 | inherits(Min, Base); |
| 56 | |
| 57 | Min.description = "essentially just a summary"; |