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