| 1 | "use strict"; |
| 2 | |
| 3 | /** |
| 4 | * @typedef {import('../runner.js')} Runner |
| 5 | * @typedef {import('../test.js')} Test |
| 6 | */ |
| 7 | |
| 8 | /** |
| 9 | * @module Spec |
| 10 | */ |
| 11 | /** |
| 12 | * Module dependencies. |
| 13 | */ |
| 14 | |
| 15 | var Basescip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Base. = require("./base"scip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/); |
| 16 | var constantsscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/constants. = require("../runner"scip-typescript npm mocha 11.7.7 lib/`runner.js`/).constants; |
| 17 | var EVENT_RUN_BEGINscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_RUN_BEGIN. = constants.EVENT_RUN_BEGIN; |
| 18 | var EVENT_RUN_ENDscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_RUN_END. = constants.EVENT_RUN_END; |
| 19 | var EVENT_SUITE_BEGINscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_SUITE_BEGIN. = constants.EVENT_SUITE_BEGIN; |
| 20 | var EVENT_SUITE_ENDscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_SUITE_END. = constants.EVENT_SUITE_END; |
| 21 | var EVENT_TEST_FAILscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_TEST_FAIL. = constants.EVENT_TEST_FAIL; |
| 22 | var EVENT_TEST_PASSscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_TEST_PASS. = constants.EVENT_TEST_PASS; |
| 23 | var EVENT_TEST_PENDINGscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_TEST_PENDING. = constants.EVENT_TEST_PENDING; |
| 24 | var inheritsscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/inherits. = require("../utils"scip-typescript npm mocha 11.7.7 lib/`utils.js`/).inherits; |
| 25 | var colorscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/color. = Basescip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/Base()..color; |
| 26 | |
| 27 | /** |
| 28 | * Expose `Spec`. |
| 29 | */ |
| 30 | |
| 31 | exportsscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/ = module.exports = Specscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().; |
| 32 | |
| 33 | /** |
| 34 | * Constructs a new `Spec` reporter instance. |
| 35 | * |
| 36 | * @public |
| 37 | * @class |
| 38 | * @memberof Mocha.reporters |
| 39 | * @extends Mocha.reporters.Base |
| 40 | * @param {Runner} runner - Instance triggers reporter actions. |
| 41 | * @param {Object} [options] - runner options |
| 42 | */ |
| 43 | function Specscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().(runnerscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().(runner), optionsscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().(options)) { |
| 44 | Basescip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/Base()..callscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Function#call().(this, runnerscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().(runner), optionsscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().(options)); |
| 45 | |
| 46 | var self = this; |
| 47 | var indents = 0; |
| 48 | var n = 0; |
| 49 | |
| 50 | function indent() { |
| 51 | return Arrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#(indents).joinscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#join().(" "); |
| 52 | } |
| 53 | |
| 54 | runnerscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().(runner).on(EVENT_RUN_BEGINscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_RUN_BEGIN., function () { |
| 55 | Basescip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/Base()..consoleLog(); |
| 56 | }); |
| 57 | |
| 58 | runnerscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().(runner).on(EVENT_SUITE_BEGINscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_SUITE_BEGIN., function (suite) { |
| 59 | ++indents; |
| 60 | Basescip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/Base()..consoleLog(colorscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/color.("suite", "%s%s"), indent(), suite.title); |
| 61 | }); |
| 62 | |
| 63 | runnerscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().(runner).on(EVENT_SUITE_ENDscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_SUITE_END., function () { |
| 64 | --indents; |
| 65 | if (indents === 1) { |
| 66 | Basescip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/Base()..consoleLog(); |
| 67 | } |
| 68 | }); |
| 69 | |
| 70 | runnerscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().(runner).on(EVENT_TEST_PENDINGscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_TEST_PENDING., function (test) { |
| 71 | var fmt = indent() + colorscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/color.("pending", " - %s"); |
| 72 | Basescip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/Base()..consoleLog(fmt, test.title); |
| 73 | }); |
| 74 | |
| 75 | runnerscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().(runner).on(EVENT_TEST_PASSscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_TEST_PASS., function (test) { |
| 76 | var fmt; |
| 77 | if (test.speed === "fast") { |
| 78 | fmt = |
| 79 | indent() + |
| 80 | colorscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/color.("checkmark", " " + Basescip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/Base()..symbols.okscip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/ok0:) + |
| 81 | colorscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/color.("pass", " %s"); |
| 82 | Basescip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/Base()..consoleLog(fmt, test.title); |
| 83 | } else { |
| 84 | fmt = |
| 85 | indent() + |
| 86 | colorscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/color.("checkmark", " " + Basescip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/Base()..symbols.okscip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/ok0:) + |
| 87 | colorscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/color.("pass", " %s") + |
| 88 | colorscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/color.(test.speed, " (%dms)"); |
| 89 | Basescip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/Base()..consoleLog(fmt, test.title, test.duration); |
| 90 | } |
| 91 | }); |
| 92 | |
| 93 | runnerscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().(runner).on(EVENT_TEST_FAILscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_TEST_FAIL., function (test) { |
| 94 | Basescip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/Base()..consoleLog(indent() + colorscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/color.("fail", " %d) %s"), ++n, test.title); |
| 95 | }); |
| 96 | |
| 97 | runnerscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec().(runner).once(EVENT_RUN_ENDscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/EVENT_RUN_END., self.epilogue.bind(self)); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Inherit from `Base.prototype`. |
| 102 | */ |
| 103 | inheritsscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/inherits.(Specscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec()., Basescip-typescript npm mocha 11.7.7 lib/reporters/`base.js`/Base().); |
| 104 | |
| 105 | Specscip-typescript npm mocha 11.7.7 lib/reporters/`spec.js`/Spec()..description = "hierarchical & verbose [default]"; |