@eggjs/mock 6.1.0-beta.3 → 6.1.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.js +24 -1
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.js +1 -1
- package/dist/index.js +0 -1
- package/dist/inject_mocha.d.ts +1 -0
- package/dist/inject_mocha.js +35 -0
- package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +142 -0
- package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js +157 -0
- package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js +97 -0
- package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js +40 -0
- package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +812 -0
- package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +50 -0
- package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +68 -0
- package/dist/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +752 -0
- package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js +203 -0
- package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js +209 -0
- package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js +18 -0
- package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js +215 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/dmp.js +24 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/xml.js +33 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/array.js +29 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/base.js +185 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/character.js +23 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/css.js +26 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/json.js +83 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/line.js +51 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/sentence.js +26 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/word.js +151 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js +178 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js +168 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js +301 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js +137 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js +367 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js +91 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js +99 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/array.js +23 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/distance-iterator.js +30 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/params.js +22 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/string.js +97 -0
- package/dist/node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js +14 -0
- package/dist/node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js +16 -0
- package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.js +4093 -0
- package/dist/node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js +14 -0
- package/dist/node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js +27 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js +12 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/context.js +83 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/error-constants.js +35 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/errors.js +392 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/hook.js +86 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js +104 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js +99 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js +65 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js +18 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js +95 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js +105 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocha.js +1037 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocharc.js +24 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/buffered-worker-pool.js +152 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/esm-utils.js +74 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/file-unloader.js +22 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/parallel-buffered-runner.js +329 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/serializer.js +314 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/pending.js +22 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/base.js +417 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/doc.js +79 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/dot.js +75 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/html.js +283 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/index.js +40 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json-stream.js +90 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json.js +145 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/landing.js +107 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js +77 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js +106 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js +57 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js +233 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js +92 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js +91 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js +261 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js +166 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runnable.js +346 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runner.js +922 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/stats-collector.js +72 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/suite.js +517 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/test.js +105 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/utils.js +505 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/package.js +225 -0
- package/dist/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +124 -0
- package/dist/node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/index.js +11 -0
- package/dist/node_modules/.pnpm/serialize-javascript@6.0.2/node_modules/serialize-javascript/index.js +114 -0
- package/dist/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js +76 -0
- package/dist/node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js +89 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/Pool.js +366 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/Promise.js +248 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/WorkerHandler.js +419 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/debug-port-allocator.js +27 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/environment.js +18 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/generated/embeddedWorker.js +16 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/index.js +63 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/transfer.js +21 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/validateOptions.js +9 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.3/node_modules/workerpool/src/worker.js +281 -0
- package/dist/register.d.ts +0 -2
- package/dist/register.js +1 -26
- package/package.json +10 -8
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { __commonJS, __require } from "../../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { require_utils } from "../utils.js";
|
|
3
|
+
import { require_runner } from "../runner.js";
|
|
4
|
+
import { require_base } from "./base.js";
|
|
5
|
+
|
|
6
|
+
//#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js
|
|
7
|
+
var require_tap = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js": ((exports, module) => {
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {import('../runner.js')} Runner
|
|
10
|
+
* @typedef {import('../test.js')} Test
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @module TAP
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Module dependencies.
|
|
17
|
+
*/
|
|
18
|
+
var util = __require("node:util");
|
|
19
|
+
var Base = require_base();
|
|
20
|
+
var constants = require_runner().constants;
|
|
21
|
+
var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
|
22
|
+
var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
|
23
|
+
var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
|
|
24
|
+
var EVENT_RUN_END = constants.EVENT_RUN_END;
|
|
25
|
+
var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
|
26
|
+
var EVENT_TEST_END = constants.EVENT_TEST_END;
|
|
27
|
+
var inherits = require_utils().inherits;
|
|
28
|
+
var sprintf = util.format;
|
|
29
|
+
/**
|
|
30
|
+
* Expose `TAP`.
|
|
31
|
+
*/
|
|
32
|
+
exports = module.exports = TAP;
|
|
33
|
+
/**
|
|
34
|
+
* Constructs a new `TAP` 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 TAP(runner, options) {
|
|
44
|
+
Base.call(this, runner, options);
|
|
45
|
+
var self = this;
|
|
46
|
+
var n = 1;
|
|
47
|
+
var tapVersion = "12";
|
|
48
|
+
if (options && options.reporterOptions) {
|
|
49
|
+
if (options.reporterOptions.tapVersion) tapVersion = options.reporterOptions.tapVersion.toString();
|
|
50
|
+
}
|
|
51
|
+
this._producer = createProducer(tapVersion);
|
|
52
|
+
runner.once(EVENT_RUN_BEGIN, function() {
|
|
53
|
+
self._producer.writeVersion();
|
|
54
|
+
});
|
|
55
|
+
runner.on(EVENT_TEST_END, function() {
|
|
56
|
+
++n;
|
|
57
|
+
});
|
|
58
|
+
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
59
|
+
self._producer.writePending(n, test);
|
|
60
|
+
});
|
|
61
|
+
runner.on(EVENT_TEST_PASS, function(test) {
|
|
62
|
+
self._producer.writePass(n, test);
|
|
63
|
+
});
|
|
64
|
+
runner.on(EVENT_TEST_FAIL, function(test, err) {
|
|
65
|
+
self._producer.writeFail(n, test, err);
|
|
66
|
+
});
|
|
67
|
+
runner.once(EVENT_RUN_END, function() {
|
|
68
|
+
self._producer.writeEpilogue(runner.stats);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Inherit from `Base.prototype`.
|
|
73
|
+
*/
|
|
74
|
+
inherits(TAP, Base);
|
|
75
|
+
/**
|
|
76
|
+
* Returns a TAP-safe title of `test`.
|
|
77
|
+
*
|
|
78
|
+
* @private
|
|
79
|
+
* @param {Test} test - Test instance.
|
|
80
|
+
* @return {String} title with any hash character removed
|
|
81
|
+
*/
|
|
82
|
+
function title(test) {
|
|
83
|
+
return test.fullTitle().replace(/#/g, "");
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Writes newline-terminated formatted string to reporter output stream.
|
|
87
|
+
*
|
|
88
|
+
* @private
|
|
89
|
+
* @param {string} format - `printf`-like format string
|
|
90
|
+
* @param {...*} [varArgs] - Format string arguments
|
|
91
|
+
*/
|
|
92
|
+
function println() {
|
|
93
|
+
var vargs = Array.from(arguments);
|
|
94
|
+
vargs[0] += "\n";
|
|
95
|
+
process.stdout.write(sprintf.apply(null, vargs));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Returns a `tapVersion`-appropriate TAP producer instance, if possible.
|
|
99
|
+
*
|
|
100
|
+
* @private
|
|
101
|
+
* @param {string} tapVersion - Version of TAP specification to produce.
|
|
102
|
+
* @returns {TAPProducer} specification-appropriate instance
|
|
103
|
+
* @throws {Error} if specification version has no associated producer.
|
|
104
|
+
*/
|
|
105
|
+
function createProducer(tapVersion) {
|
|
106
|
+
var producer = {
|
|
107
|
+
12: new TAP12Producer(),
|
|
108
|
+
13: new TAP13Producer()
|
|
109
|
+
}[tapVersion];
|
|
110
|
+
if (!producer) throw new Error("invalid or unsupported TAP version: " + JSON.stringify(tapVersion));
|
|
111
|
+
return producer;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @summary
|
|
115
|
+
* Constructs a new TAPProducer.
|
|
116
|
+
*
|
|
117
|
+
* @description
|
|
118
|
+
* <em>Only</em> to be used as an abstract base class.
|
|
119
|
+
*
|
|
120
|
+
* @private
|
|
121
|
+
* @constructor
|
|
122
|
+
*/
|
|
123
|
+
function TAPProducer() {}
|
|
124
|
+
/**
|
|
125
|
+
* Writes the TAP version to reporter output stream.
|
|
126
|
+
*
|
|
127
|
+
* @abstract
|
|
128
|
+
*/
|
|
129
|
+
TAPProducer.prototype.writeVersion = function() {};
|
|
130
|
+
/**
|
|
131
|
+
* Writes the plan to reporter output stream.
|
|
132
|
+
*
|
|
133
|
+
* @abstract
|
|
134
|
+
* @param {number} ntests - Number of tests that are planned to run.
|
|
135
|
+
*/
|
|
136
|
+
TAPProducer.prototype.writePlan = function(ntests) {
|
|
137
|
+
println("%d..%d", 1, ntests);
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Writes that test passed to reporter output stream.
|
|
141
|
+
*
|
|
142
|
+
* @abstract
|
|
143
|
+
* @param {number} n - Index of test that passed.
|
|
144
|
+
* @param {Test} test - Instance containing test information.
|
|
145
|
+
*/
|
|
146
|
+
TAPProducer.prototype.writePass = function(n, test) {
|
|
147
|
+
println("ok %d %s", n, title(test));
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Writes that test was skipped to reporter output stream.
|
|
151
|
+
*
|
|
152
|
+
* @abstract
|
|
153
|
+
* @param {number} n - Index of test that was skipped.
|
|
154
|
+
* @param {Test} test - Instance containing test information.
|
|
155
|
+
*/
|
|
156
|
+
TAPProducer.prototype.writePending = function(n, test) {
|
|
157
|
+
println("ok %d %s # SKIP -", n, title(test));
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Writes that test failed to reporter output stream.
|
|
161
|
+
*
|
|
162
|
+
* @abstract
|
|
163
|
+
* @param {number} n - Index of test that failed.
|
|
164
|
+
* @param {Test} test - Instance containing test information.
|
|
165
|
+
*/
|
|
166
|
+
TAPProducer.prototype.writeFail = function(n, test) {
|
|
167
|
+
println("not ok %d %s", n, title(test));
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Writes the summary epilogue to reporter output stream.
|
|
171
|
+
*
|
|
172
|
+
* @abstract
|
|
173
|
+
* @param {Object} stats - Object containing run statistics.
|
|
174
|
+
*/
|
|
175
|
+
TAPProducer.prototype.writeEpilogue = function(stats) {
|
|
176
|
+
println("# tests " + (stats.passes + stats.failures));
|
|
177
|
+
println("# pass " + stats.passes);
|
|
178
|
+
println("# fail " + stats.failures);
|
|
179
|
+
this.writePlan(stats.passes + stats.failures + stats.pending);
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* @summary
|
|
183
|
+
* Constructs a new TAP12Producer.
|
|
184
|
+
*
|
|
185
|
+
* @description
|
|
186
|
+
* Produces output conforming to the TAP12 specification.
|
|
187
|
+
*
|
|
188
|
+
* @private
|
|
189
|
+
* @constructor
|
|
190
|
+
* @extends TAPProducer
|
|
191
|
+
* @see {@link https://testanything.org/tap-specification.html|Specification}
|
|
192
|
+
*/
|
|
193
|
+
function TAP12Producer() {
|
|
194
|
+
/**
|
|
195
|
+
* Writes that test failed to reporter output stream, with error formatting.
|
|
196
|
+
* @override
|
|
197
|
+
*/
|
|
198
|
+
this.writeFail = function(n, test, err) {
|
|
199
|
+
TAPProducer.prototype.writeFail.call(this, n, test, err);
|
|
200
|
+
if (err.message) println(err.message.replace(/^/gm, " "));
|
|
201
|
+
if (err.stack) println(err.stack.replace(/^/gm, " "));
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Inherit from `TAPProducer.prototype`.
|
|
206
|
+
*/
|
|
207
|
+
inherits(TAP12Producer, TAPProducer);
|
|
208
|
+
/**
|
|
209
|
+
* @summary
|
|
210
|
+
* Constructs a new TAP13Producer.
|
|
211
|
+
*
|
|
212
|
+
* @description
|
|
213
|
+
* Produces output conforming to the TAP13 specification.
|
|
214
|
+
*
|
|
215
|
+
* @private
|
|
216
|
+
* @constructor
|
|
217
|
+
* @extends TAPProducer
|
|
218
|
+
* @see {@link https://testanything.org/tap-version-13-specification.html|Specification}
|
|
219
|
+
*/
|
|
220
|
+
function TAP13Producer() {
|
|
221
|
+
/**
|
|
222
|
+
* Writes the TAP version to reporter output stream.
|
|
223
|
+
* @override
|
|
224
|
+
*/
|
|
225
|
+
this.writeVersion = function() {
|
|
226
|
+
println("TAP version 13");
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Writes that test failed to reporter output stream, with error formatting.
|
|
230
|
+
* @override
|
|
231
|
+
*/
|
|
232
|
+
this.writeFail = function(n, test, err) {
|
|
233
|
+
TAPProducer.prototype.writeFail.call(this, n, test, err);
|
|
234
|
+
if (err.message != null || err.stack != null) {
|
|
235
|
+
println(indent(1) + "---");
|
|
236
|
+
if (err.message) {
|
|
237
|
+
println(indent(2) + "message: |-");
|
|
238
|
+
println(err.message.replace(/^/gm, indent(3)));
|
|
239
|
+
}
|
|
240
|
+
if (err.stack) {
|
|
241
|
+
println(indent(2) + "stack: |-");
|
|
242
|
+
println(err.stack.replace(/^/gm, indent(3)));
|
|
243
|
+
}
|
|
244
|
+
println(indent(1) + "...");
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
function indent(level) {
|
|
248
|
+
return Array(level + 1).join(" ");
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Inherit from `TAPProducer.prototype`.
|
|
253
|
+
*/
|
|
254
|
+
inherits(TAP13Producer, TAPProducer);
|
|
255
|
+
TAP.description = "TAP-compatible output";
|
|
256
|
+
}) });
|
|
257
|
+
|
|
258
|
+
//#endregion
|
|
259
|
+
export default require_tap();
|
|
260
|
+
|
|
261
|
+
export { require_tap };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { __commonJS, __require } from "../../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { require_utils } from "../utils.js";
|
|
3
|
+
import { require_errors } from "../errors.js";
|
|
4
|
+
import { require_runnable } from "../runnable.js";
|
|
5
|
+
import { require_runner } from "../runner.js";
|
|
6
|
+
import { require_base } from "./base.js";
|
|
7
|
+
|
|
8
|
+
//#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js
|
|
9
|
+
var require_xunit = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js": ((exports, module) => {
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {import('../runner.js')} Runner
|
|
12
|
+
* @typedef {import('../test.js')} Test
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* @module XUnit
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Module dependencies.
|
|
19
|
+
*/
|
|
20
|
+
var Base = require_base();
|
|
21
|
+
var utils = require_utils();
|
|
22
|
+
var fs = __require("node:fs");
|
|
23
|
+
var path = __require("node:path");
|
|
24
|
+
var createUnsupportedError = require_errors().createUnsupportedError;
|
|
25
|
+
var constants = require_runner().constants;
|
|
26
|
+
var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
|
|
27
|
+
var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
|
|
28
|
+
var EVENT_RUN_END = constants.EVENT_RUN_END;
|
|
29
|
+
var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
|
|
30
|
+
var STATE_FAILED = require_runnable().constants.STATE_FAILED;
|
|
31
|
+
var inherits = utils.inherits;
|
|
32
|
+
var escape = utils.escape;
|
|
33
|
+
/**
|
|
34
|
+
* Save timer references to avoid Sinon interfering (see GH-237).
|
|
35
|
+
*/
|
|
36
|
+
var Date = global.Date;
|
|
37
|
+
/**
|
|
38
|
+
* Expose `XUnit`.
|
|
39
|
+
*/
|
|
40
|
+
exports = module.exports = XUnit;
|
|
41
|
+
/**
|
|
42
|
+
* Constructs a new `XUnit` reporter instance.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
* @class
|
|
46
|
+
* @memberof Mocha.reporters
|
|
47
|
+
* @extends Mocha.reporters.Base
|
|
48
|
+
* @param {Runner} runner - Instance triggers reporter actions.
|
|
49
|
+
* @param {Object} [options] - runner options
|
|
50
|
+
*/
|
|
51
|
+
function XUnit(runner, options) {
|
|
52
|
+
Base.call(this, runner, options);
|
|
53
|
+
var stats = this.stats;
|
|
54
|
+
var tests = [];
|
|
55
|
+
var self = this;
|
|
56
|
+
var suiteName;
|
|
57
|
+
var DEFAULT_SUITE_NAME = "Mocha Tests";
|
|
58
|
+
if (options && options.reporterOptions) {
|
|
59
|
+
if (options.reporterOptions.output) {
|
|
60
|
+
if (!fs.createWriteStream) throw createUnsupportedError("file output not supported in browser");
|
|
61
|
+
fs.mkdirSync(path.dirname(options.reporterOptions.output), { recursive: true });
|
|
62
|
+
self.fileStream = fs.createWriteStream(options.reporterOptions.output);
|
|
63
|
+
}
|
|
64
|
+
suiteName = options.reporterOptions.suiteName;
|
|
65
|
+
}
|
|
66
|
+
suiteName = suiteName || DEFAULT_SUITE_NAME;
|
|
67
|
+
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
68
|
+
tests.push(test);
|
|
69
|
+
});
|
|
70
|
+
runner.on(EVENT_TEST_PASS, function(test) {
|
|
71
|
+
tests.push(test);
|
|
72
|
+
});
|
|
73
|
+
runner.on(EVENT_TEST_FAIL, function(test) {
|
|
74
|
+
tests.push(test);
|
|
75
|
+
});
|
|
76
|
+
runner.once(EVENT_RUN_END, function() {
|
|
77
|
+
self.write(tag("testsuite", {
|
|
78
|
+
name: suiteName,
|
|
79
|
+
tests: stats.tests,
|
|
80
|
+
failures: 0,
|
|
81
|
+
errors: stats.failures,
|
|
82
|
+
skipped: stats.tests - stats.failures - stats.passes,
|
|
83
|
+
timestamp: new Date().toUTCString(),
|
|
84
|
+
time: stats.duration / 1e3 || 0
|
|
85
|
+
}, false));
|
|
86
|
+
tests.forEach(function(t) {
|
|
87
|
+
self.test(t, options);
|
|
88
|
+
});
|
|
89
|
+
self.write("</testsuite>");
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Inherit from `Base.prototype`.
|
|
94
|
+
*/
|
|
95
|
+
inherits(XUnit, Base);
|
|
96
|
+
/**
|
|
97
|
+
* Override done to close the stream (if it's a file).
|
|
98
|
+
*
|
|
99
|
+
* @param failures
|
|
100
|
+
* @param {Function} fn
|
|
101
|
+
*/
|
|
102
|
+
XUnit.prototype.done = function(failures, fn) {
|
|
103
|
+
if (this.fileStream) this.fileStream.end(function() {
|
|
104
|
+
fn(failures);
|
|
105
|
+
});
|
|
106
|
+
else fn(failures);
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Write out the given line.
|
|
110
|
+
*
|
|
111
|
+
* @param {string} line
|
|
112
|
+
*/
|
|
113
|
+
XUnit.prototype.write = function(line) {
|
|
114
|
+
if (this.fileStream) this.fileStream.write(line + "\n");
|
|
115
|
+
else if (typeof process === "object" && process.stdout) process.stdout.write(line + "\n");
|
|
116
|
+
else Base.consoleLog(line);
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Output tag for the given `test.`
|
|
120
|
+
*
|
|
121
|
+
* @param {Test} test
|
|
122
|
+
*/
|
|
123
|
+
XUnit.prototype.test = function(test, options) {
|
|
124
|
+
Base.useColors = false;
|
|
125
|
+
var attrs = {
|
|
126
|
+
classname: test.parent.fullTitle(),
|
|
127
|
+
name: test.title,
|
|
128
|
+
file: testFilePath(test.file, options),
|
|
129
|
+
time: test.duration / 1e3 || 0
|
|
130
|
+
};
|
|
131
|
+
if (test.state === STATE_FAILED) {
|
|
132
|
+
var err = test.err;
|
|
133
|
+
var diff = !Base.hideDiff && Base.showDiff(err) ? "\n" + Base.generateDiff(err.actual, err.expected) : "";
|
|
134
|
+
this.write(tag("testcase", attrs, false, tag("failure", {}, false, escape(err.message) + escape(diff) + "\n" + escape(err.stack))));
|
|
135
|
+
} else if (test.isPending()) this.write(tag("testcase", attrs, false, tag("skipped", {}, true)));
|
|
136
|
+
else this.write(tag("testcase", attrs, true));
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* HTML tag helper.
|
|
140
|
+
*
|
|
141
|
+
* @param name
|
|
142
|
+
* @param attrs
|
|
143
|
+
* @param close
|
|
144
|
+
* @param content
|
|
145
|
+
* @return {string}
|
|
146
|
+
*/
|
|
147
|
+
function tag(name, attrs, close, content) {
|
|
148
|
+
var end = close ? "/>" : ">";
|
|
149
|
+
var pairs = [];
|
|
150
|
+
var tag$1;
|
|
151
|
+
for (var key in attrs) if (Object.prototype.hasOwnProperty.call(attrs, key)) pairs.push(key + "=\"" + escape(attrs[key]) + "\"");
|
|
152
|
+
tag$1 = "<" + name + (pairs.length ? " " + pairs.join(" ") : "") + end;
|
|
153
|
+
if (content) tag$1 += content + "</" + name + end;
|
|
154
|
+
return tag$1;
|
|
155
|
+
}
|
|
156
|
+
function testFilePath(filepath, options) {
|
|
157
|
+
if (options && options.reporterOptions && options.reporterOptions.showRelativePaths) return path.relative(process.cwd(), filepath);
|
|
158
|
+
return filepath;
|
|
159
|
+
}
|
|
160
|
+
XUnit.description = "XUnit-compatible XML output";
|
|
161
|
+
}) });
|
|
162
|
+
|
|
163
|
+
//#endregion
|
|
164
|
+
export default require_xunit();
|
|
165
|
+
|
|
166
|
+
export { require_xunit };
|