@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,417 @@
|
|
|
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 };
|
|
@@ -0,0 +1,79 @@
|
|
|
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 };
|
|
@@ -0,0 +1,75 @@
|
|
|
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 };
|