@eggjs/mock 6.1.0-beta.9 → 7.0.0-beta.14

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.
Files changed (104) hide show
  1. package/README.md +1 -1
  2. package/README.zh_CN.md +1 -1
  3. package/dist/_virtual/rolldown_runtime.js +1 -24
  4. package/dist/inject_mocha.d.ts +1 -1
  5. package/dist/inject_mocha.js +2 -3
  6. package/dist/lib/app.js +4 -1
  7. package/dist/lib/context.js +1 -3
  8. package/dist/lib/types.d.ts +4 -0
  9. package/package.json +9 -13
  10. package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +0 -142
  11. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js +0 -157
  12. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js +0 -97
  13. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js +0 -40
  14. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +0 -814
  15. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +0 -50
  16. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +0 -68
  17. package/dist/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +0 -752
  18. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js +0 -203
  19. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js +0 -209
  20. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js +0 -18
  21. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js +0 -215
  22. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/dmp.js +0 -24
  23. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/xml.js +0 -33
  24. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/array.js +0 -29
  25. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/base.js +0 -185
  26. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/character.js +0 -23
  27. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/css.js +0 -26
  28. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/json.js +0 -83
  29. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/line.js +0 -51
  30. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/sentence.js +0 -26
  31. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/word.js +0 -151
  32. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js +0 -178
  33. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js +0 -168
  34. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js +0 -301
  35. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js +0 -137
  36. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js +0 -367
  37. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js +0 -91
  38. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js +0 -99
  39. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/array.js +0 -23
  40. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/distance-iterator.js +0 -30
  41. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/params.js +0 -22
  42. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/string.js +0 -97
  43. package/dist/node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js +0 -14
  44. package/dist/node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js +0 -16
  45. package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.js +0 -4093
  46. package/dist/node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js +0 -14
  47. package/dist/node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js +0 -27
  48. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js +0 -12
  49. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/context.js +0 -83
  50. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/error-constants.js +0 -35
  51. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/errors.js +0 -392
  52. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/hook.js +0 -86
  53. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js +0 -104
  54. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js +0 -99
  55. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js +0 -65
  56. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js +0 -18
  57. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js +0 -95
  58. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js +0 -105
  59. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocha.js +0 -1037
  60. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocharc.js +0 -24
  61. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/buffered-worker-pool.js +0 -152
  62. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/esm-utils.js +0 -74
  63. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/file-unloader.js +0 -22
  64. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/parallel-buffered-runner.js +0 -329
  65. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/serializer.js +0 -314
  66. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/pending.js +0 -22
  67. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/base.js +0 -417
  68. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/doc.js +0 -79
  69. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/dot.js +0 -75
  70. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/html.js +0 -283
  71. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/index.js +0 -40
  72. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json-stream.js +0 -90
  73. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json.js +0 -145
  74. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/landing.js +0 -107
  75. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js +0 -77
  76. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js +0 -106
  77. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js +0 -57
  78. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js +0 -233
  79. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js +0 -92
  80. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js +0 -91
  81. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js +0 -261
  82. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js +0 -166
  83. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runnable.js +0 -346
  84. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runner.js +0 -922
  85. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/stats-collector.js +0 -72
  86. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/suite.js +0 -517
  87. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/test.js +0 -105
  88. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/utils.js +0 -505
  89. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/package.js +0 -225
  90. package/dist/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +0 -124
  91. package/dist/node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/index.js +0 -11
  92. package/dist/node_modules/.pnpm/serialize-javascript@6.0.2/node_modules/serialize-javascript/index.js +0 -114
  93. package/dist/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js +0 -76
  94. package/dist/node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js +0 -89
  95. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Pool.js +0 -366
  96. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Promise.js +0 -248
  97. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/WorkerHandler.js +0 -419
  98. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/debug-port-allocator.js +0 -27
  99. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/environment.js +0 -18
  100. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/generated/embeddedWorker.js +0 -16
  101. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/index.js +0 -63
  102. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/transfer.js +0 -21
  103. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/validateOptions.js +0 -9
  104. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/worker.js +0 -277
@@ -1,417 +0,0 @@
1
- import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
- import { require_lib } from "../../../../../diff@7.0.0/node_modules/diff/lib/index.js";
3
- import { require_ms } from "../../../../../ms@2.1.3/node_modules/ms/index.js";
4
- import { require_utils } from "../utils.js";
5
- import { require_supports_color } from "../../../../../supports-color@8.1.1/node_modules/supports-color/index.js";
6
- import { require_log_symbols } from "../../../../../log-symbols@4.1.0/node_modules/log-symbols/index.js";
7
- import { require_runner } from "../runner.js";
8
-
9
- //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/base.js
10
- var require_base = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/base.js": ((exports, module) => {
11
- /**
12
- * @typedef {import('../runner.js')} Runner
13
- * @typedef {import('../test.js')} Test
14
- * @typedef {import('../types.d.ts').FullErrorStack} FullErrorStack
15
- */
16
- /**
17
- * @module Base
18
- */
19
- /**
20
- * Module dependencies.
21
- */
22
- var diff = require_lib();
23
- var milliseconds = require_ms();
24
- var utils = require_utils();
25
- var supportsColor = require_supports_color();
26
- var symbols = require_log_symbols();
27
- var constants = require_runner().constants;
28
- var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
29
- var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
30
- const isBrowser = utils.isBrowser();
31
- function getBrowserWindowSize() {
32
- if ("innerHeight" in global) return [global.innerHeight, global.innerWidth];
33
- return [640, 480];
34
- }
35
- /**
36
- * Expose `Base`.
37
- */
38
- exports = module.exports = Base;
39
- /**
40
- * Check if both stdio streams are associated with a tty.
41
- */
42
- var isatty = isBrowser || process.stdout.isTTY && process.stderr.isTTY;
43
- /**
44
- * Save log references to avoid tests interfering (see GH-3604).
45
- */
46
- var consoleLog = console.log;
47
- /**
48
- * Enable coloring by default, except in the browser interface.
49
- */
50
- exports.useColors = !isBrowser && (supportsColor.stdout || process.env.MOCHA_COLORS !== void 0);
51
- /**
52
- * Inline diffs instead of +/-
53
- */
54
- exports.inlineDiffs = false;
55
- /**
56
- * Truncate diffs longer than this value to avoid slow performance
57
- */
58
- exports.maxDiffSize = 8192;
59
- /**
60
- * Default color map.
61
- */
62
- exports.colors = {
63
- pass: 90,
64
- fail: 31,
65
- "bright pass": 92,
66
- "bright fail": 91,
67
- "bright yellow": 93,
68
- pending: 36,
69
- suite: 0,
70
- "error title": 0,
71
- "error message": 31,
72
- "error stack": 90,
73
- checkmark: 32,
74
- fast: 90,
75
- medium: 33,
76
- slow: 31,
77
- green: 32,
78
- light: 90,
79
- "diff gutter": 90,
80
- "diff added": 32,
81
- "diff removed": 31,
82
- "diff added inline": "30;42",
83
- "diff removed inline": "30;41"
84
- };
85
- /**
86
- * Default symbol map.
87
- */
88
- exports.symbols = {
89
- ok: symbols.success,
90
- err: symbols.error,
91
- dot: ".",
92
- comma: ",",
93
- bang: "!"
94
- };
95
- /**
96
- * Color `str` with the given `type`,
97
- * allowing colors to be disabled,
98
- * as well as user-defined color
99
- * schemes.
100
- *
101
- * @private
102
- * @param {string} type
103
- * @param {string} str
104
- * @return {string}
105
- */
106
- var color = exports.color = function(type, str) {
107
- if (!exports.useColors) return String(str);
108
- return "\x1B[" + exports.colors[type] + "m" + str + "\x1B[0m";
109
- };
110
- /**
111
- * Expose term window size, with some defaults for when stderr is not a tty.
112
- */
113
- exports.window = { width: 75 };
114
- if (isatty) if (isBrowser) exports.window.width = getBrowserWindowSize()[1];
115
- else exports.window.width = process.stdout.getWindowSize(1)[0];
116
- /**
117
- * Expose some basic cursor interactions that are common among reporters.
118
- */
119
- exports.cursor = {
120
- hide: function() {
121
- isatty && process.stdout.write("\x1B[?25l");
122
- },
123
- show: function() {
124
- isatty && process.stdout.write("\x1B[?25h");
125
- },
126
- deleteLine: function() {
127
- isatty && process.stdout.write("\x1B[2K");
128
- },
129
- beginningOfLine: function() {
130
- isatty && process.stdout.write("\x1B[0G");
131
- },
132
- CR: function() {
133
- if (isatty) {
134
- exports.cursor.deleteLine();
135
- exports.cursor.beginningOfLine();
136
- } else process.stdout.write("\r");
137
- }
138
- };
139
- var showDiff = exports.showDiff = function(err) {
140
- return err && err.showDiff !== false && sameType(err.actual, err.expected) && err.expected !== void 0;
141
- };
142
- function stringifyDiffObjs(err) {
143
- if (!utils.isString(err.actual) || !utils.isString(err.expected)) {
144
- err.actual = utils.stringify(err.actual);
145
- err.expected = utils.stringify(err.expected);
146
- }
147
- }
148
- /**
149
- * Returns a diff between 2 strings with coloured ANSI output.
150
- *
151
- * @description
152
- * The diff will be either inline or unified dependent on the value
153
- * of `Base.inlineDiff`.
154
- *
155
- * @param {string} actual
156
- * @param {string} expected
157
- * @return {string} Diff
158
- */
159
- var generateDiff = exports.generateDiff = function(actual, expected) {
160
- try {
161
- var maxLen = exports.maxDiffSize;
162
- var skipped = 0;
163
- if (maxLen > 0) {
164
- skipped = Math.max(actual.length - maxLen, expected.length - maxLen);
165
- actual = actual.slice(0, maxLen);
166
- expected = expected.slice(0, maxLen);
167
- }
168
- let result = exports.inlineDiffs ? inlineDiff(actual, expected) : unifiedDiff(actual, expected);
169
- if (skipped > 0) result = `${result}\n [mocha] output truncated to ${maxLen} characters, see "maxDiffSize" reporter-option\n`;
170
- return result;
171
- } catch (err) {
172
- return "\n " + color("diff added", "+ expected") + " " + color("diff removed", "- actual: failed to generate Mocha diff") + "\n";
173
- }
174
- };
175
- /**
176
- * Traverses err.cause and returns all stack traces
177
- *
178
- * @private
179
- * @param {Error} err
180
- * @param {Set<Error>} [seen]
181
- * @return {FullErrorStack}
182
- */
183
- var getFullErrorStack = function(err, seen) {
184
- if (seen && seen.has(err)) return {
185
- message: "",
186
- msg: "<circular>",
187
- stack: ""
188
- };
189
- var message;
190
- if (typeof err.inspect === "function") message = err.inspect() + "";
191
- else if (err.message && typeof err.message.toString === "function") message = err.message + "";
192
- else message = "";
193
- var msg;
194
- var stack = err.stack || message;
195
- var index = message ? stack.indexOf(message) : -1;
196
- if (index === -1) msg = message;
197
- else {
198
- index += message.length;
199
- msg = stack.slice(0, index);
200
- stack = stack.slice(index + 1);
201
- if (err.cause) {
202
- seen = seen || /* @__PURE__ */ new Set();
203
- seen.add(err);
204
- const causeStack = getFullErrorStack(err.cause, seen);
205
- stack += "\n Caused by: " + causeStack.msg + (causeStack.stack ? "\n" + causeStack.stack : "");
206
- }
207
- }
208
- return {
209
- message,
210
- msg,
211
- stack
212
- };
213
- };
214
- /**
215
- * Outputs the given `failures` as a list.
216
- *
217
- * @public
218
- * @memberof Mocha.reporters.Base
219
- * @variation 1
220
- * @param {Object[]} failures - Each is Test instance with corresponding
221
- * Error property
222
- */
223
- exports.list = function(failures) {
224
- var multipleErr, multipleTest;
225
- Base.consoleLog();
226
- failures.forEach(function(test, i) {
227
- var fmt = color("error title", " %s) %s:\n") + color("error message", " %s") + color("error stack", "\n%s\n");
228
- var err;
229
- if (test.err && test.err.multiple) {
230
- if (multipleTest !== test) {
231
- multipleTest = test;
232
- multipleErr = [test.err].concat(test.err.multiple);
233
- }
234
- err = multipleErr.shift();
235
- } else err = test.err;
236
- var { message, msg, stack } = getFullErrorStack(err);
237
- if (err.uncaught) msg = "Uncaught " + msg;
238
- if (!exports.hideDiff && showDiff(err)) {
239
- stringifyDiffObjs(err);
240
- fmt = color("error title", " %s) %s:\n%s") + color("error stack", "\n%s\n");
241
- var match = message.match(/^([^:]+): expected/);
242
- msg = "\n " + color("error message", match ? match[1] : msg);
243
- msg += generateDiff(err.actual, err.expected);
244
- }
245
- stack = stack.replace(/^/gm, " ");
246
- var testTitle = "";
247
- test.titlePath().forEach(function(str, index) {
248
- if (index !== 0) testTitle += "\n ";
249
- for (var i$1 = 0; i$1 < index; i$1++) testTitle += " ";
250
- testTitle += str;
251
- });
252
- Base.consoleLog(fmt, i + 1, testTitle, msg, stack);
253
- });
254
- };
255
- /**
256
- * Constructs a new `Base` reporter instance.
257
- *
258
- * @description
259
- * All other reporters generally inherit from this reporter.
260
- *
261
- * @public
262
- * @class
263
- * @memberof Mocha.reporters
264
- * @param {Runner} runner - Instance triggers reporter actions.
265
- * @param {Object} [options] - runner options
266
- */
267
- function Base(runner, options) {
268
- var failures = this.failures = [];
269
- if (!runner) throw new TypeError("Missing runner argument");
270
- this.options = options || {};
271
- this.runner = runner;
272
- this.stats = runner.stats;
273
- var maxDiffSizeOpt = this.options.reporterOption && this.options.reporterOption.maxDiffSize;
274
- if (maxDiffSizeOpt !== void 0 && !isNaN(Number(maxDiffSizeOpt))) exports.maxDiffSize = Number(maxDiffSizeOpt);
275
- runner.on(EVENT_TEST_PASS, function(test) {
276
- if (test.duration > test.slow()) test.speed = "slow";
277
- else if (test.duration > test.slow() / 2) test.speed = "medium";
278
- else test.speed = "fast";
279
- });
280
- runner.on(EVENT_TEST_FAIL, function(test, err) {
281
- if (showDiff(err)) stringifyDiffObjs(err);
282
- if (test.err && err instanceof Error) test.err.multiple = (test.err.multiple || []).concat(err);
283
- else test.err = err;
284
- failures.push(test);
285
- });
286
- }
287
- /**
288
- * Outputs common epilogue used by many of the bundled reporters.
289
- *
290
- * @public
291
- * @memberof Mocha.reporters
292
- */
293
- Base.prototype.epilogue = function() {
294
- var stats = this.stats;
295
- var fmt;
296
- Base.consoleLog();
297
- fmt = color("bright pass", " ") + color("green", " %d passing") + color("light", " (%s)");
298
- Base.consoleLog(fmt, stats.passes || 0, milliseconds(stats.duration));
299
- if (stats.pending) {
300
- fmt = color("pending", " ") + color("pending", " %d pending");
301
- Base.consoleLog(fmt, stats.pending);
302
- }
303
- if (stats.failures) {
304
- fmt = color("fail", " %d failing");
305
- Base.consoleLog(fmt, stats.failures);
306
- Base.list(this.failures);
307
- Base.consoleLog();
308
- }
309
- Base.consoleLog();
310
- };
311
- /**
312
- * Pads the given `str` to `len`.
313
- *
314
- * @private
315
- * @param {string} str
316
- * @param {string} len
317
- * @return {string}
318
- */
319
- function pad(str, len) {
320
- str = String(str);
321
- return Array(len - str.length + 1).join(" ") + str;
322
- }
323
- /**
324
- * Returns inline diff between 2 strings with coloured ANSI output.
325
- *
326
- * @private
327
- * @param {String} actual
328
- * @param {String} expected
329
- * @return {string} Diff
330
- */
331
- function inlineDiff(actual, expected) {
332
- var msg = errorDiff(actual, expected);
333
- var lines = msg.split("\n");
334
- if (lines.length > 4) {
335
- var width = String(lines.length).length;
336
- msg = lines.map(function(str, i) {
337
- return pad(++i, width) + " | " + str;
338
- }).join("\n");
339
- }
340
- msg = "\n" + color("diff removed inline", "actual") + " " + color("diff added inline", "expected") + "\n\n" + msg + "\n";
341
- msg = msg.replace(/^/gm, " ");
342
- return msg;
343
- }
344
- /**
345
- * Returns unified diff between two strings with coloured ANSI output.
346
- *
347
- * @private
348
- * @param {String} actual
349
- * @param {String} expected
350
- * @return {string} The diff.
351
- */
352
- function unifiedDiff(actual, expected) {
353
- var indent = " ";
354
- function cleanUp(line) {
355
- if (line[0] === "+") return indent + colorLines("diff added", line);
356
- if (line[0] === "-") return indent + colorLines("diff removed", line);
357
- if (line.match(/@@/)) return "--";
358
- if (line.match(/\\ No newline/)) return null;
359
- return indent + line;
360
- }
361
- function notBlank(line) {
362
- return typeof line !== "undefined" && line !== null;
363
- }
364
- var lines = diff.createPatch("string", actual, expected).split("\n").splice(5);
365
- return "\n " + colorLines("diff added", "+ expected") + " " + colorLines("diff removed", "- actual") + "\n\n" + lines.map(cleanUp).filter(notBlank).join("\n");
366
- }
367
- /**
368
- * Returns character diff for `err`.
369
- *
370
- * @private
371
- * @param {String} actual
372
- * @param {String} expected
373
- * @return {string} the diff
374
- */
375
- function errorDiff(actual, expected) {
376
- return diff.diffWordsWithSpace(actual, expected).map(function(str) {
377
- if (str.added) return colorLines("diff added inline", str.value);
378
- if (str.removed) return colorLines("diff removed inline", str.value);
379
- return str.value;
380
- }).join("");
381
- }
382
- /**
383
- * Colors lines for `str`, using the color `name`.
384
- *
385
- * @private
386
- * @param {string} name
387
- * @param {string} str
388
- * @return {string}
389
- */
390
- function colorLines(name, str) {
391
- return str.split("\n").map(function(str$1) {
392
- return color(name, str$1);
393
- }).join("\n");
394
- }
395
- /**
396
- * Object#toString reference.
397
- */
398
- var objToString = Object.prototype.toString;
399
- /**
400
- * Checks that a / b have the same type.
401
- *
402
- * @private
403
- * @param {Object} a
404
- * @param {Object} b
405
- * @return {boolean}
406
- */
407
- function sameType(a, b) {
408
- return objToString.call(a) === objToString.call(b);
409
- }
410
- Base.consoleLog = consoleLog;
411
- Base.abstract = true;
412
- }) });
413
-
414
- //#endregion
415
- export default require_base();
416
-
417
- export { require_base };
@@ -1,79 +0,0 @@
1
- import { __commonJS } 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/doc.js
7
- var require_doc = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/doc.js": ((exports, module) => {
8
- /**
9
- * @typedef {import('../runner.js')} Runner
10
- */
11
- /**
12
- * @module Doc
13
- */
14
- /**
15
- * Module dependencies.
16
- */
17
- var Base = require_base();
18
- var utils = require_utils();
19
- var constants = require_runner().constants;
20
- var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
21
- var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
22
- var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
23
- var EVENT_SUITE_END = constants.EVENT_SUITE_END;
24
- /**
25
- * Expose `Doc`.
26
- */
27
- exports = module.exports = Doc;
28
- /**
29
- * Constructs a new `Doc` reporter instance.
30
- *
31
- * @public
32
- * @class
33
- * @memberof Mocha.reporters
34
- * @extends Mocha.reporters.Base
35
- * @param {Runner} runner - Instance triggers reporter actions.
36
- * @param {Object} [options] - runner options
37
- */
38
- function Doc(runner, options) {
39
- Base.call(this, runner, options);
40
- var indents = 2;
41
- function indent() {
42
- return Array(indents).join(" ");
43
- }
44
- runner.on(EVENT_SUITE_BEGIN, function(suite) {
45
- if (suite.root) return;
46
- ++indents;
47
- Base.consoleLog("%s<section class=\"suite\">", indent());
48
- ++indents;
49
- Base.consoleLog("%s<h1>%s</h1>", indent(), utils.escape(suite.title));
50
- Base.consoleLog("%s<dl>", indent());
51
- });
52
- runner.on(EVENT_SUITE_END, function(suite) {
53
- if (suite.root) return;
54
- Base.consoleLog("%s</dl>", indent());
55
- --indents;
56
- Base.consoleLog("%s</section>", indent());
57
- --indents;
58
- });
59
- runner.on(EVENT_TEST_PASS, function(test) {
60
- Base.consoleLog("%s <dt>%s</dt>", indent(), utils.escape(test.title));
61
- Base.consoleLog("%s <dt>%s</dt>", indent(), utils.escape(test.file));
62
- var code = utils.escape(utils.clean(test.body));
63
- Base.consoleLog("%s <dd><pre><code>%s</code></pre></dd>", indent(), code);
64
- });
65
- runner.on(EVENT_TEST_FAIL, function(test, err) {
66
- Base.consoleLog("%s <dt class=\"error\">%s</dt>", indent(), utils.escape(test.title));
67
- Base.consoleLog("%s <dt class=\"error\">%s</dt>", indent(), utils.escape(test.file));
68
- var code = utils.escape(utils.clean(test.body));
69
- Base.consoleLog("%s <dd class=\"error\"><pre><code>%s</code></pre></dd>", indent(), code);
70
- Base.consoleLog("%s <dd class=\"error\">%s</dd>", indent(), utils.escape(err));
71
- });
72
- }
73
- Doc.description = "HTML documentation";
74
- }) });
75
-
76
- //#endregion
77
- export default require_doc();
78
-
79
- export { require_doc };
@@ -1,75 +0,0 @@
1
- import { __commonJS } 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/dot.js
7
- var require_dot = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/dot.js": ((exports, module) => {
8
- /**
9
- * @typedef {import('../runner.js')} Runner
10
- */
11
- /**
12
- * @module Dot
13
- */
14
- /**
15
- * Module dependencies.
16
- */
17
- var Base = require_base();
18
- var inherits = require_utils().inherits;
19
- var constants = require_runner().constants;
20
- var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
21
- var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
22
- var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
23
- var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
24
- var EVENT_RUN_END = constants.EVENT_RUN_END;
25
- /**
26
- * Expose `Dot`.
27
- */
28
- exports = module.exports = Dot;
29
- /**
30
- * Constructs a new `Dot` reporter instance.
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 Dot(runner, options) {
40
- Base.call(this, runner, options);
41
- var self = this;
42
- var width = Base.window.width * .75 | 0;
43
- var n = -1;
44
- runner.on(EVENT_RUN_BEGIN, function() {
45
- process.stdout.write("\n");
46
- });
47
- runner.on(EVENT_TEST_PENDING, function() {
48
- if (++n % width === 0) process.stdout.write("\n ");
49
- process.stdout.write(Base.color("pending", Base.symbols.comma));
50
- });
51
- runner.on(EVENT_TEST_PASS, function(test) {
52
- if (++n % width === 0) process.stdout.write("\n ");
53
- if (test.speed === "slow") process.stdout.write(Base.color("bright yellow", Base.symbols.dot));
54
- else process.stdout.write(Base.color(test.speed, Base.symbols.dot));
55
- });
56
- runner.on(EVENT_TEST_FAIL, function() {
57
- if (++n % width === 0) process.stdout.write("\n ");
58
- process.stdout.write(Base.color("fail", Base.symbols.bang));
59
- });
60
- runner.once(EVENT_RUN_END, function() {
61
- process.stdout.write("\n");
62
- self.epilogue();
63
- });
64
- }
65
- /**
66
- * Inherit from `Base.prototype`.
67
- */
68
- inherits(Dot, Base);
69
- Dot.description = "dot matrix representation";
70
- }) });
71
-
72
- //#endregion
73
- export default require_dot();
74
-
75
- export { require_dot };