@rotorsoft/act 0.38.0 → 0.40.0
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/README.md +21 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts +13 -0
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/test/index.d.ts +2 -0
- package/dist/@types/test/index.d.ts.map +1 -0
- package/dist/@types/test/sandbox.d.ts +113 -0
- package/dist/@types/test/sandbox.d.ts.map +1 -0
- package/dist/@types/types/action.d.ts +2 -2
- package/dist/@types/types/ports.d.ts +13 -8
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-5WRI5ZAA.js.map +1 -0
- package/dist/chunk-TP2OZWHP.js +877 -0
- package/dist/chunk-TP2OZWHP.js.map +1 -0
- package/dist/dist-INXH4GUE.js +546 -0
- package/dist/dist-INXH4GUE.js.map +1 -0
- package/dist/index.cjs +30 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +74 -882
- package/dist/index.js.map +1 -1
- package/dist/magic-string.es-ZGO77SPS.js +1309 -0
- package/dist/magic-string.es-ZGO77SPS.js.map +1 -0
- package/dist/test/index.cjs +4833 -0
- package/dist/test/index.cjs.map +1 -0
- package/dist/test/index.js +3912 -0
- package/dist/test/index.js.map +1 -0
- package/dist/types/index.js +1 -0
- package/package.json +9 -1
|
@@ -0,0 +1,3912 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InMemoryCache,
|
|
3
|
+
InMemoryStore
|
|
4
|
+
} from "../chunk-TP2OZWHP.js";
|
|
5
|
+
import "../chunk-AGWZY6YT.js";
|
|
6
|
+
import {
|
|
7
|
+
__commonJS,
|
|
8
|
+
__toESM
|
|
9
|
+
} from "../chunk-5WRI5ZAA.js";
|
|
10
|
+
|
|
11
|
+
// ../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/branding.js
|
|
12
|
+
var require_branding = __commonJS({
|
|
13
|
+
"../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/branding.js"(exports) {
|
|
14
|
+
"use strict";
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// ../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/messages.js
|
|
20
|
+
var require_messages = __commonJS({
|
|
21
|
+
"../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/messages.js"(exports) {
|
|
22
|
+
"use strict";
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// ../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/overloads.js
|
|
28
|
+
var require_overloads = __commonJS({
|
|
29
|
+
"../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/overloads.js"(exports) {
|
|
30
|
+
"use strict";
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// ../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/utils.js
|
|
36
|
+
var require_utils = __commonJS({
|
|
37
|
+
"../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/utils.js"(exports) {
|
|
38
|
+
"use strict";
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// ../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/index.js
|
|
44
|
+
var require_dist = __commonJS({
|
|
45
|
+
"../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/index.js"(exports) {
|
|
46
|
+
"use strict";
|
|
47
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
48
|
+
if (k2 === void 0) k2 = k;
|
|
49
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
50
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
51
|
+
desc = { enumerable: true, get: function() {
|
|
52
|
+
return m[k];
|
|
53
|
+
} };
|
|
54
|
+
}
|
|
55
|
+
Object.defineProperty(o, k2, desc);
|
|
56
|
+
}) : (function(o, m, k, k2) {
|
|
57
|
+
if (k2 === void 0) k2 = k;
|
|
58
|
+
o[k2] = m[k];
|
|
59
|
+
}));
|
|
60
|
+
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
61
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
|
62
|
+
};
|
|
63
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
|
+
exports.expectTypeOf = void 0;
|
|
65
|
+
__exportStar(require_branding(), exports);
|
|
66
|
+
__exportStar(require_messages(), exports);
|
|
67
|
+
__exportStar(require_overloads(), exports);
|
|
68
|
+
__exportStar(require_utils(), exports);
|
|
69
|
+
var fn = () => true;
|
|
70
|
+
var expectTypeOf2 = (_actual) => {
|
|
71
|
+
const nonFunctionProperties = [
|
|
72
|
+
"parameters",
|
|
73
|
+
"returns",
|
|
74
|
+
"resolves",
|
|
75
|
+
"not",
|
|
76
|
+
"items",
|
|
77
|
+
"constructorParameters",
|
|
78
|
+
"thisParameter",
|
|
79
|
+
"instance",
|
|
80
|
+
"guards",
|
|
81
|
+
"asserts",
|
|
82
|
+
"branded"
|
|
83
|
+
];
|
|
84
|
+
const obj = {
|
|
85
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
86
|
+
toBeAny: fn,
|
|
87
|
+
toBeUnknown: fn,
|
|
88
|
+
toBeNever: fn,
|
|
89
|
+
toBeFunction: fn,
|
|
90
|
+
toBeObject: fn,
|
|
91
|
+
toBeArray: fn,
|
|
92
|
+
toBeString: fn,
|
|
93
|
+
toBeNumber: fn,
|
|
94
|
+
toBeBoolean: fn,
|
|
95
|
+
toBeVoid: fn,
|
|
96
|
+
toBeSymbol: fn,
|
|
97
|
+
toBeNull: fn,
|
|
98
|
+
toBeUndefined: fn,
|
|
99
|
+
toBeNullable: fn,
|
|
100
|
+
toBeBigInt: fn,
|
|
101
|
+
toMatchTypeOf: fn,
|
|
102
|
+
toEqualTypeOf: fn,
|
|
103
|
+
toBeConstructibleWith: fn,
|
|
104
|
+
toMatchObjectType: fn,
|
|
105
|
+
toExtend: fn,
|
|
106
|
+
map: exports.expectTypeOf,
|
|
107
|
+
toBeCallableWith: exports.expectTypeOf,
|
|
108
|
+
extract: exports.expectTypeOf,
|
|
109
|
+
exclude: exports.expectTypeOf,
|
|
110
|
+
pick: exports.expectTypeOf,
|
|
111
|
+
omit: exports.expectTypeOf,
|
|
112
|
+
toHaveProperty: exports.expectTypeOf,
|
|
113
|
+
parameter: exports.expectTypeOf
|
|
114
|
+
};
|
|
115
|
+
const getterProperties = nonFunctionProperties;
|
|
116
|
+
getterProperties.forEach((prop) => Object.defineProperty(obj, prop, { get: () => (0, exports.expectTypeOf)({}) }));
|
|
117
|
+
return obj;
|
|
118
|
+
};
|
|
119
|
+
exports.expectTypeOf = expectTypeOf2;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// ../../node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.js
|
|
124
|
+
var b = {
|
|
125
|
+
reset: [0, 0],
|
|
126
|
+
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
127
|
+
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
128
|
+
italic: [3, 23],
|
|
129
|
+
underline: [4, 24],
|
|
130
|
+
inverse: [7, 27],
|
|
131
|
+
hidden: [8, 28],
|
|
132
|
+
strikethrough: [9, 29],
|
|
133
|
+
black: [30, 39],
|
|
134
|
+
red: [31, 39],
|
|
135
|
+
green: [32, 39],
|
|
136
|
+
yellow: [33, 39],
|
|
137
|
+
blue: [34, 39],
|
|
138
|
+
magenta: [35, 39],
|
|
139
|
+
cyan: [36, 39],
|
|
140
|
+
white: [37, 39],
|
|
141
|
+
gray: [90, 39],
|
|
142
|
+
bgBlack: [40, 49],
|
|
143
|
+
bgRed: [41, 49],
|
|
144
|
+
bgGreen: [42, 49],
|
|
145
|
+
bgYellow: [43, 49],
|
|
146
|
+
bgBlue: [44, 49],
|
|
147
|
+
bgMagenta: [45, 49],
|
|
148
|
+
bgCyan: [46, 49],
|
|
149
|
+
bgWhite: [47, 49],
|
|
150
|
+
blackBright: [90, 39],
|
|
151
|
+
redBright: [91, 39],
|
|
152
|
+
greenBright: [92, 39],
|
|
153
|
+
yellowBright: [93, 39],
|
|
154
|
+
blueBright: [94, 39],
|
|
155
|
+
magentaBright: [95, 39],
|
|
156
|
+
cyanBright: [96, 39],
|
|
157
|
+
whiteBright: [97, 39],
|
|
158
|
+
bgBlackBright: [100, 49],
|
|
159
|
+
bgRedBright: [101, 49],
|
|
160
|
+
bgGreenBright: [102, 49],
|
|
161
|
+
bgYellowBright: [103, 49],
|
|
162
|
+
bgBlueBright: [104, 49],
|
|
163
|
+
bgMagentaBright: [105, 49],
|
|
164
|
+
bgCyanBright: [106, 49],
|
|
165
|
+
bgWhiteBright: [107, 49]
|
|
166
|
+
};
|
|
167
|
+
function i(e) {
|
|
168
|
+
return String(e);
|
|
169
|
+
}
|
|
170
|
+
i.open = "";
|
|
171
|
+
i.close = "";
|
|
172
|
+
function B() {
|
|
173
|
+
let e = typeof process != "undefined" ? process : void 0, r = (e == null ? void 0 : e.env) || {}, a = r.FORCE_TTY !== "false", l = (e == null ? void 0 : e.argv) || [];
|
|
174
|
+
return !("NO_COLOR" in r || l.includes("--no-color")) && ("FORCE_COLOR" in r || l.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && r.TERM !== "dumb" || "CI" in r) || typeof window != "undefined" && !!window.chrome;
|
|
175
|
+
}
|
|
176
|
+
function C({ force: e } = {}) {
|
|
177
|
+
let r = e || B(), a = (t, o, u, n) => {
|
|
178
|
+
let g = "", s = 0;
|
|
179
|
+
do
|
|
180
|
+
g += t.substring(s, n) + u, s = n + o.length, n = t.indexOf(o, s);
|
|
181
|
+
while (~n);
|
|
182
|
+
return g + t.substring(s);
|
|
183
|
+
}, l = (t, o, u = t) => {
|
|
184
|
+
let n = (g) => {
|
|
185
|
+
let s = String(g), h = s.indexOf(o, t.length);
|
|
186
|
+
return ~h ? t + a(s, o, u, h) + o : t + s + o;
|
|
187
|
+
};
|
|
188
|
+
return n.open = t, n.close = o, n;
|
|
189
|
+
}, c = {
|
|
190
|
+
isColorSupported: r
|
|
191
|
+
}, f = (t) => `\x1B[${t}m`;
|
|
192
|
+
for (let t in b) {
|
|
193
|
+
let o = b[t];
|
|
194
|
+
c[t] = r ? l(
|
|
195
|
+
f(o[0]),
|
|
196
|
+
f(o[1]),
|
|
197
|
+
o[2]
|
|
198
|
+
) : i;
|
|
199
|
+
}
|
|
200
|
+
return c;
|
|
201
|
+
}
|
|
202
|
+
var d = C();
|
|
203
|
+
var y = d;
|
|
204
|
+
|
|
205
|
+
// ../../node_modules/.pnpm/@vitest+pretty-format@4.1.6/node_modules/@vitest/pretty-format/dist/index.js
|
|
206
|
+
function _mergeNamespaces(n, m) {
|
|
207
|
+
m.forEach(function(e) {
|
|
208
|
+
e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
|
|
209
|
+
if (k !== "default" && !(k in n)) {
|
|
210
|
+
var d2 = Object.getOwnPropertyDescriptor(e, k);
|
|
211
|
+
Object.defineProperty(n, k, d2.get ? d2 : {
|
|
212
|
+
enumerable: true,
|
|
213
|
+
get: function() {
|
|
214
|
+
return e[k];
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
return Object.freeze(n);
|
|
221
|
+
}
|
|
222
|
+
function getKeysOfEnumerableProperties(object, compareKeys) {
|
|
223
|
+
const rawKeys = Object.keys(object);
|
|
224
|
+
const keys = compareKeys === null ? rawKeys : rawKeys.sort(compareKeys);
|
|
225
|
+
if (Object.getOwnPropertySymbols) {
|
|
226
|
+
for (const symbol of Object.getOwnPropertySymbols(object)) {
|
|
227
|
+
if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
|
|
228
|
+
keys.push(symbol);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return keys;
|
|
233
|
+
}
|
|
234
|
+
function printIteratorEntries(iterator, config, indentation, depth, refs, printer2, separator = ": ") {
|
|
235
|
+
let result = "";
|
|
236
|
+
let width = 0;
|
|
237
|
+
let current = iterator.next();
|
|
238
|
+
if (!current.done) {
|
|
239
|
+
result += config.spacingOuter;
|
|
240
|
+
const indentationNext = indentation + config.indent;
|
|
241
|
+
while (!current.done) {
|
|
242
|
+
result += indentationNext;
|
|
243
|
+
if (width++ === config.maxWidth) {
|
|
244
|
+
result += "\u2026";
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
const name = printer2(current.value[0], config, indentationNext, depth, refs);
|
|
248
|
+
const value = printer2(current.value[1], config, indentationNext, depth, refs);
|
|
249
|
+
result += name + separator + value;
|
|
250
|
+
current = iterator.next();
|
|
251
|
+
if (!current.done) {
|
|
252
|
+
result += `,${config.spacingInner}`;
|
|
253
|
+
} else if (!config.min) {
|
|
254
|
+
result += ",";
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
result += config.spacingOuter + indentation;
|
|
258
|
+
}
|
|
259
|
+
return result;
|
|
260
|
+
}
|
|
261
|
+
function printIteratorValues(iterator, config, indentation, depth, refs, printer2) {
|
|
262
|
+
let result = "";
|
|
263
|
+
let width = 0;
|
|
264
|
+
let current = iterator.next();
|
|
265
|
+
if (!current.done) {
|
|
266
|
+
result += config.spacingOuter;
|
|
267
|
+
const indentationNext = indentation + config.indent;
|
|
268
|
+
while (!current.done) {
|
|
269
|
+
result += indentationNext;
|
|
270
|
+
if (width++ === config.maxWidth) {
|
|
271
|
+
result += "\u2026";
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
result += printer2(current.value, config, indentationNext, depth, refs);
|
|
275
|
+
current = iterator.next();
|
|
276
|
+
if (!current.done) {
|
|
277
|
+
result += `,${config.spacingInner}`;
|
|
278
|
+
} else if (!config.min) {
|
|
279
|
+
result += ",";
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
result += config.spacingOuter + indentation;
|
|
283
|
+
}
|
|
284
|
+
return result;
|
|
285
|
+
}
|
|
286
|
+
function printListItems(list, config, indentation, depth, refs, printer2) {
|
|
287
|
+
let result = "";
|
|
288
|
+
list = list instanceof ArrayBuffer ? new DataView(list) : list;
|
|
289
|
+
const isDataView = (l) => l instanceof DataView;
|
|
290
|
+
const length = isDataView(list) ? list.byteLength : list.length;
|
|
291
|
+
if (length > 0) {
|
|
292
|
+
result += config.spacingOuter;
|
|
293
|
+
const indentationNext = indentation + config.indent;
|
|
294
|
+
for (let i2 = 0; i2 < length; i2++) {
|
|
295
|
+
result += indentationNext;
|
|
296
|
+
if (i2 === config.maxWidth) {
|
|
297
|
+
result += "\u2026";
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
if (isDataView(list) || i2 in list) {
|
|
301
|
+
result += printer2(isDataView(list) ? list.getInt8(i2) : list[i2], config, indentationNext, depth, refs);
|
|
302
|
+
}
|
|
303
|
+
if (i2 < length - 1) {
|
|
304
|
+
result += `,${config.spacingInner}`;
|
|
305
|
+
} else if (!config.min) {
|
|
306
|
+
result += ",";
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
result += config.spacingOuter + indentation;
|
|
310
|
+
}
|
|
311
|
+
return result;
|
|
312
|
+
}
|
|
313
|
+
function printObjectProperties(val, config, indentation, depth, refs, printer2) {
|
|
314
|
+
let result = "";
|
|
315
|
+
const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
|
|
316
|
+
if (keys.length > 0) {
|
|
317
|
+
result += config.spacingOuter;
|
|
318
|
+
const indentationNext = indentation + config.indent;
|
|
319
|
+
for (let i2 = 0; i2 < keys.length; i2++) {
|
|
320
|
+
const key = keys[i2];
|
|
321
|
+
const name = printer2(key, config, indentationNext, depth, refs);
|
|
322
|
+
const value = printer2(val[key], config, indentationNext, depth, refs);
|
|
323
|
+
result += `${indentationNext + name}: ${value}`;
|
|
324
|
+
if (i2 < keys.length - 1) {
|
|
325
|
+
result += `,${config.spacingInner}`;
|
|
326
|
+
} else if (!config.min) {
|
|
327
|
+
result += ",";
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
result += config.spacingOuter + indentation;
|
|
331
|
+
}
|
|
332
|
+
return result;
|
|
333
|
+
}
|
|
334
|
+
var asymmetricMatcher = typeof Symbol === "function" && Symbol.for ? /* @__PURE__ */ Symbol.for("jest.asymmetricMatcher") : 1267621;
|
|
335
|
+
var SPACE$2 = " ";
|
|
336
|
+
var serialize$5 = (val, config, indentation, depth, refs, printer2) => {
|
|
337
|
+
const stringedValue = val.toString();
|
|
338
|
+
if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") {
|
|
339
|
+
if (++depth > config.maxDepth) {
|
|
340
|
+
return `[${stringedValue}]`;
|
|
341
|
+
}
|
|
342
|
+
return `${stringedValue + SPACE$2}[${printListItems(val.sample, config, indentation, depth, refs, printer2)}]`;
|
|
343
|
+
}
|
|
344
|
+
if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") {
|
|
345
|
+
if (++depth > config.maxDepth) {
|
|
346
|
+
return `[${stringedValue}]`;
|
|
347
|
+
}
|
|
348
|
+
return `${stringedValue + SPACE$2}{${printObjectProperties(val.sample, config, indentation, depth, refs, printer2)}}`;
|
|
349
|
+
}
|
|
350
|
+
if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching") {
|
|
351
|
+
return stringedValue + SPACE$2 + printer2(val.sample, config, indentation, depth, refs);
|
|
352
|
+
}
|
|
353
|
+
if (stringedValue === "StringContaining" || stringedValue === "StringNotContaining") {
|
|
354
|
+
return stringedValue + SPACE$2 + printer2(val.sample, config, indentation, depth, refs);
|
|
355
|
+
}
|
|
356
|
+
if (typeof val.toAsymmetricMatcher !== "function") {
|
|
357
|
+
throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
|
|
358
|
+
}
|
|
359
|
+
return val.toAsymmetricMatcher();
|
|
360
|
+
};
|
|
361
|
+
var test$5 = (val) => val && val.$$typeof === asymmetricMatcher;
|
|
362
|
+
var plugin$5 = {
|
|
363
|
+
serialize: serialize$5,
|
|
364
|
+
test: test$5
|
|
365
|
+
};
|
|
366
|
+
var SPACE$1 = " ";
|
|
367
|
+
var OBJECT_NAMES = /* @__PURE__ */ new Set(["DOMStringMap", "NamedNodeMap"]);
|
|
368
|
+
var ARRAY_REGEXP = /^(?:HTML\w*Collection|NodeList)$/;
|
|
369
|
+
function testName(name) {
|
|
370
|
+
return OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
|
|
371
|
+
}
|
|
372
|
+
var test$4 = (val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name);
|
|
373
|
+
function isNamedNodeMap(collection) {
|
|
374
|
+
return collection.constructor.name === "NamedNodeMap";
|
|
375
|
+
}
|
|
376
|
+
var serialize$4 = (collection, config, indentation, depth, refs, printer2) => {
|
|
377
|
+
const name = collection.constructor.name;
|
|
378
|
+
if (++depth > config.maxDepth) {
|
|
379
|
+
return `[${name}]`;
|
|
380
|
+
}
|
|
381
|
+
return (config.min ? "" : name + SPACE$1) + (OBJECT_NAMES.has(name) ? `{${printObjectProperties(isNamedNodeMap(collection) ? [...collection].reduce((props, attribute) => {
|
|
382
|
+
props[attribute.name] = attribute.value;
|
|
383
|
+
return props;
|
|
384
|
+
}, {}) : { ...collection }, config, indentation, depth, refs, printer2)}}` : `[${printListItems([...collection], config, indentation, depth, refs, printer2)}]`);
|
|
385
|
+
};
|
|
386
|
+
var plugin$4 = {
|
|
387
|
+
serialize: serialize$4,
|
|
388
|
+
test: test$4
|
|
389
|
+
};
|
|
390
|
+
function escapeHTML(str) {
|
|
391
|
+
return str.replaceAll("<", "<").replaceAll(">", ">");
|
|
392
|
+
}
|
|
393
|
+
function printProps(keys, props, config, indentation, depth, refs, printer2) {
|
|
394
|
+
const indentationNext = indentation + config.indent;
|
|
395
|
+
const colors = config.colors;
|
|
396
|
+
return keys.map((key) => {
|
|
397
|
+
const value = props[key];
|
|
398
|
+
if (typeof value === "string" && value[0] === "_" && value.startsWith("__vitest_") && value.match(/__vitest_\d+__/)) {
|
|
399
|
+
return "";
|
|
400
|
+
}
|
|
401
|
+
let printed = printer2(value, config, indentationNext, depth, refs);
|
|
402
|
+
if (typeof value !== "string") {
|
|
403
|
+
if (printed.includes("\n")) {
|
|
404
|
+
printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
|
|
405
|
+
}
|
|
406
|
+
printed = `{${printed}}`;
|
|
407
|
+
}
|
|
408
|
+
return `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`;
|
|
409
|
+
}).join("");
|
|
410
|
+
}
|
|
411
|
+
function printChildren(children, config, indentation, depth, refs, printer2) {
|
|
412
|
+
return children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText(child, config) : printer2(child, config, indentation, depth, refs))).join("");
|
|
413
|
+
}
|
|
414
|
+
function printShadowRoot(children, config, indentation, depth, refs, printer2) {
|
|
415
|
+
if (config.printShadowRoot === false) {
|
|
416
|
+
return "";
|
|
417
|
+
}
|
|
418
|
+
return [`${config.spacingOuter + indentation}#shadow-root`, printChildren(children, config, indentation + config.indent, depth, refs, printer2)].join("");
|
|
419
|
+
}
|
|
420
|
+
function printText(text, config) {
|
|
421
|
+
const contentColor = config.colors.content;
|
|
422
|
+
return contentColor.open + escapeHTML(text) + contentColor.close;
|
|
423
|
+
}
|
|
424
|
+
function printComment(comment, config) {
|
|
425
|
+
const commentColor = config.colors.comment;
|
|
426
|
+
return `${commentColor.open}<!--${escapeHTML(comment)}-->${commentColor.close}`;
|
|
427
|
+
}
|
|
428
|
+
function printElement(type, printedProps, printedChildren, config, indentation) {
|
|
429
|
+
const tagColor = config.colors.tag;
|
|
430
|
+
return `${tagColor.open}<${type}${printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open}${printedChildren ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}</${type}` : `${printedProps && !config.min ? "" : " "}/`}>${tagColor.close}`;
|
|
431
|
+
}
|
|
432
|
+
function printElementAsLeaf(type, config) {
|
|
433
|
+
const tagColor = config.colors.tag;
|
|
434
|
+
return `${tagColor.open}<${type}${tagColor.close} \u2026${tagColor.open} />${tagColor.close}`;
|
|
435
|
+
}
|
|
436
|
+
var ELEMENT_NODE = 1;
|
|
437
|
+
var TEXT_NODE = 3;
|
|
438
|
+
var COMMENT_NODE = 8;
|
|
439
|
+
var FRAGMENT_NODE = 11;
|
|
440
|
+
var ELEMENT_REGEXP = /^(?:(?:HTML|SVG)\w*)?Element$/;
|
|
441
|
+
function testHasAttribute(val) {
|
|
442
|
+
try {
|
|
443
|
+
return typeof val.hasAttribute === "function" && val.hasAttribute("is");
|
|
444
|
+
} catch {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
function testNode(val) {
|
|
449
|
+
const constructorName = val.constructor.name;
|
|
450
|
+
const { nodeType, tagName } = val;
|
|
451
|
+
const isCustomElement = typeof tagName === "string" && tagName.includes("-") || testHasAttribute(val);
|
|
452
|
+
return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment";
|
|
453
|
+
}
|
|
454
|
+
var test$3 = (val) => val?.constructor?.name && testNode(val);
|
|
455
|
+
function nodeIsText(node) {
|
|
456
|
+
return node.nodeType === TEXT_NODE;
|
|
457
|
+
}
|
|
458
|
+
function nodeIsComment(node) {
|
|
459
|
+
return node.nodeType === COMMENT_NODE;
|
|
460
|
+
}
|
|
461
|
+
function nodeIsFragment(node) {
|
|
462
|
+
return node.nodeType === FRAGMENT_NODE;
|
|
463
|
+
}
|
|
464
|
+
function filterChildren(children, filterNode) {
|
|
465
|
+
let filtered = children.filter((node) => {
|
|
466
|
+
if (node.nodeType === TEXT_NODE) {
|
|
467
|
+
const text = node.data || "";
|
|
468
|
+
return text.trim().length > 0;
|
|
469
|
+
}
|
|
470
|
+
return true;
|
|
471
|
+
});
|
|
472
|
+
if (filterNode) {
|
|
473
|
+
filtered = filtered.filter(filterNode);
|
|
474
|
+
}
|
|
475
|
+
return filtered;
|
|
476
|
+
}
|
|
477
|
+
function serializeDOM(node, config, indentation, depth, refs, printer2, filterNode) {
|
|
478
|
+
if (nodeIsText(node)) {
|
|
479
|
+
return printText(node.data, config);
|
|
480
|
+
}
|
|
481
|
+
if (nodeIsComment(node)) {
|
|
482
|
+
return printComment(node.data, config);
|
|
483
|
+
}
|
|
484
|
+
const type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
|
|
485
|
+
if (++depth > config.maxDepth) {
|
|
486
|
+
return printElementAsLeaf(type, config);
|
|
487
|
+
}
|
|
488
|
+
const children = Array.prototype.slice.call(node.childNodes || node.children);
|
|
489
|
+
const shadowChildren = nodeIsFragment(node) || !node.shadowRoot ? [] : Array.prototype.slice.call(node.shadowRoot.children);
|
|
490
|
+
const resolvedChildren = filterNode ? filterChildren(children, filterNode) : children;
|
|
491
|
+
const resolvedShadowChildren = filterNode ? filterChildren(shadowChildren, filterNode) : shadowChildren;
|
|
492
|
+
return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
|
|
493
|
+
props[attribute.name] = attribute.value;
|
|
494
|
+
return props;
|
|
495
|
+
}, {}), config, indentation + config.indent, depth, refs, printer2), (resolvedShadowChildren.length > 0 ? printShadowRoot(resolvedShadowChildren, config, indentation + config.indent, depth, refs, printer2) : "") + printChildren(resolvedChildren, config, indentation + config.indent, depth, refs, printer2), config, indentation);
|
|
496
|
+
}
|
|
497
|
+
var serialize$3 = (node, config, indentation, depth, refs, printer2) => serializeDOM(node, config, indentation, depth, refs, printer2);
|
|
498
|
+
function createDOMElementFilter(filterNode) {
|
|
499
|
+
return {
|
|
500
|
+
test: test$3,
|
|
501
|
+
serialize: (node, config, indentation, depth, refs, printer2) => serializeDOM(node, config, indentation, depth, refs, printer2, filterNode)
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
var plugin$3 = {
|
|
505
|
+
serialize: serialize$3,
|
|
506
|
+
test: test$3
|
|
507
|
+
};
|
|
508
|
+
var IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
509
|
+
var IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
|
|
510
|
+
var IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
|
|
511
|
+
var IS_MAP_SENTINEL = "@@__IMMUTABLE_MAP__@@";
|
|
512
|
+
var IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
|
|
513
|
+
var IS_RECORD_SENTINEL = "@@__IMMUTABLE_RECORD__@@";
|
|
514
|
+
var IS_SEQ_SENTINEL = "@@__IMMUTABLE_SEQ__@@";
|
|
515
|
+
var IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
|
|
516
|
+
var IS_STACK_SENTINEL = "@@__IMMUTABLE_STACK__@@";
|
|
517
|
+
var getImmutableName = (name) => `Immutable.${name}`;
|
|
518
|
+
var printAsLeaf = (name) => `[${name}]`;
|
|
519
|
+
var SPACE = " ";
|
|
520
|
+
var LAZY = "\u2026";
|
|
521
|
+
function printImmutableEntries(val, config, indentation, depth, refs, printer2, type) {
|
|
522
|
+
return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}{${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer2)}}`;
|
|
523
|
+
}
|
|
524
|
+
function getRecordEntries(val) {
|
|
525
|
+
let i2 = 0;
|
|
526
|
+
return { next() {
|
|
527
|
+
if (i2 < val._keys.length) {
|
|
528
|
+
const key = val._keys[i2++];
|
|
529
|
+
return {
|
|
530
|
+
done: false,
|
|
531
|
+
value: [key, val.get(key)]
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
return {
|
|
535
|
+
done: true,
|
|
536
|
+
value: void 0
|
|
537
|
+
};
|
|
538
|
+
} };
|
|
539
|
+
}
|
|
540
|
+
function printImmutableRecord(val, config, indentation, depth, refs, printer2) {
|
|
541
|
+
const name = getImmutableName(val._name || "Record");
|
|
542
|
+
return ++depth > config.maxDepth ? printAsLeaf(name) : `${name + SPACE}{${printIteratorEntries(getRecordEntries(val), config, indentation, depth, refs, printer2)}}`;
|
|
543
|
+
}
|
|
544
|
+
function printImmutableSeq(val, config, indentation, depth, refs, printer2) {
|
|
545
|
+
const name = getImmutableName("Seq");
|
|
546
|
+
if (++depth > config.maxDepth) {
|
|
547
|
+
return printAsLeaf(name);
|
|
548
|
+
}
|
|
549
|
+
if (val[IS_KEYED_SENTINEL]) {
|
|
550
|
+
return `${name + SPACE}{${val._iter || val._object ? printIteratorEntries(val.entries(), config, indentation, depth, refs, printer2) : LAZY}}`;
|
|
551
|
+
}
|
|
552
|
+
return `${name + SPACE}[${val._iter || val._array || val._collection || val._iterable ? printIteratorValues(val.values(), config, indentation, depth, refs, printer2) : LAZY}]`;
|
|
553
|
+
}
|
|
554
|
+
function printImmutableValues(val, config, indentation, depth, refs, printer2, type) {
|
|
555
|
+
return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}[${printIteratorValues(val.values(), config, indentation, depth, refs, printer2)}]`;
|
|
556
|
+
}
|
|
557
|
+
var serialize$2 = (val, config, indentation, depth, refs, printer2) => {
|
|
558
|
+
if (val[IS_MAP_SENTINEL]) {
|
|
559
|
+
return printImmutableEntries(val, config, indentation, depth, refs, printer2, val[IS_ORDERED_SENTINEL] ? "OrderedMap" : "Map");
|
|
560
|
+
}
|
|
561
|
+
if (val[IS_LIST_SENTINEL]) {
|
|
562
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer2, "List");
|
|
563
|
+
}
|
|
564
|
+
if (val[IS_SET_SENTINEL]) {
|
|
565
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer2, val[IS_ORDERED_SENTINEL] ? "OrderedSet" : "Set");
|
|
566
|
+
}
|
|
567
|
+
if (val[IS_STACK_SENTINEL]) {
|
|
568
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer2, "Stack");
|
|
569
|
+
}
|
|
570
|
+
if (val[IS_SEQ_SENTINEL]) {
|
|
571
|
+
return printImmutableSeq(val, config, indentation, depth, refs, printer2);
|
|
572
|
+
}
|
|
573
|
+
return printImmutableRecord(val, config, indentation, depth, refs, printer2);
|
|
574
|
+
};
|
|
575
|
+
var test$2 = (val) => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
|
|
576
|
+
var plugin$2 = {
|
|
577
|
+
serialize: serialize$2,
|
|
578
|
+
test: test$2
|
|
579
|
+
};
|
|
580
|
+
function getDefaultExportFromCjs(x) {
|
|
581
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
582
|
+
}
|
|
583
|
+
var reactIs$1 = { exports: {} };
|
|
584
|
+
var reactIs_production = {};
|
|
585
|
+
var hasRequiredReactIs_production;
|
|
586
|
+
function requireReactIs_production() {
|
|
587
|
+
if (hasRequiredReactIs_production) return reactIs_production;
|
|
588
|
+
hasRequiredReactIs_production = 1;
|
|
589
|
+
var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_VIEW_TRANSITION_TYPE = /* @__PURE__ */ Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference");
|
|
590
|
+
function typeOf(object) {
|
|
591
|
+
if ("object" === typeof object && null !== object) {
|
|
592
|
+
var $$typeof = object.$$typeof;
|
|
593
|
+
switch ($$typeof) {
|
|
594
|
+
case REACT_ELEMENT_TYPE:
|
|
595
|
+
switch (object = object.type, object) {
|
|
596
|
+
case REACT_FRAGMENT_TYPE:
|
|
597
|
+
case REACT_PROFILER_TYPE:
|
|
598
|
+
case REACT_STRICT_MODE_TYPE:
|
|
599
|
+
case REACT_SUSPENSE_TYPE:
|
|
600
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
601
|
+
case REACT_VIEW_TRANSITION_TYPE:
|
|
602
|
+
return object;
|
|
603
|
+
default:
|
|
604
|
+
switch (object = object && object.$$typeof, object) {
|
|
605
|
+
case REACT_CONTEXT_TYPE:
|
|
606
|
+
case REACT_FORWARD_REF_TYPE:
|
|
607
|
+
case REACT_LAZY_TYPE:
|
|
608
|
+
case REACT_MEMO_TYPE:
|
|
609
|
+
return object;
|
|
610
|
+
case REACT_CONSUMER_TYPE:
|
|
611
|
+
return object;
|
|
612
|
+
default:
|
|
613
|
+
return $$typeof;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
case REACT_PORTAL_TYPE:
|
|
617
|
+
return $$typeof;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
reactIs_production.ContextConsumer = REACT_CONSUMER_TYPE;
|
|
622
|
+
reactIs_production.ContextProvider = REACT_CONTEXT_TYPE;
|
|
623
|
+
reactIs_production.Element = REACT_ELEMENT_TYPE;
|
|
624
|
+
reactIs_production.ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
625
|
+
reactIs_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
626
|
+
reactIs_production.Lazy = REACT_LAZY_TYPE;
|
|
627
|
+
reactIs_production.Memo = REACT_MEMO_TYPE;
|
|
628
|
+
reactIs_production.Portal = REACT_PORTAL_TYPE;
|
|
629
|
+
reactIs_production.Profiler = REACT_PROFILER_TYPE;
|
|
630
|
+
reactIs_production.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
631
|
+
reactIs_production.Suspense = REACT_SUSPENSE_TYPE;
|
|
632
|
+
reactIs_production.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
633
|
+
reactIs_production.isContextConsumer = function(object) {
|
|
634
|
+
return typeOf(object) === REACT_CONSUMER_TYPE;
|
|
635
|
+
};
|
|
636
|
+
reactIs_production.isContextProvider = function(object) {
|
|
637
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
638
|
+
};
|
|
639
|
+
reactIs_production.isElement = function(object) {
|
|
640
|
+
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
641
|
+
};
|
|
642
|
+
reactIs_production.isForwardRef = function(object) {
|
|
643
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
644
|
+
};
|
|
645
|
+
reactIs_production.isFragment = function(object) {
|
|
646
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
647
|
+
};
|
|
648
|
+
reactIs_production.isLazy = function(object) {
|
|
649
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
650
|
+
};
|
|
651
|
+
reactIs_production.isMemo = function(object) {
|
|
652
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
653
|
+
};
|
|
654
|
+
reactIs_production.isPortal = function(object) {
|
|
655
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
656
|
+
};
|
|
657
|
+
reactIs_production.isProfiler = function(object) {
|
|
658
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
659
|
+
};
|
|
660
|
+
reactIs_production.isStrictMode = function(object) {
|
|
661
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
662
|
+
};
|
|
663
|
+
reactIs_production.isSuspense = function(object) {
|
|
664
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
665
|
+
};
|
|
666
|
+
reactIs_production.isSuspenseList = function(object) {
|
|
667
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
668
|
+
};
|
|
669
|
+
reactIs_production.isValidElementType = function(type) {
|
|
670
|
+
return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
|
|
671
|
+
};
|
|
672
|
+
reactIs_production.typeOf = typeOf;
|
|
673
|
+
return reactIs_production;
|
|
674
|
+
}
|
|
675
|
+
var hasRequiredReactIs$1;
|
|
676
|
+
function requireReactIs$1() {
|
|
677
|
+
if (hasRequiredReactIs$1) return reactIs$1.exports;
|
|
678
|
+
hasRequiredReactIs$1 = 1;
|
|
679
|
+
{
|
|
680
|
+
reactIs$1.exports = requireReactIs_production();
|
|
681
|
+
}
|
|
682
|
+
return reactIs$1.exports;
|
|
683
|
+
}
|
|
684
|
+
var reactIsExports$1 = requireReactIs$1();
|
|
685
|
+
var index$1 = /* @__PURE__ */ getDefaultExportFromCjs(reactIsExports$1);
|
|
686
|
+
var ReactIs19 = /* @__PURE__ */ _mergeNamespaces({
|
|
687
|
+
__proto__: null,
|
|
688
|
+
default: index$1
|
|
689
|
+
}, [reactIsExports$1]);
|
|
690
|
+
var reactIs = { exports: {} };
|
|
691
|
+
var reactIs_production_min = {};
|
|
692
|
+
var hasRequiredReactIs_production_min;
|
|
693
|
+
function requireReactIs_production_min() {
|
|
694
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
695
|
+
hasRequiredReactIs_production_min = 1;
|
|
696
|
+
var b2 = /* @__PURE__ */ Symbol.for("react.element"), c = /* @__PURE__ */ Symbol.for("react.portal"), d2 = /* @__PURE__ */ Symbol.for("react.fragment"), e = /* @__PURE__ */ Symbol.for("react.strict_mode"), f = /* @__PURE__ */ Symbol.for("react.profiler"), g = /* @__PURE__ */ Symbol.for("react.provider"), h = /* @__PURE__ */ Symbol.for("react.context"), k = /* @__PURE__ */ Symbol.for("react.server_context"), l = /* @__PURE__ */ Symbol.for("react.forward_ref"), m = /* @__PURE__ */ Symbol.for("react.suspense"), n = /* @__PURE__ */ Symbol.for("react.suspense_list"), p = /* @__PURE__ */ Symbol.for("react.memo"), q = /* @__PURE__ */ Symbol.for("react.lazy"), t = /* @__PURE__ */ Symbol.for("react.offscreen"), u;
|
|
697
|
+
u = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
698
|
+
function v(a) {
|
|
699
|
+
if ("object" === typeof a && null !== a) {
|
|
700
|
+
var r = a.$$typeof;
|
|
701
|
+
switch (r) {
|
|
702
|
+
case b2:
|
|
703
|
+
switch (a = a.type, a) {
|
|
704
|
+
case d2:
|
|
705
|
+
case f:
|
|
706
|
+
case e:
|
|
707
|
+
case m:
|
|
708
|
+
case n:
|
|
709
|
+
return a;
|
|
710
|
+
default:
|
|
711
|
+
switch (a = a && a.$$typeof, a) {
|
|
712
|
+
case k:
|
|
713
|
+
case h:
|
|
714
|
+
case l:
|
|
715
|
+
case q:
|
|
716
|
+
case p:
|
|
717
|
+
case g:
|
|
718
|
+
return a;
|
|
719
|
+
default:
|
|
720
|
+
return r;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
case c:
|
|
724
|
+
return r;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
reactIs_production_min.ContextConsumer = h;
|
|
729
|
+
reactIs_production_min.ContextProvider = g;
|
|
730
|
+
reactIs_production_min.Element = b2;
|
|
731
|
+
reactIs_production_min.ForwardRef = l;
|
|
732
|
+
reactIs_production_min.Fragment = d2;
|
|
733
|
+
reactIs_production_min.Lazy = q;
|
|
734
|
+
reactIs_production_min.Memo = p;
|
|
735
|
+
reactIs_production_min.Portal = c;
|
|
736
|
+
reactIs_production_min.Profiler = f;
|
|
737
|
+
reactIs_production_min.StrictMode = e;
|
|
738
|
+
reactIs_production_min.Suspense = m;
|
|
739
|
+
reactIs_production_min.SuspenseList = n;
|
|
740
|
+
reactIs_production_min.isAsyncMode = function() {
|
|
741
|
+
return false;
|
|
742
|
+
};
|
|
743
|
+
reactIs_production_min.isConcurrentMode = function() {
|
|
744
|
+
return false;
|
|
745
|
+
};
|
|
746
|
+
reactIs_production_min.isContextConsumer = function(a) {
|
|
747
|
+
return v(a) === h;
|
|
748
|
+
};
|
|
749
|
+
reactIs_production_min.isContextProvider = function(a) {
|
|
750
|
+
return v(a) === g;
|
|
751
|
+
};
|
|
752
|
+
reactIs_production_min.isElement = function(a) {
|
|
753
|
+
return "object" === typeof a && null !== a && a.$$typeof === b2;
|
|
754
|
+
};
|
|
755
|
+
reactIs_production_min.isForwardRef = function(a) {
|
|
756
|
+
return v(a) === l;
|
|
757
|
+
};
|
|
758
|
+
reactIs_production_min.isFragment = function(a) {
|
|
759
|
+
return v(a) === d2;
|
|
760
|
+
};
|
|
761
|
+
reactIs_production_min.isLazy = function(a) {
|
|
762
|
+
return v(a) === q;
|
|
763
|
+
};
|
|
764
|
+
reactIs_production_min.isMemo = function(a) {
|
|
765
|
+
return v(a) === p;
|
|
766
|
+
};
|
|
767
|
+
reactIs_production_min.isPortal = function(a) {
|
|
768
|
+
return v(a) === c;
|
|
769
|
+
};
|
|
770
|
+
reactIs_production_min.isProfiler = function(a) {
|
|
771
|
+
return v(a) === f;
|
|
772
|
+
};
|
|
773
|
+
reactIs_production_min.isStrictMode = function(a) {
|
|
774
|
+
return v(a) === e;
|
|
775
|
+
};
|
|
776
|
+
reactIs_production_min.isSuspense = function(a) {
|
|
777
|
+
return v(a) === m;
|
|
778
|
+
};
|
|
779
|
+
reactIs_production_min.isSuspenseList = function(a) {
|
|
780
|
+
return v(a) === n;
|
|
781
|
+
};
|
|
782
|
+
reactIs_production_min.isValidElementType = function(a) {
|
|
783
|
+
return "string" === typeof a || "function" === typeof a || a === d2 || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? true : false;
|
|
784
|
+
};
|
|
785
|
+
reactIs_production_min.typeOf = v;
|
|
786
|
+
return reactIs_production_min;
|
|
787
|
+
}
|
|
788
|
+
var hasRequiredReactIs;
|
|
789
|
+
function requireReactIs() {
|
|
790
|
+
if (hasRequiredReactIs) return reactIs.exports;
|
|
791
|
+
hasRequiredReactIs = 1;
|
|
792
|
+
{
|
|
793
|
+
reactIs.exports = requireReactIs_production_min();
|
|
794
|
+
}
|
|
795
|
+
return reactIs.exports;
|
|
796
|
+
}
|
|
797
|
+
var reactIsExports = requireReactIs();
|
|
798
|
+
var index = /* @__PURE__ */ getDefaultExportFromCjs(reactIsExports);
|
|
799
|
+
var ReactIs18 = /* @__PURE__ */ _mergeNamespaces({
|
|
800
|
+
__proto__: null,
|
|
801
|
+
default: index
|
|
802
|
+
}, [reactIsExports]);
|
|
803
|
+
var reactIsMethods = [
|
|
804
|
+
"isAsyncMode",
|
|
805
|
+
"isConcurrentMode",
|
|
806
|
+
"isContextConsumer",
|
|
807
|
+
"isContextProvider",
|
|
808
|
+
"isElement",
|
|
809
|
+
"isForwardRef",
|
|
810
|
+
"isFragment",
|
|
811
|
+
"isLazy",
|
|
812
|
+
"isMemo",
|
|
813
|
+
"isPortal",
|
|
814
|
+
"isProfiler",
|
|
815
|
+
"isStrictMode",
|
|
816
|
+
"isSuspense",
|
|
817
|
+
"isSuspenseList",
|
|
818
|
+
"isValidElementType"
|
|
819
|
+
];
|
|
820
|
+
var ReactIs = Object.fromEntries(reactIsMethods.map((m) => [m, (v) => ReactIs18[m](v) || ReactIs19[m](v)]));
|
|
821
|
+
function getChildren(arg, children = []) {
|
|
822
|
+
if (Array.isArray(arg)) {
|
|
823
|
+
for (const item of arg) {
|
|
824
|
+
getChildren(item, children);
|
|
825
|
+
}
|
|
826
|
+
} else if (arg != null && arg !== false && arg !== "") {
|
|
827
|
+
children.push(arg);
|
|
828
|
+
}
|
|
829
|
+
return children;
|
|
830
|
+
}
|
|
831
|
+
function getType(element) {
|
|
832
|
+
const type = element.type;
|
|
833
|
+
if (typeof type === "string") {
|
|
834
|
+
return type;
|
|
835
|
+
}
|
|
836
|
+
if (typeof type === "function") {
|
|
837
|
+
return type.displayName || type.name || "Unknown";
|
|
838
|
+
}
|
|
839
|
+
if (ReactIs.isFragment(element)) {
|
|
840
|
+
return "React.Fragment";
|
|
841
|
+
}
|
|
842
|
+
if (ReactIs.isSuspense(element)) {
|
|
843
|
+
return "React.Suspense";
|
|
844
|
+
}
|
|
845
|
+
if (typeof type === "object" && type !== null) {
|
|
846
|
+
if (ReactIs.isContextProvider(element)) {
|
|
847
|
+
return "Context.Provider";
|
|
848
|
+
}
|
|
849
|
+
if (ReactIs.isContextConsumer(element)) {
|
|
850
|
+
return "Context.Consumer";
|
|
851
|
+
}
|
|
852
|
+
if (ReactIs.isForwardRef(element)) {
|
|
853
|
+
if (type.displayName) {
|
|
854
|
+
return type.displayName;
|
|
855
|
+
}
|
|
856
|
+
const functionName = type.render.displayName || type.render.name || "";
|
|
857
|
+
return functionName === "" ? "ForwardRef" : `ForwardRef(${functionName})`;
|
|
858
|
+
}
|
|
859
|
+
if (ReactIs.isMemo(element)) {
|
|
860
|
+
const functionName = type.displayName || type.type.displayName || type.type.name || "";
|
|
861
|
+
return functionName === "" ? "Memo" : `Memo(${functionName})`;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
return "UNDEFINED";
|
|
865
|
+
}
|
|
866
|
+
function getPropKeys$1(element) {
|
|
867
|
+
const { props } = element;
|
|
868
|
+
return Object.keys(props).filter((key) => key !== "children" && props[key] !== void 0).sort();
|
|
869
|
+
}
|
|
870
|
+
var serialize$1 = (element, config, indentation, depth, refs, printer2) => ++depth > config.maxDepth ? printElementAsLeaf(getType(element), config) : printElement(getType(element), printProps(getPropKeys$1(element), element.props, config, indentation + config.indent, depth, refs, printer2), printChildren(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer2), config, indentation);
|
|
871
|
+
var test$1 = (val) => val != null && ReactIs.isElement(val);
|
|
872
|
+
var plugin$1 = {
|
|
873
|
+
serialize: serialize$1,
|
|
874
|
+
test: test$1
|
|
875
|
+
};
|
|
876
|
+
var testSymbol = typeof Symbol === "function" && Symbol.for ? /* @__PURE__ */ Symbol.for("react.test.json") : 245830487;
|
|
877
|
+
function getPropKeys(object) {
|
|
878
|
+
const { props } = object;
|
|
879
|
+
return props ? Object.keys(props).filter((key) => props[key] !== void 0).sort() : [];
|
|
880
|
+
}
|
|
881
|
+
var serialize = (object, config, indentation, depth, refs, printer2) => ++depth > config.maxDepth ? printElementAsLeaf(object.type, config) : printElement(object.type, object.props ? printProps(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer2) : "", object.children ? printChildren(object.children, config, indentation + config.indent, depth, refs, printer2) : "", config, indentation);
|
|
882
|
+
var test = (val) => val && val.$$typeof === testSymbol;
|
|
883
|
+
var plugin = {
|
|
884
|
+
serialize,
|
|
885
|
+
test
|
|
886
|
+
};
|
|
887
|
+
var toString = Object.prototype.toString;
|
|
888
|
+
var toISOString = Date.prototype.toISOString;
|
|
889
|
+
var errorToString = Error.prototype.toString;
|
|
890
|
+
var regExpToString = RegExp.prototype.toString;
|
|
891
|
+
function getConstructorName(val) {
|
|
892
|
+
return typeof val.constructor === "function" && val.constructor.name || "Object";
|
|
893
|
+
}
|
|
894
|
+
function isWindow(val) {
|
|
895
|
+
return typeof window !== "undefined" && val === window;
|
|
896
|
+
}
|
|
897
|
+
var SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
|
898
|
+
var NEWLINE_REGEXP = /\n/g;
|
|
899
|
+
var PrettyFormatPluginError = class extends Error {
|
|
900
|
+
constructor(message, stack) {
|
|
901
|
+
super(message);
|
|
902
|
+
this.stack = stack;
|
|
903
|
+
this.name = this.constructor.name;
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
function isToStringedArrayType(toStringed) {
|
|
907
|
+
return toStringed === "[object Array]" || toStringed === "[object ArrayBuffer]" || toStringed === "[object DataView]" || toStringed === "[object Float32Array]" || toStringed === "[object Float64Array]" || toStringed === "[object Int8Array]" || toStringed === "[object Int16Array]" || toStringed === "[object Int32Array]" || toStringed === "[object Uint8Array]" || toStringed === "[object Uint8ClampedArray]" || toStringed === "[object Uint16Array]" || toStringed === "[object Uint32Array]";
|
|
908
|
+
}
|
|
909
|
+
function printNumber(val) {
|
|
910
|
+
return Object.is(val, -0) ? "-0" : String(val);
|
|
911
|
+
}
|
|
912
|
+
function printBigInt(val) {
|
|
913
|
+
return String(`${val}n`);
|
|
914
|
+
}
|
|
915
|
+
function printFunction(val, printFunctionName) {
|
|
916
|
+
if (!printFunctionName) {
|
|
917
|
+
return "[Function]";
|
|
918
|
+
}
|
|
919
|
+
return `[Function ${val.name || "anonymous"}]`;
|
|
920
|
+
}
|
|
921
|
+
function printSymbol(val) {
|
|
922
|
+
return String(val).replace(SYMBOL_REGEXP, "Symbol($1)");
|
|
923
|
+
}
|
|
924
|
+
function printError(val) {
|
|
925
|
+
return `[${errorToString.call(val)}]`;
|
|
926
|
+
}
|
|
927
|
+
function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
|
|
928
|
+
if (val === true || val === false) {
|
|
929
|
+
return `${val}`;
|
|
930
|
+
}
|
|
931
|
+
if (val === void 0) {
|
|
932
|
+
return "undefined";
|
|
933
|
+
}
|
|
934
|
+
if (val === null) {
|
|
935
|
+
return "null";
|
|
936
|
+
}
|
|
937
|
+
const typeOf = typeof val;
|
|
938
|
+
if (typeOf === "number") {
|
|
939
|
+
return printNumber(val);
|
|
940
|
+
}
|
|
941
|
+
if (typeOf === "bigint") {
|
|
942
|
+
return printBigInt(val);
|
|
943
|
+
}
|
|
944
|
+
if (typeOf === "string") {
|
|
945
|
+
if (escapeString) {
|
|
946
|
+
return `"${val.replaceAll(/"|\\/g, "\\$&")}"`;
|
|
947
|
+
}
|
|
948
|
+
return `"${val}"`;
|
|
949
|
+
}
|
|
950
|
+
if (typeOf === "function") {
|
|
951
|
+
return printFunction(val, printFunctionName);
|
|
952
|
+
}
|
|
953
|
+
if (typeOf === "symbol") {
|
|
954
|
+
return printSymbol(val);
|
|
955
|
+
}
|
|
956
|
+
const toStringed = toString.call(val);
|
|
957
|
+
if (toStringed === "[object WeakMap]") {
|
|
958
|
+
return "WeakMap {}";
|
|
959
|
+
}
|
|
960
|
+
if (toStringed === "[object WeakSet]") {
|
|
961
|
+
return "WeakSet {}";
|
|
962
|
+
}
|
|
963
|
+
if (toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]") {
|
|
964
|
+
return printFunction(val, printFunctionName);
|
|
965
|
+
}
|
|
966
|
+
if (toStringed === "[object Symbol]") {
|
|
967
|
+
return printSymbol(val);
|
|
968
|
+
}
|
|
969
|
+
if (toStringed === "[object Date]") {
|
|
970
|
+
return Number.isNaN(+val) ? "Date { NaN }" : toISOString.call(val);
|
|
971
|
+
}
|
|
972
|
+
if (toStringed === "[object Error]") {
|
|
973
|
+
return printError(val);
|
|
974
|
+
}
|
|
975
|
+
if (toStringed === "[object RegExp]") {
|
|
976
|
+
if (escapeRegex) {
|
|
977
|
+
return regExpToString.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
|
|
978
|
+
}
|
|
979
|
+
return regExpToString.call(val);
|
|
980
|
+
}
|
|
981
|
+
if (val instanceof Error) {
|
|
982
|
+
return printError(val);
|
|
983
|
+
}
|
|
984
|
+
return null;
|
|
985
|
+
}
|
|
986
|
+
function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
987
|
+
if (refs.includes(val)) {
|
|
988
|
+
return "[Circular]";
|
|
989
|
+
}
|
|
990
|
+
refs = [...refs];
|
|
991
|
+
refs.push(val);
|
|
992
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
993
|
+
const min = config.min;
|
|
994
|
+
if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === "function" && !hasCalledToJSON) {
|
|
995
|
+
return printer(val.toJSON(), config, indentation, depth, refs, true);
|
|
996
|
+
}
|
|
997
|
+
const toStringed = toString.call(val);
|
|
998
|
+
if (toStringed === "[object Arguments]") {
|
|
999
|
+
return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
|
|
1000
|
+
}
|
|
1001
|
+
if (isToStringedArrayType(toStringed)) {
|
|
1002
|
+
return hitMaxDepth ? `[${val.constructor.name}]` : `${min ? "" : !config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
|
|
1003
|
+
}
|
|
1004
|
+
if (toStringed === "[object Map]") {
|
|
1005
|
+
return hitMaxDepth ? "[Map]" : `Map {${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer, " => ")}}`;
|
|
1006
|
+
}
|
|
1007
|
+
if (toStringed === "[object Set]") {
|
|
1008
|
+
return hitMaxDepth ? "[Set]" : `Set {${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}}`;
|
|
1009
|
+
}
|
|
1010
|
+
return hitMaxDepth || isWindow(val) ? `[${getConstructorName(val)}]` : `${min ? "" : !config.printBasicPrototype && getConstructorName(val) === "Object" ? "" : `${getConstructorName(val)} `}{${printObjectProperties(val, config, indentation, depth, refs, printer)}}`;
|
|
1011
|
+
}
|
|
1012
|
+
var ErrorPlugin = {
|
|
1013
|
+
test: (val) => val && val instanceof Error,
|
|
1014
|
+
serialize(val, config, indentation, depth, refs, printer2) {
|
|
1015
|
+
if (refs.includes(val)) {
|
|
1016
|
+
return "[Circular]";
|
|
1017
|
+
}
|
|
1018
|
+
refs = [...refs, val];
|
|
1019
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
1020
|
+
const { message, cause, ...rest } = val;
|
|
1021
|
+
const entries = {
|
|
1022
|
+
message,
|
|
1023
|
+
...typeof cause !== "undefined" ? { cause } : {},
|
|
1024
|
+
...val instanceof AggregateError ? { errors: val.errors } : {},
|
|
1025
|
+
...rest
|
|
1026
|
+
};
|
|
1027
|
+
const name = val.name !== "Error" ? val.name : getConstructorName(val);
|
|
1028
|
+
return hitMaxDepth ? `[${name}]` : `${name} {${printIteratorEntries(Object.entries(entries).values(), config, indentation, depth, refs, printer2)}}`;
|
|
1029
|
+
}
|
|
1030
|
+
};
|
|
1031
|
+
function isNewPlugin(plugin2) {
|
|
1032
|
+
return plugin2.serialize != null;
|
|
1033
|
+
}
|
|
1034
|
+
function printPlugin(plugin2, val, config, indentation, depth, refs) {
|
|
1035
|
+
let printed;
|
|
1036
|
+
try {
|
|
1037
|
+
printed = isNewPlugin(plugin2) ? plugin2.serialize(val, config, indentation, depth, refs, printer) : plugin2.print(val, (valChild) => printer(valChild, config, indentation, depth, refs), (str) => {
|
|
1038
|
+
const indentationNext = indentation + config.indent;
|
|
1039
|
+
return indentationNext + str.replaceAll(NEWLINE_REGEXP, `
|
|
1040
|
+
${indentationNext}`);
|
|
1041
|
+
}, {
|
|
1042
|
+
edgeSpacing: config.spacingOuter,
|
|
1043
|
+
min: config.min,
|
|
1044
|
+
spacing: config.spacingInner
|
|
1045
|
+
}, config.colors);
|
|
1046
|
+
} catch (error) {
|
|
1047
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
1048
|
+
}
|
|
1049
|
+
if (typeof printed !== "string") {
|
|
1050
|
+
throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
|
|
1051
|
+
}
|
|
1052
|
+
return printed;
|
|
1053
|
+
}
|
|
1054
|
+
function findPlugin(plugins2, val) {
|
|
1055
|
+
for (const plugin2 of plugins2) {
|
|
1056
|
+
try {
|
|
1057
|
+
if (plugin2.test(val)) {
|
|
1058
|
+
return plugin2;
|
|
1059
|
+
}
|
|
1060
|
+
} catch (error) {
|
|
1061
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
return null;
|
|
1065
|
+
}
|
|
1066
|
+
function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
1067
|
+
let result;
|
|
1068
|
+
const plugin2 = findPlugin(config.plugins, val);
|
|
1069
|
+
if (plugin2 !== null) {
|
|
1070
|
+
result = printPlugin(plugin2, val, config, indentation, depth, refs);
|
|
1071
|
+
} else {
|
|
1072
|
+
const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
|
|
1073
|
+
if (basicResult !== null) {
|
|
1074
|
+
result = basicResult;
|
|
1075
|
+
} else {
|
|
1076
|
+
result = printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
config._outputLengthPerDepth[depth] ??= 0;
|
|
1080
|
+
config._outputLengthPerDepth[depth] += result.length;
|
|
1081
|
+
if (config._outputLengthPerDepth[depth] > config.maxOutputLength) {
|
|
1082
|
+
config.maxDepth = 0;
|
|
1083
|
+
}
|
|
1084
|
+
return result;
|
|
1085
|
+
}
|
|
1086
|
+
var DEFAULT_THEME = {
|
|
1087
|
+
comment: "gray",
|
|
1088
|
+
content: "reset",
|
|
1089
|
+
prop: "yellow",
|
|
1090
|
+
tag: "cyan",
|
|
1091
|
+
value: "green"
|
|
1092
|
+
};
|
|
1093
|
+
var DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
|
|
1094
|
+
var DEFAULT_OPTIONS = {
|
|
1095
|
+
callToJSON: true,
|
|
1096
|
+
compareKeys: void 0,
|
|
1097
|
+
escapeRegex: false,
|
|
1098
|
+
escapeString: true,
|
|
1099
|
+
highlight: false,
|
|
1100
|
+
indent: 2,
|
|
1101
|
+
maxDepth: Number.POSITIVE_INFINITY,
|
|
1102
|
+
maxOutputLength: 1e6,
|
|
1103
|
+
maxWidth: Number.POSITIVE_INFINITY,
|
|
1104
|
+
min: false,
|
|
1105
|
+
plugins: [],
|
|
1106
|
+
printBasicPrototype: true,
|
|
1107
|
+
printFunctionName: true,
|
|
1108
|
+
printShadowRoot: true,
|
|
1109
|
+
theme: DEFAULT_THEME
|
|
1110
|
+
};
|
|
1111
|
+
function validateOptions(options) {
|
|
1112
|
+
for (const key of Object.keys(options)) {
|
|
1113
|
+
if (!Object.hasOwn(DEFAULT_OPTIONS, key)) {
|
|
1114
|
+
throw new Error(`pretty-format: Unknown option "${key}".`);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
if (options.min && options.indent !== void 0 && options.indent !== 0) {
|
|
1118
|
+
throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
function getColorsHighlight() {
|
|
1122
|
+
return DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
1123
|
+
const value = DEFAULT_THEME[key];
|
|
1124
|
+
const color = value && y[value];
|
|
1125
|
+
if (color && typeof color.close === "string" && typeof color.open === "string") {
|
|
1126
|
+
colors[key] = color;
|
|
1127
|
+
} else {
|
|
1128
|
+
throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
|
|
1129
|
+
}
|
|
1130
|
+
return colors;
|
|
1131
|
+
}, /* @__PURE__ */ Object.create(null));
|
|
1132
|
+
}
|
|
1133
|
+
function getColorsEmpty() {
|
|
1134
|
+
return DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
1135
|
+
colors[key] = {
|
|
1136
|
+
close: "",
|
|
1137
|
+
open: ""
|
|
1138
|
+
};
|
|
1139
|
+
return colors;
|
|
1140
|
+
}, /* @__PURE__ */ Object.create(null));
|
|
1141
|
+
}
|
|
1142
|
+
function getPrintFunctionName(options) {
|
|
1143
|
+
return options?.printFunctionName ?? DEFAULT_OPTIONS.printFunctionName;
|
|
1144
|
+
}
|
|
1145
|
+
function getEscapeRegex(options) {
|
|
1146
|
+
return options?.escapeRegex ?? DEFAULT_OPTIONS.escapeRegex;
|
|
1147
|
+
}
|
|
1148
|
+
function getEscapeString(options) {
|
|
1149
|
+
return options?.escapeString ?? DEFAULT_OPTIONS.escapeString;
|
|
1150
|
+
}
|
|
1151
|
+
function getConfig(options) {
|
|
1152
|
+
return {
|
|
1153
|
+
callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS.callToJSON,
|
|
1154
|
+
colors: options?.highlight ? getColorsHighlight() : getColorsEmpty(),
|
|
1155
|
+
compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS.compareKeys,
|
|
1156
|
+
escapeRegex: getEscapeRegex(options),
|
|
1157
|
+
escapeString: getEscapeString(options),
|
|
1158
|
+
indent: options?.min ? "" : createIndent(options?.indent ?? DEFAULT_OPTIONS.indent),
|
|
1159
|
+
maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS.maxDepth,
|
|
1160
|
+
maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS.maxWidth,
|
|
1161
|
+
min: options?.min ?? DEFAULT_OPTIONS.min,
|
|
1162
|
+
plugins: options?.plugins ?? DEFAULT_OPTIONS.plugins,
|
|
1163
|
+
printBasicPrototype: options?.printBasicPrototype ?? true,
|
|
1164
|
+
printFunctionName: getPrintFunctionName(options),
|
|
1165
|
+
printShadowRoot: options?.printShadowRoot ?? true,
|
|
1166
|
+
spacingInner: options?.min ? " " : "\n",
|
|
1167
|
+
spacingOuter: options?.min ? "" : "\n",
|
|
1168
|
+
maxOutputLength: options?.maxOutputLength ?? DEFAULT_OPTIONS.maxOutputLength,
|
|
1169
|
+
_outputLengthPerDepth: []
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
function createIndent(indent) {
|
|
1173
|
+
return Array.from({ length: indent + 1 }).join(" ");
|
|
1174
|
+
}
|
|
1175
|
+
function format(val, options) {
|
|
1176
|
+
if (options) {
|
|
1177
|
+
validateOptions(options);
|
|
1178
|
+
if (options.plugins) {
|
|
1179
|
+
const plugin2 = findPlugin(options.plugins, val);
|
|
1180
|
+
if (plugin2 !== null) {
|
|
1181
|
+
return printPlugin(plugin2, val, getConfig(options), "", 0, []);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
const basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options));
|
|
1186
|
+
if (basicResult !== null) {
|
|
1187
|
+
return basicResult;
|
|
1188
|
+
}
|
|
1189
|
+
return printComplexValue(val, getConfig(options), "", 0, []);
|
|
1190
|
+
}
|
|
1191
|
+
var plugins = {
|
|
1192
|
+
AsymmetricMatcher: plugin$5,
|
|
1193
|
+
DOMCollection: plugin$4,
|
|
1194
|
+
DOMElement: plugin$3,
|
|
1195
|
+
Immutable: plugin$2,
|
|
1196
|
+
ReactElement: plugin$1,
|
|
1197
|
+
ReactTestComponent: plugin,
|
|
1198
|
+
Error: ErrorPlugin
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
// ../../node_modules/.pnpm/@vitest+utils@4.1.6/node_modules/@vitest/utils/dist/display.js
|
|
1202
|
+
var ansiColors = {
|
|
1203
|
+
bold: ["1", "22"],
|
|
1204
|
+
dim: ["2", "22"],
|
|
1205
|
+
italic: ["3", "23"],
|
|
1206
|
+
underline: ["4", "24"],
|
|
1207
|
+
// 5 & 6 are blinking
|
|
1208
|
+
inverse: ["7", "27"],
|
|
1209
|
+
hidden: ["8", "28"],
|
|
1210
|
+
strike: ["9", "29"],
|
|
1211
|
+
// 10-20 are fonts
|
|
1212
|
+
// 21-29 are resets for 1-9
|
|
1213
|
+
black: ["30", "39"],
|
|
1214
|
+
red: ["31", "39"],
|
|
1215
|
+
green: ["32", "39"],
|
|
1216
|
+
yellow: ["33", "39"],
|
|
1217
|
+
blue: ["34", "39"],
|
|
1218
|
+
magenta: ["35", "39"],
|
|
1219
|
+
cyan: ["36", "39"],
|
|
1220
|
+
white: ["37", "39"],
|
|
1221
|
+
brightblack: ["30;1", "39"],
|
|
1222
|
+
brightred: ["31;1", "39"],
|
|
1223
|
+
brightgreen: ["32;1", "39"],
|
|
1224
|
+
brightyellow: ["33;1", "39"],
|
|
1225
|
+
brightblue: ["34;1", "39"],
|
|
1226
|
+
brightmagenta: ["35;1", "39"],
|
|
1227
|
+
brightcyan: ["36;1", "39"],
|
|
1228
|
+
brightwhite: ["37;1", "39"],
|
|
1229
|
+
grey: ["90", "39"]
|
|
1230
|
+
};
|
|
1231
|
+
var styles = {
|
|
1232
|
+
special: "cyan",
|
|
1233
|
+
number: "yellow",
|
|
1234
|
+
bigint: "yellow",
|
|
1235
|
+
boolean: "yellow",
|
|
1236
|
+
undefined: "grey",
|
|
1237
|
+
null: "bold",
|
|
1238
|
+
string: "green",
|
|
1239
|
+
symbol: "green",
|
|
1240
|
+
date: "magenta",
|
|
1241
|
+
regexp: "red"
|
|
1242
|
+
};
|
|
1243
|
+
var truncator = "\u2026";
|
|
1244
|
+
function colorise(value, styleType) {
|
|
1245
|
+
const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
|
|
1246
|
+
if (!color) {
|
|
1247
|
+
return String(value);
|
|
1248
|
+
}
|
|
1249
|
+
return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`;
|
|
1250
|
+
}
|
|
1251
|
+
function normaliseOptions({
|
|
1252
|
+
showHidden = false,
|
|
1253
|
+
depth = 2,
|
|
1254
|
+
colors = false,
|
|
1255
|
+
customInspect = true,
|
|
1256
|
+
showProxy = false,
|
|
1257
|
+
maxArrayLength = Infinity,
|
|
1258
|
+
breakLength = Infinity,
|
|
1259
|
+
seen = [],
|
|
1260
|
+
// eslint-disable-next-line no-shadow
|
|
1261
|
+
truncate: truncate2 = Infinity,
|
|
1262
|
+
stylize = String
|
|
1263
|
+
} = {}, inspect2) {
|
|
1264
|
+
const options = {
|
|
1265
|
+
showHidden: Boolean(showHidden),
|
|
1266
|
+
depth: Number(depth),
|
|
1267
|
+
colors: Boolean(colors),
|
|
1268
|
+
customInspect: Boolean(customInspect),
|
|
1269
|
+
showProxy: Boolean(showProxy),
|
|
1270
|
+
maxArrayLength: Number(maxArrayLength),
|
|
1271
|
+
breakLength: Number(breakLength),
|
|
1272
|
+
truncate: Number(truncate2),
|
|
1273
|
+
seen,
|
|
1274
|
+
inspect: inspect2,
|
|
1275
|
+
stylize
|
|
1276
|
+
};
|
|
1277
|
+
if (options.colors) {
|
|
1278
|
+
options.stylize = colorise;
|
|
1279
|
+
}
|
|
1280
|
+
return options;
|
|
1281
|
+
}
|
|
1282
|
+
function isHighSurrogate(char) {
|
|
1283
|
+
return char >= "\uD800" && char <= "\uDBFF";
|
|
1284
|
+
}
|
|
1285
|
+
function truncate(string, length, tail = truncator) {
|
|
1286
|
+
string = String(string);
|
|
1287
|
+
const tailLength = tail.length;
|
|
1288
|
+
const stringLength = string.length;
|
|
1289
|
+
if (tailLength > length && stringLength > tailLength) {
|
|
1290
|
+
return tail;
|
|
1291
|
+
}
|
|
1292
|
+
if (stringLength > length && stringLength > tailLength) {
|
|
1293
|
+
let end = length - tailLength;
|
|
1294
|
+
if (end > 0 && isHighSurrogate(string[end - 1])) {
|
|
1295
|
+
end = end - 1;
|
|
1296
|
+
}
|
|
1297
|
+
return `${string.slice(0, end)}${tail}`;
|
|
1298
|
+
}
|
|
1299
|
+
return string;
|
|
1300
|
+
}
|
|
1301
|
+
function inspectList(list, options, inspectItem, separator = ", ") {
|
|
1302
|
+
inspectItem = inspectItem || options.inspect;
|
|
1303
|
+
const size = list.length;
|
|
1304
|
+
if (size === 0)
|
|
1305
|
+
return "";
|
|
1306
|
+
const originalLength = options.truncate;
|
|
1307
|
+
let output = "";
|
|
1308
|
+
let peek = "";
|
|
1309
|
+
let truncated = "";
|
|
1310
|
+
for (let i2 = 0; i2 < size; i2 += 1) {
|
|
1311
|
+
const last = i2 + 1 === list.length;
|
|
1312
|
+
const secondToLast = i2 + 2 === list.length;
|
|
1313
|
+
truncated = `${truncator}(${list.length - i2})`;
|
|
1314
|
+
const value = list[i2];
|
|
1315
|
+
options.truncate = originalLength - output.length - (last ? 0 : separator.length);
|
|
1316
|
+
const string = peek || inspectItem(value, options) + (last ? "" : separator);
|
|
1317
|
+
const nextLength = output.length + string.length;
|
|
1318
|
+
const truncatedLength = nextLength + truncated.length;
|
|
1319
|
+
if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
|
|
1320
|
+
break;
|
|
1321
|
+
}
|
|
1322
|
+
if (!last && !secondToLast && truncatedLength > originalLength) {
|
|
1323
|
+
break;
|
|
1324
|
+
}
|
|
1325
|
+
peek = last ? "" : inspectItem(list[i2 + 1], options) + (secondToLast ? "" : separator);
|
|
1326
|
+
if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
|
|
1327
|
+
break;
|
|
1328
|
+
}
|
|
1329
|
+
output += string;
|
|
1330
|
+
if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
|
|
1331
|
+
truncated = `${truncator}(${list.length - i2 - 1})`;
|
|
1332
|
+
break;
|
|
1333
|
+
}
|
|
1334
|
+
truncated = "";
|
|
1335
|
+
}
|
|
1336
|
+
return `${output}${truncated}`;
|
|
1337
|
+
}
|
|
1338
|
+
function quoteComplexKey(key) {
|
|
1339
|
+
if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
|
|
1340
|
+
return key;
|
|
1341
|
+
}
|
|
1342
|
+
return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
|
|
1343
|
+
}
|
|
1344
|
+
function inspectProperty([key, value], options) {
|
|
1345
|
+
options.truncate -= 2;
|
|
1346
|
+
if (typeof key === "string") {
|
|
1347
|
+
key = quoteComplexKey(key);
|
|
1348
|
+
} else if (typeof key !== "number") {
|
|
1349
|
+
key = `[${options.inspect(key, options)}]`;
|
|
1350
|
+
}
|
|
1351
|
+
options.truncate -= key.length;
|
|
1352
|
+
value = options.inspect(value, options);
|
|
1353
|
+
return `${key}: ${value}`;
|
|
1354
|
+
}
|
|
1355
|
+
function inspectArray(array, options) {
|
|
1356
|
+
const nonIndexProperties = Object.keys(array).slice(array.length);
|
|
1357
|
+
if (!array.length && !nonIndexProperties.length)
|
|
1358
|
+
return "[]";
|
|
1359
|
+
options.truncate -= 4;
|
|
1360
|
+
const listContents = inspectList(array, options);
|
|
1361
|
+
options.truncate -= listContents.length;
|
|
1362
|
+
let propertyContents = "";
|
|
1363
|
+
if (nonIndexProperties.length) {
|
|
1364
|
+
propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
|
|
1365
|
+
}
|
|
1366
|
+
return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
|
|
1367
|
+
}
|
|
1368
|
+
var getArrayName = (array) => {
|
|
1369
|
+
if (typeof Buffer === "function" && array instanceof Buffer) {
|
|
1370
|
+
return "Buffer";
|
|
1371
|
+
}
|
|
1372
|
+
if (array[Symbol.toStringTag]) {
|
|
1373
|
+
return array[Symbol.toStringTag];
|
|
1374
|
+
}
|
|
1375
|
+
return array.constructor.name;
|
|
1376
|
+
};
|
|
1377
|
+
function inspectTypedArray(array, options) {
|
|
1378
|
+
const name = getArrayName(array);
|
|
1379
|
+
options.truncate -= name.length + 4;
|
|
1380
|
+
const nonIndexProperties = Object.keys(array).slice(array.length);
|
|
1381
|
+
if (!array.length && !nonIndexProperties.length)
|
|
1382
|
+
return `${name}[]`;
|
|
1383
|
+
let output = "";
|
|
1384
|
+
for (let i2 = 0; i2 < array.length; i2++) {
|
|
1385
|
+
const string = `${options.stylize(truncate(array[i2], options.truncate), "number")}${i2 === array.length - 1 ? "" : ", "}`;
|
|
1386
|
+
options.truncate -= string.length;
|
|
1387
|
+
if (array[i2] !== array.length && options.truncate <= 3) {
|
|
1388
|
+
output += `${truncator}(${array.length - array[i2] + 1})`;
|
|
1389
|
+
break;
|
|
1390
|
+
}
|
|
1391
|
+
output += string;
|
|
1392
|
+
}
|
|
1393
|
+
let propertyContents = "";
|
|
1394
|
+
if (nonIndexProperties.length) {
|
|
1395
|
+
propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
|
|
1396
|
+
}
|
|
1397
|
+
return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
|
|
1398
|
+
}
|
|
1399
|
+
function inspectDate(dateObject, options) {
|
|
1400
|
+
const stringRepresentation = dateObject.toJSON();
|
|
1401
|
+
if (stringRepresentation === null) {
|
|
1402
|
+
return "Invalid Date";
|
|
1403
|
+
}
|
|
1404
|
+
const split = stringRepresentation.split("T");
|
|
1405
|
+
const date = split[0];
|
|
1406
|
+
return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
|
|
1407
|
+
}
|
|
1408
|
+
function inspectFunction(func, options) {
|
|
1409
|
+
const functionType = func[Symbol.toStringTag] || "Function";
|
|
1410
|
+
const name = func.name;
|
|
1411
|
+
if (!name) {
|
|
1412
|
+
return options.stylize(`[${functionType}]`, "special");
|
|
1413
|
+
}
|
|
1414
|
+
return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
|
|
1415
|
+
}
|
|
1416
|
+
function inspectMapEntry([key, value], options) {
|
|
1417
|
+
options.truncate -= 4;
|
|
1418
|
+
key = options.inspect(key, options);
|
|
1419
|
+
options.truncate -= key.length;
|
|
1420
|
+
value = options.inspect(value, options);
|
|
1421
|
+
return `${key} => ${value}`;
|
|
1422
|
+
}
|
|
1423
|
+
function mapToEntries(map) {
|
|
1424
|
+
const entries = [];
|
|
1425
|
+
map.forEach((value, key) => {
|
|
1426
|
+
entries.push([key, value]);
|
|
1427
|
+
});
|
|
1428
|
+
return entries;
|
|
1429
|
+
}
|
|
1430
|
+
function inspectMap(map, options) {
|
|
1431
|
+
if (map.size === 0)
|
|
1432
|
+
return "Map{}";
|
|
1433
|
+
options.truncate -= 7;
|
|
1434
|
+
return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
|
|
1435
|
+
}
|
|
1436
|
+
var isNaN = Number.isNaN || ((i2) => i2 !== i2);
|
|
1437
|
+
function inspectNumber(number, options) {
|
|
1438
|
+
if (isNaN(number)) {
|
|
1439
|
+
return options.stylize("NaN", "number");
|
|
1440
|
+
}
|
|
1441
|
+
if (number === Infinity) {
|
|
1442
|
+
return options.stylize("Infinity", "number");
|
|
1443
|
+
}
|
|
1444
|
+
if (number === -Infinity) {
|
|
1445
|
+
return options.stylize("-Infinity", "number");
|
|
1446
|
+
}
|
|
1447
|
+
if (number === 0) {
|
|
1448
|
+
return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
|
|
1449
|
+
}
|
|
1450
|
+
return options.stylize(truncate(String(number), options.truncate), "number");
|
|
1451
|
+
}
|
|
1452
|
+
function inspectBigInt(number, options) {
|
|
1453
|
+
let nums = truncate(number.toString(), options.truncate - 1);
|
|
1454
|
+
if (nums !== truncator)
|
|
1455
|
+
nums += "n";
|
|
1456
|
+
return options.stylize(nums, "bigint");
|
|
1457
|
+
}
|
|
1458
|
+
function inspectRegExp(value, options) {
|
|
1459
|
+
const flags = value.toString().split("/")[2];
|
|
1460
|
+
const sourceLength = options.truncate - (2 + flags.length);
|
|
1461
|
+
const source = value.source;
|
|
1462
|
+
return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
|
|
1463
|
+
}
|
|
1464
|
+
function arrayFromSet(set) {
|
|
1465
|
+
const values = [];
|
|
1466
|
+
set.forEach((value) => {
|
|
1467
|
+
values.push(value);
|
|
1468
|
+
});
|
|
1469
|
+
return values;
|
|
1470
|
+
}
|
|
1471
|
+
function inspectSet(set, options) {
|
|
1472
|
+
if (set.size === 0)
|
|
1473
|
+
return "Set{}";
|
|
1474
|
+
options.truncate -= 7;
|
|
1475
|
+
return `Set{ ${inspectList(arrayFromSet(set), options)} }`;
|
|
1476
|
+
}
|
|
1477
|
+
var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
|
|
1478
|
+
var escapeCharacters = {
|
|
1479
|
+
"\b": "\\b",
|
|
1480
|
+
" ": "\\t",
|
|
1481
|
+
"\n": "\\n",
|
|
1482
|
+
"\f": "\\f",
|
|
1483
|
+
"\r": "\\r",
|
|
1484
|
+
"'": "\\'",
|
|
1485
|
+
"\\": "\\\\"
|
|
1486
|
+
};
|
|
1487
|
+
var hex = 16;
|
|
1488
|
+
function escape(char) {
|
|
1489
|
+
return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-4)}`;
|
|
1490
|
+
}
|
|
1491
|
+
function inspectString(string, options) {
|
|
1492
|
+
if (stringEscapeChars.test(string)) {
|
|
1493
|
+
string = string.replace(stringEscapeChars, escape);
|
|
1494
|
+
}
|
|
1495
|
+
return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
|
|
1496
|
+
}
|
|
1497
|
+
function inspectSymbol(value) {
|
|
1498
|
+
if ("description" in Symbol.prototype) {
|
|
1499
|
+
return value.description ? `Symbol(${value.description})` : "Symbol()";
|
|
1500
|
+
}
|
|
1501
|
+
return value.toString();
|
|
1502
|
+
}
|
|
1503
|
+
var getPromiseValue = () => "Promise{\u2026}";
|
|
1504
|
+
function inspectObject$1(object, options) {
|
|
1505
|
+
const properties = Object.getOwnPropertyNames(object);
|
|
1506
|
+
const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
|
|
1507
|
+
if (properties.length === 0 && symbols.length === 0) {
|
|
1508
|
+
return "{}";
|
|
1509
|
+
}
|
|
1510
|
+
options.truncate -= 4;
|
|
1511
|
+
options.seen = options.seen || [];
|
|
1512
|
+
if (options.seen.includes(object)) {
|
|
1513
|
+
return "[Circular]";
|
|
1514
|
+
}
|
|
1515
|
+
options.seen.push(object);
|
|
1516
|
+
const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty);
|
|
1517
|
+
const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty);
|
|
1518
|
+
options.seen.pop();
|
|
1519
|
+
let sep = "";
|
|
1520
|
+
if (propertyContents && symbolContents) {
|
|
1521
|
+
sep = ", ";
|
|
1522
|
+
}
|
|
1523
|
+
return `{ ${propertyContents}${sep}${symbolContents} }`;
|
|
1524
|
+
}
|
|
1525
|
+
var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
|
|
1526
|
+
function inspectClass(value, options) {
|
|
1527
|
+
let name = "";
|
|
1528
|
+
if (toStringTag && toStringTag in value) {
|
|
1529
|
+
name = value[toStringTag];
|
|
1530
|
+
}
|
|
1531
|
+
name = name || value.constructor.name;
|
|
1532
|
+
if (!name || name === "_class") {
|
|
1533
|
+
name = "<Anonymous Class>";
|
|
1534
|
+
}
|
|
1535
|
+
options.truncate -= name.length;
|
|
1536
|
+
return `${name}${inspectObject$1(value, options)}`;
|
|
1537
|
+
}
|
|
1538
|
+
function inspectArguments(args, options) {
|
|
1539
|
+
if (args.length === 0)
|
|
1540
|
+
return "Arguments[]";
|
|
1541
|
+
options.truncate -= 13;
|
|
1542
|
+
return `Arguments[ ${inspectList(args, options)} ]`;
|
|
1543
|
+
}
|
|
1544
|
+
var errorKeys = [
|
|
1545
|
+
"stack",
|
|
1546
|
+
"line",
|
|
1547
|
+
"column",
|
|
1548
|
+
"name",
|
|
1549
|
+
"message",
|
|
1550
|
+
"fileName",
|
|
1551
|
+
"lineNumber",
|
|
1552
|
+
"columnNumber",
|
|
1553
|
+
"number",
|
|
1554
|
+
"description",
|
|
1555
|
+
"cause"
|
|
1556
|
+
];
|
|
1557
|
+
function inspectObject(error, options) {
|
|
1558
|
+
const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
|
|
1559
|
+
const name = error.name;
|
|
1560
|
+
options.truncate -= name.length;
|
|
1561
|
+
let message = "";
|
|
1562
|
+
if (typeof error.message === "string") {
|
|
1563
|
+
message = truncate(error.message, options.truncate);
|
|
1564
|
+
} else {
|
|
1565
|
+
properties.unshift("message");
|
|
1566
|
+
}
|
|
1567
|
+
message = message ? `: ${message}` : "";
|
|
1568
|
+
options.truncate -= message.length + 5;
|
|
1569
|
+
options.seen = options.seen || [];
|
|
1570
|
+
if (options.seen.includes(error)) {
|
|
1571
|
+
return "[Circular]";
|
|
1572
|
+
}
|
|
1573
|
+
options.seen.push(error);
|
|
1574
|
+
const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
|
|
1575
|
+
return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
|
|
1576
|
+
}
|
|
1577
|
+
function inspectAttribute([key, value], options) {
|
|
1578
|
+
options.truncate -= 3;
|
|
1579
|
+
if (!value) {
|
|
1580
|
+
return `${options.stylize(String(key), "yellow")}`;
|
|
1581
|
+
}
|
|
1582
|
+
return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
|
|
1583
|
+
}
|
|
1584
|
+
function inspectNodeCollection(collection, options) {
|
|
1585
|
+
return inspectList(collection, options, inspectNode, "\n");
|
|
1586
|
+
}
|
|
1587
|
+
function inspectNode(node, options) {
|
|
1588
|
+
switch (node.nodeType) {
|
|
1589
|
+
case 1:
|
|
1590
|
+
return inspectHTML(node, options);
|
|
1591
|
+
case 3:
|
|
1592
|
+
return options.inspect(node.data, options);
|
|
1593
|
+
default:
|
|
1594
|
+
return options.inspect(node, options);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
function inspectHTML(element, options) {
|
|
1598
|
+
const properties = element.getAttributeNames();
|
|
1599
|
+
const name = element.tagName.toLowerCase();
|
|
1600
|
+
const head = options.stylize(`<${name}`, "special");
|
|
1601
|
+
const headClose = options.stylize(`>`, "special");
|
|
1602
|
+
const tail = options.stylize(`</${name}>`, "special");
|
|
1603
|
+
options.truncate -= name.length * 2 + 5;
|
|
1604
|
+
let propertyContents = "";
|
|
1605
|
+
if (properties.length > 0) {
|
|
1606
|
+
propertyContents += " ";
|
|
1607
|
+
propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
|
|
1608
|
+
}
|
|
1609
|
+
options.truncate -= propertyContents.length;
|
|
1610
|
+
const truncate2 = options.truncate;
|
|
1611
|
+
let children = inspectNodeCollection(element.children, options);
|
|
1612
|
+
if (children && children.length > truncate2) {
|
|
1613
|
+
children = `${truncator}(${element.children.length})`;
|
|
1614
|
+
}
|
|
1615
|
+
return `${head}${propertyContents}${headClose}${children}${tail}`;
|
|
1616
|
+
}
|
|
1617
|
+
var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
|
|
1618
|
+
var chaiInspect = symbolsSupported ? /* @__PURE__ */ Symbol.for("chai/inspect") : "@@chai/inspect";
|
|
1619
|
+
var nodeInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
1620
|
+
var constructorMap = /* @__PURE__ */ new WeakMap();
|
|
1621
|
+
var stringTagMap = {};
|
|
1622
|
+
var baseTypesMap = {
|
|
1623
|
+
undefined: (value, options) => options.stylize("undefined", "undefined"),
|
|
1624
|
+
null: (value, options) => options.stylize("null", "null"),
|
|
1625
|
+
boolean: (value, options) => options.stylize(String(value), "boolean"),
|
|
1626
|
+
Boolean: (value, options) => options.stylize(String(value), "boolean"),
|
|
1627
|
+
number: inspectNumber,
|
|
1628
|
+
Number: inspectNumber,
|
|
1629
|
+
bigint: inspectBigInt,
|
|
1630
|
+
BigInt: inspectBigInt,
|
|
1631
|
+
string: inspectString,
|
|
1632
|
+
String: inspectString,
|
|
1633
|
+
function: inspectFunction,
|
|
1634
|
+
Function: inspectFunction,
|
|
1635
|
+
symbol: inspectSymbol,
|
|
1636
|
+
// A Symbol polyfill will return `Symbol` not `symbol` from typedetect
|
|
1637
|
+
Symbol: inspectSymbol,
|
|
1638
|
+
Array: inspectArray,
|
|
1639
|
+
Date: inspectDate,
|
|
1640
|
+
Map: inspectMap,
|
|
1641
|
+
Set: inspectSet,
|
|
1642
|
+
RegExp: inspectRegExp,
|
|
1643
|
+
Promise: getPromiseValue,
|
|
1644
|
+
// WeakSet, WeakMap are totally opaque to us
|
|
1645
|
+
WeakSet: (value, options) => options.stylize("WeakSet{\u2026}", "special"),
|
|
1646
|
+
WeakMap: (value, options) => options.stylize("WeakMap{\u2026}", "special"),
|
|
1647
|
+
Arguments: inspectArguments,
|
|
1648
|
+
Int8Array: inspectTypedArray,
|
|
1649
|
+
Uint8Array: inspectTypedArray,
|
|
1650
|
+
Uint8ClampedArray: inspectTypedArray,
|
|
1651
|
+
Int16Array: inspectTypedArray,
|
|
1652
|
+
Uint16Array: inspectTypedArray,
|
|
1653
|
+
Int32Array: inspectTypedArray,
|
|
1654
|
+
Uint32Array: inspectTypedArray,
|
|
1655
|
+
Float32Array: inspectTypedArray,
|
|
1656
|
+
Float64Array: inspectTypedArray,
|
|
1657
|
+
Generator: () => "",
|
|
1658
|
+
DataView: () => "",
|
|
1659
|
+
ArrayBuffer: () => "",
|
|
1660
|
+
Error: inspectObject,
|
|
1661
|
+
HTMLCollection: inspectNodeCollection,
|
|
1662
|
+
NodeList: inspectNodeCollection
|
|
1663
|
+
};
|
|
1664
|
+
var inspectCustom = (value, options, type, inspectFn) => {
|
|
1665
|
+
if (chaiInspect in value && typeof value[chaiInspect] === "function") {
|
|
1666
|
+
return value[chaiInspect](options);
|
|
1667
|
+
}
|
|
1668
|
+
if (nodeInspect in value && typeof value[nodeInspect] === "function") {
|
|
1669
|
+
return value[nodeInspect](options.depth, options, inspectFn);
|
|
1670
|
+
}
|
|
1671
|
+
if ("inspect" in value && typeof value.inspect === "function") {
|
|
1672
|
+
return value.inspect(options.depth, options);
|
|
1673
|
+
}
|
|
1674
|
+
if ("constructor" in value && constructorMap.has(value.constructor)) {
|
|
1675
|
+
return constructorMap.get(value.constructor)(value, options);
|
|
1676
|
+
}
|
|
1677
|
+
if (stringTagMap[type]) {
|
|
1678
|
+
return stringTagMap[type](value, options);
|
|
1679
|
+
}
|
|
1680
|
+
return "";
|
|
1681
|
+
};
|
|
1682
|
+
var toString2 = Object.prototype.toString;
|
|
1683
|
+
function inspect$1(value, opts = {}) {
|
|
1684
|
+
const options = normaliseOptions(opts, inspect$1);
|
|
1685
|
+
const { customInspect } = options;
|
|
1686
|
+
let type = value === null ? "null" : typeof value;
|
|
1687
|
+
if (type === "object") {
|
|
1688
|
+
type = toString2.call(value).slice(8, -1);
|
|
1689
|
+
}
|
|
1690
|
+
if (type in baseTypesMap) {
|
|
1691
|
+
return baseTypesMap[type](value, options);
|
|
1692
|
+
}
|
|
1693
|
+
if (customInspect && value) {
|
|
1694
|
+
const output = inspectCustom(value, options, type, inspect$1);
|
|
1695
|
+
if (output) {
|
|
1696
|
+
if (typeof output === "string")
|
|
1697
|
+
return output;
|
|
1698
|
+
return inspect$1(output, options);
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
const proto = value ? Object.getPrototypeOf(value) : false;
|
|
1702
|
+
if (proto === Object.prototype || proto === null) {
|
|
1703
|
+
return inspectObject$1(value, options);
|
|
1704
|
+
}
|
|
1705
|
+
if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) {
|
|
1706
|
+
return inspectHTML(value, options);
|
|
1707
|
+
}
|
|
1708
|
+
if ("constructor" in value) {
|
|
1709
|
+
if (value.constructor !== Object) {
|
|
1710
|
+
return inspectClass(value, options);
|
|
1711
|
+
}
|
|
1712
|
+
return inspectObject$1(value, options);
|
|
1713
|
+
}
|
|
1714
|
+
if (value === Object(value)) {
|
|
1715
|
+
return inspectObject$1(value, options);
|
|
1716
|
+
}
|
|
1717
|
+
return options.stylize(String(value), type);
|
|
1718
|
+
}
|
|
1719
|
+
var { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins;
|
|
1720
|
+
var PLUGINS = [
|
|
1721
|
+
ReactTestComponent,
|
|
1722
|
+
ReactElement,
|
|
1723
|
+
DOMElement,
|
|
1724
|
+
DOMCollection,
|
|
1725
|
+
Immutable,
|
|
1726
|
+
AsymmetricMatcher
|
|
1727
|
+
];
|
|
1728
|
+
function stringify(object, maxDepth = 10, { maxLength, filterNode, ...options } = {}) {
|
|
1729
|
+
const MAX_LENGTH = maxLength ?? 1e4;
|
|
1730
|
+
let result;
|
|
1731
|
+
const filterFn = typeof filterNode === "string" ? createNodeFilterFromSelector(filterNode) : filterNode;
|
|
1732
|
+
const plugins2 = filterFn ? [
|
|
1733
|
+
ReactTestComponent,
|
|
1734
|
+
ReactElement,
|
|
1735
|
+
createDOMElementFilter(filterFn),
|
|
1736
|
+
DOMCollection,
|
|
1737
|
+
Immutable,
|
|
1738
|
+
AsymmetricMatcher
|
|
1739
|
+
] : PLUGINS;
|
|
1740
|
+
try {
|
|
1741
|
+
result = format(object, {
|
|
1742
|
+
maxDepth,
|
|
1743
|
+
escapeString: false,
|
|
1744
|
+
plugins: plugins2,
|
|
1745
|
+
...options
|
|
1746
|
+
});
|
|
1747
|
+
} catch {
|
|
1748
|
+
result = format(object, {
|
|
1749
|
+
callToJSON: false,
|
|
1750
|
+
maxDepth,
|
|
1751
|
+
escapeString: false,
|
|
1752
|
+
plugins: plugins2,
|
|
1753
|
+
...options
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), {
|
|
1757
|
+
maxLength,
|
|
1758
|
+
filterNode,
|
|
1759
|
+
...options
|
|
1760
|
+
}) : result;
|
|
1761
|
+
}
|
|
1762
|
+
function createNodeFilterFromSelector(selector) {
|
|
1763
|
+
const ELEMENT_NODE2 = 1;
|
|
1764
|
+
const COMMENT_NODE2 = 8;
|
|
1765
|
+
return (node) => {
|
|
1766
|
+
if (node.nodeType === COMMENT_NODE2) {
|
|
1767
|
+
return false;
|
|
1768
|
+
}
|
|
1769
|
+
if (node.nodeType === ELEMENT_NODE2 && node.matches) {
|
|
1770
|
+
try {
|
|
1771
|
+
return !node.matches(selector);
|
|
1772
|
+
} catch {
|
|
1773
|
+
return true;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
return true;
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
var formatRegExp = /%[sdjifoOc%]/g;
|
|
1780
|
+
function baseFormat(args, options = {}) {
|
|
1781
|
+
const formatArg = (item, inspecOptions) => {
|
|
1782
|
+
if (options.prettifyObject) {
|
|
1783
|
+
return stringify(item, void 0, {
|
|
1784
|
+
printBasicPrototype: false,
|
|
1785
|
+
escapeString: false
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
return inspect(item, inspecOptions);
|
|
1789
|
+
};
|
|
1790
|
+
if (typeof args[0] !== "string") {
|
|
1791
|
+
const objects = [];
|
|
1792
|
+
for (let i3 = 0; i3 < args.length; i3++) {
|
|
1793
|
+
objects.push(formatArg(args[i3], {
|
|
1794
|
+
depth: 0,
|
|
1795
|
+
colors: false
|
|
1796
|
+
}));
|
|
1797
|
+
}
|
|
1798
|
+
return objects.join(" ");
|
|
1799
|
+
}
|
|
1800
|
+
const len = args.length;
|
|
1801
|
+
let i2 = 1;
|
|
1802
|
+
const template = args[0];
|
|
1803
|
+
let str = String(template).replace(formatRegExp, (x) => {
|
|
1804
|
+
if (x === "%%") {
|
|
1805
|
+
return "%";
|
|
1806
|
+
}
|
|
1807
|
+
if (i2 >= len) {
|
|
1808
|
+
return x;
|
|
1809
|
+
}
|
|
1810
|
+
switch (x) {
|
|
1811
|
+
case "%s": {
|
|
1812
|
+
const value = args[i2++];
|
|
1813
|
+
if (typeof value === "bigint") {
|
|
1814
|
+
return `${value.toString()}n`;
|
|
1815
|
+
}
|
|
1816
|
+
if (typeof value === "number" && value === 0 && 1 / value < 0) {
|
|
1817
|
+
return "-0";
|
|
1818
|
+
}
|
|
1819
|
+
if (typeof value === "object" && value !== null) {
|
|
1820
|
+
if (typeof value.toString === "function" && value.toString !== Object.prototype.toString) {
|
|
1821
|
+
return value.toString();
|
|
1822
|
+
}
|
|
1823
|
+
return formatArg(value, {
|
|
1824
|
+
depth: 0,
|
|
1825
|
+
colors: false
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
return String(value);
|
|
1829
|
+
}
|
|
1830
|
+
case "%d": {
|
|
1831
|
+
const value = args[i2++];
|
|
1832
|
+
if (typeof value === "bigint") {
|
|
1833
|
+
return `${value.toString()}n`;
|
|
1834
|
+
}
|
|
1835
|
+
if (typeof value === "symbol") {
|
|
1836
|
+
return "NaN";
|
|
1837
|
+
}
|
|
1838
|
+
return Number(value).toString();
|
|
1839
|
+
}
|
|
1840
|
+
case "%i": {
|
|
1841
|
+
const value = args[i2++];
|
|
1842
|
+
if (typeof value === "bigint") {
|
|
1843
|
+
return `${value.toString()}n`;
|
|
1844
|
+
}
|
|
1845
|
+
return Number.parseInt(String(value)).toString();
|
|
1846
|
+
}
|
|
1847
|
+
case "%f":
|
|
1848
|
+
return Number.parseFloat(String(args[i2++])).toString();
|
|
1849
|
+
case "%o":
|
|
1850
|
+
return formatArg(args[i2++], {
|
|
1851
|
+
showHidden: true,
|
|
1852
|
+
showProxy: true
|
|
1853
|
+
});
|
|
1854
|
+
case "%O":
|
|
1855
|
+
return formatArg(args[i2++]);
|
|
1856
|
+
case "%c": {
|
|
1857
|
+
i2++;
|
|
1858
|
+
return "";
|
|
1859
|
+
}
|
|
1860
|
+
case "%j":
|
|
1861
|
+
try {
|
|
1862
|
+
return JSON.stringify(args[i2++]);
|
|
1863
|
+
} catch (err) {
|
|
1864
|
+
const m = err.message;
|
|
1865
|
+
if (m.includes("circular structure") || m.includes("cyclic structures") || m.includes("cyclic object")) {
|
|
1866
|
+
return "[Circular]";
|
|
1867
|
+
}
|
|
1868
|
+
throw err;
|
|
1869
|
+
}
|
|
1870
|
+
default:
|
|
1871
|
+
return x;
|
|
1872
|
+
}
|
|
1873
|
+
});
|
|
1874
|
+
for (let x = args[i2]; i2 < len; x = args[++i2]) {
|
|
1875
|
+
if (x === null || typeof x !== "object") {
|
|
1876
|
+
str += ` ${typeof x === "symbol" ? x.toString() : x}`;
|
|
1877
|
+
} else {
|
|
1878
|
+
str += ` ${formatArg(x)}`;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
return str;
|
|
1882
|
+
}
|
|
1883
|
+
function format2(...args) {
|
|
1884
|
+
return baseFormat(args);
|
|
1885
|
+
}
|
|
1886
|
+
function inspect(obj, options = {}) {
|
|
1887
|
+
if (options.truncate === 0) {
|
|
1888
|
+
options.truncate = Number.POSITIVE_INFINITY;
|
|
1889
|
+
}
|
|
1890
|
+
return inspect$1(obj, options);
|
|
1891
|
+
}
|
|
1892
|
+
function objDisplay(obj, options = {}) {
|
|
1893
|
+
if (typeof options.truncate === "undefined") {
|
|
1894
|
+
options.truncate = 40;
|
|
1895
|
+
}
|
|
1896
|
+
const str = inspect(obj, options);
|
|
1897
|
+
const type = Object.prototype.toString.call(obj);
|
|
1898
|
+
if (options.truncate && str.length >= options.truncate) {
|
|
1899
|
+
if (type === "[object Function]") {
|
|
1900
|
+
const fn = obj;
|
|
1901
|
+
return !fn.name ? "[Function]" : `[Function: ${fn.name}]`;
|
|
1902
|
+
} else if (type === "[object Array]") {
|
|
1903
|
+
return `[ Array(${obj.length}) ]`;
|
|
1904
|
+
} else if (type === "[object Object]") {
|
|
1905
|
+
const keys = Object.keys(obj);
|
|
1906
|
+
const kstr = keys.length > 2 ? `${keys.splice(0, 2).join(", ")}, ...` : keys.join(", ");
|
|
1907
|
+
return `{ Object (${kstr}) }`;
|
|
1908
|
+
} else {
|
|
1909
|
+
return str;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
return str;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
// ../../node_modules/.pnpm/@vitest+utils@4.1.6/node_modules/@vitest/utils/dist/helpers.js
|
|
1916
|
+
function assertTypes(value, name, types) {
|
|
1917
|
+
const receivedType = typeof value;
|
|
1918
|
+
const pass = types.includes(receivedType);
|
|
1919
|
+
if (!pass) {
|
|
1920
|
+
throw new TypeError(`${name} value must be ${types.join(" or ")}, received "${receivedType}"`);
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
function filterOutComments(s) {
|
|
1924
|
+
const result = [];
|
|
1925
|
+
let commentState = "none";
|
|
1926
|
+
for (let i2 = 0; i2 < s.length; ++i2) {
|
|
1927
|
+
if (commentState === "singleline") {
|
|
1928
|
+
if (s[i2] === "\n") {
|
|
1929
|
+
commentState = "none";
|
|
1930
|
+
}
|
|
1931
|
+
} else if (commentState === "multiline") {
|
|
1932
|
+
if (s[i2 - 1] === "*" && s[i2] === "/") {
|
|
1933
|
+
commentState = "none";
|
|
1934
|
+
}
|
|
1935
|
+
} else if (commentState === "none") {
|
|
1936
|
+
if (s[i2] === "/" && s[i2 + 1] === "/") {
|
|
1937
|
+
commentState = "singleline";
|
|
1938
|
+
} else if (s[i2] === "/" && s[i2 + 1] === "*") {
|
|
1939
|
+
commentState = "multiline";
|
|
1940
|
+
i2 += 2;
|
|
1941
|
+
} else {
|
|
1942
|
+
result.push(s[i2]);
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
return result.join("");
|
|
1947
|
+
}
|
|
1948
|
+
function toArray(array) {
|
|
1949
|
+
if (array === null || array === void 0) {
|
|
1950
|
+
array = [];
|
|
1951
|
+
}
|
|
1952
|
+
if (Array.isArray(array)) {
|
|
1953
|
+
return array;
|
|
1954
|
+
}
|
|
1955
|
+
return [array];
|
|
1956
|
+
}
|
|
1957
|
+
function isObject(item) {
|
|
1958
|
+
return item != null && typeof item === "object" && !Array.isArray(item);
|
|
1959
|
+
}
|
|
1960
|
+
function objectAttr(source, path, defaultValue = void 0) {
|
|
1961
|
+
const paths = path.replace(/\[(\d+)\]/g, ".$1").split(".");
|
|
1962
|
+
let result = source;
|
|
1963
|
+
for (const p of paths) {
|
|
1964
|
+
result = new Object(result)[p];
|
|
1965
|
+
if (result === void 0) {
|
|
1966
|
+
return defaultValue;
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
return result;
|
|
1970
|
+
}
|
|
1971
|
+
function createDefer() {
|
|
1972
|
+
let resolve2 = null;
|
|
1973
|
+
let reject = null;
|
|
1974
|
+
const p = new Promise((_resolve, _reject) => {
|
|
1975
|
+
resolve2 = _resolve;
|
|
1976
|
+
reject = _reject;
|
|
1977
|
+
});
|
|
1978
|
+
p.resolve = resolve2;
|
|
1979
|
+
p.reject = reject;
|
|
1980
|
+
return p;
|
|
1981
|
+
}
|
|
1982
|
+
function isNegativeNaN(val) {
|
|
1983
|
+
if (!Number.isNaN(val)) {
|
|
1984
|
+
return false;
|
|
1985
|
+
}
|
|
1986
|
+
const f64 = new Float64Array(1);
|
|
1987
|
+
f64[0] = val;
|
|
1988
|
+
const u32 = new Uint32Array(f64.buffer);
|
|
1989
|
+
const isNegative = u32[1] >>> 31 === 1;
|
|
1990
|
+
return isNegative;
|
|
1991
|
+
}
|
|
1992
|
+
function ordinal(i2) {
|
|
1993
|
+
const j = i2 % 10;
|
|
1994
|
+
const k = i2 % 100;
|
|
1995
|
+
if (j === 1 && k !== 11) {
|
|
1996
|
+
return `${i2}st`;
|
|
1997
|
+
}
|
|
1998
|
+
if (j === 2 && k !== 12) {
|
|
1999
|
+
return `${i2}nd`;
|
|
2000
|
+
}
|
|
2001
|
+
if (j === 3 && k !== 13) {
|
|
2002
|
+
return `${i2}rd`;
|
|
2003
|
+
}
|
|
2004
|
+
return `${i2}th`;
|
|
2005
|
+
}
|
|
2006
|
+
function unique(array) {
|
|
2007
|
+
return Array.from(new Set(array));
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
// ../../node_modules/.pnpm/@vitest+utils@4.1.6/node_modules/@vitest/utils/dist/timers.js
|
|
2011
|
+
var SAFE_TIMERS_SYMBOL = /* @__PURE__ */ Symbol("vitest:SAFE_TIMERS");
|
|
2012
|
+
function getSafeTimers() {
|
|
2013
|
+
const { setTimeout: safeSetTimeout, setInterval: safeSetInterval, clearInterval: safeClearInterval, clearTimeout: safeClearTimeout, setImmediate: safeSetImmediate, clearImmediate: safeClearImmediate, queueMicrotask: safeQueueMicrotask } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis;
|
|
2014
|
+
const { nextTick: safeNextTick } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis.process || {};
|
|
2015
|
+
return {
|
|
2016
|
+
nextTick: safeNextTick,
|
|
2017
|
+
setTimeout: safeSetTimeout,
|
|
2018
|
+
setInterval: safeSetInterval,
|
|
2019
|
+
clearInterval: safeClearInterval,
|
|
2020
|
+
clearTimeout: safeClearTimeout,
|
|
2021
|
+
setImmediate: safeSetImmediate,
|
|
2022
|
+
clearImmediate: safeClearImmediate,
|
|
2023
|
+
queueMicrotask: safeQueueMicrotask
|
|
2024
|
+
};
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
// ../../node_modules/.pnpm/@vitest+utils@4.1.6/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
|
|
2028
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
2029
|
+
function normalizeWindowsPath(input = "") {
|
|
2030
|
+
if (!input) {
|
|
2031
|
+
return input;
|
|
2032
|
+
}
|
|
2033
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
2034
|
+
}
|
|
2035
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
2036
|
+
function cwd() {
|
|
2037
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
2038
|
+
return process.cwd().replace(/\\/g, "/");
|
|
2039
|
+
}
|
|
2040
|
+
return "/";
|
|
2041
|
+
}
|
|
2042
|
+
var resolve = function(...arguments_) {
|
|
2043
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
2044
|
+
let resolvedPath = "";
|
|
2045
|
+
let resolvedAbsolute = false;
|
|
2046
|
+
for (let index2 = arguments_.length - 1; index2 >= -1 && !resolvedAbsolute; index2--) {
|
|
2047
|
+
const path = index2 >= 0 ? arguments_[index2] : cwd();
|
|
2048
|
+
if (!path || path.length === 0) {
|
|
2049
|
+
continue;
|
|
2050
|
+
}
|
|
2051
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
2052
|
+
resolvedAbsolute = isAbsolute(path);
|
|
2053
|
+
}
|
|
2054
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
2055
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
2056
|
+
return `/${resolvedPath}`;
|
|
2057
|
+
}
|
|
2058
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
2059
|
+
};
|
|
2060
|
+
function normalizeString(path, allowAboveRoot) {
|
|
2061
|
+
let res = "";
|
|
2062
|
+
let lastSegmentLength = 0;
|
|
2063
|
+
let lastSlash = -1;
|
|
2064
|
+
let dots = 0;
|
|
2065
|
+
let char = null;
|
|
2066
|
+
for (let index2 = 0; index2 <= path.length; ++index2) {
|
|
2067
|
+
if (index2 < path.length) {
|
|
2068
|
+
char = path[index2];
|
|
2069
|
+
} else if (char === "/") {
|
|
2070
|
+
break;
|
|
2071
|
+
} else {
|
|
2072
|
+
char = "/";
|
|
2073
|
+
}
|
|
2074
|
+
if (char === "/") {
|
|
2075
|
+
if (lastSlash === index2 - 1 || dots === 1) ;
|
|
2076
|
+
else if (dots === 2) {
|
|
2077
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
2078
|
+
if (res.length > 2) {
|
|
2079
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
2080
|
+
if (lastSlashIndex === -1) {
|
|
2081
|
+
res = "";
|
|
2082
|
+
lastSegmentLength = 0;
|
|
2083
|
+
} else {
|
|
2084
|
+
res = res.slice(0, lastSlashIndex);
|
|
2085
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
2086
|
+
}
|
|
2087
|
+
lastSlash = index2;
|
|
2088
|
+
dots = 0;
|
|
2089
|
+
continue;
|
|
2090
|
+
} else if (res.length > 0) {
|
|
2091
|
+
res = "";
|
|
2092
|
+
lastSegmentLength = 0;
|
|
2093
|
+
lastSlash = index2;
|
|
2094
|
+
dots = 0;
|
|
2095
|
+
continue;
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
if (allowAboveRoot) {
|
|
2099
|
+
res += res.length > 0 ? "/.." : "..";
|
|
2100
|
+
lastSegmentLength = 2;
|
|
2101
|
+
}
|
|
2102
|
+
} else {
|
|
2103
|
+
if (res.length > 0) {
|
|
2104
|
+
res += `/${path.slice(lastSlash + 1, index2)}`;
|
|
2105
|
+
} else {
|
|
2106
|
+
res = path.slice(lastSlash + 1, index2);
|
|
2107
|
+
}
|
|
2108
|
+
lastSegmentLength = index2 - lastSlash - 1;
|
|
2109
|
+
}
|
|
2110
|
+
lastSlash = index2;
|
|
2111
|
+
dots = 0;
|
|
2112
|
+
} else if (char === "." && dots !== -1) {
|
|
2113
|
+
++dots;
|
|
2114
|
+
} else {
|
|
2115
|
+
dots = -1;
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
return res;
|
|
2119
|
+
}
|
|
2120
|
+
var isAbsolute = function(p) {
|
|
2121
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
2122
|
+
};
|
|
2123
|
+
|
|
2124
|
+
// ../../node_modules/.pnpm/@vitest+utils@4.1.6/node_modules/@vitest/utils/dist/source-map.js
|
|
2125
|
+
var comma = ",".charCodeAt(0);
|
|
2126
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
2127
|
+
var intToChar = new Uint8Array(64);
|
|
2128
|
+
var charToInt = new Uint8Array(128);
|
|
2129
|
+
for (let i2 = 0; i2 < chars.length; i2++) {
|
|
2130
|
+
const c = chars.charCodeAt(i2);
|
|
2131
|
+
intToChar[i2] = c;
|
|
2132
|
+
charToInt[c] = i2;
|
|
2133
|
+
}
|
|
2134
|
+
var CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m;
|
|
2135
|
+
var SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/;
|
|
2136
|
+
var NOW_LENGTH = Date.now().toString().length;
|
|
2137
|
+
var REGEXP_VITEST = new RegExp(`vitest=\\d{${NOW_LENGTH}}`);
|
|
2138
|
+
function extractLocation(urlLike) {
|
|
2139
|
+
if (!urlLike.includes(":")) {
|
|
2140
|
+
return [urlLike];
|
|
2141
|
+
}
|
|
2142
|
+
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
2143
|
+
const parts = regExp.exec(urlLike.replace(/^\(|\)$/g, ""));
|
|
2144
|
+
if (!parts) {
|
|
2145
|
+
return [urlLike];
|
|
2146
|
+
}
|
|
2147
|
+
let url = parts[1];
|
|
2148
|
+
if (url.startsWith("async ")) {
|
|
2149
|
+
url = url.slice(6);
|
|
2150
|
+
}
|
|
2151
|
+
if (url.startsWith("http:") || url.startsWith("https:")) {
|
|
2152
|
+
const urlObj = new URL(url);
|
|
2153
|
+
urlObj.searchParams.delete("import");
|
|
2154
|
+
urlObj.searchParams.delete("browserv");
|
|
2155
|
+
url = urlObj.pathname + urlObj.hash + urlObj.search;
|
|
2156
|
+
}
|
|
2157
|
+
if (url.startsWith("/@fs/")) {
|
|
2158
|
+
const isWindows2 = /^\/@fs\/[a-zA-Z]:\//.test(url);
|
|
2159
|
+
url = url.slice(isWindows2 ? 5 : 4);
|
|
2160
|
+
}
|
|
2161
|
+
if (url.includes("vitest=")) {
|
|
2162
|
+
url = url.replace(REGEXP_VITEST, "").replace(/[?&]$/, "");
|
|
2163
|
+
}
|
|
2164
|
+
return [
|
|
2165
|
+
url,
|
|
2166
|
+
parts[2] || void 0,
|
|
2167
|
+
parts[3] || void 0
|
|
2168
|
+
];
|
|
2169
|
+
}
|
|
2170
|
+
function parseSingleFFOrSafariStack(raw) {
|
|
2171
|
+
let line = raw.trim();
|
|
2172
|
+
if (SAFARI_NATIVE_CODE_REGEXP.test(line)) {
|
|
2173
|
+
return null;
|
|
2174
|
+
}
|
|
2175
|
+
if (line.includes(" > eval")) {
|
|
2176
|
+
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
|
|
2177
|
+
}
|
|
2178
|
+
if (!line.includes("@")) {
|
|
2179
|
+
return null;
|
|
2180
|
+
}
|
|
2181
|
+
let atIndex = -1;
|
|
2182
|
+
let locationPart = "";
|
|
2183
|
+
let functionName;
|
|
2184
|
+
for (let i2 = 0; i2 < line.length; i2++) {
|
|
2185
|
+
if (line[i2] === "@") {
|
|
2186
|
+
const candidateLocation = line.slice(i2 + 1);
|
|
2187
|
+
if (candidateLocation.includes(":") && candidateLocation.length >= 3) {
|
|
2188
|
+
atIndex = i2;
|
|
2189
|
+
locationPart = candidateLocation;
|
|
2190
|
+
functionName = i2 > 0 ? line.slice(0, i2) : void 0;
|
|
2191
|
+
break;
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
if (atIndex === -1 || !locationPart.includes(":") || locationPart.length < 3) {
|
|
2196
|
+
return null;
|
|
2197
|
+
}
|
|
2198
|
+
const [url, lineNumber, columnNumber] = extractLocation(locationPart);
|
|
2199
|
+
if (!url || !lineNumber || !columnNumber) {
|
|
2200
|
+
return null;
|
|
2201
|
+
}
|
|
2202
|
+
return {
|
|
2203
|
+
file: url,
|
|
2204
|
+
method: functionName || "",
|
|
2205
|
+
line: Number.parseInt(lineNumber),
|
|
2206
|
+
column: Number.parseInt(columnNumber)
|
|
2207
|
+
};
|
|
2208
|
+
}
|
|
2209
|
+
function parseSingleStack(raw) {
|
|
2210
|
+
const line = raw.trim();
|
|
2211
|
+
if (!CHROME_IE_STACK_REGEXP.test(line)) {
|
|
2212
|
+
return parseSingleFFOrSafariStack(line);
|
|
2213
|
+
}
|
|
2214
|
+
return parseSingleV8Stack(line);
|
|
2215
|
+
}
|
|
2216
|
+
function parseSingleV8Stack(raw) {
|
|
2217
|
+
let line = raw.trim();
|
|
2218
|
+
if (!CHROME_IE_STACK_REGEXP.test(line)) {
|
|
2219
|
+
return null;
|
|
2220
|
+
}
|
|
2221
|
+
if (line.includes("(eval ")) {
|
|
2222
|
+
line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
|
|
2223
|
+
}
|
|
2224
|
+
let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
|
|
2225
|
+
const location = sanitizedLine.match(/ (\(.+\)$)/);
|
|
2226
|
+
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
|
|
2227
|
+
const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine);
|
|
2228
|
+
let method = location && sanitizedLine || "";
|
|
2229
|
+
let file = url && ["eval", "<anonymous>"].includes(url) ? void 0 : url;
|
|
2230
|
+
if (!file || !lineNumber || !columnNumber) {
|
|
2231
|
+
return null;
|
|
2232
|
+
}
|
|
2233
|
+
if (method.startsWith("async ")) {
|
|
2234
|
+
method = method.slice(6);
|
|
2235
|
+
}
|
|
2236
|
+
if (file.startsWith("file://")) {
|
|
2237
|
+
file = file.slice(7);
|
|
2238
|
+
}
|
|
2239
|
+
file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve(file);
|
|
2240
|
+
if (method) {
|
|
2241
|
+
method = method.replace(/\(0\s?,\s?__vite_ssr_import_\d+__.(\w+)\)/g, "$1").replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "").replace(/(Object\.)?__vite_ssr_export_default__\s?/g, "");
|
|
2242
|
+
}
|
|
2243
|
+
return {
|
|
2244
|
+
method,
|
|
2245
|
+
file,
|
|
2246
|
+
line: Number.parseInt(lineNumber),
|
|
2247
|
+
column: Number.parseInt(columnNumber)
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
// ../../node_modules/.pnpm/@vitest+runner@4.1.6/node_modules/@vitest/runner/dist/chunk-artifact.js
|
|
2252
|
+
var PendingError = class extends Error {
|
|
2253
|
+
code = "VITEST_PENDING";
|
|
2254
|
+
taskId;
|
|
2255
|
+
constructor(message, task, note) {
|
|
2256
|
+
super(message);
|
|
2257
|
+
this.message = message;
|
|
2258
|
+
this.note = note;
|
|
2259
|
+
this.taskId = task.id;
|
|
2260
|
+
}
|
|
2261
|
+
};
|
|
2262
|
+
var FixtureDependencyError = class extends Error {
|
|
2263
|
+
name = "FixtureDependencyError";
|
|
2264
|
+
};
|
|
2265
|
+
var FixtureAccessError = class extends Error {
|
|
2266
|
+
name = "FixtureAccessError";
|
|
2267
|
+
};
|
|
2268
|
+
var FixtureParseError = class extends Error {
|
|
2269
|
+
name = "FixtureParseError";
|
|
2270
|
+
};
|
|
2271
|
+
var fnMap = /* @__PURE__ */ new WeakMap();
|
|
2272
|
+
var testFixtureMap = /* @__PURE__ */ new WeakMap();
|
|
2273
|
+
var hooksMap = /* @__PURE__ */ new WeakMap();
|
|
2274
|
+
function setFn(key, fn) {
|
|
2275
|
+
fnMap.set(key, fn);
|
|
2276
|
+
}
|
|
2277
|
+
function setTestFixture(key, fixture2) {
|
|
2278
|
+
testFixtureMap.set(key, fixture2);
|
|
2279
|
+
}
|
|
2280
|
+
function getTestFixtures(key) {
|
|
2281
|
+
return testFixtureMap.get(key);
|
|
2282
|
+
}
|
|
2283
|
+
function setHooks(key, hooks) {
|
|
2284
|
+
hooksMap.set(key, hooks);
|
|
2285
|
+
}
|
|
2286
|
+
function getHooks(key) {
|
|
2287
|
+
return hooksMap.get(key);
|
|
2288
|
+
}
|
|
2289
|
+
var FIXTURE_STACK_TRACE_KEY = /* @__PURE__ */ Symbol.for("VITEST_FIXTURE_STACK_TRACE");
|
|
2290
|
+
var TestFixtures = class _TestFixtures {
|
|
2291
|
+
_suiteContexts;
|
|
2292
|
+
_overrides = /* @__PURE__ */ new WeakMap();
|
|
2293
|
+
_registrations;
|
|
2294
|
+
static _definitions = [];
|
|
2295
|
+
static _builtinFixtures = [
|
|
2296
|
+
"task",
|
|
2297
|
+
"signal",
|
|
2298
|
+
"onTestFailed",
|
|
2299
|
+
"onTestFinished",
|
|
2300
|
+
"skip",
|
|
2301
|
+
"annotate"
|
|
2302
|
+
];
|
|
2303
|
+
static _fixtureOptionKeys = [
|
|
2304
|
+
"auto",
|
|
2305
|
+
"injected",
|
|
2306
|
+
"scope"
|
|
2307
|
+
];
|
|
2308
|
+
static _fixtureScopes = [
|
|
2309
|
+
"test",
|
|
2310
|
+
"file",
|
|
2311
|
+
"worker"
|
|
2312
|
+
];
|
|
2313
|
+
static _workerContextSuite = { type: "worker" };
|
|
2314
|
+
static clearDefinitions() {
|
|
2315
|
+
_TestFixtures._definitions.length = 0;
|
|
2316
|
+
}
|
|
2317
|
+
static getWorkerContexts() {
|
|
2318
|
+
return _TestFixtures._definitions.map((f) => f.getWorkerContext());
|
|
2319
|
+
}
|
|
2320
|
+
static getFileContexts(file) {
|
|
2321
|
+
return _TestFixtures._definitions.map((f) => f.getFileContext(file));
|
|
2322
|
+
}
|
|
2323
|
+
static isFixtureOptions(obj) {
|
|
2324
|
+
return isObject(obj) && Object.keys(obj).some((key) => _TestFixtures._fixtureOptionKeys.includes(key));
|
|
2325
|
+
}
|
|
2326
|
+
constructor(registrations) {
|
|
2327
|
+
this._registrations = registrations ?? /* @__PURE__ */ new Map();
|
|
2328
|
+
this._suiteContexts = /* @__PURE__ */ new WeakMap();
|
|
2329
|
+
_TestFixtures._definitions.push(this);
|
|
2330
|
+
}
|
|
2331
|
+
extend(runner2, userFixtures) {
|
|
2332
|
+
const { suite: suite2 } = getCurrentSuite();
|
|
2333
|
+
const isTopLevel = !suite2 || suite2.file === suite2;
|
|
2334
|
+
const registrations = this.parseUserFixtures(runner2, userFixtures, isTopLevel);
|
|
2335
|
+
return new _TestFixtures(registrations);
|
|
2336
|
+
}
|
|
2337
|
+
get(suite2) {
|
|
2338
|
+
let currentSuite = suite2;
|
|
2339
|
+
while (currentSuite) {
|
|
2340
|
+
const overrides = this._overrides.get(currentSuite);
|
|
2341
|
+
if (overrides) {
|
|
2342
|
+
return overrides;
|
|
2343
|
+
}
|
|
2344
|
+
if (currentSuite === currentSuite.file) {
|
|
2345
|
+
break;
|
|
2346
|
+
}
|
|
2347
|
+
currentSuite = currentSuite.suite || currentSuite.file;
|
|
2348
|
+
}
|
|
2349
|
+
return this._registrations;
|
|
2350
|
+
}
|
|
2351
|
+
override(runner2, userFixtures) {
|
|
2352
|
+
const { suite: currentSuite, file } = getCurrentSuite();
|
|
2353
|
+
const suite2 = currentSuite || file;
|
|
2354
|
+
const isTopLevel = !currentSuite || currentSuite.file === currentSuite;
|
|
2355
|
+
const suiteRegistrations = new Map(this.get(suite2));
|
|
2356
|
+
const registrations = this.parseUserFixtures(runner2, userFixtures, isTopLevel, suiteRegistrations);
|
|
2357
|
+
if (isTopLevel) {
|
|
2358
|
+
this._registrations = registrations;
|
|
2359
|
+
} else {
|
|
2360
|
+
this._overrides.set(suite2, registrations);
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
getFileContext(file) {
|
|
2364
|
+
if (!this._suiteContexts.has(file)) {
|
|
2365
|
+
this._suiteContexts.set(file, /* @__PURE__ */ Object.create(null));
|
|
2366
|
+
}
|
|
2367
|
+
return this._suiteContexts.get(file);
|
|
2368
|
+
}
|
|
2369
|
+
getWorkerContext() {
|
|
2370
|
+
if (!this._suiteContexts.has(_TestFixtures._workerContextSuite)) {
|
|
2371
|
+
this._suiteContexts.set(_TestFixtures._workerContextSuite, /* @__PURE__ */ Object.create(null));
|
|
2372
|
+
}
|
|
2373
|
+
return this._suiteContexts.get(_TestFixtures._workerContextSuite);
|
|
2374
|
+
}
|
|
2375
|
+
parseUserFixtures(runner2, userFixtures, supportNonTest, registrations = new Map(this._registrations)) {
|
|
2376
|
+
const errors = [];
|
|
2377
|
+
Object.entries(userFixtures).forEach(([name, fn]) => {
|
|
2378
|
+
let options;
|
|
2379
|
+
let value;
|
|
2380
|
+
let _options;
|
|
2381
|
+
if (Array.isArray(fn) && fn.length >= 2 && _TestFixtures.isFixtureOptions(fn[1])) {
|
|
2382
|
+
_options = fn[1];
|
|
2383
|
+
options = {
|
|
2384
|
+
auto: _options.auto ?? false,
|
|
2385
|
+
scope: _options.scope ?? "test",
|
|
2386
|
+
injected: _options.injected ?? false
|
|
2387
|
+
};
|
|
2388
|
+
value = options.injected ? runner2.injectValue?.(name) ?? fn[0] : fn[0];
|
|
2389
|
+
} else {
|
|
2390
|
+
value = fn;
|
|
2391
|
+
}
|
|
2392
|
+
const parent = registrations.get(name);
|
|
2393
|
+
if (parent && options) {
|
|
2394
|
+
if (parent.scope !== options.scope) {
|
|
2395
|
+
errors.push(new FixtureDependencyError(`The "${name}" fixture was already registered with a "${options.scope}" scope.`));
|
|
2396
|
+
}
|
|
2397
|
+
if (parent.auto !== options.auto) {
|
|
2398
|
+
errors.push(new FixtureDependencyError(`The "${name}" fixture was already registered as { auto: ${options.auto} }.`));
|
|
2399
|
+
}
|
|
2400
|
+
} else if (parent) {
|
|
2401
|
+
options = {
|
|
2402
|
+
auto: parent.auto,
|
|
2403
|
+
scope: parent.scope,
|
|
2404
|
+
injected: parent.injected
|
|
2405
|
+
};
|
|
2406
|
+
} else if (!options) {
|
|
2407
|
+
options = {
|
|
2408
|
+
auto: false,
|
|
2409
|
+
injected: false,
|
|
2410
|
+
scope: "test"
|
|
2411
|
+
};
|
|
2412
|
+
}
|
|
2413
|
+
if (options.scope && !_TestFixtures._fixtureScopes.includes(options.scope)) {
|
|
2414
|
+
errors.push(new FixtureDependencyError(`The "${name}" fixture has unknown scope "${options.scope}".`));
|
|
2415
|
+
}
|
|
2416
|
+
if (!supportNonTest && options.scope !== "test") {
|
|
2417
|
+
errors.push(new FixtureDependencyError(`The "${name}" fixture cannot be defined with a ${options.scope} scope${!_options?.scope && parent?.scope ? " (inherited from the base fixture)" : ""} inside the describe block. Define it at the top level of the file instead.`));
|
|
2418
|
+
}
|
|
2419
|
+
const deps = isFixtureFunction(value) ? getUsedProps(value) : /* @__PURE__ */ new Set();
|
|
2420
|
+
const item = {
|
|
2421
|
+
name,
|
|
2422
|
+
value,
|
|
2423
|
+
auto: options.auto ?? false,
|
|
2424
|
+
injected: options.injected ?? false,
|
|
2425
|
+
scope: options.scope ?? "test",
|
|
2426
|
+
deps,
|
|
2427
|
+
parent
|
|
2428
|
+
};
|
|
2429
|
+
if (isFixtureFunction(value)) {
|
|
2430
|
+
Object.assign(value, { [FIXTURE_STACK_TRACE_KEY]: new Error("STACK_TRACE_ERROR") });
|
|
2431
|
+
}
|
|
2432
|
+
registrations.set(name, item);
|
|
2433
|
+
if (item.scope === "worker" && (runner2.pool === "vmThreads" || runner2.pool === "vmForks")) {
|
|
2434
|
+
item.scope = "file";
|
|
2435
|
+
}
|
|
2436
|
+
});
|
|
2437
|
+
for (const fixture2 of registrations.values()) {
|
|
2438
|
+
for (const depName of fixture2.deps) {
|
|
2439
|
+
if (_TestFixtures._builtinFixtures.includes(depName)) {
|
|
2440
|
+
continue;
|
|
2441
|
+
}
|
|
2442
|
+
const dep = registrations.get(depName);
|
|
2443
|
+
if (!dep) {
|
|
2444
|
+
errors.push(new FixtureDependencyError(`The "${fixture2.name}" fixture depends on unknown fixture "${depName}".`));
|
|
2445
|
+
continue;
|
|
2446
|
+
}
|
|
2447
|
+
if (depName === fixture2.name && !fixture2.parent) {
|
|
2448
|
+
errors.push(new FixtureDependencyError(`The "${fixture2.name}" fixture depends on itself, but does not have a base implementation.`));
|
|
2449
|
+
continue;
|
|
2450
|
+
}
|
|
2451
|
+
if (_TestFixtures._fixtureScopes.indexOf(fixture2.scope) > _TestFixtures._fixtureScopes.indexOf(dep.scope)) {
|
|
2452
|
+
errors.push(new FixtureDependencyError(`The ${fixture2.scope} "${fixture2.name}" fixture cannot depend on a ${dep.scope} fixture "${dep.name}".`));
|
|
2453
|
+
continue;
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
if (errors.length === 1) {
|
|
2458
|
+
throw errors[0];
|
|
2459
|
+
} else if (errors.length > 1) {
|
|
2460
|
+
throw new AggregateError(errors, "Cannot resolve user fixtures. See errors for more information.");
|
|
2461
|
+
}
|
|
2462
|
+
return registrations;
|
|
2463
|
+
}
|
|
2464
|
+
};
|
|
2465
|
+
var cleanupFnArrayMap = /* @__PURE__ */ new WeakMap();
|
|
2466
|
+
var contextHasFixturesCache = /* @__PURE__ */ new WeakMap();
|
|
2467
|
+
function withFixtures(fn, options) {
|
|
2468
|
+
const collector = getCurrentSuite();
|
|
2469
|
+
const suite2 = options?.suite || collector.suite || collector.file;
|
|
2470
|
+
return async (hookContext) => {
|
|
2471
|
+
const context = hookContext || options?.context;
|
|
2472
|
+
if (!context) {
|
|
2473
|
+
if (options?.suiteHook) {
|
|
2474
|
+
validateSuiteHook(fn, options.suiteHook, options.stackTraceError);
|
|
2475
|
+
}
|
|
2476
|
+
return fn({});
|
|
2477
|
+
}
|
|
2478
|
+
const fixtures = options?.fixtures || getTestFixtures(context);
|
|
2479
|
+
if (!fixtures) {
|
|
2480
|
+
return fn(context);
|
|
2481
|
+
}
|
|
2482
|
+
const registrations = fixtures.get(suite2);
|
|
2483
|
+
if (!registrations.size) {
|
|
2484
|
+
return fn(context);
|
|
2485
|
+
}
|
|
2486
|
+
const usedFixtures = [];
|
|
2487
|
+
const usedProps = getUsedProps(fn);
|
|
2488
|
+
for (const fixture2 of registrations.values()) {
|
|
2489
|
+
if (isAutoFixture(fixture2, options) || usedProps.has(fixture2.name)) {
|
|
2490
|
+
usedFixtures.push(fixture2);
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
if (!usedFixtures.length) {
|
|
2494
|
+
return fn(context);
|
|
2495
|
+
}
|
|
2496
|
+
if (!cleanupFnArrayMap.has(context)) {
|
|
2497
|
+
cleanupFnArrayMap.set(context, []);
|
|
2498
|
+
}
|
|
2499
|
+
const cleanupFnArray = cleanupFnArrayMap.get(context);
|
|
2500
|
+
const pendingFixtures = resolveDeps(usedFixtures, registrations);
|
|
2501
|
+
if (!pendingFixtures.length) {
|
|
2502
|
+
return fn(context);
|
|
2503
|
+
}
|
|
2504
|
+
if (options?.suiteHook) {
|
|
2505
|
+
const testScopedFixtures = pendingFixtures.filter((f) => f.scope === "test");
|
|
2506
|
+
if (testScopedFixtures.length > 0) {
|
|
2507
|
+
const fixtureNames = testScopedFixtures.map((f) => `"${f.name}"`).join(", ");
|
|
2508
|
+
const alternativeHook = {
|
|
2509
|
+
aroundAll: "aroundEach",
|
|
2510
|
+
beforeAll: "beforeEach",
|
|
2511
|
+
afterAll: "afterEach"
|
|
2512
|
+
};
|
|
2513
|
+
const error = new FixtureDependencyError(`Test-scoped fixtures cannot be used inside ${options.suiteHook} hook. The following fixtures are test-scoped: ${fixtureNames}. Use { scope: 'file' } or { scope: 'worker' } fixtures instead, or move the logic to ${alternativeHook[options.suiteHook]} hook.`);
|
|
2514
|
+
if (options.stackTraceError?.stack) {
|
|
2515
|
+
error.stack = error.message + options.stackTraceError.stack.replace(options.stackTraceError.message, "");
|
|
2516
|
+
}
|
|
2517
|
+
throw error;
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
if (!contextHasFixturesCache.has(context)) {
|
|
2521
|
+
contextHasFixturesCache.set(context, /* @__PURE__ */ new WeakSet());
|
|
2522
|
+
}
|
|
2523
|
+
const cachedFixtures = contextHasFixturesCache.get(context);
|
|
2524
|
+
for (const fixture2 of pendingFixtures) {
|
|
2525
|
+
if (fixture2.scope === "test") {
|
|
2526
|
+
if (cachedFixtures.has(fixture2)) {
|
|
2527
|
+
continue;
|
|
2528
|
+
}
|
|
2529
|
+
cachedFixtures.add(fixture2);
|
|
2530
|
+
const resolvedValue = await resolveTestFixtureValue(fixture2, context, cleanupFnArray);
|
|
2531
|
+
context[fixture2.name] = resolvedValue;
|
|
2532
|
+
cleanupFnArray.push(() => {
|
|
2533
|
+
cachedFixtures.delete(fixture2);
|
|
2534
|
+
});
|
|
2535
|
+
} else {
|
|
2536
|
+
const resolvedValue = await resolveScopeFixtureValue(fixtures, suite2, fixture2);
|
|
2537
|
+
context[fixture2.name] = resolvedValue;
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
return fn(context);
|
|
2541
|
+
};
|
|
2542
|
+
}
|
|
2543
|
+
function isAutoFixture(fixture2, options) {
|
|
2544
|
+
if (!fixture2.auto) {
|
|
2545
|
+
return false;
|
|
2546
|
+
}
|
|
2547
|
+
if (options?.suiteHook && fixture2.scope === "test") {
|
|
2548
|
+
return false;
|
|
2549
|
+
}
|
|
2550
|
+
return true;
|
|
2551
|
+
}
|
|
2552
|
+
function isFixtureFunction(value) {
|
|
2553
|
+
return typeof value === "function";
|
|
2554
|
+
}
|
|
2555
|
+
function resolveTestFixtureValue(fixture2, context, cleanupFnArray) {
|
|
2556
|
+
if (!isFixtureFunction(fixture2.value)) {
|
|
2557
|
+
return fixture2.value;
|
|
2558
|
+
}
|
|
2559
|
+
return resolveFixtureFunction(fixture2.value, fixture2.name, context, cleanupFnArray);
|
|
2560
|
+
}
|
|
2561
|
+
var scopedFixturePromiseCache = /* @__PURE__ */ new WeakMap();
|
|
2562
|
+
async function resolveScopeFixtureValue(fixtures, suite2, fixture2) {
|
|
2563
|
+
const workerContext = fixtures.getWorkerContext();
|
|
2564
|
+
const fileContext = fixtures.getFileContext(suite2.file);
|
|
2565
|
+
const fixtureContext = fixture2.scope === "worker" ? workerContext : fileContext;
|
|
2566
|
+
if (!isFixtureFunction(fixture2.value)) {
|
|
2567
|
+
fixtureContext[fixture2.name] = fixture2.value;
|
|
2568
|
+
return fixture2.value;
|
|
2569
|
+
}
|
|
2570
|
+
if (fixture2.name in fixtureContext) {
|
|
2571
|
+
return fixtureContext[fixture2.name];
|
|
2572
|
+
}
|
|
2573
|
+
if (scopedFixturePromiseCache.has(fixture2)) {
|
|
2574
|
+
return scopedFixturePromiseCache.get(fixture2);
|
|
2575
|
+
}
|
|
2576
|
+
if (!cleanupFnArrayMap.has(fixtureContext)) {
|
|
2577
|
+
cleanupFnArrayMap.set(fixtureContext, []);
|
|
2578
|
+
}
|
|
2579
|
+
const cleanupFnFileArray = cleanupFnArrayMap.get(fixtureContext);
|
|
2580
|
+
const promise = resolveFixtureFunction(fixture2.value, fixture2.name, fixture2.scope === "file" ? {
|
|
2581
|
+
...workerContext,
|
|
2582
|
+
...fileContext
|
|
2583
|
+
} : fixtureContext, cleanupFnFileArray).then((value) => {
|
|
2584
|
+
fixtureContext[fixture2.name] = value;
|
|
2585
|
+
scopedFixturePromiseCache.delete(fixture2);
|
|
2586
|
+
return value;
|
|
2587
|
+
});
|
|
2588
|
+
scopedFixturePromiseCache.set(fixture2, promise);
|
|
2589
|
+
return promise;
|
|
2590
|
+
}
|
|
2591
|
+
async function resolveFixtureFunction(fixtureFn, fixtureName, context, cleanupFnArray) {
|
|
2592
|
+
const useFnArgPromise = createDefer();
|
|
2593
|
+
const stackTraceError = FIXTURE_STACK_TRACE_KEY in fixtureFn && fixtureFn[FIXTURE_STACK_TRACE_KEY] instanceof Error ? fixtureFn[FIXTURE_STACK_TRACE_KEY] : void 0;
|
|
2594
|
+
let isUseFnArgResolved = false;
|
|
2595
|
+
const fixtureReturn = fixtureFn(context, async (useFnArg) => {
|
|
2596
|
+
isUseFnArgResolved = true;
|
|
2597
|
+
useFnArgPromise.resolve(useFnArg);
|
|
2598
|
+
const useReturnPromise = createDefer();
|
|
2599
|
+
cleanupFnArray.push(async () => {
|
|
2600
|
+
useReturnPromise.resolve();
|
|
2601
|
+
await fixtureReturn;
|
|
2602
|
+
});
|
|
2603
|
+
await useReturnPromise;
|
|
2604
|
+
}).then(() => {
|
|
2605
|
+
if (!isUseFnArgResolved) {
|
|
2606
|
+
const error = new Error(`Fixture "${fixtureName}" returned without calling "use". Make sure to call "use" in every code path of the fixture function.`);
|
|
2607
|
+
if (stackTraceError?.stack) {
|
|
2608
|
+
error.stack = error.message + stackTraceError.stack.replace(stackTraceError.message, "");
|
|
2609
|
+
}
|
|
2610
|
+
useFnArgPromise.reject(error);
|
|
2611
|
+
}
|
|
2612
|
+
}).catch((e) => {
|
|
2613
|
+
if (!isUseFnArgResolved) {
|
|
2614
|
+
useFnArgPromise.reject(e);
|
|
2615
|
+
return;
|
|
2616
|
+
}
|
|
2617
|
+
throw e;
|
|
2618
|
+
});
|
|
2619
|
+
return useFnArgPromise;
|
|
2620
|
+
}
|
|
2621
|
+
function resolveDeps(usedFixtures, registrations, depSet = /* @__PURE__ */ new Set(), pendingFixtures = []) {
|
|
2622
|
+
usedFixtures.forEach((fixture2) => {
|
|
2623
|
+
if (pendingFixtures.includes(fixture2)) {
|
|
2624
|
+
return;
|
|
2625
|
+
}
|
|
2626
|
+
if (!isFixtureFunction(fixture2.value) || !fixture2.deps) {
|
|
2627
|
+
pendingFixtures.push(fixture2);
|
|
2628
|
+
return;
|
|
2629
|
+
}
|
|
2630
|
+
if (depSet.has(fixture2)) {
|
|
2631
|
+
if (fixture2.parent) {
|
|
2632
|
+
fixture2 = fixture2.parent;
|
|
2633
|
+
} else {
|
|
2634
|
+
throw new Error(`Circular fixture dependency detected: ${fixture2.name} <- ${[...depSet].reverse().map((d2) => d2.name).join(" <- ")}`);
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
depSet.add(fixture2);
|
|
2638
|
+
resolveDeps([...fixture2.deps].map((n) => n === fixture2.name ? fixture2.parent : registrations.get(n)).filter((n) => !!n), registrations, depSet, pendingFixtures);
|
|
2639
|
+
pendingFixtures.push(fixture2);
|
|
2640
|
+
depSet.clear();
|
|
2641
|
+
});
|
|
2642
|
+
return pendingFixtures;
|
|
2643
|
+
}
|
|
2644
|
+
function validateSuiteHook(fn, hook, suiteError) {
|
|
2645
|
+
const usedProps = getUsedProps(fn, {
|
|
2646
|
+
sourceError: suiteError,
|
|
2647
|
+
suiteHook: hook
|
|
2648
|
+
});
|
|
2649
|
+
if (usedProps.size) {
|
|
2650
|
+
const error = new FixtureAccessError(`The ${hook} hook uses fixtures "${[...usedProps].join('", "')}", but has no access to context. Did you forget to call it as "test.${hook}()" instead of "${hook}()"?
|
|
2651
|
+
If you used internal "suite" task as the first argument previously, access it in the second argument instead. See https://vitest.dev/guide/test-context#suite-level-hooks`);
|
|
2652
|
+
if (suiteError) {
|
|
2653
|
+
error.stack = suiteError.stack?.replace(suiteError.message, error.message);
|
|
2654
|
+
}
|
|
2655
|
+
throw error;
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
var kPropsSymbol = /* @__PURE__ */ Symbol("$vitest:fixture-props");
|
|
2659
|
+
var kPropNamesSymbol = /* @__PURE__ */ Symbol("$vitest:fixture-prop-names");
|
|
2660
|
+
function configureProps(fn, options) {
|
|
2661
|
+
Object.defineProperty(fn, kPropsSymbol, {
|
|
2662
|
+
value: options,
|
|
2663
|
+
enumerable: false
|
|
2664
|
+
});
|
|
2665
|
+
}
|
|
2666
|
+
function memoProps(fn, props) {
|
|
2667
|
+
fn[kPropNamesSymbol] = props;
|
|
2668
|
+
return props;
|
|
2669
|
+
}
|
|
2670
|
+
function getUsedProps(fn, { sourceError, suiteHook } = {}) {
|
|
2671
|
+
if (kPropNamesSymbol in fn) {
|
|
2672
|
+
return fn[kPropNamesSymbol];
|
|
2673
|
+
}
|
|
2674
|
+
const { index: fixturesIndex = 0, original: implementation = fn } = kPropsSymbol in fn ? fn[kPropsSymbol] : {};
|
|
2675
|
+
let fnString = filterOutComments(implementation.toString());
|
|
2676
|
+
if (/__async\((?:this|null), (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(fnString)) {
|
|
2677
|
+
fnString = fnString.split(/__async\((?:this|null),/)[1];
|
|
2678
|
+
}
|
|
2679
|
+
const match = fnString.match(/[^(]*\(([^)]*)/);
|
|
2680
|
+
if (!match) {
|
|
2681
|
+
return memoProps(fn, /* @__PURE__ */ new Set());
|
|
2682
|
+
}
|
|
2683
|
+
const args = splitByComma(match[1]);
|
|
2684
|
+
if (!args.length) {
|
|
2685
|
+
return memoProps(fn, /* @__PURE__ */ new Set());
|
|
2686
|
+
}
|
|
2687
|
+
const fixturesArgument = args[fixturesIndex];
|
|
2688
|
+
if (!fixturesArgument) {
|
|
2689
|
+
return memoProps(fn, /* @__PURE__ */ new Set());
|
|
2690
|
+
}
|
|
2691
|
+
if (!(fixturesArgument[0] === "{" && fixturesArgument.endsWith("}"))) {
|
|
2692
|
+
const ordinalArgument = ordinal(fixturesIndex + 1);
|
|
2693
|
+
const error = new FixtureParseError(`The ${ordinalArgument} argument inside a fixture must use object destructuring pattern, e.g. ({ task } => {}). Instead, received "${fixturesArgument}".${suiteHook ? ` If you used internal "suite" task as the ${ordinalArgument} argument previously, access it in the ${ordinal(fixturesIndex + 2)} argument instead.` : ""}`);
|
|
2694
|
+
if (sourceError) {
|
|
2695
|
+
error.stack = sourceError.stack?.replace(sourceError.message, error.message);
|
|
2696
|
+
}
|
|
2697
|
+
throw error;
|
|
2698
|
+
}
|
|
2699
|
+
const _first = fixturesArgument.slice(1, -1).replace(/\s/g, "");
|
|
2700
|
+
const props = splitByComma(_first).map((prop) => {
|
|
2701
|
+
return prop.replace(/:.*|=.*/g, "");
|
|
2702
|
+
});
|
|
2703
|
+
const last = props.at(-1);
|
|
2704
|
+
if (last && last.startsWith("...")) {
|
|
2705
|
+
const error = new FixtureParseError(`Rest parameters are not supported in fixtures, received "${last}".`);
|
|
2706
|
+
if (sourceError) {
|
|
2707
|
+
error.stack = sourceError.stack?.replace(sourceError.message, error.message);
|
|
2708
|
+
}
|
|
2709
|
+
throw error;
|
|
2710
|
+
}
|
|
2711
|
+
return memoProps(fn, new Set(props));
|
|
2712
|
+
}
|
|
2713
|
+
function splitByComma(s) {
|
|
2714
|
+
const result = [];
|
|
2715
|
+
const stack = [];
|
|
2716
|
+
let start = 0;
|
|
2717
|
+
for (let i2 = 0; i2 < s.length; i2++) {
|
|
2718
|
+
if (s[i2] === "{" || s[i2] === "[") {
|
|
2719
|
+
stack.push(s[i2] === "{" ? "}" : "]");
|
|
2720
|
+
} else if (s[i2] === stack.at(-1)) {
|
|
2721
|
+
stack.pop();
|
|
2722
|
+
} else if (!stack.length && s[i2] === ",") {
|
|
2723
|
+
const token = s.substring(start, i2).trim();
|
|
2724
|
+
if (token) {
|
|
2725
|
+
result.push(token);
|
|
2726
|
+
}
|
|
2727
|
+
start = i2 + 1;
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
const lastToken = s.substring(start).trim();
|
|
2731
|
+
if (lastToken) {
|
|
2732
|
+
result.push(lastToken);
|
|
2733
|
+
}
|
|
2734
|
+
return result;
|
|
2735
|
+
}
|
|
2736
|
+
var _test;
|
|
2737
|
+
function getCurrentTest() {
|
|
2738
|
+
return _test;
|
|
2739
|
+
}
|
|
2740
|
+
var kChainableContext = /* @__PURE__ */ Symbol("kChainableContext");
|
|
2741
|
+
function getChainableContext(chainable) {
|
|
2742
|
+
return chainable?.[kChainableContext];
|
|
2743
|
+
}
|
|
2744
|
+
function createChainable(keys, fn, context) {
|
|
2745
|
+
function create(context2) {
|
|
2746
|
+
const chain2 = function(...args) {
|
|
2747
|
+
return fn.apply(context2, args);
|
|
2748
|
+
};
|
|
2749
|
+
Object.assign(chain2, fn);
|
|
2750
|
+
Object.defineProperty(chain2, kChainableContext, {
|
|
2751
|
+
value: {
|
|
2752
|
+
withContext: () => chain2.bind(context2),
|
|
2753
|
+
getFixtures: () => context2.fixtures,
|
|
2754
|
+
setContext: (key, value) => {
|
|
2755
|
+
context2[key] = value;
|
|
2756
|
+
},
|
|
2757
|
+
mergeContext: (ctx) => {
|
|
2758
|
+
Object.assign(context2, ctx);
|
|
2759
|
+
}
|
|
2760
|
+
},
|
|
2761
|
+
enumerable: false
|
|
2762
|
+
});
|
|
2763
|
+
for (const key of keys) {
|
|
2764
|
+
Object.defineProperty(chain2, key, { get() {
|
|
2765
|
+
return create({
|
|
2766
|
+
...context2,
|
|
2767
|
+
[key]: true
|
|
2768
|
+
});
|
|
2769
|
+
} });
|
|
2770
|
+
}
|
|
2771
|
+
return chain2;
|
|
2772
|
+
}
|
|
2773
|
+
const chain = create(context ?? {});
|
|
2774
|
+
Object.defineProperty(chain, "fn", {
|
|
2775
|
+
value: fn,
|
|
2776
|
+
enumerable: false
|
|
2777
|
+
});
|
|
2778
|
+
return chain;
|
|
2779
|
+
}
|
|
2780
|
+
function getDefaultHookTimeout() {
|
|
2781
|
+
return getRunner().config.hookTimeout;
|
|
2782
|
+
}
|
|
2783
|
+
var CLEANUP_TIMEOUT_KEY = /* @__PURE__ */ Symbol.for("VITEST_CLEANUP_TIMEOUT");
|
|
2784
|
+
var CLEANUP_STACK_TRACE_KEY = /* @__PURE__ */ Symbol.for("VITEST_CLEANUP_STACK_TRACE");
|
|
2785
|
+
var AROUND_TIMEOUT_KEY = /* @__PURE__ */ Symbol.for("VITEST_AROUND_TIMEOUT");
|
|
2786
|
+
var AROUND_STACK_TRACE_KEY = /* @__PURE__ */ Symbol.for("VITEST_AROUND_STACK_TRACE");
|
|
2787
|
+
function beforeAll(fn, timeout = getDefaultHookTimeout()) {
|
|
2788
|
+
assertTypes(fn, '"beforeAll" callback', ["function"]);
|
|
2789
|
+
const stackTraceError = new Error("STACK_TRACE_ERROR");
|
|
2790
|
+
const context = getChainableContext(this);
|
|
2791
|
+
return getCurrentSuite().on("beforeAll", Object.assign(withTimeout(withSuiteFixtures("beforeAll", fn, context, stackTraceError), timeout, true, stackTraceError), {
|
|
2792
|
+
[CLEANUP_TIMEOUT_KEY]: timeout,
|
|
2793
|
+
[CLEANUP_STACK_TRACE_KEY]: stackTraceError
|
|
2794
|
+
}));
|
|
2795
|
+
}
|
|
2796
|
+
function afterAll(fn, timeout) {
|
|
2797
|
+
assertTypes(fn, '"afterAll" callback', ["function"]);
|
|
2798
|
+
const context = getChainableContext(this);
|
|
2799
|
+
const stackTraceError = new Error("STACK_TRACE_ERROR");
|
|
2800
|
+
return getCurrentSuite().on("afterAll", withTimeout(withSuiteFixtures("afterAll", fn, context, stackTraceError), timeout ?? getDefaultHookTimeout(), true, stackTraceError));
|
|
2801
|
+
}
|
|
2802
|
+
function beforeEach(fn, timeout = getDefaultHookTimeout()) {
|
|
2803
|
+
assertTypes(fn, '"beforeEach" callback', ["function"]);
|
|
2804
|
+
const stackTraceError = new Error("STACK_TRACE_ERROR");
|
|
2805
|
+
const wrapper = (context, suite2) => {
|
|
2806
|
+
const fixtureResolver = withFixtures(fn, { suite: suite2 });
|
|
2807
|
+
return fixtureResolver(context);
|
|
2808
|
+
};
|
|
2809
|
+
return getCurrentSuite().on("beforeEach", Object.assign(withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, stackTraceError, abortIfTimeout), {
|
|
2810
|
+
[CLEANUP_TIMEOUT_KEY]: timeout,
|
|
2811
|
+
[CLEANUP_STACK_TRACE_KEY]: stackTraceError
|
|
2812
|
+
}));
|
|
2813
|
+
}
|
|
2814
|
+
function afterEach(fn, timeout) {
|
|
2815
|
+
assertTypes(fn, '"afterEach" callback', ["function"]);
|
|
2816
|
+
const wrapper = (context, suite2) => {
|
|
2817
|
+
const fixtureResolver = withFixtures(fn, { suite: suite2 });
|
|
2818
|
+
return fixtureResolver(context);
|
|
2819
|
+
};
|
|
2820
|
+
return getCurrentSuite().on("afterEach", withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
2821
|
+
}
|
|
2822
|
+
var onTestFailed = createTestHook("onTestFailed", (test3, handler, timeout) => {
|
|
2823
|
+
test3.onFailed ||= [];
|
|
2824
|
+
test3.onFailed.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
2825
|
+
});
|
|
2826
|
+
var onTestFinished = createTestHook("onTestFinished", (test3, handler, timeout) => {
|
|
2827
|
+
test3.onFinished ||= [];
|
|
2828
|
+
test3.onFinished.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
2829
|
+
});
|
|
2830
|
+
function aroundAll(fn, timeout) {
|
|
2831
|
+
assertTypes(fn, '"aroundAll" callback', ["function"]);
|
|
2832
|
+
const stackTraceError = new Error("STACK_TRACE_ERROR");
|
|
2833
|
+
const resolvedTimeout = timeout ?? getDefaultHookTimeout();
|
|
2834
|
+
const context = getChainableContext(this);
|
|
2835
|
+
return getCurrentSuite().on("aroundAll", Object.assign(withSuiteFixtures("aroundAll", fn, context, stackTraceError, 1), {
|
|
2836
|
+
[AROUND_TIMEOUT_KEY]: resolvedTimeout,
|
|
2837
|
+
[AROUND_STACK_TRACE_KEY]: stackTraceError
|
|
2838
|
+
}));
|
|
2839
|
+
}
|
|
2840
|
+
function aroundEach(fn, timeout) {
|
|
2841
|
+
assertTypes(fn, '"aroundEach" callback', ["function"]);
|
|
2842
|
+
const stackTraceError = new Error("STACK_TRACE_ERROR");
|
|
2843
|
+
const resolvedTimeout = timeout ?? getDefaultHookTimeout();
|
|
2844
|
+
const wrapper = (runTest, context, suite2) => {
|
|
2845
|
+
const innerFn = (ctx) => fn(runTest, ctx, suite2);
|
|
2846
|
+
configureProps(innerFn, {
|
|
2847
|
+
index: 1,
|
|
2848
|
+
original: fn
|
|
2849
|
+
});
|
|
2850
|
+
const fixtureResolver = withFixtures(innerFn, { suite: suite2 });
|
|
2851
|
+
return fixtureResolver(context);
|
|
2852
|
+
};
|
|
2853
|
+
return getCurrentSuite().on("aroundEach", Object.assign(wrapper, {
|
|
2854
|
+
[AROUND_TIMEOUT_KEY]: resolvedTimeout,
|
|
2855
|
+
[AROUND_STACK_TRACE_KEY]: stackTraceError
|
|
2856
|
+
}));
|
|
2857
|
+
}
|
|
2858
|
+
function withSuiteFixtures(suiteHook, fn, context, stackTraceError, contextIndex = 0) {
|
|
2859
|
+
return (...args) => {
|
|
2860
|
+
const suite2 = args.at(-1);
|
|
2861
|
+
const prefix = args.slice(0, -1);
|
|
2862
|
+
const wrapper = (ctx) => fn(...prefix, ctx, suite2);
|
|
2863
|
+
configureProps(wrapper, {
|
|
2864
|
+
index: contextIndex,
|
|
2865
|
+
original: fn
|
|
2866
|
+
});
|
|
2867
|
+
const fixtures = context?.getFixtures();
|
|
2868
|
+
const fileContext = fixtures?.getFileContext(suite2.file);
|
|
2869
|
+
const fixtured = withFixtures(wrapper, {
|
|
2870
|
+
suiteHook,
|
|
2871
|
+
fixtures,
|
|
2872
|
+
context: fileContext,
|
|
2873
|
+
stackTraceError
|
|
2874
|
+
});
|
|
2875
|
+
return fixtured();
|
|
2876
|
+
};
|
|
2877
|
+
}
|
|
2878
|
+
function createTestHook(name, handler) {
|
|
2879
|
+
return (fn, timeout) => {
|
|
2880
|
+
assertTypes(fn, `"${name}" callback`, ["function"]);
|
|
2881
|
+
const current = getCurrentTest();
|
|
2882
|
+
if (!current) {
|
|
2883
|
+
throw new Error(`Hook ${name}() can only be called inside a test`);
|
|
2884
|
+
}
|
|
2885
|
+
return handler(current, fn, timeout);
|
|
2886
|
+
};
|
|
2887
|
+
}
|
|
2888
|
+
function findTestFileStackTrace(testFilePath, error) {
|
|
2889
|
+
const lines = error.split("\n").slice(1);
|
|
2890
|
+
for (const line of lines) {
|
|
2891
|
+
const stack = parseSingleStack(line);
|
|
2892
|
+
if (stack && stack.file === testFilePath) {
|
|
2893
|
+
return stack;
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
function validateTags(config, tags) {
|
|
2898
|
+
if (!config.strictTags) {
|
|
2899
|
+
return;
|
|
2900
|
+
}
|
|
2901
|
+
const availableTags = new Set(config.tags.map((tag) => tag.name));
|
|
2902
|
+
for (const tag of tags) {
|
|
2903
|
+
if (!availableTags.has(tag)) {
|
|
2904
|
+
throw createNoTagsError(config.tags, tag);
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
function createNoTagsError(availableTags, tag, prefix = "tag") {
|
|
2909
|
+
if (!availableTags.length) {
|
|
2910
|
+
throw new Error(`The Vitest config does't define any "tags", cannot apply "${tag}" ${prefix} for this test. See: https://vitest.dev/guide/test-tags`);
|
|
2911
|
+
}
|
|
2912
|
+
throw new Error(`The ${prefix} "${tag}" is not defined in the configuration. Available tags are:
|
|
2913
|
+
${availableTags.map((t) => `- ${t.name}${t.description ? `: ${t.description}` : ""}`).join("\n")}`);
|
|
2914
|
+
}
|
|
2915
|
+
function createTaskName(names, separator = " > ") {
|
|
2916
|
+
return names.filter((name) => name !== void 0).join(separator);
|
|
2917
|
+
}
|
|
2918
|
+
var suite = createSuite();
|
|
2919
|
+
var test2 = createTest(function(name, optionsOrFn, optionsOrTest) {
|
|
2920
|
+
if (getCurrentTest()) {
|
|
2921
|
+
throw new Error('Calling the test function inside another test function is not allowed. Please put it inside "describe" or "suite" so it can be properly collected.');
|
|
2922
|
+
}
|
|
2923
|
+
getCurrentSuite().test.fn.call(this, formatName(name), optionsOrFn, optionsOrTest);
|
|
2924
|
+
});
|
|
2925
|
+
var runner;
|
|
2926
|
+
var defaultSuite;
|
|
2927
|
+
var currentTestFilepath;
|
|
2928
|
+
function assert(condition, message) {
|
|
2929
|
+
if (!condition) {
|
|
2930
|
+
throw new Error(`Vitest failed to find ${message}. One of the following is possible:
|
|
2931
|
+
- "vitest" is imported directly without running "vitest" command
|
|
2932
|
+
- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)
|
|
2933
|
+
- "vitest" is imported inside Vite / Vitest config file
|
|
2934
|
+
- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues
|
|
2935
|
+
`);
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
function getRunner() {
|
|
2939
|
+
assert(runner, "the runner");
|
|
2940
|
+
return runner;
|
|
2941
|
+
}
|
|
2942
|
+
function getCurrentSuite() {
|
|
2943
|
+
const currentSuite = collectorContext.currentSuite || defaultSuite;
|
|
2944
|
+
assert(currentSuite, "the current suite");
|
|
2945
|
+
return currentSuite;
|
|
2946
|
+
}
|
|
2947
|
+
function createSuiteHooks() {
|
|
2948
|
+
return {
|
|
2949
|
+
beforeAll: [],
|
|
2950
|
+
afterAll: [],
|
|
2951
|
+
beforeEach: [],
|
|
2952
|
+
afterEach: [],
|
|
2953
|
+
aroundEach: [],
|
|
2954
|
+
aroundAll: []
|
|
2955
|
+
};
|
|
2956
|
+
}
|
|
2957
|
+
var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
|
2958
|
+
function parseArguments(optionsOrFn, timeoutOrTest) {
|
|
2959
|
+
if (timeoutOrTest != null && typeof timeoutOrTest === "object") {
|
|
2960
|
+
throw new TypeError(`Signature "test(name, fn, { ... })" was deprecated in Vitest 3 and removed in Vitest 4. Please, provide options as a second argument instead.`);
|
|
2961
|
+
}
|
|
2962
|
+
let options = {};
|
|
2963
|
+
let fn;
|
|
2964
|
+
if (typeof timeoutOrTest === "number") {
|
|
2965
|
+
options = { timeout: timeoutOrTest };
|
|
2966
|
+
} else if (typeof optionsOrFn === "object") {
|
|
2967
|
+
options = optionsOrFn;
|
|
2968
|
+
}
|
|
2969
|
+
if (typeof optionsOrFn === "function") {
|
|
2970
|
+
if (typeof timeoutOrTest === "function") {
|
|
2971
|
+
throw new TypeError("Cannot use two functions as arguments. Please use the second argument for options.");
|
|
2972
|
+
}
|
|
2973
|
+
fn = optionsOrFn;
|
|
2974
|
+
} else if (typeof timeoutOrTest === "function") {
|
|
2975
|
+
fn = timeoutOrTest;
|
|
2976
|
+
}
|
|
2977
|
+
return {
|
|
2978
|
+
options,
|
|
2979
|
+
handler: fn
|
|
2980
|
+
};
|
|
2981
|
+
}
|
|
2982
|
+
function createSuiteCollector(name, factory = () => {
|
|
2983
|
+
}, mode, each, suiteOptions) {
|
|
2984
|
+
const tasks = [];
|
|
2985
|
+
let suite2;
|
|
2986
|
+
initSuite(true);
|
|
2987
|
+
const task = function(name2 = "", options = {}) {
|
|
2988
|
+
const currentSuite = collectorContext.currentSuite?.suite;
|
|
2989
|
+
const parentTask = currentSuite ?? collectorContext.currentSuite?.file;
|
|
2990
|
+
const parentTags = parentTask?.tags || [];
|
|
2991
|
+
const testTags = unique([...parentTags, ...toArray(options.tags)]);
|
|
2992
|
+
const tagsOptions = testTags.map((tag) => {
|
|
2993
|
+
const tagDefinition = runner.config.tags?.find((t) => t.name === tag);
|
|
2994
|
+
if (!tagDefinition && runner.config.strictTags) {
|
|
2995
|
+
throw createNoTagsError(runner.config.tags, tag);
|
|
2996
|
+
}
|
|
2997
|
+
return tagDefinition;
|
|
2998
|
+
}).filter((r) => r != null).sort((tag1, tag2) => (tag2.priority ?? POSITIVE_INFINITY) - (tag1.priority ?? POSITIVE_INFINITY)).reduce((acc, tag) => {
|
|
2999
|
+
const { name: name3, description, priority, meta, ...options2 } = tag;
|
|
3000
|
+
Object.assign(acc, options2);
|
|
3001
|
+
if (meta) {
|
|
3002
|
+
acc.meta = Object.assign(acc.meta ?? /* @__PURE__ */ Object.create(null), meta);
|
|
3003
|
+
}
|
|
3004
|
+
return acc;
|
|
3005
|
+
}, {});
|
|
3006
|
+
const testOwnMeta = options.meta;
|
|
3007
|
+
options = {
|
|
3008
|
+
...tagsOptions,
|
|
3009
|
+
...options
|
|
3010
|
+
};
|
|
3011
|
+
const timeout = options.timeout ?? runner.config.testTimeout;
|
|
3012
|
+
const parentMeta = currentSuite?.meta;
|
|
3013
|
+
const tagMeta = tagsOptions.meta;
|
|
3014
|
+
const testMeta = /* @__PURE__ */ Object.create(null);
|
|
3015
|
+
if (tagMeta) {
|
|
3016
|
+
Object.assign(testMeta, tagMeta);
|
|
3017
|
+
}
|
|
3018
|
+
if (parentMeta) {
|
|
3019
|
+
Object.assign(testMeta, parentMeta);
|
|
3020
|
+
}
|
|
3021
|
+
if (testOwnMeta) {
|
|
3022
|
+
Object.assign(testMeta, testOwnMeta);
|
|
3023
|
+
}
|
|
3024
|
+
const task2 = {
|
|
3025
|
+
id: "",
|
|
3026
|
+
name: name2,
|
|
3027
|
+
fullName: createTaskName([currentSuite?.fullName ?? collectorContext.currentSuite?.file?.fullName, name2]),
|
|
3028
|
+
fullTestName: createTaskName([currentSuite?.fullTestName, name2]),
|
|
3029
|
+
suite: currentSuite,
|
|
3030
|
+
each: options.each,
|
|
3031
|
+
fails: options.fails,
|
|
3032
|
+
context: void 0,
|
|
3033
|
+
type: "test",
|
|
3034
|
+
file: currentSuite?.file ?? collectorContext.currentSuite?.file,
|
|
3035
|
+
timeout,
|
|
3036
|
+
retry: options.retry ?? runner.config.retry,
|
|
3037
|
+
repeats: options.repeats,
|
|
3038
|
+
mode: options.only ? "only" : options.skip ? "skip" : options.todo ? "todo" : "run",
|
|
3039
|
+
meta: testMeta,
|
|
3040
|
+
annotations: [],
|
|
3041
|
+
artifacts: [],
|
|
3042
|
+
tags: testTags
|
|
3043
|
+
};
|
|
3044
|
+
const handler = options.handler;
|
|
3045
|
+
if (task2.mode === "run" && !handler) {
|
|
3046
|
+
task2.mode = "todo";
|
|
3047
|
+
}
|
|
3048
|
+
if (options.concurrent ?? (!options.sequential && runner.config.sequence.concurrent)) {
|
|
3049
|
+
task2.concurrent = true;
|
|
3050
|
+
}
|
|
3051
|
+
task2.shuffle = suiteOptions?.shuffle;
|
|
3052
|
+
const context = createTestContext(task2, runner);
|
|
3053
|
+
Object.defineProperty(task2, "context", {
|
|
3054
|
+
value: context,
|
|
3055
|
+
enumerable: false
|
|
3056
|
+
});
|
|
3057
|
+
setTestFixture(context, options.fixtures ?? new TestFixtures());
|
|
3058
|
+
const limit = Error.stackTraceLimit;
|
|
3059
|
+
Error.stackTraceLimit = 10;
|
|
3060
|
+
const stackTraceError = new Error("STACK_TRACE_ERROR");
|
|
3061
|
+
Error.stackTraceLimit = limit;
|
|
3062
|
+
if (handler) {
|
|
3063
|
+
setFn(task2, withTimeout(withCancel(withAwaitAsyncAssertions(withFixtures(handler, { context }), task2), task2.context.signal), timeout, false, stackTraceError, (_, error) => abortIfTimeout([context], error)));
|
|
3064
|
+
}
|
|
3065
|
+
if (runner.config.includeTaskLocation) {
|
|
3066
|
+
const error = stackTraceError.stack;
|
|
3067
|
+
const stack = findTestFileStackTrace(currentTestFilepath, error);
|
|
3068
|
+
if (stack) {
|
|
3069
|
+
task2.location = {
|
|
3070
|
+
line: stack.line,
|
|
3071
|
+
column: stack.column
|
|
3072
|
+
};
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
tasks.push(task2);
|
|
3076
|
+
return task2;
|
|
3077
|
+
};
|
|
3078
|
+
const test3 = createTest(function(name2, optionsOrFn, timeoutOrTest) {
|
|
3079
|
+
let { options, handler } = parseArguments(optionsOrFn, timeoutOrTest);
|
|
3080
|
+
if (typeof suiteOptions === "object") {
|
|
3081
|
+
options = Object.assign({}, suiteOptions, options);
|
|
3082
|
+
}
|
|
3083
|
+
const concurrent = this.concurrent ?? (!this.sequential && options?.concurrent);
|
|
3084
|
+
if (options.concurrent != null && concurrent != null) {
|
|
3085
|
+
options.concurrent = concurrent;
|
|
3086
|
+
}
|
|
3087
|
+
const sequential = this.sequential ?? (!this.concurrent && options?.sequential);
|
|
3088
|
+
if (options.sequential != null && sequential != null) {
|
|
3089
|
+
options.sequential = sequential;
|
|
3090
|
+
}
|
|
3091
|
+
const test4 = task(formatName(name2), {
|
|
3092
|
+
...this,
|
|
3093
|
+
...options,
|
|
3094
|
+
handler
|
|
3095
|
+
});
|
|
3096
|
+
test4.type = "test";
|
|
3097
|
+
});
|
|
3098
|
+
const collector = {
|
|
3099
|
+
type: "collector",
|
|
3100
|
+
name,
|
|
3101
|
+
mode,
|
|
3102
|
+
suite: suite2,
|
|
3103
|
+
options: suiteOptions,
|
|
3104
|
+
test: test3,
|
|
3105
|
+
file: suite2.file,
|
|
3106
|
+
tasks,
|
|
3107
|
+
collect,
|
|
3108
|
+
task,
|
|
3109
|
+
clear,
|
|
3110
|
+
on: addHook
|
|
3111
|
+
};
|
|
3112
|
+
function addHook(name2, ...fn) {
|
|
3113
|
+
getHooks(suite2)[name2].push(...fn);
|
|
3114
|
+
}
|
|
3115
|
+
function initSuite(includeLocation) {
|
|
3116
|
+
if (typeof suiteOptions === "number") {
|
|
3117
|
+
suiteOptions = { timeout: suiteOptions };
|
|
3118
|
+
}
|
|
3119
|
+
const currentSuite = collectorContext.currentSuite?.suite;
|
|
3120
|
+
const parentTask = currentSuite ?? collectorContext.currentSuite?.file;
|
|
3121
|
+
const suiteTags = toArray(suiteOptions?.tags);
|
|
3122
|
+
validateTags(runner.config, suiteTags);
|
|
3123
|
+
suite2 = {
|
|
3124
|
+
id: "",
|
|
3125
|
+
type: "suite",
|
|
3126
|
+
name,
|
|
3127
|
+
fullName: createTaskName([currentSuite?.fullName ?? collectorContext.currentSuite?.file?.fullName, name]),
|
|
3128
|
+
fullTestName: createTaskName([currentSuite?.fullTestName, name]),
|
|
3129
|
+
suite: currentSuite,
|
|
3130
|
+
mode,
|
|
3131
|
+
each,
|
|
3132
|
+
file: currentSuite?.file ?? collectorContext.currentSuite?.file,
|
|
3133
|
+
shuffle: suiteOptions?.shuffle,
|
|
3134
|
+
tasks: [],
|
|
3135
|
+
meta: suiteOptions?.meta ?? /* @__PURE__ */ Object.create(null),
|
|
3136
|
+
concurrent: suiteOptions?.concurrent,
|
|
3137
|
+
tags: unique([...parentTask?.tags || [], ...suiteTags])
|
|
3138
|
+
};
|
|
3139
|
+
if (runner && includeLocation && runner.config.includeTaskLocation) {
|
|
3140
|
+
const limit = Error.stackTraceLimit;
|
|
3141
|
+
Error.stackTraceLimit = 15;
|
|
3142
|
+
const error = new Error("stacktrace").stack;
|
|
3143
|
+
Error.stackTraceLimit = limit;
|
|
3144
|
+
const stack = findTestFileStackTrace(currentTestFilepath, error);
|
|
3145
|
+
if (stack) {
|
|
3146
|
+
suite2.location = {
|
|
3147
|
+
line: stack.line,
|
|
3148
|
+
column: stack.column
|
|
3149
|
+
};
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
setHooks(suite2, createSuiteHooks());
|
|
3153
|
+
}
|
|
3154
|
+
function clear() {
|
|
3155
|
+
tasks.length = 0;
|
|
3156
|
+
initSuite(false);
|
|
3157
|
+
}
|
|
3158
|
+
async function collect(file) {
|
|
3159
|
+
if (!file) {
|
|
3160
|
+
throw new TypeError("File is required to collect tasks.");
|
|
3161
|
+
}
|
|
3162
|
+
if (factory) {
|
|
3163
|
+
await runWithSuite(collector, () => factory(test3));
|
|
3164
|
+
}
|
|
3165
|
+
const allChildren = [];
|
|
3166
|
+
for (const i2 of tasks) {
|
|
3167
|
+
allChildren.push(i2.type === "collector" ? await i2.collect(file) : i2);
|
|
3168
|
+
}
|
|
3169
|
+
suite2.tasks = allChildren;
|
|
3170
|
+
return suite2;
|
|
3171
|
+
}
|
|
3172
|
+
collectTask(collector);
|
|
3173
|
+
return collector;
|
|
3174
|
+
}
|
|
3175
|
+
function withAwaitAsyncAssertions(fn, task) {
|
|
3176
|
+
return (async (...args) => {
|
|
3177
|
+
const fnResult = await fn(...args);
|
|
3178
|
+
if (task.promises) {
|
|
3179
|
+
const result = await Promise.allSettled(task.promises);
|
|
3180
|
+
const errors = result.map((r) => r.status === "rejected" ? r.reason : void 0).filter(Boolean);
|
|
3181
|
+
if (errors.length) {
|
|
3182
|
+
throw errors;
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
return fnResult;
|
|
3186
|
+
});
|
|
3187
|
+
}
|
|
3188
|
+
function createSuite() {
|
|
3189
|
+
function suiteFn(name, factoryOrOptions, optionsOrFactory) {
|
|
3190
|
+
if (getCurrentTest()) {
|
|
3191
|
+
throw new Error("Calling the suite function inside test function is not allowed. It can be only called at the top level or inside another suite function.");
|
|
3192
|
+
}
|
|
3193
|
+
const currentSuite = collectorContext.currentSuite || defaultSuite;
|
|
3194
|
+
let { options, handler: factory } = parseArguments(factoryOrOptions, optionsOrFactory);
|
|
3195
|
+
const isConcurrentSpecified = options.concurrent || this.concurrent || options.sequential === false;
|
|
3196
|
+
const isSequentialSpecified = options.sequential || this.sequential || options.concurrent === false;
|
|
3197
|
+
const { meta: parentMeta, ...parentOptions } = currentSuite?.options || {};
|
|
3198
|
+
options = {
|
|
3199
|
+
...parentOptions,
|
|
3200
|
+
...options
|
|
3201
|
+
};
|
|
3202
|
+
const shuffle2 = this.shuffle ?? options.shuffle ?? currentSuite?.options?.shuffle ?? runner?.config.sequence.shuffle;
|
|
3203
|
+
if (shuffle2 != null) {
|
|
3204
|
+
options.shuffle = shuffle2;
|
|
3205
|
+
}
|
|
3206
|
+
let mode = this.only ?? options.only ? "only" : this.skip ?? options.skip ? "skip" : this.todo ?? options.todo ? "todo" : "run";
|
|
3207
|
+
if (mode === "run" && !factory) {
|
|
3208
|
+
mode = "todo";
|
|
3209
|
+
}
|
|
3210
|
+
const isConcurrent = isConcurrentSpecified || options.concurrent && !isSequentialSpecified;
|
|
3211
|
+
const isSequential = isSequentialSpecified || options.sequential && !isConcurrentSpecified;
|
|
3212
|
+
if (isConcurrent != null) {
|
|
3213
|
+
options.concurrent = isConcurrent && !isSequential;
|
|
3214
|
+
}
|
|
3215
|
+
if (isSequential != null) {
|
|
3216
|
+
options.sequential = isSequential && !isConcurrent;
|
|
3217
|
+
}
|
|
3218
|
+
if (parentMeta) {
|
|
3219
|
+
options.meta = Object.assign(/* @__PURE__ */ Object.create(null), parentMeta, options.meta);
|
|
3220
|
+
}
|
|
3221
|
+
return createSuiteCollector(formatName(name), factory, mode, this.each, options);
|
|
3222
|
+
}
|
|
3223
|
+
suiteFn.each = function(cases, ...args) {
|
|
3224
|
+
const context = getChainableContext(this);
|
|
3225
|
+
const suite2 = context.withContext();
|
|
3226
|
+
context.setContext("each", true);
|
|
3227
|
+
if (Array.isArray(cases) && args.length) {
|
|
3228
|
+
cases = formatTemplateString(cases, args);
|
|
3229
|
+
}
|
|
3230
|
+
return (name, optionsOrFn, fnOrOptions) => {
|
|
3231
|
+
const _name = formatName(name);
|
|
3232
|
+
const arrayOnlyCases = cases.every(Array.isArray);
|
|
3233
|
+
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
3234
|
+
const fnFirst = typeof optionsOrFn === "function";
|
|
3235
|
+
cases.forEach((i2, idx) => {
|
|
3236
|
+
const items = Array.isArray(i2) ? i2 : [i2];
|
|
3237
|
+
if (fnFirst) {
|
|
3238
|
+
if (arrayOnlyCases) {
|
|
3239
|
+
suite2(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
|
|
3240
|
+
} else {
|
|
3241
|
+
suite2(formatTitle(_name, items, idx), handler ? () => handler(i2) : void 0, options.timeout);
|
|
3242
|
+
}
|
|
3243
|
+
} else {
|
|
3244
|
+
if (arrayOnlyCases) {
|
|
3245
|
+
suite2(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
|
|
3246
|
+
} else {
|
|
3247
|
+
suite2(formatTitle(_name, items, idx), options, handler ? () => handler(i2) : void 0);
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
});
|
|
3251
|
+
context.setContext("each", void 0);
|
|
3252
|
+
};
|
|
3253
|
+
};
|
|
3254
|
+
suiteFn.for = function(cases, ...args) {
|
|
3255
|
+
if (Array.isArray(cases) && args.length) {
|
|
3256
|
+
cases = formatTemplateString(cases, args);
|
|
3257
|
+
}
|
|
3258
|
+
return (name, optionsOrFn, fnOrOptions) => {
|
|
3259
|
+
const name_ = formatName(name);
|
|
3260
|
+
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
3261
|
+
cases.forEach((item, idx) => {
|
|
3262
|
+
suite(formatTitle(name_, toArray(item), idx), options, handler ? () => handler(item) : void 0);
|
|
3263
|
+
});
|
|
3264
|
+
};
|
|
3265
|
+
};
|
|
3266
|
+
suiteFn.skipIf = (condition) => condition ? suite.skip : suite;
|
|
3267
|
+
suiteFn.runIf = (condition) => condition ? suite : suite.skip;
|
|
3268
|
+
return createChainable([
|
|
3269
|
+
"concurrent",
|
|
3270
|
+
"sequential",
|
|
3271
|
+
"shuffle",
|
|
3272
|
+
"skip",
|
|
3273
|
+
"only",
|
|
3274
|
+
"todo"
|
|
3275
|
+
], suiteFn);
|
|
3276
|
+
}
|
|
3277
|
+
function createTaskCollector(fn) {
|
|
3278
|
+
const taskFn = fn;
|
|
3279
|
+
taskFn.each = function(cases, ...args) {
|
|
3280
|
+
const context = getChainableContext(this);
|
|
3281
|
+
const test3 = context.withContext();
|
|
3282
|
+
context.setContext("each", true);
|
|
3283
|
+
if (Array.isArray(cases) && args.length) {
|
|
3284
|
+
cases = formatTemplateString(cases, args);
|
|
3285
|
+
}
|
|
3286
|
+
return (name, optionsOrFn, fnOrOptions) => {
|
|
3287
|
+
const _name = formatName(name);
|
|
3288
|
+
const arrayOnlyCases = cases.every(Array.isArray);
|
|
3289
|
+
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
3290
|
+
const fnFirst = typeof optionsOrFn === "function";
|
|
3291
|
+
cases.forEach((i2, idx) => {
|
|
3292
|
+
const items = Array.isArray(i2) ? i2 : [i2];
|
|
3293
|
+
if (fnFirst) {
|
|
3294
|
+
if (arrayOnlyCases) {
|
|
3295
|
+
test3(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
|
|
3296
|
+
} else {
|
|
3297
|
+
test3(formatTitle(_name, items, idx), handler ? () => handler(i2) : void 0, options.timeout);
|
|
3298
|
+
}
|
|
3299
|
+
} else {
|
|
3300
|
+
if (arrayOnlyCases) {
|
|
3301
|
+
test3(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
|
|
3302
|
+
} else {
|
|
3303
|
+
test3(formatTitle(_name, items, idx), options, handler ? () => handler(i2) : void 0);
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
});
|
|
3307
|
+
context.setContext("each", void 0);
|
|
3308
|
+
};
|
|
3309
|
+
};
|
|
3310
|
+
taskFn.for = function(cases, ...args) {
|
|
3311
|
+
const context = getChainableContext(this);
|
|
3312
|
+
const test3 = context.withContext();
|
|
3313
|
+
if (Array.isArray(cases) && args.length) {
|
|
3314
|
+
cases = formatTemplateString(cases, args);
|
|
3315
|
+
}
|
|
3316
|
+
return (name, optionsOrFn, fnOrOptions) => {
|
|
3317
|
+
const _name = formatName(name);
|
|
3318
|
+
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
3319
|
+
cases.forEach((item, idx) => {
|
|
3320
|
+
const handlerWrapper = handler ? (ctx) => handler(item, ctx) : void 0;
|
|
3321
|
+
if (handlerWrapper) {
|
|
3322
|
+
configureProps(handlerWrapper, {
|
|
3323
|
+
index: 1,
|
|
3324
|
+
original: handler
|
|
3325
|
+
});
|
|
3326
|
+
}
|
|
3327
|
+
test3(formatTitle(_name, toArray(item), idx), options, handlerWrapper);
|
|
3328
|
+
});
|
|
3329
|
+
};
|
|
3330
|
+
};
|
|
3331
|
+
taskFn.skipIf = function(condition) {
|
|
3332
|
+
return condition ? this.skip : this;
|
|
3333
|
+
};
|
|
3334
|
+
taskFn.runIf = function(condition) {
|
|
3335
|
+
return condition ? this : this.skip;
|
|
3336
|
+
};
|
|
3337
|
+
function parseBuilderFixtures(fixturesOrName, optionsOrFn, maybeFn) {
|
|
3338
|
+
if (typeof fixturesOrName !== "string") {
|
|
3339
|
+
return fixturesOrName;
|
|
3340
|
+
}
|
|
3341
|
+
const fixtureName = fixturesOrName;
|
|
3342
|
+
let fixtureOptions;
|
|
3343
|
+
let fixtureValue;
|
|
3344
|
+
if (maybeFn !== void 0) {
|
|
3345
|
+
fixtureOptions = optionsOrFn;
|
|
3346
|
+
fixtureValue = maybeFn;
|
|
3347
|
+
} else {
|
|
3348
|
+
if (optionsOrFn !== null && typeof optionsOrFn === "object" && !Array.isArray(optionsOrFn) && TestFixtures.isFixtureOptions(optionsOrFn)) {
|
|
3349
|
+
fixtureOptions = optionsOrFn;
|
|
3350
|
+
fixtureValue = {};
|
|
3351
|
+
} else {
|
|
3352
|
+
fixtureOptions = void 0;
|
|
3353
|
+
fixtureValue = optionsOrFn;
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
if (typeof fixtureValue === "function") {
|
|
3357
|
+
const builderFn = fixtureValue;
|
|
3358
|
+
const fixture2 = async (ctx, use) => {
|
|
3359
|
+
let cleanup;
|
|
3360
|
+
const onCleanup = (fn2) => {
|
|
3361
|
+
if (cleanup !== void 0) {
|
|
3362
|
+
throw new Error(`onCleanup can only be called once per fixture. Define separate fixtures if you need multiple cleanup functions.`);
|
|
3363
|
+
}
|
|
3364
|
+
cleanup = fn2;
|
|
3365
|
+
};
|
|
3366
|
+
const value = await builderFn(ctx, { onCleanup });
|
|
3367
|
+
await use(value);
|
|
3368
|
+
if (cleanup) {
|
|
3369
|
+
await cleanup();
|
|
3370
|
+
}
|
|
3371
|
+
};
|
|
3372
|
+
configureProps(fixture2, { original: builderFn });
|
|
3373
|
+
if (fixtureOptions) {
|
|
3374
|
+
return { [fixtureName]: [fixture2, fixtureOptions] };
|
|
3375
|
+
}
|
|
3376
|
+
return { [fixtureName]: fixture2 };
|
|
3377
|
+
}
|
|
3378
|
+
if (fixtureOptions) {
|
|
3379
|
+
return { [fixtureName]: [fixtureValue, fixtureOptions] };
|
|
3380
|
+
}
|
|
3381
|
+
return { [fixtureName]: fixtureValue };
|
|
3382
|
+
}
|
|
3383
|
+
taskFn.override = function(fixturesOrName, optionsOrFn, maybeFn) {
|
|
3384
|
+
const userFixtures = parseBuilderFixtures(fixturesOrName, optionsOrFn, maybeFn);
|
|
3385
|
+
getChainableContext(this).getFixtures().override(runner, userFixtures);
|
|
3386
|
+
return this;
|
|
3387
|
+
};
|
|
3388
|
+
taskFn.scoped = function(fixtures) {
|
|
3389
|
+
console.warn(`test.scoped() is deprecated and will be removed in future versions. Please use test.override() instead.`);
|
|
3390
|
+
return this.override(fixtures);
|
|
3391
|
+
};
|
|
3392
|
+
taskFn.extend = function(fixturesOrName, optionsOrFn, maybeFn) {
|
|
3393
|
+
const userFixtures = parseBuilderFixtures(fixturesOrName, optionsOrFn, maybeFn);
|
|
3394
|
+
const fixtures = getChainableContext(this).getFixtures().extend(runner, userFixtures);
|
|
3395
|
+
const _test3 = createTest(function(name, optionsOrFn2, optionsOrTest) {
|
|
3396
|
+
fn.call(this, formatName(name), optionsOrFn2, optionsOrTest);
|
|
3397
|
+
});
|
|
3398
|
+
getChainableContext(_test3).mergeContext({ fixtures });
|
|
3399
|
+
return _test3;
|
|
3400
|
+
};
|
|
3401
|
+
taskFn.describe = suite;
|
|
3402
|
+
taskFn.suite = suite;
|
|
3403
|
+
taskFn.beforeEach = beforeEach;
|
|
3404
|
+
taskFn.afterEach = afterEach;
|
|
3405
|
+
taskFn.beforeAll = beforeAll;
|
|
3406
|
+
taskFn.afterAll = afterAll;
|
|
3407
|
+
taskFn.aroundEach = aroundEach;
|
|
3408
|
+
taskFn.aroundAll = aroundAll;
|
|
3409
|
+
const _test2 = createChainable([
|
|
3410
|
+
"concurrent",
|
|
3411
|
+
"sequential",
|
|
3412
|
+
"skip",
|
|
3413
|
+
"only",
|
|
3414
|
+
"todo",
|
|
3415
|
+
"fails"
|
|
3416
|
+
], taskFn, { fixtures: new TestFixtures() });
|
|
3417
|
+
return _test2;
|
|
3418
|
+
}
|
|
3419
|
+
function createTest(fn) {
|
|
3420
|
+
return createTaskCollector(fn);
|
|
3421
|
+
}
|
|
3422
|
+
function formatName(name) {
|
|
3423
|
+
return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
|
|
3424
|
+
}
|
|
3425
|
+
function formatTitle(template, items, idx) {
|
|
3426
|
+
if (template.includes("%#") || template.includes("%$")) {
|
|
3427
|
+
template = template.replace(/%%/g, "__vitest_escaped_%__").replace(/%#/g, `${idx}`).replace(/%\$/g, `${idx + 1}`).replace(/__vitest_escaped_%__/g, "%%");
|
|
3428
|
+
}
|
|
3429
|
+
const count = template.split("%").length - 1;
|
|
3430
|
+
if (template.includes("%f")) {
|
|
3431
|
+
const placeholders = template.match(/%f/g) || [];
|
|
3432
|
+
placeholders.forEach((_, i3) => {
|
|
3433
|
+
if (isNegativeNaN(items[i3]) || Object.is(items[i3], -0)) {
|
|
3434
|
+
let occurrence = 0;
|
|
3435
|
+
template = template.replace(/%f/g, (match) => {
|
|
3436
|
+
occurrence++;
|
|
3437
|
+
return occurrence === i3 + 1 ? "-%f" : match;
|
|
3438
|
+
});
|
|
3439
|
+
}
|
|
3440
|
+
});
|
|
3441
|
+
}
|
|
3442
|
+
const isObjectItem = isObject(items[0]);
|
|
3443
|
+
function formatAttribute(s) {
|
|
3444
|
+
return s.replace(/\$([$\w.]+)/g, (_, key) => {
|
|
3445
|
+
const isArrayKey = /^\d+$/.test(key);
|
|
3446
|
+
if (!isObjectItem && !isArrayKey) {
|
|
3447
|
+
return `$${key}`;
|
|
3448
|
+
}
|
|
3449
|
+
const arrayElement = isArrayKey ? objectAttr(items, key) : void 0;
|
|
3450
|
+
const value = isObjectItem ? objectAttr(items[0], key, arrayElement) : arrayElement;
|
|
3451
|
+
return objDisplay(value, { truncate: runner?.config?.chaiConfig?.truncateThreshold });
|
|
3452
|
+
});
|
|
3453
|
+
}
|
|
3454
|
+
let output = "";
|
|
3455
|
+
let i2 = 0;
|
|
3456
|
+
handleRegexMatch(
|
|
3457
|
+
template,
|
|
3458
|
+
formatRegExp,
|
|
3459
|
+
// format "%"
|
|
3460
|
+
(match) => {
|
|
3461
|
+
if (i2 < count) {
|
|
3462
|
+
output += format2(match[0], items[i2++]);
|
|
3463
|
+
} else {
|
|
3464
|
+
output += match[0];
|
|
3465
|
+
}
|
|
3466
|
+
},
|
|
3467
|
+
// format "$"
|
|
3468
|
+
(nonMatch) => {
|
|
3469
|
+
output += formatAttribute(nonMatch);
|
|
3470
|
+
}
|
|
3471
|
+
);
|
|
3472
|
+
return output;
|
|
3473
|
+
}
|
|
3474
|
+
function handleRegexMatch(input, regex, onMatch, onNonMatch) {
|
|
3475
|
+
let lastIndex = 0;
|
|
3476
|
+
for (const m of input.matchAll(regex)) {
|
|
3477
|
+
if (lastIndex < m.index) {
|
|
3478
|
+
onNonMatch(input.slice(lastIndex, m.index));
|
|
3479
|
+
}
|
|
3480
|
+
onMatch(m);
|
|
3481
|
+
lastIndex = m.index + m[0].length;
|
|
3482
|
+
}
|
|
3483
|
+
if (lastIndex < input.length) {
|
|
3484
|
+
onNonMatch(input.slice(lastIndex));
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3487
|
+
function formatTemplateString(cases, args) {
|
|
3488
|
+
const header = cases.join("").trim().replace(/ /g, "").split("\n").map((i2) => i2.split("|"))[0];
|
|
3489
|
+
const res = [];
|
|
3490
|
+
for (let i2 = 0; i2 < Math.floor(args.length / header.length); i2++) {
|
|
3491
|
+
const oneCase = {};
|
|
3492
|
+
for (let j = 0; j < header.length; j++) {
|
|
3493
|
+
oneCase[header[j]] = args[i2 * header.length + j];
|
|
3494
|
+
}
|
|
3495
|
+
res.push(oneCase);
|
|
3496
|
+
}
|
|
3497
|
+
return res;
|
|
3498
|
+
}
|
|
3499
|
+
var now$2 = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
3500
|
+
var collectorContext = {
|
|
3501
|
+
tasks: [],
|
|
3502
|
+
currentSuite: null
|
|
3503
|
+
};
|
|
3504
|
+
function collectTask(task) {
|
|
3505
|
+
collectorContext.currentSuite?.tasks.push(task);
|
|
3506
|
+
}
|
|
3507
|
+
async function runWithSuite(suite2, fn) {
|
|
3508
|
+
const prev = collectorContext.currentSuite;
|
|
3509
|
+
collectorContext.currentSuite = suite2;
|
|
3510
|
+
await fn();
|
|
3511
|
+
collectorContext.currentSuite = prev;
|
|
3512
|
+
}
|
|
3513
|
+
function withTimeout(fn, timeout, isHook = false, stackTraceError, onTimeout) {
|
|
3514
|
+
if (timeout <= 0 || timeout === Number.POSITIVE_INFINITY) {
|
|
3515
|
+
return fn;
|
|
3516
|
+
}
|
|
3517
|
+
const { setTimeout: setTimeout3, clearTimeout: clearTimeout3 } = getSafeTimers();
|
|
3518
|
+
return (function runWithTimeout(...args) {
|
|
3519
|
+
const startTime = now$2();
|
|
3520
|
+
const runner2 = getRunner();
|
|
3521
|
+
runner2._currentTaskStartTime = startTime;
|
|
3522
|
+
runner2._currentTaskTimeout = timeout;
|
|
3523
|
+
return new Promise((resolve_, reject_) => {
|
|
3524
|
+
const timer = setTimeout3(() => {
|
|
3525
|
+
clearTimeout3(timer);
|
|
3526
|
+
rejectTimeoutError();
|
|
3527
|
+
}, timeout);
|
|
3528
|
+
timer.unref?.();
|
|
3529
|
+
function rejectTimeoutError() {
|
|
3530
|
+
const error = makeTimeoutError(isHook, timeout, stackTraceError);
|
|
3531
|
+
onTimeout?.(args, error);
|
|
3532
|
+
reject_(error);
|
|
3533
|
+
}
|
|
3534
|
+
function resolve2(result) {
|
|
3535
|
+
runner2._currentTaskStartTime = void 0;
|
|
3536
|
+
runner2._currentTaskTimeout = void 0;
|
|
3537
|
+
clearTimeout3(timer);
|
|
3538
|
+
if (now$2() - startTime >= timeout) {
|
|
3539
|
+
rejectTimeoutError();
|
|
3540
|
+
return;
|
|
3541
|
+
}
|
|
3542
|
+
resolve_(result);
|
|
3543
|
+
}
|
|
3544
|
+
function reject(error) {
|
|
3545
|
+
runner2._currentTaskStartTime = void 0;
|
|
3546
|
+
runner2._currentTaskTimeout = void 0;
|
|
3547
|
+
clearTimeout3(timer);
|
|
3548
|
+
reject_(error);
|
|
3549
|
+
}
|
|
3550
|
+
try {
|
|
3551
|
+
const result = fn(...args);
|
|
3552
|
+
if (typeof result === "object" && result != null && typeof result.then === "function") {
|
|
3553
|
+
result.then(resolve2, reject);
|
|
3554
|
+
} else {
|
|
3555
|
+
resolve2(result);
|
|
3556
|
+
}
|
|
3557
|
+
} catch (error) {
|
|
3558
|
+
reject(error);
|
|
3559
|
+
}
|
|
3560
|
+
});
|
|
3561
|
+
});
|
|
3562
|
+
}
|
|
3563
|
+
function withCancel(fn, signal) {
|
|
3564
|
+
return (function runWithCancel(...args) {
|
|
3565
|
+
return new Promise((resolve2, reject) => {
|
|
3566
|
+
signal.addEventListener("abort", () => reject(signal.reason));
|
|
3567
|
+
try {
|
|
3568
|
+
const result = fn(...args);
|
|
3569
|
+
if (typeof result === "object" && result != null && typeof result.then === "function") {
|
|
3570
|
+
result.then(resolve2, reject);
|
|
3571
|
+
} else {
|
|
3572
|
+
resolve2(result);
|
|
3573
|
+
}
|
|
3574
|
+
} catch (error) {
|
|
3575
|
+
reject(error);
|
|
3576
|
+
}
|
|
3577
|
+
});
|
|
3578
|
+
});
|
|
3579
|
+
}
|
|
3580
|
+
var abortControllers = /* @__PURE__ */ new WeakMap();
|
|
3581
|
+
function abortIfTimeout([context], error) {
|
|
3582
|
+
if (context) {
|
|
3583
|
+
abortContextSignal(context, error);
|
|
3584
|
+
}
|
|
3585
|
+
}
|
|
3586
|
+
function abortContextSignal(context, error) {
|
|
3587
|
+
const abortController = abortControllers.get(context);
|
|
3588
|
+
abortController?.abort(error);
|
|
3589
|
+
}
|
|
3590
|
+
function createTestContext(test3, runner2) {
|
|
3591
|
+
const context = function() {
|
|
3592
|
+
throw new Error("done() callback is deprecated, use promise instead");
|
|
3593
|
+
};
|
|
3594
|
+
let abortController = abortControllers.get(context);
|
|
3595
|
+
if (!abortController) {
|
|
3596
|
+
abortController = new AbortController();
|
|
3597
|
+
abortControllers.set(context, abortController);
|
|
3598
|
+
}
|
|
3599
|
+
context.signal = abortController.signal;
|
|
3600
|
+
context.task = test3;
|
|
3601
|
+
context.skip = (condition, note) => {
|
|
3602
|
+
if (condition === false) {
|
|
3603
|
+
return void 0;
|
|
3604
|
+
}
|
|
3605
|
+
test3.result ??= { state: "skip" };
|
|
3606
|
+
test3.result.pending = true;
|
|
3607
|
+
throw new PendingError("test is skipped; abort execution", test3, typeof condition === "string" ? condition : note);
|
|
3608
|
+
};
|
|
3609
|
+
context.annotate = ((message, type, attachment) => {
|
|
3610
|
+
if (test3.result && test3.result.state !== "run") {
|
|
3611
|
+
throw new Error(`Cannot annotate tests outside of the test run. The test "${test3.name}" finished running with the "${test3.result.state}" state already.`);
|
|
3612
|
+
}
|
|
3613
|
+
const annotation = {
|
|
3614
|
+
message,
|
|
3615
|
+
type: typeof type === "object" || type === void 0 ? "notice" : type
|
|
3616
|
+
};
|
|
3617
|
+
const annotationAttachment = typeof type === "object" ? type : attachment;
|
|
3618
|
+
if (annotationAttachment) {
|
|
3619
|
+
annotation.attachment = annotationAttachment;
|
|
3620
|
+
manageArtifactAttachment(annotation.attachment);
|
|
3621
|
+
}
|
|
3622
|
+
return recordAsyncOperation(test3, recordArtifact(test3, {
|
|
3623
|
+
type: "internal:annotation",
|
|
3624
|
+
annotation
|
|
3625
|
+
}).then(async ({ annotation: annotation2 }) => {
|
|
3626
|
+
if (!runner2.onTestAnnotate) {
|
|
3627
|
+
throw new Error(`Test runner doesn't support test annotations.`);
|
|
3628
|
+
}
|
|
3629
|
+
await finishSendTasksUpdate(runner2);
|
|
3630
|
+
const resolvedAnnotation = await runner2.onTestAnnotate(test3, annotation2);
|
|
3631
|
+
test3.annotations.push(resolvedAnnotation);
|
|
3632
|
+
return resolvedAnnotation;
|
|
3633
|
+
}));
|
|
3634
|
+
});
|
|
3635
|
+
context.onTestFailed = (handler, timeout) => {
|
|
3636
|
+
test3.onFailed ||= [];
|
|
3637
|
+
test3.onFailed.push(withTimeout(handler, timeout ?? runner2.config.hookTimeout, true, new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
|
|
3638
|
+
};
|
|
3639
|
+
context.onTestFinished = (handler, timeout) => {
|
|
3640
|
+
test3.onFinished ||= [];
|
|
3641
|
+
test3.onFinished.push(withTimeout(handler, timeout ?? runner2.config.hookTimeout, true, new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
|
|
3642
|
+
};
|
|
3643
|
+
return runner2.extendTaskContext?.(context) || context;
|
|
3644
|
+
}
|
|
3645
|
+
function makeTimeoutError(isHook, timeout, stackTraceError) {
|
|
3646
|
+
const message = `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.
|
|
3647
|
+
If this is a long-running ${isHook ? "hook" : "test"}, pass a timeout value as the last argument or configure it globally with "${isHook ? "hookTimeout" : "testTimeout"}".`;
|
|
3648
|
+
const error = new Error(message);
|
|
3649
|
+
if (stackTraceError?.stack) {
|
|
3650
|
+
error.stack = stackTraceError.stack.replace(error.message, stackTraceError.message);
|
|
3651
|
+
}
|
|
3652
|
+
return error;
|
|
3653
|
+
}
|
|
3654
|
+
var now$1 = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
3655
|
+
var now = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
3656
|
+
var unixNow = Date.now;
|
|
3657
|
+
var { clearTimeout: clearTimeout2, setTimeout: setTimeout2 } = getSafeTimers();
|
|
3658
|
+
var packs = /* @__PURE__ */ new Map();
|
|
3659
|
+
var eventsPacks = [];
|
|
3660
|
+
var pendingTasksUpdates = [];
|
|
3661
|
+
function sendTasksUpdate(runner2) {
|
|
3662
|
+
if (packs.size) {
|
|
3663
|
+
const taskPacks = Array.from(packs).map(([id, task]) => {
|
|
3664
|
+
return [
|
|
3665
|
+
id,
|
|
3666
|
+
task[0],
|
|
3667
|
+
task[1]
|
|
3668
|
+
];
|
|
3669
|
+
});
|
|
3670
|
+
const p = runner2.onTaskUpdate?.(taskPacks, eventsPacks);
|
|
3671
|
+
if (p) {
|
|
3672
|
+
pendingTasksUpdates.push(p);
|
|
3673
|
+
p.then(() => pendingTasksUpdates.splice(pendingTasksUpdates.indexOf(p), 1), () => {
|
|
3674
|
+
});
|
|
3675
|
+
}
|
|
3676
|
+
eventsPacks.length = 0;
|
|
3677
|
+
packs.clear();
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
async function finishSendTasksUpdate(runner2) {
|
|
3681
|
+
sendTasksUpdate(runner2);
|
|
3682
|
+
await Promise.all(pendingTasksUpdates);
|
|
3683
|
+
}
|
|
3684
|
+
function throttle(fn, ms) {
|
|
3685
|
+
let last = 0;
|
|
3686
|
+
let pendingCall;
|
|
3687
|
+
return function call(...args) {
|
|
3688
|
+
const now2 = unixNow();
|
|
3689
|
+
if (now2 - last > ms) {
|
|
3690
|
+
last = now2;
|
|
3691
|
+
clearTimeout2(pendingCall);
|
|
3692
|
+
pendingCall = void 0;
|
|
3693
|
+
return fn.apply(this, args);
|
|
3694
|
+
}
|
|
3695
|
+
pendingCall ??= setTimeout2(() => call.bind(this)(...args), ms);
|
|
3696
|
+
};
|
|
3697
|
+
}
|
|
3698
|
+
var sendTasksUpdateThrottled = throttle(sendTasksUpdate, 100);
|
|
3699
|
+
async function recordArtifact(task, artifact) {
|
|
3700
|
+
const runner2 = getRunner();
|
|
3701
|
+
const stack = findTestFileStackTrace(task.file.filepath, new Error("STACK_TRACE").stack);
|
|
3702
|
+
if (stack) {
|
|
3703
|
+
artifact.location = {
|
|
3704
|
+
file: stack.file,
|
|
3705
|
+
line: stack.line,
|
|
3706
|
+
column: stack.column
|
|
3707
|
+
};
|
|
3708
|
+
if (artifact.type === "internal:annotation") {
|
|
3709
|
+
artifact.annotation.location = artifact.location;
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
if (Array.isArray(artifact.attachments)) {
|
|
3713
|
+
for (const attachment of artifact.attachments) {
|
|
3714
|
+
manageArtifactAttachment(attachment);
|
|
3715
|
+
}
|
|
3716
|
+
}
|
|
3717
|
+
if (artifact.type === "internal:annotation") {
|
|
3718
|
+
return artifact;
|
|
3719
|
+
}
|
|
3720
|
+
if (!runner2.onTestArtifactRecord) {
|
|
3721
|
+
throw new Error(`Test runner doesn't support test artifacts.`);
|
|
3722
|
+
}
|
|
3723
|
+
await finishSendTasksUpdate(runner2);
|
|
3724
|
+
const resolvedArtifact = await runner2.onTestArtifactRecord(task, artifact);
|
|
3725
|
+
task.artifacts.push(resolvedArtifact);
|
|
3726
|
+
return resolvedArtifact;
|
|
3727
|
+
}
|
|
3728
|
+
var table = [];
|
|
3729
|
+
for (let i2 = 65; i2 < 91; i2++) {
|
|
3730
|
+
table.push(String.fromCharCode(i2));
|
|
3731
|
+
}
|
|
3732
|
+
for (let i2 = 97; i2 < 123; i2++) {
|
|
3733
|
+
table.push(String.fromCharCode(i2));
|
|
3734
|
+
}
|
|
3735
|
+
for (let i2 = 0; i2 < 10; i2++) {
|
|
3736
|
+
table.push(i2.toString(10));
|
|
3737
|
+
}
|
|
3738
|
+
table.push("+", "/");
|
|
3739
|
+
function encodeUint8Array(bytes) {
|
|
3740
|
+
let base64 = "";
|
|
3741
|
+
const len = bytes.byteLength;
|
|
3742
|
+
for (let i2 = 0; i2 < len; i2 += 3) {
|
|
3743
|
+
if (len === i2 + 1) {
|
|
3744
|
+
const a = (bytes[i2] & 252) >> 2;
|
|
3745
|
+
const b2 = (bytes[i2] & 3) << 4;
|
|
3746
|
+
base64 += table[a];
|
|
3747
|
+
base64 += table[b2];
|
|
3748
|
+
base64 += "==";
|
|
3749
|
+
} else if (len === i2 + 2) {
|
|
3750
|
+
const a = (bytes[i2] & 252) >> 2;
|
|
3751
|
+
const b2 = (bytes[i2] & 3) << 4 | (bytes[i2 + 1] & 240) >> 4;
|
|
3752
|
+
const c = (bytes[i2 + 1] & 15) << 2;
|
|
3753
|
+
base64 += table[a];
|
|
3754
|
+
base64 += table[b2];
|
|
3755
|
+
base64 += table[c];
|
|
3756
|
+
base64 += "=";
|
|
3757
|
+
} else {
|
|
3758
|
+
const a = (bytes[i2] & 252) >> 2;
|
|
3759
|
+
const b2 = (bytes[i2] & 3) << 4 | (bytes[i2 + 1] & 240) >> 4;
|
|
3760
|
+
const c = (bytes[i2 + 1] & 15) << 2 | (bytes[i2 + 2] & 192) >> 6;
|
|
3761
|
+
const d2 = bytes[i2 + 2] & 63;
|
|
3762
|
+
base64 += table[a];
|
|
3763
|
+
base64 += table[b2];
|
|
3764
|
+
base64 += table[c];
|
|
3765
|
+
base64 += table[d2];
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
return base64;
|
|
3769
|
+
}
|
|
3770
|
+
function recordAsyncOperation(test3, promise) {
|
|
3771
|
+
promise = promise.finally(() => {
|
|
3772
|
+
if (!test3.promises) {
|
|
3773
|
+
return;
|
|
3774
|
+
}
|
|
3775
|
+
const index2 = test3.promises.indexOf(promise);
|
|
3776
|
+
if (index2 !== -1) {
|
|
3777
|
+
test3.promises.splice(index2, 1);
|
|
3778
|
+
}
|
|
3779
|
+
});
|
|
3780
|
+
if (!test3.promises) {
|
|
3781
|
+
test3.promises = [];
|
|
3782
|
+
}
|
|
3783
|
+
test3.promises.push(promise);
|
|
3784
|
+
return promise;
|
|
3785
|
+
}
|
|
3786
|
+
function manageArtifactAttachment(attachment) {
|
|
3787
|
+
if (attachment.body == null && !attachment.path) {
|
|
3788
|
+
throw new TypeError(`Test attachment requires "body" or "path" to be set. Both are missing.`);
|
|
3789
|
+
}
|
|
3790
|
+
if (attachment.body && attachment.path) {
|
|
3791
|
+
throw new TypeError(`Test attachment requires only one of "body" or "path" to be set. Both are specified.`);
|
|
3792
|
+
}
|
|
3793
|
+
if (attachment.path && attachment.bodyEncoding) {
|
|
3794
|
+
throw new TypeError(`Test attachment with "path" should not have "bodyEncoding" specified.`);
|
|
3795
|
+
}
|
|
3796
|
+
if (attachment.body instanceof Uint8Array) {
|
|
3797
|
+
attachment.body = encodeUint8Array(attachment.body);
|
|
3798
|
+
}
|
|
3799
|
+
if (attachment.body != null) {
|
|
3800
|
+
attachment.bodyEncoding ??= "base64";
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
|
|
3804
|
+
// ../../node_modules/.pnpm/vite@7.3.3_@types+node@25.7.0_jiti@2.6.1_lightningcss@1.32.0_terser@5.46.1_tsx@4.21.0_yaml@2.9.0/node_modules/vite/dist/node/module-runner.js
|
|
3805
|
+
var SOURCEMAPPING_URL = "sourceMa";
|
|
3806
|
+
SOURCEMAPPING_URL += "ppingURL";
|
|
3807
|
+
var isWindows = typeof process < "u" && process.platform === "win32";
|
|
3808
|
+
var AsyncFunction = async function() {
|
|
3809
|
+
}.constructor;
|
|
3810
|
+
var chars2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3811
|
+
var intToChar2 = new Uint8Array(64);
|
|
3812
|
+
var charToInt2 = new Uint8Array(128);
|
|
3813
|
+
for (let i2 = 0; i2 < chars2.length; i2++) {
|
|
3814
|
+
let c = chars2.charCodeAt(i2);
|
|
3815
|
+
intToChar2[i2] = c, charToInt2[c] = i2;
|
|
3816
|
+
}
|
|
3817
|
+
var MODULE_RUNNER_SOURCEMAPPING_REGEXP = /* @__PURE__ */ RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
|
|
3818
|
+
var retrieveFileHandlers = /* @__PURE__ */ new Set();
|
|
3819
|
+
var retrieveSourceMapHandlers = /* @__PURE__ */ new Set();
|
|
3820
|
+
var createExecHandlers = (handlers) => ((...args) => {
|
|
3821
|
+
for (let handler of handlers) {
|
|
3822
|
+
let result = handler(...args);
|
|
3823
|
+
if (result) return result;
|
|
3824
|
+
}
|
|
3825
|
+
return null;
|
|
3826
|
+
});
|
|
3827
|
+
var retrieveFileFromHandlers = createExecHandlers(retrieveFileHandlers);
|
|
3828
|
+
var retrieveSourceMapFromHandlers = createExecHandlers(retrieveSourceMapHandlers);
|
|
3829
|
+
var originalPrepare = Error.prepareStackTrace;
|
|
3830
|
+
var customizationHookNamespace = "vite-module-runner:import-meta-resolve/v1/";
|
|
3831
|
+
var customizationHooksModule = `
|
|
3832
|
+
|
|
3833
|
+
export async function resolve(specifier, context, nextResolve) {
|
|
3834
|
+
if (specifier.startsWith(${JSON.stringify(customizationHookNamespace)})) {
|
|
3835
|
+
const data = specifier.slice(${JSON.stringify(customizationHookNamespace)}.length)
|
|
3836
|
+
const [parsedSpecifier, parsedImporter] = JSON.parse(data)
|
|
3837
|
+
specifier = parsedSpecifier
|
|
3838
|
+
context.parentURL = parsedImporter
|
|
3839
|
+
}
|
|
3840
|
+
return nextResolve(specifier, context)
|
|
3841
|
+
}
|
|
3842
|
+
|
|
3843
|
+
`;
|
|
3844
|
+
`${customizationHookNamespace}`;
|
|
3845
|
+
var envProxy = new Proxy({}, { get(_, p) {
|
|
3846
|
+
throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
|
|
3847
|
+
} });
|
|
3848
|
+
|
|
3849
|
+
// ../../node_modules/.pnpm/vitest@4.1.6_@opentelemetry+api@1.9.0_@types+node@25.7.0_@vitest+coverage-v8@4.1.6_vite_582ee6038b40d7e1fe3c73876076a024/node_modules/vitest/dist/index.js
|
|
3850
|
+
var import_expect_type = __toESM(require_dist(), 1);
|
|
3851
|
+
|
|
3852
|
+
// src/test/sandbox.ts
|
|
3853
|
+
async function sandbox(builder, options = {}) {
|
|
3854
|
+
const store = options.store ? await options.store() : new InMemoryStore();
|
|
3855
|
+
const cache = options.cache ? await options.cache() : new InMemoryCache();
|
|
3856
|
+
await store.seed();
|
|
3857
|
+
const app = builder.build({
|
|
3858
|
+
...options.actOptions,
|
|
3859
|
+
scoped: { store, cache }
|
|
3860
|
+
});
|
|
3861
|
+
let _disposed;
|
|
3862
|
+
const dispose = () => {
|
|
3863
|
+
if (!_disposed) {
|
|
3864
|
+
_disposed = (async () => {
|
|
3865
|
+
await app.shutdown();
|
|
3866
|
+
await store.dispose();
|
|
3867
|
+
await cache.dispose();
|
|
3868
|
+
})();
|
|
3869
|
+
}
|
|
3870
|
+
return _disposed;
|
|
3871
|
+
};
|
|
3872
|
+
return { app, store, cache, dispose };
|
|
3873
|
+
}
|
|
3874
|
+
function fixture(builder, defaults = {}) {
|
|
3875
|
+
return test2.extend({
|
|
3876
|
+
app: async ({}, use) => {
|
|
3877
|
+
const ctx = await sandbox(builder, defaults);
|
|
3878
|
+
try {
|
|
3879
|
+
await use(ctx.app);
|
|
3880
|
+
} finally {
|
|
3881
|
+
await ctx.dispose();
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3884
|
+
});
|
|
3885
|
+
}
|
|
3886
|
+
export {
|
|
3887
|
+
fixture,
|
|
3888
|
+
sandbox
|
|
3889
|
+
};
|
|
3890
|
+
/*! Bundled license information:
|
|
3891
|
+
|
|
3892
|
+
@vitest/pretty-format/dist/index.js:
|
|
3893
|
+
(**
|
|
3894
|
+
* @license React
|
|
3895
|
+
* react-is.production.js
|
|
3896
|
+
*
|
|
3897
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3898
|
+
*
|
|
3899
|
+
* This source code is licensed under the MIT license found in the
|
|
3900
|
+
* LICENSE file in the root directory of this source tree.
|
|
3901
|
+
*)
|
|
3902
|
+
(**
|
|
3903
|
+
* @license React
|
|
3904
|
+
* react-is.production.min.js
|
|
3905
|
+
*
|
|
3906
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3907
|
+
*
|
|
3908
|
+
* This source code is licensed under the MIT license found in the
|
|
3909
|
+
* LICENSE file in the root directory of this source tree.
|
|
3910
|
+
*)
|
|
3911
|
+
*/
|
|
3912
|
+
//# sourceMappingURL=index.js.map
|