@accelint/design-system 1.1.5 → 1.1.7
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/components/button/button.css.d.ts +1 -0
- package/dist/components/button/index.d.ts +9 -40
- package/dist/components/button/index.js +23 -17
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/types.d.ts +3 -2
- package/dist/components/collection/index.d.ts +2 -2
- package/dist/components/collection/index.js.map +1 -1
- package/dist/components/date-input/index.js +4 -1
- package/dist/components/date-input/index.js.map +1 -1
- package/dist/components/dialog/dialog.css.d.ts +1 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/dialog/types.d.ts +1 -0
- package/dist/components/drawer/drawer.css.d.ts +1 -1
- package/dist/components/drawer/index.d.ts +1 -1
- package/dist/components/drawer/types.d.ts +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/menu/index.d.ts +2 -2
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/merge-provider/index.js +15 -7
- package/dist/components/merge-provider/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +1 -1
- package/dist/components/number-field/number-field.css.d.ts +1 -1
- package/dist/components/number-field/types.d.ts +1 -1
- package/dist/components/options/index.js +1 -1
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/picker/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +3 -128
- package/dist/components/text-field/index.js +3 -3
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/tree/index.js +5 -2
- package/dist/components/tree/index.js.map +1 -1
- package/dist/hooks/index.d.ts +11 -11
- package/dist/hooks/use-collection-render/index.d.ts +1 -1
- package/dist/hooks/use-collection-render/index.js +2 -3
- package/dist/hooks/use-collection-render/index.js.map +1 -1
- package/dist/hooks/use-context-props/index.js.map +1 -1
- package/dist/hooks/use-defaults/index.d.ts +32 -80
- package/dist/hooks/use-defaults/index.js +1 -4
- package/dist/hooks/use-defaults/index.js.map +1 -1
- package/dist/hooks/use-defaults/types.d.ts +1 -1
- package/dist/hooks/use-theme/index.d.ts +1 -1
- package/dist/hooks/use-theme/types.d.ts +1 -1
- package/dist/hooks/use-tree/index.js +3 -2
- package/dist/hooks/use-tree/index.js.map +1 -1
- package/dist/hooks/use-tree/utils.js +6 -9
- package/dist/hooks/use-tree/utils.js.map +1 -1
- package/dist/hooks/use-update-effect/index.js.map +1 -1
- package/dist/index.css +32 -32
- package/dist/index.d.ts +5 -5
- package/dist/ladle/actions.js.map +1 -1
- package/dist/test/setup.js +634 -1254
- package/dist/test/setup.js.map +1 -1
- package/dist/utils/props/index.d.ts +1 -2
- package/dist/utils/props/index.js.map +1 -1
- package/package.json +39 -39
package/dist/test/setup.js
CHANGED
|
@@ -11,16 +11,18 @@ import 'react-dom';
|
|
|
11
11
|
import 'react-dom/client';
|
|
12
12
|
import * as prettyFormat from 'pretty-format.js';
|
|
13
13
|
import lzString from 'lz-string.js';
|
|
14
|
-
import { JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, ASYMMETRIC_MATCHERS_OBJECT, getState, setState, addCustomEqualityTesters, equals, iterableEquality, subsetEquality } from '@vitest/expect.js';
|
|
14
|
+
import { chai, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, ASYMMETRIC_MATCHERS_OBJECT, getState, setState, addCustomEqualityTesters, customMatchers, equals, iterableEquality, subsetEquality } from '@vitest/expect.js';
|
|
15
15
|
import { afterEach as afterEach$1, getCurrentTest } from '@vitest/runner.js';
|
|
16
|
+
import { getSafeTimers, delay } from '@vitest/utils/timers.js';
|
|
16
17
|
import { getNames } from '@vitest/runner/utils.js';
|
|
17
|
-
import * as chai$1 from 'chai.js';
|
|
18
|
-
import { assertTypes, getSafeTimers, createSimpleStackTrace } from '@vitest/utils.js';
|
|
19
18
|
import { stripSnapshotIndentation, addSerializer, SnapshotClient } from '@vitest/snapshot.js';
|
|
20
19
|
import '@vitest/utils/error.js';
|
|
21
|
-
import
|
|
22
|
-
import
|
|
20
|
+
import '@vitest/utils/helpers.js';
|
|
21
|
+
import '@vitest/spy.js';
|
|
22
|
+
import '@vitest/utils/offset.js';
|
|
23
|
+
import '@vitest/utils/source-map.js';
|
|
23
24
|
import 'expect-type.js';
|
|
25
|
+
import 'pathe.js';
|
|
24
26
|
|
|
25
27
|
// ../node_modules/.pnpm/@testing-library+jest-dom@6.9.1/node_modules/@testing-library/jest-dom/dist/matchers.mjs
|
|
26
28
|
var matchers_exports = {};
|
|
@@ -3999,7 +4001,7 @@ typeof document !== "undefined" && document.body ? getQueriesForElement(document
|
|
|
3999
4001
|
return helpers;
|
|
4000
4002
|
}, initialValue);
|
|
4001
4003
|
|
|
4002
|
-
// ../node_modules/.pnpm/@testing-library+react@16.3.
|
|
4004
|
+
// ../node_modules/.pnpm/@testing-library+react@16.3.1_@testing-library+dom@10.4.1_@types+react-dom@19.0.0_@type_e58d195d2fe7d9a4e3d711d7fbfc8046/node_modules/@testing-library/react/dist/@testing-library/react.esm.js
|
|
4003
4005
|
var reactAct = typeof React.act === "function" ? React.act : DeprecatedReactTestUtils.act;
|
|
4004
4006
|
function getGlobalThis() {
|
|
4005
4007
|
if (typeof globalThis !== "undefined") {
|
|
@@ -4108,11 +4110,10 @@ configure({
|
|
|
4108
4110
|
var mountedContainers = /* @__PURE__ */ new Set();
|
|
4109
4111
|
var mountedRootEntries = [];
|
|
4110
4112
|
function cleanup() {
|
|
4111
|
-
mountedRootEntries.forEach((
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
} = _ref3;
|
|
4113
|
+
mountedRootEntries.forEach(({
|
|
4114
|
+
root,
|
|
4115
|
+
container
|
|
4116
|
+
}) => {
|
|
4116
4117
|
act3(() => {
|
|
4117
4118
|
root.unmount();
|
|
4118
4119
|
});
|
|
@@ -4147,82 +4148,22 @@ if (typeof process === "undefined" || !process.env?.RTL_SKIP_AUTO_CLEANUP) {
|
|
|
4147
4148
|
var NAME_WORKER_STATE = "__vitest_worker__";
|
|
4148
4149
|
function getWorkerState() {
|
|
4149
4150
|
const workerState = globalThis[NAME_WORKER_STATE];
|
|
4150
|
-
if (!workerState)
|
|
4151
|
-
const errorMsg = 'Vitest failed to access its internal state.\n\nOne of the following is possible:\n- "vitest" is imported directly without running "vitest" command\n- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n';
|
|
4152
|
-
throw new Error(errorMsg);
|
|
4153
|
-
}
|
|
4151
|
+
if (!workerState) throw new Error('Vitest failed to access its internal state.\n\nOne of the following is possible:\n- "vitest" is imported directly without running "vitest" command\n- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)\n- "vitest" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n');
|
|
4154
4152
|
return workerState;
|
|
4155
4153
|
}
|
|
4156
|
-
function getCurrentEnvironment() {
|
|
4157
|
-
const state = getWorkerState();
|
|
4158
|
-
return state?.environment.name;
|
|
4159
|
-
}
|
|
4160
|
-
function isChildProcess() {
|
|
4161
|
-
return typeof process !== "undefined" && !!process.send;
|
|
4162
|
-
}
|
|
4163
|
-
function resetModules(modules, resetMocks = false) {
|
|
4164
|
-
const skipPaths = [
|
|
4165
|
-
// Vitest
|
|
4166
|
-
/\/vitest\/dist\//,
|
|
4167
|
-
/\/vite-node\/dist\//,
|
|
4168
|
-
// yarn's .store folder
|
|
4169
|
-
/vitest-virtual-\w+\/dist/,
|
|
4170
|
-
// cnpm
|
|
4171
|
-
/@vitest\/dist/,
|
|
4172
|
-
// don't clear mocks
|
|
4173
|
-
...!resetMocks ? [/^mock:/] : []
|
|
4174
|
-
];
|
|
4175
|
-
modules.forEach((mod, path) => {
|
|
4176
|
-
if (skipPaths.some((re) => re.test(path))) {
|
|
4177
|
-
return;
|
|
4178
|
-
}
|
|
4179
|
-
modules.invalidateModule(mod);
|
|
4180
|
-
});
|
|
4181
|
-
}
|
|
4182
|
-
function waitNextTick() {
|
|
4183
|
-
const { setTimeout: setTimeout2 } = getSafeTimers();
|
|
4184
|
-
return new Promise((resolve) => setTimeout2(resolve, 0));
|
|
4185
|
-
}
|
|
4186
|
-
async function waitForImportsToResolve() {
|
|
4187
|
-
await waitNextTick();
|
|
4188
|
-
const state = getWorkerState();
|
|
4189
|
-
const promises = [];
|
|
4190
|
-
let resolvingCount = 0;
|
|
4191
|
-
for (const mod of state.moduleCache.values()) {
|
|
4192
|
-
if (mod.promise && !mod.evaluated) {
|
|
4193
|
-
promises.push(mod.promise);
|
|
4194
|
-
}
|
|
4195
|
-
if (mod.resolving) {
|
|
4196
|
-
resolvingCount++;
|
|
4197
|
-
}
|
|
4198
|
-
}
|
|
4199
|
-
if (!promises.length && !resolvingCount) {
|
|
4200
|
-
return;
|
|
4201
|
-
}
|
|
4202
|
-
await Promise.allSettled(promises);
|
|
4203
|
-
await waitForImportsToResolve();
|
|
4204
|
-
}
|
|
4205
4154
|
|
|
4206
|
-
// ../node_modules/.pnpm/vitest@
|
|
4155
|
+
// ../node_modules/.pnpm/vitest@4.0.16_@types+node@25.0.3_jiti@2.6.1_jsdom@25.0.1_msw@2.12.7_@types+node@25.0.3_typescript@5.9.3__tsx@4.21.0/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js
|
|
4207
4156
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
4208
|
-
function getDefaultExportFromCjs(x) {
|
|
4209
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4210
|
-
}
|
|
4211
4157
|
|
|
4212
|
-
// ../node_modules/.pnpm/vitest@
|
|
4158
|
+
// ../node_modules/.pnpm/vitest@4.0.16_@types+node@25.0.3_jiti@2.6.1_jsdom@25.0.1_msw@2.12.7_@types+node@25.0.3_typescript@5.9.3__tsx@4.21.0/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js
|
|
4213
4159
|
var RealDate = Date;
|
|
4214
|
-
var now = null;
|
|
4215
4160
|
var MockDate = class _MockDate extends RealDate {
|
|
4216
4161
|
constructor(y, m, d, h, M, s, ms) {
|
|
4217
4162
|
super();
|
|
4218
4163
|
let date;
|
|
4219
4164
|
switch (arguments.length) {
|
|
4220
4165
|
case 0:
|
|
4221
|
-
|
|
4222
|
-
date = new RealDate(now.valueOf());
|
|
4223
|
-
} else {
|
|
4224
|
-
date = new RealDate();
|
|
4225
|
-
}
|
|
4166
|
+
date = new RealDate();
|
|
4226
4167
|
break;
|
|
4227
4168
|
case 1:
|
|
4228
4169
|
date = new RealDate(y);
|
|
@@ -4250,257 +4191,122 @@ MockDate.parse = function(dateString) {
|
|
|
4250
4191
|
MockDate.toString = function() {
|
|
4251
4192
|
return RealDate.toString();
|
|
4252
4193
|
};
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
if (Number.isNaN(dateObj.getTime())) {
|
|
4256
|
-
throw new TypeError(`mockdate: The time set is an invalid date: ${date}`);
|
|
4257
|
-
}
|
|
4258
|
-
globalThis.Date = MockDate;
|
|
4259
|
-
now = dateObj.valueOf();
|
|
4260
|
-
}
|
|
4261
|
-
function resetDate() {
|
|
4262
|
-
globalThis.Date = RealDate;
|
|
4263
|
-
}
|
|
4194
|
+
|
|
4195
|
+
// ../node_modules/.pnpm/vitest@4.0.16_@types+node@25.0.3_jiti@2.6.1_jsdom@25.0.1_msw@2.12.7_@types+node@25.0.3_typescript@5.9.3__tsx@4.21.0/node_modules/vitest/dist/chunks/vi.2VT5v0um.js
|
|
4264
4196
|
var unsupported = [
|
|
4265
|
-
// .poll is meant to retry matchers until they succeed, and
|
|
4266
|
-
// snapshots will always succeed as long as the poll method doesn't thow an error
|
|
4267
|
-
// in this case using the `vi.waitFor` method is more appropriate
|
|
4268
4197
|
"matchSnapshot",
|
|
4269
4198
|
"toMatchSnapshot",
|
|
4270
4199
|
"toMatchInlineSnapshot",
|
|
4271
4200
|
"toThrowErrorMatchingSnapshot",
|
|
4272
4201
|
"toThrowErrorMatchingInlineSnapshot",
|
|
4273
|
-
// toThrow will never succeed because we call the poll callback until it doesn't throw
|
|
4274
4202
|
"throws",
|
|
4275
4203
|
"Throw",
|
|
4276
4204
|
"throw",
|
|
4277
4205
|
"toThrow",
|
|
4278
4206
|
"toThrowError"
|
|
4279
|
-
// these are not supported because you can call them without `.poll`,
|
|
4280
|
-
// we throw an error inside the rejects/resolves methods to prevent this
|
|
4281
|
-
// rejects,
|
|
4282
|
-
// resolves
|
|
4283
4207
|
];
|
|
4284
|
-
function
|
|
4208
|
+
function throwWithCause(error, source) {
|
|
4209
|
+
if (error.cause == null) error.cause = /* @__PURE__ */ new Error("Matcher did not succeed in time.");
|
|
4210
|
+
throw copyStackTrace$1(error, source);
|
|
4211
|
+
}
|
|
4212
|
+
function createExpectPoll(expect) {
|
|
4285
4213
|
return function poll(fn2, options = {}) {
|
|
4286
|
-
const
|
|
4287
|
-
const defaults =
|
|
4288
|
-
const {
|
|
4289
|
-
interval = defaults.interval ?? 50,
|
|
4290
|
-
timeout = defaults.timeout ?? 1e3,
|
|
4291
|
-
message
|
|
4292
|
-
} = options;
|
|
4293
|
-
const assertion = expect2(null, message).withContext({
|
|
4294
|
-
poll: true
|
|
4295
|
-
});
|
|
4214
|
+
const defaults = getWorkerState().config.expect?.poll ?? {};
|
|
4215
|
+
const { interval = defaults.interval ?? 50, timeout = defaults.timeout ?? 1e3, message } = options;
|
|
4216
|
+
const assertion = expect(null, message).withContext({ poll: true });
|
|
4296
4217
|
fn2 = fn2.bind(assertion);
|
|
4297
|
-
const test2 = chai
|
|
4298
|
-
if (!test2)
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
);
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
let intervalId;
|
|
4319
|
-
let lastError;
|
|
4320
|
-
const { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = getSafeTimers();
|
|
4321
|
-
const timeoutId = setTimeout2(() => {
|
|
4322
|
-
clearTimeout2(intervalId);
|
|
4323
|
-
reject(
|
|
4324
|
-
copyStackTrace$1(
|
|
4325
|
-
new Error(`Matcher did not succeed in ${timeout}ms`, {
|
|
4326
|
-
cause: lastError
|
|
4327
|
-
}),
|
|
4328
|
-
STACK_TRACE_ERROR
|
|
4329
|
-
)
|
|
4330
|
-
);
|
|
4331
|
-
}, timeout);
|
|
4332
|
-
const check = async () => {
|
|
4218
|
+
const test2 = chai.util.flag(assertion, "vitest-test");
|
|
4219
|
+
if (!test2) throw new Error("expect.poll() must be called inside a test");
|
|
4220
|
+
const proxy = new Proxy(assertion, { get(target, key, receiver) {
|
|
4221
|
+
const assertionFunction = Reflect.get(target, key, receiver);
|
|
4222
|
+
if (typeof assertionFunction !== "function") return assertionFunction instanceof chai.Assertion ? proxy : assertionFunction;
|
|
4223
|
+
if (key === "assert") return assertionFunction;
|
|
4224
|
+
if (typeof key === "string" && unsupported.includes(key)) throw new SyntaxError(`expect.poll() is not supported in combination with .${key}(). Use vi.waitFor() if your assertion condition is unstable.`);
|
|
4225
|
+
return function(...args) {
|
|
4226
|
+
const STACK_TRACE_ERROR = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
|
|
4227
|
+
const promise = async () => {
|
|
4228
|
+
const { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = getSafeTimers();
|
|
4229
|
+
let executionPhase = "fn";
|
|
4230
|
+
let hasTimedOut = false;
|
|
4231
|
+
const timerId = setTimeout2(() => {
|
|
4232
|
+
hasTimedOut = true;
|
|
4233
|
+
}, timeout);
|
|
4234
|
+
chai.util.flag(assertion, "_name", key);
|
|
4235
|
+
try {
|
|
4236
|
+
while (true) {
|
|
4237
|
+
const isLastAttempt = hasTimedOut;
|
|
4238
|
+
if (isLastAttempt) chai.util.flag(assertion, "_isLastPollAttempt", true);
|
|
4333
4239
|
try {
|
|
4334
|
-
|
|
4240
|
+
executionPhase = "fn";
|
|
4335
4241
|
const obj = await fn2();
|
|
4336
|
-
chai
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
clearTimeout2(timeoutId);
|
|
4242
|
+
chai.util.flag(assertion, "object", obj);
|
|
4243
|
+
executionPhase = "assertion";
|
|
4244
|
+
return await assertionFunction.call(assertion, ...args);
|
|
4340
4245
|
} catch (err) {
|
|
4341
|
-
|
|
4342
|
-
|
|
4246
|
+
if (isLastAttempt || executionPhase === "assertion" && chai.util.flag(assertion, "_poll.assert_once")) throwWithCause(err, STACK_TRACE_ERROR);
|
|
4247
|
+
await delay(interval, setTimeout2);
|
|
4343
4248
|
}
|
|
4344
|
-
}
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4249
|
+
}
|
|
4250
|
+
} finally {
|
|
4251
|
+
clearTimeout2(timerId);
|
|
4252
|
+
}
|
|
4253
|
+
};
|
|
4254
|
+
let awaited = false;
|
|
4255
|
+
test2.onFinished ??= [];
|
|
4256
|
+
test2.onFinished.push(() => {
|
|
4257
|
+
if (!awaited) {
|
|
4258
|
+
const negated = chai.util.flag(assertion, "negate") ? "not." : "";
|
|
4259
|
+
const assertionString = `expect.${chai.util.flag(assertion, "_poll.element") ? "element(locator)" : "poll(assertion)"}.${negated}${String(key)}()`;
|
|
4260
|
+
throw copyStackTrace$1(/* @__PURE__ */ new Error(`${assertionString} was not awaited. This assertion is asynchronous and must be awaited; otherwise, it is not executed to avoid unhandled rejections:
|
|
4356
4261
|
|
|
4357
4262
|
await ${assertionString}
|
|
4358
|
-
`
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
then(onFulfilled, onRejected)
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
},
|
|
4375
|
-
[Symbol.toStringTag]: "Promise"
|
|
4376
|
-
};
|
|
4263
|
+
`), STACK_TRACE_ERROR);
|
|
4264
|
+
}
|
|
4265
|
+
});
|
|
4266
|
+
let resultPromise;
|
|
4267
|
+
return {
|
|
4268
|
+
then(onFulfilled, onRejected) {
|
|
4269
|
+
awaited = true;
|
|
4270
|
+
return (resultPromise ||= promise()).then(onFulfilled, onRejected);
|
|
4271
|
+
},
|
|
4272
|
+
catch(onRejected) {
|
|
4273
|
+
return (resultPromise ||= promise()).catch(onRejected);
|
|
4274
|
+
},
|
|
4275
|
+
finally(onFinally) {
|
|
4276
|
+
return (resultPromise ||= promise()).finally(onFinally);
|
|
4277
|
+
},
|
|
4278
|
+
[Symbol.toStringTag]: "Promise"
|
|
4377
4279
|
};
|
|
4378
|
-
}
|
|
4379
|
-
});
|
|
4280
|
+
};
|
|
4281
|
+
} });
|
|
4380
4282
|
return proxy;
|
|
4381
4283
|
};
|
|
4382
4284
|
}
|
|
4383
4285
|
function copyStackTrace$1(target, source) {
|
|
4384
|
-
if (source.stack !== void 0)
|
|
4385
|
-
target.stack = source.stack.replace(source.message, target.message);
|
|
4386
|
-
}
|
|
4286
|
+
if (source.stack !== void 0) target.stack = source.stack.replace(source.message, target.message);
|
|
4387
4287
|
return target;
|
|
4388
4288
|
}
|
|
4389
|
-
function
|
|
4390
|
-
|
|
4391
|
-
}
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
var hasRequiredChaiSubset;
|
|
4395
|
-
function requireChaiSubset() {
|
|
4396
|
-
if (hasRequiredChaiSubset) return chaiSubset$1.exports;
|
|
4397
|
-
hasRequiredChaiSubset = 1;
|
|
4398
|
-
(function(module2, exports$1) {
|
|
4399
|
-
(function() {
|
|
4400
|
-
(function(chaiSubset2) {
|
|
4401
|
-
if (typeof commonjsRequire === "function" && true && true) {
|
|
4402
|
-
return module2.exports = chaiSubset2;
|
|
4403
|
-
} else {
|
|
4404
|
-
return chai.use(chaiSubset2);
|
|
4405
|
-
}
|
|
4406
|
-
})(function(chai3, utils) {
|
|
4407
|
-
var Assertion2 = chai3.Assertion;
|
|
4408
|
-
var assertionPrototype = Assertion2.prototype;
|
|
4409
|
-
Assertion2.addMethod("containSubset", function(expected) {
|
|
4410
|
-
var actual = utils.flag(this, "object");
|
|
4411
|
-
var showDiff = chai3.config.showDiff;
|
|
4412
|
-
assertionPrototype.assert.call(
|
|
4413
|
-
this,
|
|
4414
|
-
compare(expected, actual),
|
|
4415
|
-
"expected #{act} to contain subset #{exp}",
|
|
4416
|
-
"expected #{act} to not contain subset #{exp}",
|
|
4417
|
-
expected,
|
|
4418
|
-
actual,
|
|
4419
|
-
showDiff
|
|
4420
|
-
);
|
|
4421
|
-
});
|
|
4422
|
-
chai3.assert.containSubset = function(val, exp, msg) {
|
|
4423
|
-
new chai3.Assertion(val, msg).to.be.containSubset(exp);
|
|
4424
|
-
};
|
|
4425
|
-
function compare(expected, actual) {
|
|
4426
|
-
if (expected === actual) {
|
|
4427
|
-
return true;
|
|
4428
|
-
}
|
|
4429
|
-
if (typeof actual !== typeof expected) {
|
|
4430
|
-
return false;
|
|
4431
|
-
}
|
|
4432
|
-
if (typeof expected !== "object" || expected === null) {
|
|
4433
|
-
return expected === actual;
|
|
4434
|
-
}
|
|
4435
|
-
if (!!expected && !actual) {
|
|
4436
|
-
return false;
|
|
4437
|
-
}
|
|
4438
|
-
if (Array.isArray(expected)) {
|
|
4439
|
-
if (typeof actual.length !== "number") {
|
|
4440
|
-
return false;
|
|
4441
|
-
}
|
|
4442
|
-
var aa = Array.prototype.slice.call(actual);
|
|
4443
|
-
return expected.every(function(exp) {
|
|
4444
|
-
return aa.some(function(act4) {
|
|
4445
|
-
return compare(exp, act4);
|
|
4446
|
-
});
|
|
4447
|
-
});
|
|
4448
|
-
}
|
|
4449
|
-
if (expected instanceof Date) {
|
|
4450
|
-
if (actual instanceof Date) {
|
|
4451
|
-
return expected.getTime() === actual.getTime();
|
|
4452
|
-
} else {
|
|
4453
|
-
return false;
|
|
4454
|
-
}
|
|
4455
|
-
}
|
|
4456
|
-
return Object.keys(expected).every(function(key) {
|
|
4457
|
-
var eo = expected[key];
|
|
4458
|
-
var ao = actual[key];
|
|
4459
|
-
if (typeof eo === "object" && eo !== null && ao !== null) {
|
|
4460
|
-
return compare(eo, ao);
|
|
4461
|
-
}
|
|
4462
|
-
if (typeof eo === "function") {
|
|
4463
|
-
return eo(ao);
|
|
4464
|
-
}
|
|
4465
|
-
return ao === eo;
|
|
4466
|
-
});
|
|
4467
|
-
}
|
|
4468
|
-
});
|
|
4469
|
-
}).call(chaiSubset);
|
|
4470
|
-
})(chaiSubset$1);
|
|
4471
|
-
return chaiSubset$1.exports;
|
|
4472
|
-
}
|
|
4473
|
-
var chaiSubsetExports = requireChaiSubset();
|
|
4474
|
-
var Subset = /* @__PURE__ */ getDefaultExportFromCjs(chaiSubsetExports);
|
|
4475
|
-
function createAssertionMessage(util2, assertion, hasArgs) {
|
|
4476
|
-
const not = util2.flag(assertion, "negate") ? "not." : "";
|
|
4477
|
-
const name = `${util2.flag(assertion, "_name")}(${"expected"})`;
|
|
4478
|
-
const promiseName = util2.flag(assertion, "promise");
|
|
4479
|
-
const promise = promiseName ? `.${promiseName}` : "";
|
|
4480
|
-
return `expect(actual)${promise}.${not}${name}`;
|
|
4289
|
+
function createAssertionMessage(util, assertion, hasArgs) {
|
|
4290
|
+
const not = util.flag(assertion, "negate") ? "not." : "";
|
|
4291
|
+
const name = `${util.flag(assertion, "_name")}(${"expected"})`;
|
|
4292
|
+
const promiseName = util.flag(assertion, "promise");
|
|
4293
|
+
return `expect(actual)${promiseName ? `.${promiseName}` : ""}.${not}${name}`;
|
|
4481
4294
|
}
|
|
4482
4295
|
function recordAsyncExpect(_test, promise, assertion, error) {
|
|
4483
4296
|
const test2 = _test;
|
|
4484
4297
|
if (test2 && promise instanceof Promise) {
|
|
4485
4298
|
promise = promise.finally(() => {
|
|
4486
|
-
if (!test2.promises)
|
|
4487
|
-
return;
|
|
4488
|
-
}
|
|
4299
|
+
if (!test2.promises) return;
|
|
4489
4300
|
const index = test2.promises.indexOf(promise);
|
|
4490
|
-
if (index !== -1)
|
|
4491
|
-
test2.promises.splice(index, 1);
|
|
4492
|
-
}
|
|
4301
|
+
if (index !== -1) test2.promises.splice(index, 1);
|
|
4493
4302
|
});
|
|
4494
|
-
if (!test2.promises)
|
|
4495
|
-
test2.promises = [];
|
|
4496
|
-
}
|
|
4303
|
+
if (!test2.promises) test2.promises = [];
|
|
4497
4304
|
test2.promises.push(promise);
|
|
4498
4305
|
let resolved = false;
|
|
4499
4306
|
test2.onFinished ??= [];
|
|
4500
4307
|
test2.onFinished.push(() => {
|
|
4501
4308
|
if (!resolved) {
|
|
4502
|
-
const
|
|
4503
|
-
const stack = processor(error.stack);
|
|
4309
|
+
const stack = (globalThis.__vitest_worker__?.onFilterStackTrace || ((s) => s || ""))(error.stack);
|
|
4504
4310
|
console.warn([
|
|
4505
4311
|
`Promise returned by \`${assertion}\` was not awaited. `,
|
|
4506
4312
|
"Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. ",
|
|
@@ -4510,9 +4316,9 @@ function recordAsyncExpect(_test, promise, assertion, error) {
|
|
|
4510
4316
|
}
|
|
4511
4317
|
});
|
|
4512
4318
|
return {
|
|
4513
|
-
then(
|
|
4319
|
+
then(onFulfilled, onRejected) {
|
|
4514
4320
|
resolved = true;
|
|
4515
|
-
return promise.then(
|
|
4321
|
+
return promise.then(onFulfilled, onRejected);
|
|
4516
4322
|
},
|
|
4517
4323
|
catch(onRejected) {
|
|
4518
4324
|
return promise.catch(onRejected);
|
|
@@ -4527,22 +4333,14 @@ function recordAsyncExpect(_test, promise, assertion, error) {
|
|
|
4527
4333
|
}
|
|
4528
4334
|
var _client;
|
|
4529
4335
|
function getSnapshotClient() {
|
|
4530
|
-
if (!_client) {
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
return equals(received, expected, [iterableEquality, subsetEquality]);
|
|
4534
|
-
}
|
|
4535
|
-
});
|
|
4536
|
-
}
|
|
4336
|
+
if (!_client) _client = new SnapshotClient({ isEqual: (received, expected) => {
|
|
4337
|
+
return equals(received, expected, [iterableEquality, subsetEquality]);
|
|
4338
|
+
} });
|
|
4537
4339
|
return _client;
|
|
4538
4340
|
}
|
|
4539
4341
|
function getError(expected, promise) {
|
|
4540
4342
|
if (typeof expected !== "function") {
|
|
4541
|
-
if (!promise) {
|
|
4542
|
-
throw new Error(
|
|
4543
|
-
`expected must be a function, received ${typeof expected}`
|
|
4544
|
-
);
|
|
4545
|
-
}
|
|
4343
|
+
if (!promise) throw new Error(`expected must be a function, received ${typeof expected}`);
|
|
4546
4344
|
return expected;
|
|
4547
4345
|
}
|
|
4548
4346
|
try {
|
|
@@ -4553,248 +4351,174 @@ function getError(expected, promise) {
|
|
|
4553
4351
|
throw new Error("snapshot function didn't throw");
|
|
4554
4352
|
}
|
|
4555
4353
|
function getTestNames(test2) {
|
|
4556
|
-
if (!test2) {
|
|
4557
|
-
return {};
|
|
4558
|
-
}
|
|
4559
4354
|
return {
|
|
4560
4355
|
filepath: test2.file.filepath,
|
|
4561
|
-
name: getNames(test2).slice(1).join(" > ")
|
|
4356
|
+
name: getNames(test2).slice(1).join(" > "),
|
|
4357
|
+
testId: test2.id
|
|
4562
4358
|
};
|
|
4563
4359
|
}
|
|
4564
4360
|
var SnapshotPlugin = (chai3, utils) => {
|
|
4565
|
-
|
|
4566
|
-
utils.
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
);
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
"
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
}
|
|
4662
|
-
);
|
|
4663
|
-
utils.addMethod(
|
|
4664
|
-
chai3.Assertion.prototype,
|
|
4665
|
-
"toThrowErrorMatchingSnapshot",
|
|
4666
|
-
function(message) {
|
|
4667
|
-
utils.flag(this, "_name", "toThrowErrorMatchingSnapshot");
|
|
4668
|
-
const isNot = utils.flag(this, "negate");
|
|
4669
|
-
if (isNot) {
|
|
4670
|
-
throw new Error(
|
|
4671
|
-
'toThrowErrorMatchingSnapshot cannot be used with "not"'
|
|
4672
|
-
);
|
|
4673
|
-
}
|
|
4674
|
-
const expected = utils.flag(this, "object");
|
|
4675
|
-
const test2 = utils.flag(this, "vitest-test");
|
|
4676
|
-
const promise = utils.flag(this, "promise");
|
|
4677
|
-
const errorMessage = utils.flag(this, "message");
|
|
4678
|
-
getSnapshotClient().assert({
|
|
4679
|
-
received: getError(expected, promise),
|
|
4680
|
-
message,
|
|
4681
|
-
errorMessage,
|
|
4682
|
-
...getTestNames(test2)
|
|
4683
|
-
});
|
|
4684
|
-
}
|
|
4685
|
-
);
|
|
4686
|
-
utils.addMethod(
|
|
4687
|
-
chai3.Assertion.prototype,
|
|
4688
|
-
"toThrowErrorMatchingInlineSnapshot",
|
|
4689
|
-
function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
|
|
4690
|
-
const isNot = utils.flag(this, "negate");
|
|
4691
|
-
if (isNot) {
|
|
4692
|
-
throw new Error(
|
|
4693
|
-
'toThrowErrorMatchingInlineSnapshot cannot be used with "not"'
|
|
4694
|
-
);
|
|
4695
|
-
}
|
|
4696
|
-
const test2 = utils.flag(this, "vitest-test");
|
|
4697
|
-
const isInsideEach = test2 && (test2.each || test2.suite?.each);
|
|
4698
|
-
if (isInsideEach) {
|
|
4699
|
-
throw new Error(
|
|
4700
|
-
"InlineSnapshot cannot be used inside of test.each or describe.each"
|
|
4701
|
-
);
|
|
4702
|
-
}
|
|
4703
|
-
const expected = utils.flag(this, "object");
|
|
4704
|
-
const error = utils.flag(this, "error");
|
|
4705
|
-
const promise = utils.flag(this, "promise");
|
|
4706
|
-
const errorMessage = utils.flag(this, "message");
|
|
4707
|
-
if (inlineSnapshot) {
|
|
4708
|
-
inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
4709
|
-
}
|
|
4710
|
-
getSnapshotClient().assert({
|
|
4711
|
-
received: getError(expected, promise),
|
|
4712
|
-
message,
|
|
4713
|
-
inlineSnapshot,
|
|
4714
|
-
isInline: true,
|
|
4715
|
-
error,
|
|
4716
|
-
errorMessage,
|
|
4717
|
-
...getTestNames(test2)
|
|
4718
|
-
});
|
|
4719
|
-
}
|
|
4720
|
-
);
|
|
4361
|
+
function getTest(assertionName, obj) {
|
|
4362
|
+
const test2 = utils.flag(obj, "vitest-test");
|
|
4363
|
+
if (!test2) throw new Error(`'${assertionName}' cannot be used without test context`);
|
|
4364
|
+
return test2;
|
|
4365
|
+
}
|
|
4366
|
+
for (const key of ["matchSnapshot", "toMatchSnapshot"]) utils.addMethod(chai3.Assertion.prototype, key, function(properties, message) {
|
|
4367
|
+
utils.flag(this, "_name", key);
|
|
4368
|
+
if (utils.flag(this, "negate")) throw new Error(`${key} cannot be used with "not"`);
|
|
4369
|
+
const expected = utils.flag(this, "object");
|
|
4370
|
+
const test2 = getTest(key, this);
|
|
4371
|
+
if (typeof properties === "string" && typeof message === "undefined") {
|
|
4372
|
+
message = properties;
|
|
4373
|
+
properties = void 0;
|
|
4374
|
+
}
|
|
4375
|
+
const errorMessage = utils.flag(this, "message");
|
|
4376
|
+
getSnapshotClient().assert({
|
|
4377
|
+
received: expected,
|
|
4378
|
+
message,
|
|
4379
|
+
isInline: false,
|
|
4380
|
+
properties,
|
|
4381
|
+
errorMessage,
|
|
4382
|
+
...getTestNames(test2)
|
|
4383
|
+
});
|
|
4384
|
+
});
|
|
4385
|
+
utils.addMethod(chai3.Assertion.prototype, "toMatchFileSnapshot", function(file, message) {
|
|
4386
|
+
utils.flag(this, "_name", "toMatchFileSnapshot");
|
|
4387
|
+
if (utils.flag(this, "negate")) throw new Error('toMatchFileSnapshot cannot be used with "not"');
|
|
4388
|
+
const error = /* @__PURE__ */ new Error("resolves");
|
|
4389
|
+
const expected = utils.flag(this, "object");
|
|
4390
|
+
const test2 = getTest("toMatchFileSnapshot", this);
|
|
4391
|
+
const errorMessage = utils.flag(this, "message");
|
|
4392
|
+
return recordAsyncExpect(test2, getSnapshotClient().assertRaw({
|
|
4393
|
+
received: expected,
|
|
4394
|
+
message,
|
|
4395
|
+
isInline: false,
|
|
4396
|
+
rawSnapshot: { file },
|
|
4397
|
+
errorMessage,
|
|
4398
|
+
...getTestNames(test2)
|
|
4399
|
+
}), createAssertionMessage(utils, this), error);
|
|
4400
|
+
});
|
|
4401
|
+
utils.addMethod(chai3.Assertion.prototype, "toMatchInlineSnapshot", function __INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
|
|
4402
|
+
utils.flag(this, "_name", "toMatchInlineSnapshot");
|
|
4403
|
+
if (utils.flag(this, "negate")) throw new Error('toMatchInlineSnapshot cannot be used with "not"');
|
|
4404
|
+
const test2 = getTest("toMatchInlineSnapshot", this);
|
|
4405
|
+
if (test2.each || test2.suite?.each) throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
4406
|
+
const expected = utils.flag(this, "object");
|
|
4407
|
+
const error = utils.flag(this, "error");
|
|
4408
|
+
if (typeof properties === "string") {
|
|
4409
|
+
message = inlineSnapshot;
|
|
4410
|
+
inlineSnapshot = properties;
|
|
4411
|
+
properties = void 0;
|
|
4412
|
+
}
|
|
4413
|
+
if (inlineSnapshot) inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
4414
|
+
const errorMessage = utils.flag(this, "message");
|
|
4415
|
+
getSnapshotClient().assert({
|
|
4416
|
+
received: expected,
|
|
4417
|
+
message,
|
|
4418
|
+
isInline: true,
|
|
4419
|
+
properties,
|
|
4420
|
+
inlineSnapshot,
|
|
4421
|
+
error,
|
|
4422
|
+
errorMessage,
|
|
4423
|
+
...getTestNames(test2)
|
|
4424
|
+
});
|
|
4425
|
+
});
|
|
4426
|
+
utils.addMethod(chai3.Assertion.prototype, "toThrowErrorMatchingSnapshot", function(message) {
|
|
4427
|
+
utils.flag(this, "_name", "toThrowErrorMatchingSnapshot");
|
|
4428
|
+
if (utils.flag(this, "negate")) throw new Error('toThrowErrorMatchingSnapshot cannot be used with "not"');
|
|
4429
|
+
const expected = utils.flag(this, "object");
|
|
4430
|
+
const test2 = getTest("toThrowErrorMatchingSnapshot", this);
|
|
4431
|
+
const promise = utils.flag(this, "promise");
|
|
4432
|
+
const errorMessage = utils.flag(this, "message");
|
|
4433
|
+
getSnapshotClient().assert({
|
|
4434
|
+
received: getError(expected, promise),
|
|
4435
|
+
message,
|
|
4436
|
+
errorMessage,
|
|
4437
|
+
...getTestNames(test2)
|
|
4438
|
+
});
|
|
4439
|
+
});
|
|
4440
|
+
utils.addMethod(chai3.Assertion.prototype, "toThrowErrorMatchingInlineSnapshot", function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
|
|
4441
|
+
if (utils.flag(this, "negate")) throw new Error('toThrowErrorMatchingInlineSnapshot cannot be used with "not"');
|
|
4442
|
+
const test2 = getTest("toThrowErrorMatchingInlineSnapshot", this);
|
|
4443
|
+
if (test2.each || test2.suite?.each) throw new Error("InlineSnapshot cannot be used inside of test.each or describe.each");
|
|
4444
|
+
const expected = utils.flag(this, "object");
|
|
4445
|
+
const error = utils.flag(this, "error");
|
|
4446
|
+
const promise = utils.flag(this, "promise");
|
|
4447
|
+
const errorMessage = utils.flag(this, "message");
|
|
4448
|
+
if (inlineSnapshot) inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
4449
|
+
getSnapshotClient().assert({
|
|
4450
|
+
received: getError(expected, promise),
|
|
4451
|
+
message,
|
|
4452
|
+
inlineSnapshot,
|
|
4453
|
+
isInline: true,
|
|
4454
|
+
error,
|
|
4455
|
+
errorMessage,
|
|
4456
|
+
...getTestNames(test2)
|
|
4457
|
+
});
|
|
4458
|
+
});
|
|
4721
4459
|
utils.addMethod(chai3.expect, "addSnapshotSerializer", addSerializer);
|
|
4722
4460
|
};
|
|
4723
|
-
chai
|
|
4724
|
-
chai
|
|
4725
|
-
chai
|
|
4726
|
-
chai
|
|
4727
|
-
chai$1.use(JestAsymmetricMatchers);
|
|
4461
|
+
chai.use(JestExtend);
|
|
4462
|
+
chai.use(JestChaiExpect);
|
|
4463
|
+
chai.use(SnapshotPlugin);
|
|
4464
|
+
chai.use(JestAsymmetricMatchers);
|
|
4728
4465
|
function createExpect(test2) {
|
|
4729
|
-
const
|
|
4730
|
-
const { assertionCalls } = getState(
|
|
4731
|
-
setState({ assertionCalls: assertionCalls + 1 },
|
|
4732
|
-
const
|
|
4466
|
+
const expect = ((value, message) => {
|
|
4467
|
+
const { assertionCalls } = getState(expect);
|
|
4468
|
+
setState({ assertionCalls: assertionCalls + 1 }, expect);
|
|
4469
|
+
const assert2 = chai.expect(value, message);
|
|
4733
4470
|
const _test = getCurrentTest();
|
|
4734
|
-
if (_test)
|
|
4735
|
-
return
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
expect2.getState = () => getState(expect2);
|
|
4743
|
-
expect2.setState = (state) => setState(state, expect2);
|
|
4471
|
+
if (_test)
|
|
4472
|
+
return assert2.withTest(_test);
|
|
4473
|
+
else return assert2;
|
|
4474
|
+
});
|
|
4475
|
+
Object.assign(expect, chai.expect);
|
|
4476
|
+
Object.assign(expect, globalThis[ASYMMETRIC_MATCHERS_OBJECT]);
|
|
4477
|
+
expect.getState = () => getState(expect);
|
|
4478
|
+
expect.setState = (state) => setState(state, expect);
|
|
4744
4479
|
const globalState = getState(globalThis[GLOBAL_EXPECT]) || {};
|
|
4745
|
-
setState(
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
environment: getCurrentEnvironment(),
|
|
4755
|
-
get testPath() {
|
|
4756
|
-
return getWorkerState().filepath;
|
|
4757
|
-
},
|
|
4758
|
-
currentTestName: globalState.currentTestName
|
|
4480
|
+
setState({
|
|
4481
|
+
...globalState,
|
|
4482
|
+
assertionCalls: 0,
|
|
4483
|
+
isExpectingAssertions: false,
|
|
4484
|
+
isExpectingAssertionsError: null,
|
|
4485
|
+
expectedAssertionsNumber: null,
|
|
4486
|
+
expectedAssertionsNumberErrorGen: null,
|
|
4487
|
+
get testPath() {
|
|
4488
|
+
return getWorkerState().filepath;
|
|
4759
4489
|
},
|
|
4760
|
-
|
|
4761
|
-
);
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4490
|
+
currentTestName: globalState.currentTestName
|
|
4491
|
+
}, expect);
|
|
4492
|
+
expect.assert = chai.assert;
|
|
4493
|
+
expect.extend = (matchers) => chai.expect.extend(expect, matchers);
|
|
4494
|
+
expect.addEqualityTesters = (customTesters) => addCustomEqualityTesters(customTesters);
|
|
4495
|
+
expect.soft = (...args) => {
|
|
4496
|
+
return expect(...args).withContext({ soft: true });
|
|
4766
4497
|
};
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
chai
|
|
4770
|
-
`expected${message ? ` "${message}" ` : " "}not to be reached`
|
|
4771
|
-
);
|
|
4498
|
+
expect.poll = createExpectPoll(expect);
|
|
4499
|
+
expect.unreachable = (message) => {
|
|
4500
|
+
chai.assert.fail(`expected${message ? ` "${message}" ` : " "}not to be reached`);
|
|
4772
4501
|
};
|
|
4773
4502
|
function assertions(expected) {
|
|
4774
|
-
const errorGen = () => new Error(
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
if (Error.captureStackTrace) {
|
|
4778
|
-
Error.captureStackTrace(errorGen(), assertions);
|
|
4779
|
-
}
|
|
4780
|
-
expect2.setState({
|
|
4503
|
+
const errorGen = () => /* @__PURE__ */ new Error(`expected number of assertions to be ${expected}, but got ${expect.getState().assertionCalls}`);
|
|
4504
|
+
if (Error.captureStackTrace) Error.captureStackTrace(errorGen(), assertions);
|
|
4505
|
+
expect.setState({
|
|
4781
4506
|
expectedAssertionsNumber: expected,
|
|
4782
4507
|
expectedAssertionsNumberErrorGen: errorGen
|
|
4783
4508
|
});
|
|
4784
4509
|
}
|
|
4785
4510
|
function hasAssertions() {
|
|
4786
|
-
const error = new Error("expected any number of assertion, but got none");
|
|
4787
|
-
if (Error.captureStackTrace)
|
|
4788
|
-
|
|
4789
|
-
}
|
|
4790
|
-
expect2.setState({
|
|
4511
|
+
const error = /* @__PURE__ */ new Error("expected any number of assertion, but got none");
|
|
4512
|
+
if (Error.captureStackTrace) Error.captureStackTrace(error, hasAssertions);
|
|
4513
|
+
expect.setState({
|
|
4791
4514
|
isExpectingAssertions: true,
|
|
4792
4515
|
isExpectingAssertionsError: error
|
|
4793
4516
|
});
|
|
4794
4517
|
}
|
|
4795
|
-
chai
|
|
4796
|
-
chai
|
|
4797
|
-
|
|
4518
|
+
chai.util.addMethod(expect, "assertions", assertions);
|
|
4519
|
+
chai.util.addMethod(expect, "hasAssertions", hasAssertions);
|
|
4520
|
+
expect.extend(customMatchers);
|
|
4521
|
+
return expect;
|
|
4798
4522
|
}
|
|
4799
4523
|
var globalExpect = createExpect();
|
|
4800
4524
|
Object.defineProperty(globalThis, GLOBAL_EXPECT, {
|
|
@@ -4802,6 +4526,8 @@ Object.defineProperty(globalThis, GLOBAL_EXPECT, {
|
|
|
4802
4526
|
writable: true,
|
|
4803
4527
|
configurable: true
|
|
4804
4528
|
});
|
|
4529
|
+
chai.assert;
|
|
4530
|
+
chai.should;
|
|
4805
4531
|
var fakeTimersSrc = {};
|
|
4806
4532
|
var global2;
|
|
4807
4533
|
var hasRequiredGlobal;
|
|
@@ -4909,42 +4635,14 @@ function requireCalledInOrder() {
|
|
|
4909
4635
|
calledInOrder_1 = calledInOrder;
|
|
4910
4636
|
return calledInOrder_1;
|
|
4911
4637
|
}
|
|
4912
|
-
var functionName;
|
|
4913
|
-
var hasRequiredFunctionName;
|
|
4914
|
-
function requireFunctionName() {
|
|
4915
|
-
if (hasRequiredFunctionName) return functionName;
|
|
4916
|
-
hasRequiredFunctionName = 1;
|
|
4917
|
-
functionName = function functionName2(func) {
|
|
4918
|
-
if (!func) {
|
|
4919
|
-
return "";
|
|
4920
|
-
}
|
|
4921
|
-
try {
|
|
4922
|
-
return func.displayName || func.name || // Use function decomposition as a last resort to get function
|
|
4923
|
-
// name. Does not rely on function decomposition to work - if it
|
|
4924
|
-
// doesn't debugging will be slightly less informative
|
|
4925
|
-
// (i.e. toString will say 'spy' rather than 'myFunc').
|
|
4926
|
-
(String(func).match(/function ([^\s(]+)/) || [])[1];
|
|
4927
|
-
} catch (e) {
|
|
4928
|
-
return "";
|
|
4929
|
-
}
|
|
4930
|
-
};
|
|
4931
|
-
return functionName;
|
|
4932
|
-
}
|
|
4933
4638
|
var className_1;
|
|
4934
4639
|
var hasRequiredClassName;
|
|
4935
4640
|
function requireClassName() {
|
|
4936
4641
|
if (hasRequiredClassName) return className_1;
|
|
4937
4642
|
hasRequiredClassName = 1;
|
|
4938
|
-
var functionName2 = requireFunctionName();
|
|
4939
4643
|
function className(value) {
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
// of the Function object, we finally try to grab the
|
|
4943
|
-
// name from its definition. This will never be reached
|
|
4944
|
-
// in node, so we are not able to test this properly.
|
|
4945
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
|
|
4946
|
-
typeof value.constructor === "function" && /* istanbul ignore next */
|
|
4947
|
-
functionName2(value.constructor) || null;
|
|
4644
|
+
const name = value.constructor && value.constructor.name;
|
|
4645
|
+
return name || null;
|
|
4948
4646
|
}
|
|
4949
4647
|
className_1 = className;
|
|
4950
4648
|
return className_1;
|
|
@@ -5000,6 +4698,27 @@ function requireEvery() {
|
|
|
5000
4698
|
};
|
|
5001
4699
|
return every;
|
|
5002
4700
|
}
|
|
4701
|
+
var functionName;
|
|
4702
|
+
var hasRequiredFunctionName;
|
|
4703
|
+
function requireFunctionName() {
|
|
4704
|
+
if (hasRequiredFunctionName) return functionName;
|
|
4705
|
+
hasRequiredFunctionName = 1;
|
|
4706
|
+
functionName = function functionName2(func) {
|
|
4707
|
+
if (!func) {
|
|
4708
|
+
return "";
|
|
4709
|
+
}
|
|
4710
|
+
try {
|
|
4711
|
+
return func.displayName || func.name || // Use function decomposition as a last resort to get function
|
|
4712
|
+
// name. Does not rely on function decomposition to work - if it
|
|
4713
|
+
// doesn't debugging will be slightly less informative
|
|
4714
|
+
// (i.e. toString will say 'spy' rather than 'myFunc').
|
|
4715
|
+
(String(func).match(/function ([^\s(]+)/) || [])[1];
|
|
4716
|
+
} catch (e) {
|
|
4717
|
+
return "";
|
|
4718
|
+
}
|
|
4719
|
+
};
|
|
4720
|
+
return functionName;
|
|
4721
|
+
}
|
|
5003
4722
|
var orderByFirstCall_1;
|
|
5004
4723
|
var hasRequiredOrderByFirstCall;
|
|
5005
4724
|
function requireOrderByFirstCall() {
|
|
@@ -5251,12 +4970,16 @@ function requireFakeTimersSrc() {
|
|
|
5251
4970
|
if (hasRequiredFakeTimersSrc) return fakeTimersSrc;
|
|
5252
4971
|
hasRequiredFakeTimersSrc = 1;
|
|
5253
4972
|
const globalObject = requireLib().global;
|
|
5254
|
-
let timersModule;
|
|
4973
|
+
let timersModule, timersPromisesModule;
|
|
5255
4974
|
if (typeof __vitest_required__ !== "undefined") {
|
|
5256
4975
|
try {
|
|
5257
4976
|
timersModule = __vitest_required__.timers;
|
|
5258
4977
|
} catch (e) {
|
|
5259
4978
|
}
|
|
4979
|
+
try {
|
|
4980
|
+
timersPromisesModule = __vitest_required__.timersPromises;
|
|
4981
|
+
} catch (e) {
|
|
4982
|
+
}
|
|
5260
4983
|
}
|
|
5261
4984
|
function withGlobal(_global) {
|
|
5262
4985
|
const maxTimeout = Math.pow(2, 31) - 1;
|
|
@@ -5267,26 +4990,57 @@ function requireFakeTimersSrc() {
|
|
|
5267
4990
|
const NOOP_ARRAY = function() {
|
|
5268
4991
|
return [];
|
|
5269
4992
|
};
|
|
5270
|
-
const
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
4993
|
+
const isPresent = {};
|
|
4994
|
+
let timeoutResult, addTimerReturnsObject = false;
|
|
4995
|
+
if (_global.setTimeout) {
|
|
4996
|
+
isPresent.setTimeout = true;
|
|
4997
|
+
timeoutResult = _global.setTimeout(NOOP, 0);
|
|
4998
|
+
addTimerReturnsObject = typeof timeoutResult === "object";
|
|
4999
|
+
}
|
|
5000
|
+
isPresent.clearTimeout = Boolean(_global.clearTimeout);
|
|
5001
|
+
isPresent.setInterval = Boolean(_global.setInterval);
|
|
5002
|
+
isPresent.clearInterval = Boolean(_global.clearInterval);
|
|
5003
|
+
isPresent.hrtime = _global.process && typeof _global.process.hrtime === "function";
|
|
5004
|
+
isPresent.hrtimeBigint = isPresent.hrtime && typeof _global.process.hrtime.bigint === "function";
|
|
5005
|
+
isPresent.nextTick = _global.process && typeof _global.process.nextTick === "function";
|
|
5275
5006
|
const utilPromisify = _global.process && _global.__vitest_required__ && _global.__vitest_required__.util.promisify;
|
|
5276
|
-
|
|
5007
|
+
isPresent.performance = _global.performance && typeof _global.performance.now === "function";
|
|
5277
5008
|
const hasPerformancePrototype = _global.Performance && (typeof _global.Performance).match(/^(function|object)$/);
|
|
5278
5009
|
const hasPerformanceConstructorPrototype = _global.performance && _global.performance.constructor && _global.performance.constructor.prototype;
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
_global.
|
|
5010
|
+
isPresent.queueMicrotask = _global.hasOwnProperty("queueMicrotask");
|
|
5011
|
+
isPresent.requestAnimationFrame = _global.requestAnimationFrame && typeof _global.requestAnimationFrame === "function";
|
|
5012
|
+
isPresent.cancelAnimationFrame = _global.cancelAnimationFrame && typeof _global.cancelAnimationFrame === "function";
|
|
5013
|
+
isPresent.requestIdleCallback = _global.requestIdleCallback && typeof _global.requestIdleCallback === "function";
|
|
5014
|
+
isPresent.cancelIdleCallbackPresent = _global.cancelIdleCallback && typeof _global.cancelIdleCallback === "function";
|
|
5015
|
+
isPresent.setImmediate = _global.setImmediate && typeof _global.setImmediate === "function";
|
|
5016
|
+
isPresent.clearImmediate = _global.clearImmediate && typeof _global.clearImmediate === "function";
|
|
5017
|
+
isPresent.Intl = _global.Intl && typeof _global.Intl === "object";
|
|
5018
|
+
if (_global.clearTimeout) {
|
|
5019
|
+
_global.clearTimeout(timeoutResult);
|
|
5020
|
+
}
|
|
5287
5021
|
const NativeDate = _global.Date;
|
|
5288
|
-
const NativeIntl =
|
|
5022
|
+
const NativeIntl = isPresent.Intl ? Object.defineProperties(
|
|
5023
|
+
/* @__PURE__ */ Object.create(null),
|
|
5024
|
+
Object.getOwnPropertyDescriptors(_global.Intl)
|
|
5025
|
+
) : void 0;
|
|
5289
5026
|
let uniqueTimerId = idCounterStart;
|
|
5027
|
+
if (NativeDate === void 0) {
|
|
5028
|
+
throw new Error(
|
|
5029
|
+
"The global scope doesn't have a `Date` object (see https://github.com/sinonjs/sinon/issues/1852#issuecomment-419622780)"
|
|
5030
|
+
);
|
|
5031
|
+
}
|
|
5032
|
+
isPresent.Date = true;
|
|
5033
|
+
class FakePerformanceEntry {
|
|
5034
|
+
constructor(name, entryType, startTime, duration) {
|
|
5035
|
+
this.name = name;
|
|
5036
|
+
this.entryType = entryType;
|
|
5037
|
+
this.startTime = startTime;
|
|
5038
|
+
this.duration = duration;
|
|
5039
|
+
}
|
|
5040
|
+
toJSON() {
|
|
5041
|
+
return JSON.stringify({ ...this });
|
|
5042
|
+
}
|
|
5043
|
+
}
|
|
5290
5044
|
function isNumberFinite(num) {
|
|
5291
5045
|
if (Number.isFinite) {
|
|
5292
5046
|
return Number.isFinite(num);
|
|
@@ -5387,80 +5141,66 @@ ${job.error.stack.split("\n").slice(matchedLineIndex + 1).join("\n")}`;
|
|
|
5387
5141
|
}
|
|
5388
5142
|
return infiniteLoopError;
|
|
5389
5143
|
}
|
|
5390
|
-
function
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5144
|
+
function createDate() {
|
|
5145
|
+
class ClockDate extends NativeDate {
|
|
5146
|
+
/**
|
|
5147
|
+
* @param {number} year
|
|
5148
|
+
* @param {number} month
|
|
5149
|
+
* @param {number} date
|
|
5150
|
+
* @param {number} hour
|
|
5151
|
+
* @param {number} minute
|
|
5152
|
+
* @param {number} second
|
|
5153
|
+
* @param {number} ms
|
|
5154
|
+
* @returns void
|
|
5155
|
+
*/
|
|
5156
|
+
// eslint-disable-next-line no-unused-vars
|
|
5157
|
+
constructor(year, month, date, hour, minute, second, ms) {
|
|
5158
|
+
if (arguments.length === 0) {
|
|
5159
|
+
super(ClockDate.clock.now);
|
|
5160
|
+
} else {
|
|
5161
|
+
super(...arguments);
|
|
5162
|
+
}
|
|
5163
|
+
Object.defineProperty(this, "constructor", {
|
|
5164
|
+
value: NativeDate,
|
|
5165
|
+
enumerable: false
|
|
5166
|
+
});
|
|
5167
|
+
}
|
|
5168
|
+
static [Symbol.hasInstance](instance) {
|
|
5169
|
+
return instance instanceof NativeDate;
|
|
5395
5170
|
}
|
|
5396
5171
|
}
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5172
|
+
ClockDate.isFake = true;
|
|
5173
|
+
if (NativeDate.now) {
|
|
5174
|
+
ClockDate.now = function now2() {
|
|
5175
|
+
return ClockDate.clock.now;
|
|
5400
5176
|
};
|
|
5401
|
-
} else {
|
|
5402
|
-
delete target.now;
|
|
5403
5177
|
}
|
|
5404
|
-
if (
|
|
5405
|
-
|
|
5406
|
-
return
|
|
5178
|
+
if (NativeDate.toSource) {
|
|
5179
|
+
ClockDate.toSource = function toSource() {
|
|
5180
|
+
return NativeDate.toSource();
|
|
5407
5181
|
};
|
|
5408
|
-
} else {
|
|
5409
|
-
delete target.toSource;
|
|
5410
5182
|
}
|
|
5411
|
-
|
|
5412
|
-
return
|
|
5183
|
+
ClockDate.toString = function toString() {
|
|
5184
|
+
return NativeDate.toString();
|
|
5413
5185
|
};
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
}
|
|
5421
|
-
function createDate() {
|
|
5422
|
-
function ClockDate(year, month, date, hour, minute, second, ms) {
|
|
5423
|
-
if (!(this instanceof ClockDate)) {
|
|
5424
|
-
return new NativeDate(ClockDate.clock.now).toString();
|
|
5425
|
-
}
|
|
5426
|
-
switch (arguments.length) {
|
|
5427
|
-
case 0:
|
|
5428
|
-
return new NativeDate(ClockDate.clock.now);
|
|
5429
|
-
case 1:
|
|
5430
|
-
return new NativeDate(year);
|
|
5431
|
-
case 2:
|
|
5432
|
-
return new NativeDate(year, month);
|
|
5433
|
-
case 3:
|
|
5434
|
-
return new NativeDate(year, month, date);
|
|
5435
|
-
case 4:
|
|
5436
|
-
return new NativeDate(year, month, date, hour);
|
|
5437
|
-
case 5:
|
|
5438
|
-
return new NativeDate(year, month, date, hour, minute);
|
|
5439
|
-
case 6:
|
|
5440
|
-
return new NativeDate(
|
|
5441
|
-
year,
|
|
5442
|
-
month,
|
|
5443
|
-
date,
|
|
5444
|
-
hour,
|
|
5445
|
-
minute,
|
|
5446
|
-
second
|
|
5447
|
-
);
|
|
5448
|
-
default:
|
|
5449
|
-
return new NativeDate(
|
|
5450
|
-
year,
|
|
5451
|
-
month,
|
|
5452
|
-
date,
|
|
5453
|
-
hour,
|
|
5454
|
-
minute,
|
|
5455
|
-
second,
|
|
5456
|
-
ms
|
|
5186
|
+
const ClockDateProxy = new Proxy(ClockDate, {
|
|
5187
|
+
// handler for [[Call]] invocations (i.e. not using `new`)
|
|
5188
|
+
apply() {
|
|
5189
|
+
if (this instanceof ClockDate) {
|
|
5190
|
+
throw new TypeError(
|
|
5191
|
+
"A Proxy should only capture `new` calls with the `construct` handler. This is not supposed to be possible, so check the logic."
|
|
5457
5192
|
);
|
|
5193
|
+
}
|
|
5194
|
+
return new NativeDate(ClockDate.clock.now).toString();
|
|
5458
5195
|
}
|
|
5459
|
-
}
|
|
5460
|
-
return
|
|
5196
|
+
});
|
|
5197
|
+
return ClockDateProxy;
|
|
5461
5198
|
}
|
|
5462
5199
|
function createIntl() {
|
|
5463
|
-
const ClockIntl = {
|
|
5200
|
+
const ClockIntl = {};
|
|
5201
|
+
Object.getOwnPropertyNames(NativeIntl).forEach(
|
|
5202
|
+
(property) => ClockIntl[property] = NativeIntl[property]
|
|
5203
|
+
);
|
|
5464
5204
|
ClockIntl.DateTimeFormat = function(...args) {
|
|
5465
5205
|
const realFormatter = new NativeIntl.DateTimeFormat(...args);
|
|
5466
5206
|
const formatter = {};
|
|
@@ -5746,11 +5486,21 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
5746
5486
|
timersModule[entry.methodName] = entry.original;
|
|
5747
5487
|
}
|
|
5748
5488
|
}
|
|
5489
|
+
if (clock.timersPromisesModuleMethods !== void 0) {
|
|
5490
|
+
for (let j = 0; j < clock.timersPromisesModuleMethods.length; j++) {
|
|
5491
|
+
const entry = clock.timersPromisesModuleMethods[j];
|
|
5492
|
+
timersPromisesModule[entry.methodName] = entry.original;
|
|
5493
|
+
}
|
|
5494
|
+
}
|
|
5749
5495
|
}
|
|
5750
5496
|
if (config2.shouldAdvanceTime === true) {
|
|
5751
5497
|
_global.clearInterval(clock.attachedInterval);
|
|
5752
5498
|
}
|
|
5753
5499
|
clock.methods = [];
|
|
5500
|
+
for (const [listener, signal] of clock.abortListenerMap.entries()) {
|
|
5501
|
+
signal.removeEventListener("abort", listener);
|
|
5502
|
+
clock.abortListenerMap.delete(listener);
|
|
5503
|
+
}
|
|
5754
5504
|
if (!clock.timers) {
|
|
5755
5505
|
return [];
|
|
5756
5506
|
}
|
|
@@ -5765,8 +5515,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
5765
5515
|
);
|
|
5766
5516
|
clock[`_${method}`] = target[method];
|
|
5767
5517
|
if (method === "Date") {
|
|
5768
|
-
|
|
5769
|
-
target[method] = date;
|
|
5518
|
+
target[method] = clock[method];
|
|
5770
5519
|
} else if (method === "Intl") {
|
|
5771
5520
|
target[method] = clock[method];
|
|
5772
5521
|
} else if (method === "performance") {
|
|
@@ -5809,36 +5558,38 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
5809
5558
|
clearInterval: _global.clearInterval,
|
|
5810
5559
|
Date: _global.Date
|
|
5811
5560
|
};
|
|
5812
|
-
if (
|
|
5561
|
+
if (isPresent.setImmediate) {
|
|
5813
5562
|
timers.setImmediate = _global.setImmediate;
|
|
5563
|
+
}
|
|
5564
|
+
if (isPresent.clearImmediate) {
|
|
5814
5565
|
timers.clearImmediate = _global.clearImmediate;
|
|
5815
5566
|
}
|
|
5816
|
-
if (
|
|
5567
|
+
if (isPresent.hrtime) {
|
|
5817
5568
|
timers.hrtime = _global.process.hrtime;
|
|
5818
5569
|
}
|
|
5819
|
-
if (
|
|
5570
|
+
if (isPresent.nextTick) {
|
|
5820
5571
|
timers.nextTick = _global.process.nextTick;
|
|
5821
5572
|
}
|
|
5822
|
-
if (
|
|
5573
|
+
if (isPresent.performance) {
|
|
5823
5574
|
timers.performance = _global.performance;
|
|
5824
5575
|
}
|
|
5825
|
-
if (
|
|
5576
|
+
if (isPresent.requestAnimationFrame) {
|
|
5826
5577
|
timers.requestAnimationFrame = _global.requestAnimationFrame;
|
|
5827
5578
|
}
|
|
5828
|
-
if (
|
|
5829
|
-
timers.queueMicrotask =
|
|
5579
|
+
if (isPresent.queueMicrotask) {
|
|
5580
|
+
timers.queueMicrotask = _global.queueMicrotask;
|
|
5830
5581
|
}
|
|
5831
|
-
if (
|
|
5582
|
+
if (isPresent.cancelAnimationFrame) {
|
|
5832
5583
|
timers.cancelAnimationFrame = _global.cancelAnimationFrame;
|
|
5833
5584
|
}
|
|
5834
|
-
if (
|
|
5585
|
+
if (isPresent.requestIdleCallback) {
|
|
5835
5586
|
timers.requestIdleCallback = _global.requestIdleCallback;
|
|
5836
5587
|
}
|
|
5837
|
-
if (
|
|
5588
|
+
if (isPresent.cancelIdleCallback) {
|
|
5838
5589
|
timers.cancelIdleCallback = _global.cancelIdleCallback;
|
|
5839
5590
|
}
|
|
5840
|
-
if (
|
|
5841
|
-
timers.Intl =
|
|
5591
|
+
if (isPresent.Intl) {
|
|
5592
|
+
timers.Intl = NativeIntl;
|
|
5842
5593
|
}
|
|
5843
5594
|
const originalSetTimeout = _global.setImmediate || _global.setTimeout;
|
|
5844
5595
|
function createClock(start, loopLimit) {
|
|
@@ -5846,11 +5597,6 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
5846
5597
|
loopLimit = loopLimit || 1e3;
|
|
5847
5598
|
let nanos = 0;
|
|
5848
5599
|
const adjustedSystemTime = [0, 0];
|
|
5849
|
-
if (NativeDate === void 0) {
|
|
5850
|
-
throw new Error(
|
|
5851
|
-
"The global scope doesn't have a `Date` object (see https://github.com/sinonjs/sinon/issues/1852#issuecomment-419622780)"
|
|
5852
|
-
);
|
|
5853
|
-
}
|
|
5854
5600
|
const clock = {
|
|
5855
5601
|
now: start,
|
|
5856
5602
|
Date: createDate(),
|
|
@@ -5886,13 +5632,13 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
5886
5632
|
const millis = hrt[0] * 1e3 + hrt[1] / 1e6;
|
|
5887
5633
|
return millis;
|
|
5888
5634
|
}
|
|
5889
|
-
if (
|
|
5635
|
+
if (isPresent.hrtimeBigint) {
|
|
5890
5636
|
hrtime.bigint = function() {
|
|
5891
5637
|
const parts = hrtime();
|
|
5892
5638
|
return BigInt(parts[0]) * BigInt(1e9) + BigInt(parts[1]);
|
|
5893
5639
|
};
|
|
5894
5640
|
}
|
|
5895
|
-
if (
|
|
5641
|
+
if (isPresent.Intl) {
|
|
5896
5642
|
clock.Intl = createIntl();
|
|
5897
5643
|
clock.Intl.clock = clock;
|
|
5898
5644
|
}
|
|
@@ -5955,7 +5701,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
5955
5701
|
clock.clearInterval = function clearInterval2(timerId) {
|
|
5956
5702
|
return clearTimer(clock, timerId, "Interval");
|
|
5957
5703
|
};
|
|
5958
|
-
if (
|
|
5704
|
+
if (isPresent.setImmediate) {
|
|
5959
5705
|
clock.setImmediate = function setImmediate(func) {
|
|
5960
5706
|
return addTimer(clock, {
|
|
5961
5707
|
func,
|
|
@@ -6188,6 +5934,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
6188
5934
|
function doRun() {
|
|
6189
5935
|
originalSetTimeout(function() {
|
|
6190
5936
|
try {
|
|
5937
|
+
runJobs(clock);
|
|
6191
5938
|
let numTimers;
|
|
6192
5939
|
if (i < clock.loopLimit) {
|
|
6193
5940
|
if (!clock.timers) {
|
|
@@ -6235,6 +5982,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
6235
5982
|
try {
|
|
6236
5983
|
const timer = lastTimer(clock);
|
|
6237
5984
|
if (!timer) {
|
|
5985
|
+
runJobs(clock);
|
|
6238
5986
|
resolve(clock.now);
|
|
6239
5987
|
}
|
|
6240
5988
|
resolve(clock.tickAsync(timer.callAt - clock.now));
|
|
@@ -6277,11 +6025,11 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
6277
6025
|
}
|
|
6278
6026
|
clock.tick(ms);
|
|
6279
6027
|
};
|
|
6280
|
-
if (
|
|
6028
|
+
if (isPresent.performance) {
|
|
6281
6029
|
clock.performance = /* @__PURE__ */ Object.create(null);
|
|
6282
6030
|
clock.performance.now = fakePerformanceNow;
|
|
6283
6031
|
}
|
|
6284
|
-
if (
|
|
6032
|
+
if (isPresent.hrtime) {
|
|
6285
6033
|
clock.hrtime = hrtime;
|
|
6286
6034
|
}
|
|
6287
6035
|
return clock;
|
|
@@ -6308,17 +6056,24 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
6308
6056
|
"config.target is no longer supported. Use `withGlobal(target)` instead."
|
|
6309
6057
|
);
|
|
6310
6058
|
}
|
|
6059
|
+
function handleMissingTimer(timer) {
|
|
6060
|
+
if (config2.ignoreMissingTimers) {
|
|
6061
|
+
return;
|
|
6062
|
+
}
|
|
6063
|
+
throw new ReferenceError(
|
|
6064
|
+
`non-existent timers and/or objects cannot be faked: '${timer}'`
|
|
6065
|
+
);
|
|
6066
|
+
}
|
|
6311
6067
|
let i, l;
|
|
6312
6068
|
const clock = createClock(config2.now, config2.loopLimit);
|
|
6313
6069
|
clock.shouldClearNativeTimers = config2.shouldClearNativeTimers;
|
|
6314
6070
|
clock.uninstall = function() {
|
|
6315
6071
|
return uninstall(clock, config2);
|
|
6316
6072
|
};
|
|
6073
|
+
clock.abortListenerMap = /* @__PURE__ */ new Map();
|
|
6317
6074
|
clock.methods = config2.toFake || [];
|
|
6318
6075
|
if (clock.methods.length === 0) {
|
|
6319
|
-
clock.methods = Object.keys(timers)
|
|
6320
|
-
return key !== "nextTick" && key !== "queueMicrotask";
|
|
6321
|
-
});
|
|
6076
|
+
clock.methods = Object.keys(timers);
|
|
6322
6077
|
}
|
|
6323
6078
|
if (config2.shouldAdvanceTime === true) {
|
|
6324
6079
|
const intervalTick = doIntervalTick.bind(
|
|
@@ -6347,17 +6102,25 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
6347
6102
|
clock.performance[name] = name.indexOf("getEntries") === 0 ? NOOP_ARRAY : NOOP;
|
|
6348
6103
|
}
|
|
6349
6104
|
});
|
|
6105
|
+
clock.performance.mark = (name) => new FakePerformanceEntry(name, "mark", 0, 0);
|
|
6106
|
+
clock.performance.measure = (name) => new FakePerformanceEntry(name, "measure", 0, 100);
|
|
6107
|
+
clock.performance.timeOrigin = getEpoch(config2.now);
|
|
6350
6108
|
} else if ((config2.toFake || []).includes("performance")) {
|
|
6351
|
-
|
|
6352
|
-
"non-existent performance object cannot be faked"
|
|
6353
|
-
);
|
|
6109
|
+
return handleMissingTimer("performance");
|
|
6354
6110
|
}
|
|
6355
6111
|
}
|
|
6356
6112
|
if (_global === globalObject && timersModule) {
|
|
6357
6113
|
clock.timersModuleMethods = [];
|
|
6358
6114
|
}
|
|
6115
|
+
if (_global === globalObject && timersPromisesModule) {
|
|
6116
|
+
clock.timersPromisesModuleMethods = [];
|
|
6117
|
+
}
|
|
6359
6118
|
for (i = 0, l = clock.methods.length; i < l; i++) {
|
|
6360
6119
|
const nameOfMethodToReplace = clock.methods[i];
|
|
6120
|
+
if (!isPresent[nameOfMethodToReplace]) {
|
|
6121
|
+
handleMissingTimer(nameOfMethodToReplace);
|
|
6122
|
+
continue;
|
|
6123
|
+
}
|
|
6361
6124
|
if (nameOfMethodToReplace === "hrtime") {
|
|
6362
6125
|
if (_global.process && typeof _global.process.hrtime === "function") {
|
|
6363
6126
|
hijackMethod(_global.process, nameOfMethodToReplace, clock);
|
|
@@ -6377,6 +6140,194 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
6377
6140
|
});
|
|
6378
6141
|
timersModule[nameOfMethodToReplace] = _global[nameOfMethodToReplace];
|
|
6379
6142
|
}
|
|
6143
|
+
if (clock.timersPromisesModuleMethods !== void 0) {
|
|
6144
|
+
if (nameOfMethodToReplace === "setTimeout") {
|
|
6145
|
+
clock.timersPromisesModuleMethods.push({
|
|
6146
|
+
methodName: "setTimeout",
|
|
6147
|
+
original: timersPromisesModule.setTimeout
|
|
6148
|
+
});
|
|
6149
|
+
timersPromisesModule.setTimeout = (delay2, value, options = {}) => new Promise((resolve, reject) => {
|
|
6150
|
+
const abort = () => {
|
|
6151
|
+
options.signal.removeEventListener(
|
|
6152
|
+
"abort",
|
|
6153
|
+
abort
|
|
6154
|
+
);
|
|
6155
|
+
clock.abortListenerMap.delete(abort);
|
|
6156
|
+
clock.clearTimeout(handle);
|
|
6157
|
+
reject(options.signal.reason);
|
|
6158
|
+
};
|
|
6159
|
+
const handle = clock.setTimeout(() => {
|
|
6160
|
+
if (options.signal) {
|
|
6161
|
+
options.signal.removeEventListener(
|
|
6162
|
+
"abort",
|
|
6163
|
+
abort
|
|
6164
|
+
);
|
|
6165
|
+
clock.abortListenerMap.delete(abort);
|
|
6166
|
+
}
|
|
6167
|
+
resolve(value);
|
|
6168
|
+
}, delay2);
|
|
6169
|
+
if (options.signal) {
|
|
6170
|
+
if (options.signal.aborted) {
|
|
6171
|
+
abort();
|
|
6172
|
+
} else {
|
|
6173
|
+
options.signal.addEventListener(
|
|
6174
|
+
"abort",
|
|
6175
|
+
abort
|
|
6176
|
+
);
|
|
6177
|
+
clock.abortListenerMap.set(
|
|
6178
|
+
abort,
|
|
6179
|
+
options.signal
|
|
6180
|
+
);
|
|
6181
|
+
}
|
|
6182
|
+
}
|
|
6183
|
+
});
|
|
6184
|
+
} else if (nameOfMethodToReplace === "setImmediate") {
|
|
6185
|
+
clock.timersPromisesModuleMethods.push({
|
|
6186
|
+
methodName: "setImmediate",
|
|
6187
|
+
original: timersPromisesModule.setImmediate
|
|
6188
|
+
});
|
|
6189
|
+
timersPromisesModule.setImmediate = (value, options = {}) => new Promise((resolve, reject) => {
|
|
6190
|
+
const abort = () => {
|
|
6191
|
+
options.signal.removeEventListener(
|
|
6192
|
+
"abort",
|
|
6193
|
+
abort
|
|
6194
|
+
);
|
|
6195
|
+
clock.abortListenerMap.delete(abort);
|
|
6196
|
+
clock.clearImmediate(handle);
|
|
6197
|
+
reject(options.signal.reason);
|
|
6198
|
+
};
|
|
6199
|
+
const handle = clock.setImmediate(() => {
|
|
6200
|
+
if (options.signal) {
|
|
6201
|
+
options.signal.removeEventListener(
|
|
6202
|
+
"abort",
|
|
6203
|
+
abort
|
|
6204
|
+
);
|
|
6205
|
+
clock.abortListenerMap.delete(abort);
|
|
6206
|
+
}
|
|
6207
|
+
resolve(value);
|
|
6208
|
+
});
|
|
6209
|
+
if (options.signal) {
|
|
6210
|
+
if (options.signal.aborted) {
|
|
6211
|
+
abort();
|
|
6212
|
+
} else {
|
|
6213
|
+
options.signal.addEventListener(
|
|
6214
|
+
"abort",
|
|
6215
|
+
abort
|
|
6216
|
+
);
|
|
6217
|
+
clock.abortListenerMap.set(
|
|
6218
|
+
abort,
|
|
6219
|
+
options.signal
|
|
6220
|
+
);
|
|
6221
|
+
}
|
|
6222
|
+
}
|
|
6223
|
+
});
|
|
6224
|
+
} else if (nameOfMethodToReplace === "setInterval") {
|
|
6225
|
+
clock.timersPromisesModuleMethods.push({
|
|
6226
|
+
methodName: "setInterval",
|
|
6227
|
+
original: timersPromisesModule.setInterval
|
|
6228
|
+
});
|
|
6229
|
+
timersPromisesModule.setInterval = (delay2, value, options = {}) => ({
|
|
6230
|
+
[Symbol.asyncIterator]: () => {
|
|
6231
|
+
const createResolvable = () => {
|
|
6232
|
+
let resolve, reject;
|
|
6233
|
+
const promise = new Promise((res, rej) => {
|
|
6234
|
+
resolve = res;
|
|
6235
|
+
reject = rej;
|
|
6236
|
+
});
|
|
6237
|
+
promise.resolve = resolve;
|
|
6238
|
+
promise.reject = reject;
|
|
6239
|
+
return promise;
|
|
6240
|
+
};
|
|
6241
|
+
let done = false;
|
|
6242
|
+
let hasThrown = false;
|
|
6243
|
+
let returnCall;
|
|
6244
|
+
let nextAvailable = 0;
|
|
6245
|
+
const nextQueue = [];
|
|
6246
|
+
const handle = clock.setInterval(() => {
|
|
6247
|
+
if (nextQueue.length > 0) {
|
|
6248
|
+
nextQueue.shift().resolve();
|
|
6249
|
+
} else {
|
|
6250
|
+
nextAvailable++;
|
|
6251
|
+
}
|
|
6252
|
+
}, delay2);
|
|
6253
|
+
const abort = () => {
|
|
6254
|
+
options.signal.removeEventListener(
|
|
6255
|
+
"abort",
|
|
6256
|
+
abort
|
|
6257
|
+
);
|
|
6258
|
+
clock.abortListenerMap.delete(abort);
|
|
6259
|
+
clock.clearInterval(handle);
|
|
6260
|
+
done = true;
|
|
6261
|
+
for (const resolvable of nextQueue) {
|
|
6262
|
+
resolvable.resolve();
|
|
6263
|
+
}
|
|
6264
|
+
};
|
|
6265
|
+
if (options.signal) {
|
|
6266
|
+
if (options.signal.aborted) {
|
|
6267
|
+
done = true;
|
|
6268
|
+
} else {
|
|
6269
|
+
options.signal.addEventListener(
|
|
6270
|
+
"abort",
|
|
6271
|
+
abort
|
|
6272
|
+
);
|
|
6273
|
+
clock.abortListenerMap.set(
|
|
6274
|
+
abort,
|
|
6275
|
+
options.signal
|
|
6276
|
+
);
|
|
6277
|
+
}
|
|
6278
|
+
}
|
|
6279
|
+
return {
|
|
6280
|
+
next: async () => {
|
|
6281
|
+
if (options.signal?.aborted && !hasThrown) {
|
|
6282
|
+
hasThrown = true;
|
|
6283
|
+
throw options.signal.reason;
|
|
6284
|
+
}
|
|
6285
|
+
if (done) {
|
|
6286
|
+
return { done: true, value: void 0 };
|
|
6287
|
+
}
|
|
6288
|
+
if (nextAvailable > 0) {
|
|
6289
|
+
nextAvailable--;
|
|
6290
|
+
return { done: false, value };
|
|
6291
|
+
}
|
|
6292
|
+
const resolvable = createResolvable();
|
|
6293
|
+
nextQueue.push(resolvable);
|
|
6294
|
+
await resolvable;
|
|
6295
|
+
if (returnCall && nextQueue.length === 0) {
|
|
6296
|
+
returnCall.resolve();
|
|
6297
|
+
}
|
|
6298
|
+
if (options.signal?.aborted && !hasThrown) {
|
|
6299
|
+
hasThrown = true;
|
|
6300
|
+
throw options.signal.reason;
|
|
6301
|
+
}
|
|
6302
|
+
if (done) {
|
|
6303
|
+
return { done: true, value: void 0 };
|
|
6304
|
+
}
|
|
6305
|
+
return { done: false, value };
|
|
6306
|
+
},
|
|
6307
|
+
return: async () => {
|
|
6308
|
+
if (done) {
|
|
6309
|
+
return { done: true, value: void 0 };
|
|
6310
|
+
}
|
|
6311
|
+
if (nextQueue.length > 0) {
|
|
6312
|
+
returnCall = createResolvable();
|
|
6313
|
+
await returnCall;
|
|
6314
|
+
}
|
|
6315
|
+
clock.clearInterval(handle);
|
|
6316
|
+
done = true;
|
|
6317
|
+
if (options.signal) {
|
|
6318
|
+
options.signal.removeEventListener(
|
|
6319
|
+
"abort",
|
|
6320
|
+
abort
|
|
6321
|
+
);
|
|
6322
|
+
clock.abortListenerMap.delete(abort);
|
|
6323
|
+
}
|
|
6324
|
+
return { done: true, value: void 0 };
|
|
6325
|
+
}
|
|
6326
|
+
};
|
|
6327
|
+
}
|
|
6328
|
+
});
|
|
6329
|
+
}
|
|
6330
|
+
}
|
|
6380
6331
|
}
|
|
6381
6332
|
return clock;
|
|
6382
6333
|
}
|
|
@@ -6394,604 +6345,33 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
6394
6345
|
fakeTimersSrc.withGlobal = withGlobal;
|
|
6395
6346
|
return fakeTimersSrc;
|
|
6396
6347
|
}
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
_now = RealDate.now;
|
|
6406
|
-
constructor({
|
|
6407
|
-
global: global3,
|
|
6408
|
-
config: config2
|
|
6409
|
-
}) {
|
|
6410
|
-
this._userConfig = config2;
|
|
6411
|
-
this._fakingDate = false;
|
|
6412
|
-
this._fakingTime = false;
|
|
6413
|
-
this._fakeTimers = fakeTimersSrcExports.withGlobal(global3);
|
|
6414
|
-
this._global = global3;
|
|
6415
|
-
}
|
|
6416
|
-
clearAllTimers() {
|
|
6417
|
-
if (this._fakingTime) {
|
|
6418
|
-
this._clock.reset();
|
|
6419
|
-
}
|
|
6420
|
-
}
|
|
6421
|
-
dispose() {
|
|
6422
|
-
this.useRealTimers();
|
|
6423
|
-
}
|
|
6424
|
-
runAllTimers() {
|
|
6425
|
-
if (this._checkFakeTimers()) {
|
|
6426
|
-
this._clock.runAll();
|
|
6427
|
-
}
|
|
6428
|
-
}
|
|
6429
|
-
async runAllTimersAsync() {
|
|
6430
|
-
if (this._checkFakeTimers()) {
|
|
6431
|
-
await this._clock.runAllAsync();
|
|
6432
|
-
}
|
|
6433
|
-
}
|
|
6434
|
-
runOnlyPendingTimers() {
|
|
6435
|
-
if (this._checkFakeTimers()) {
|
|
6436
|
-
this._clock.runToLast();
|
|
6437
|
-
}
|
|
6438
|
-
}
|
|
6439
|
-
async runOnlyPendingTimersAsync() {
|
|
6440
|
-
if (this._checkFakeTimers()) {
|
|
6441
|
-
await this._clock.runToLastAsync();
|
|
6442
|
-
}
|
|
6443
|
-
}
|
|
6444
|
-
advanceTimersToNextTimer(steps = 1) {
|
|
6445
|
-
if (this._checkFakeTimers()) {
|
|
6446
|
-
for (let i = steps; i > 0; i--) {
|
|
6447
|
-
this._clock.next();
|
|
6448
|
-
this._clock.tick(0);
|
|
6449
|
-
if (this._clock.countTimers() === 0) {
|
|
6450
|
-
break;
|
|
6451
|
-
}
|
|
6452
|
-
}
|
|
6453
|
-
}
|
|
6454
|
-
}
|
|
6455
|
-
async advanceTimersToNextTimerAsync(steps = 1) {
|
|
6456
|
-
if (this._checkFakeTimers()) {
|
|
6457
|
-
for (let i = steps; i > 0; i--) {
|
|
6458
|
-
await this._clock.nextAsync();
|
|
6459
|
-
this._clock.tick(0);
|
|
6460
|
-
if (this._clock.countTimers() === 0) {
|
|
6461
|
-
break;
|
|
6462
|
-
}
|
|
6463
|
-
}
|
|
6464
|
-
}
|
|
6465
|
-
}
|
|
6466
|
-
advanceTimersByTime(msToRun) {
|
|
6467
|
-
if (this._checkFakeTimers()) {
|
|
6468
|
-
this._clock.tick(msToRun);
|
|
6469
|
-
}
|
|
6470
|
-
}
|
|
6471
|
-
async advanceTimersByTimeAsync(msToRun) {
|
|
6472
|
-
if (this._checkFakeTimers()) {
|
|
6473
|
-
await this._clock.tickAsync(msToRun);
|
|
6474
|
-
}
|
|
6475
|
-
}
|
|
6476
|
-
advanceTimersToNextFrame() {
|
|
6477
|
-
if (this._checkFakeTimers()) {
|
|
6478
|
-
this._clock.runToFrame();
|
|
6479
|
-
}
|
|
6480
|
-
}
|
|
6481
|
-
runAllTicks() {
|
|
6482
|
-
if (this._checkFakeTimers()) {
|
|
6483
|
-
this._clock.runMicrotasks();
|
|
6484
|
-
}
|
|
6485
|
-
}
|
|
6486
|
-
useRealTimers() {
|
|
6487
|
-
if (this._fakingDate) {
|
|
6488
|
-
resetDate();
|
|
6489
|
-
this._fakingDate = false;
|
|
6490
|
-
}
|
|
6491
|
-
if (this._fakingTime) {
|
|
6492
|
-
this._clock.uninstall();
|
|
6493
|
-
this._fakingTime = false;
|
|
6494
|
-
}
|
|
6495
|
-
}
|
|
6496
|
-
useFakeTimers() {
|
|
6497
|
-
if (this._fakingDate) {
|
|
6498
|
-
throw new Error(
|
|
6499
|
-
'"setSystemTime" was called already and date was mocked. Reset timers using `vi.useRealTimers()` if you want to use fake timers again.'
|
|
6500
|
-
);
|
|
6501
|
-
}
|
|
6502
|
-
if (!this._fakingTime) {
|
|
6503
|
-
const toFake = Object.keys(this._fakeTimers.timers).filter(
|
|
6504
|
-
(timer) => timer !== "nextTick"
|
|
6505
|
-
);
|
|
6506
|
-
if (this._userConfig?.toFake?.includes("nextTick") && isChildProcess()) {
|
|
6507
|
-
throw new Error(
|
|
6508
|
-
"process.nextTick cannot be mocked inside child_process"
|
|
6509
|
-
);
|
|
6510
|
-
}
|
|
6511
|
-
const existingFakedMethods = (this._userConfig?.toFake || toFake).filter(
|
|
6512
|
-
(method) => {
|
|
6513
|
-
switch (method) {
|
|
6514
|
-
case "setImmediate":
|
|
6515
|
-
case "clearImmediate":
|
|
6516
|
-
return method in this._global && this._global[method];
|
|
6517
|
-
default:
|
|
6518
|
-
return true;
|
|
6519
|
-
}
|
|
6520
|
-
}
|
|
6521
|
-
);
|
|
6522
|
-
this._clock = this._fakeTimers.install({
|
|
6523
|
-
now: Date.now(),
|
|
6524
|
-
...this._userConfig,
|
|
6525
|
-
toFake: existingFakedMethods
|
|
6526
|
-
});
|
|
6527
|
-
this._fakingTime = true;
|
|
6528
|
-
}
|
|
6529
|
-
}
|
|
6530
|
-
reset() {
|
|
6531
|
-
if (this._checkFakeTimers()) {
|
|
6532
|
-
const { now: now2 } = this._clock;
|
|
6533
|
-
this._clock.reset();
|
|
6534
|
-
this._clock.setSystemTime(now2);
|
|
6535
|
-
}
|
|
6536
|
-
}
|
|
6537
|
-
setSystemTime(now2) {
|
|
6538
|
-
if (this._fakingTime) {
|
|
6539
|
-
this._clock.setSystemTime(now2);
|
|
6540
|
-
} else {
|
|
6541
|
-
mockDate(now2 ?? this.getRealSystemTime());
|
|
6542
|
-
this._fakingDate = true;
|
|
6543
|
-
}
|
|
6544
|
-
}
|
|
6545
|
-
getRealSystemTime() {
|
|
6546
|
-
return this._now();
|
|
6547
|
-
}
|
|
6548
|
-
getTimerCount() {
|
|
6549
|
-
if (this._checkFakeTimers()) {
|
|
6550
|
-
return this._clock.countTimers();
|
|
6551
|
-
}
|
|
6552
|
-
return 0;
|
|
6553
|
-
}
|
|
6554
|
-
configure(config2) {
|
|
6555
|
-
this._userConfig = config2;
|
|
6556
|
-
}
|
|
6557
|
-
isFakeTimers() {
|
|
6558
|
-
return this._fakingTime;
|
|
6559
|
-
}
|
|
6560
|
-
_checkFakeTimers() {
|
|
6561
|
-
if (!this._fakingTime) {
|
|
6562
|
-
throw new Error(
|
|
6563
|
-
'Timers are not mocked. Try calling "vi.useFakeTimers()" first.'
|
|
6564
|
-
);
|
|
6565
|
-
}
|
|
6566
|
-
return this._fakingTime;
|
|
6567
|
-
}
|
|
6568
|
-
};
|
|
6569
|
-
function copyStackTrace2(target, source) {
|
|
6570
|
-
if (source.stack !== void 0) {
|
|
6571
|
-
target.stack = source.stack.replace(source.message, target.message);
|
|
6572
|
-
}
|
|
6573
|
-
return target;
|
|
6574
|
-
}
|
|
6575
|
-
function waitFor2(callback, options = {}) {
|
|
6576
|
-
const { setTimeout: setTimeout2, setInterval: setInterval2, clearTimeout: clearTimeout2, clearInterval: clearInterval2 } = getSafeTimers();
|
|
6577
|
-
const { interval = 50, timeout = 1e3 } = typeof options === "number" ? { timeout: options } : options;
|
|
6578
|
-
const STACK_TRACE_ERROR = new Error("STACK_TRACE_ERROR");
|
|
6579
|
-
return new Promise((resolve, reject) => {
|
|
6580
|
-
let lastError;
|
|
6581
|
-
let promiseStatus = "idle";
|
|
6582
|
-
let timeoutId;
|
|
6583
|
-
let intervalId;
|
|
6584
|
-
const onResolve = (result) => {
|
|
6585
|
-
if (timeoutId) {
|
|
6586
|
-
clearTimeout2(timeoutId);
|
|
6587
|
-
}
|
|
6588
|
-
if (intervalId) {
|
|
6589
|
-
clearInterval2(intervalId);
|
|
6590
|
-
}
|
|
6591
|
-
resolve(result);
|
|
6592
|
-
};
|
|
6593
|
-
const handleTimeout = () => {
|
|
6594
|
-
if (intervalId) {
|
|
6595
|
-
clearInterval2(intervalId);
|
|
6596
|
-
}
|
|
6597
|
-
let error = lastError;
|
|
6598
|
-
if (!error) {
|
|
6599
|
-
error = copyStackTrace2(
|
|
6600
|
-
new Error("Timed out in waitFor!"),
|
|
6601
|
-
STACK_TRACE_ERROR
|
|
6602
|
-
);
|
|
6603
|
-
}
|
|
6604
|
-
reject(error);
|
|
6605
|
-
};
|
|
6606
|
-
const checkCallback = () => {
|
|
6607
|
-
if (vi.isFakeTimers()) {
|
|
6608
|
-
vi.advanceTimersByTime(interval);
|
|
6609
|
-
}
|
|
6610
|
-
if (promiseStatus === "pending") {
|
|
6611
|
-
return;
|
|
6612
|
-
}
|
|
6613
|
-
try {
|
|
6614
|
-
const result = callback();
|
|
6615
|
-
if (result !== null && typeof result === "object" && typeof result.then === "function") {
|
|
6616
|
-
const thenable = result;
|
|
6617
|
-
promiseStatus = "pending";
|
|
6618
|
-
thenable.then(
|
|
6619
|
-
(resolvedValue) => {
|
|
6620
|
-
promiseStatus = "resolved";
|
|
6621
|
-
onResolve(resolvedValue);
|
|
6622
|
-
},
|
|
6623
|
-
(rejectedValue) => {
|
|
6624
|
-
promiseStatus = "rejected";
|
|
6625
|
-
lastError = rejectedValue;
|
|
6626
|
-
}
|
|
6627
|
-
);
|
|
6628
|
-
} else {
|
|
6629
|
-
onResolve(result);
|
|
6630
|
-
return true;
|
|
6631
|
-
}
|
|
6632
|
-
} catch (error) {
|
|
6633
|
-
lastError = error;
|
|
6634
|
-
}
|
|
6635
|
-
};
|
|
6636
|
-
if (checkCallback() === true) {
|
|
6637
|
-
return;
|
|
6638
|
-
}
|
|
6639
|
-
timeoutId = setTimeout2(handleTimeout, timeout);
|
|
6640
|
-
intervalId = setInterval2(checkCallback, interval);
|
|
6641
|
-
});
|
|
6348
|
+
requireFakeTimersSrc();
|
|
6349
|
+
typeof process < "u" && process.platform === "win32";
|
|
6350
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
6351
|
+
var intToChar = new Uint8Array(64);
|
|
6352
|
+
var charToInt = new Uint8Array(128);
|
|
6353
|
+
for (let i = 0; i < chars.length; i++) {
|
|
6354
|
+
let c = chars.charCodeAt(i);
|
|
6355
|
+
intToChar[i] = c, charToInt[c] = i;
|
|
6642
6356
|
}
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
}
|
|
6655
|
-
if (!error) {
|
|
6656
|
-
error = copyStackTrace2(
|
|
6657
|
-
new Error("Timed out in waitUntil!"),
|
|
6658
|
-
STACK_TRACE_ERROR
|
|
6659
|
-
);
|
|
6660
|
-
}
|
|
6661
|
-
reject(error);
|
|
6662
|
-
};
|
|
6663
|
-
const onResolve = (result) => {
|
|
6664
|
-
if (!result) {
|
|
6665
|
-
return;
|
|
6666
|
-
}
|
|
6667
|
-
if (timeoutId) {
|
|
6668
|
-
clearTimeout2(timeoutId);
|
|
6669
|
-
}
|
|
6670
|
-
if (intervalId) {
|
|
6671
|
-
clearInterval2(intervalId);
|
|
6672
|
-
}
|
|
6673
|
-
resolve(result);
|
|
6674
|
-
return true;
|
|
6675
|
-
};
|
|
6676
|
-
const checkCallback = () => {
|
|
6677
|
-
if (vi.isFakeTimers()) {
|
|
6678
|
-
vi.advanceTimersByTime(interval);
|
|
6679
|
-
}
|
|
6680
|
-
if (promiseStatus === "pending") {
|
|
6681
|
-
return;
|
|
6682
|
-
}
|
|
6683
|
-
try {
|
|
6684
|
-
const result = callback();
|
|
6685
|
-
if (result !== null && typeof result === "object" && typeof result.then === "function") {
|
|
6686
|
-
const thenable = result;
|
|
6687
|
-
promiseStatus = "pending";
|
|
6688
|
-
thenable.then(
|
|
6689
|
-
(resolvedValue) => {
|
|
6690
|
-
promiseStatus = "resolved";
|
|
6691
|
-
onResolve(resolvedValue);
|
|
6692
|
-
},
|
|
6693
|
-
(rejectedValue) => {
|
|
6694
|
-
promiseStatus = "rejected";
|
|
6695
|
-
onReject(rejectedValue);
|
|
6696
|
-
}
|
|
6697
|
-
);
|
|
6698
|
-
} else {
|
|
6699
|
-
return onResolve(result);
|
|
6700
|
-
}
|
|
6701
|
-
} catch (error) {
|
|
6702
|
-
onReject(error);
|
|
6703
|
-
}
|
|
6704
|
-
};
|
|
6705
|
-
if (checkCallback() === true) {
|
|
6706
|
-
return;
|
|
6707
|
-
}
|
|
6708
|
-
timeoutId = setTimeout2(onReject, timeout);
|
|
6709
|
-
intervalId = setInterval2(checkCallback, interval);
|
|
6710
|
-
});
|
|
6711
|
-
}
|
|
6712
|
-
function createVitest() {
|
|
6713
|
-
let _mockedDate = null;
|
|
6714
|
-
let _config = null;
|
|
6715
|
-
const workerState = getWorkerState();
|
|
6716
|
-
let _timers;
|
|
6717
|
-
const timers = () => _timers ||= new FakeTimers({
|
|
6718
|
-
global: globalThis,
|
|
6719
|
-
config: workerState.config.fakeTimers
|
|
6720
|
-
});
|
|
6721
|
-
const _stubsGlobal = /* @__PURE__ */ new Map();
|
|
6722
|
-
const _stubsEnv = /* @__PURE__ */ new Map();
|
|
6723
|
-
const _envBooleans = ["PROD", "DEV", "SSR"];
|
|
6724
|
-
const utils = {
|
|
6725
|
-
useFakeTimers(config2) {
|
|
6726
|
-
if (isChildProcess()) {
|
|
6727
|
-
if (config2?.toFake?.includes("nextTick") || workerState.config?.fakeTimers?.toFake?.includes("nextTick")) {
|
|
6728
|
-
throw new Error(
|
|
6729
|
-
'vi.useFakeTimers({ toFake: ["nextTick"] }) is not supported in node:child_process. Use --pool=threads if mocking nextTick is required.'
|
|
6730
|
-
);
|
|
6731
|
-
}
|
|
6732
|
-
}
|
|
6733
|
-
if (config2) {
|
|
6734
|
-
timers().configure({ ...workerState.config.fakeTimers, ...config2 });
|
|
6735
|
-
} else {
|
|
6736
|
-
timers().configure(workerState.config.fakeTimers);
|
|
6737
|
-
}
|
|
6738
|
-
timers().useFakeTimers();
|
|
6739
|
-
return utils;
|
|
6740
|
-
},
|
|
6741
|
-
isFakeTimers() {
|
|
6742
|
-
return timers().isFakeTimers();
|
|
6743
|
-
},
|
|
6744
|
-
useRealTimers() {
|
|
6745
|
-
timers().useRealTimers();
|
|
6746
|
-
_mockedDate = null;
|
|
6747
|
-
return utils;
|
|
6748
|
-
},
|
|
6749
|
-
runOnlyPendingTimers() {
|
|
6750
|
-
timers().runOnlyPendingTimers();
|
|
6751
|
-
return utils;
|
|
6752
|
-
},
|
|
6753
|
-
async runOnlyPendingTimersAsync() {
|
|
6754
|
-
await timers().runOnlyPendingTimersAsync();
|
|
6755
|
-
return utils;
|
|
6756
|
-
},
|
|
6757
|
-
runAllTimers() {
|
|
6758
|
-
timers().runAllTimers();
|
|
6759
|
-
return utils;
|
|
6760
|
-
},
|
|
6761
|
-
async runAllTimersAsync() {
|
|
6762
|
-
await timers().runAllTimersAsync();
|
|
6763
|
-
return utils;
|
|
6764
|
-
},
|
|
6765
|
-
runAllTicks() {
|
|
6766
|
-
timers().runAllTicks();
|
|
6767
|
-
return utils;
|
|
6768
|
-
},
|
|
6769
|
-
advanceTimersByTime(ms) {
|
|
6770
|
-
timers().advanceTimersByTime(ms);
|
|
6771
|
-
return utils;
|
|
6772
|
-
},
|
|
6773
|
-
async advanceTimersByTimeAsync(ms) {
|
|
6774
|
-
await timers().advanceTimersByTimeAsync(ms);
|
|
6775
|
-
return utils;
|
|
6776
|
-
},
|
|
6777
|
-
advanceTimersToNextTimer() {
|
|
6778
|
-
timers().advanceTimersToNextTimer();
|
|
6779
|
-
return utils;
|
|
6780
|
-
},
|
|
6781
|
-
async advanceTimersToNextTimerAsync() {
|
|
6782
|
-
await timers().advanceTimersToNextTimerAsync();
|
|
6783
|
-
return utils;
|
|
6784
|
-
},
|
|
6785
|
-
advanceTimersToNextFrame() {
|
|
6786
|
-
timers().advanceTimersToNextFrame();
|
|
6787
|
-
return utils;
|
|
6788
|
-
},
|
|
6789
|
-
getTimerCount() {
|
|
6790
|
-
return timers().getTimerCount();
|
|
6791
|
-
},
|
|
6792
|
-
setSystemTime(time) {
|
|
6793
|
-
const date = time instanceof Date ? time : new Date(time);
|
|
6794
|
-
_mockedDate = date;
|
|
6795
|
-
timers().setSystemTime(date);
|
|
6796
|
-
return utils;
|
|
6797
|
-
},
|
|
6798
|
-
getMockedSystemTime() {
|
|
6799
|
-
return _mockedDate;
|
|
6800
|
-
},
|
|
6801
|
-
getRealSystemTime() {
|
|
6802
|
-
return timers().getRealSystemTime();
|
|
6803
|
-
},
|
|
6804
|
-
clearAllTimers() {
|
|
6805
|
-
timers().clearAllTimers();
|
|
6806
|
-
return utils;
|
|
6807
|
-
},
|
|
6808
|
-
// mocks
|
|
6809
|
-
spyOn,
|
|
6810
|
-
fn,
|
|
6811
|
-
waitFor: waitFor2,
|
|
6812
|
-
waitUntil,
|
|
6813
|
-
hoisted(factory) {
|
|
6814
|
-
assertTypes(factory, '"vi.hoisted" factory', ["function"]);
|
|
6815
|
-
return factory();
|
|
6816
|
-
},
|
|
6817
|
-
mock(path, factory) {
|
|
6818
|
-
if (typeof path !== "string") {
|
|
6819
|
-
throw new TypeError(
|
|
6820
|
-
`vi.mock() expects a string path, but received a ${typeof path}`
|
|
6821
|
-
);
|
|
6822
|
-
}
|
|
6823
|
-
const importer = getImporter("mock");
|
|
6824
|
-
_mocker().queueMock(
|
|
6825
|
-
path,
|
|
6826
|
-
importer,
|
|
6827
|
-
typeof factory === "function" ? () => factory(
|
|
6828
|
-
() => _mocker().importActual(
|
|
6829
|
-
path,
|
|
6830
|
-
importer,
|
|
6831
|
-
_mocker().getMockContext().callstack
|
|
6832
|
-
)
|
|
6833
|
-
) : factory
|
|
6834
|
-
);
|
|
6835
|
-
},
|
|
6836
|
-
unmock(path) {
|
|
6837
|
-
if (typeof path !== "string") {
|
|
6838
|
-
throw new TypeError(
|
|
6839
|
-
`vi.unmock() expects a string path, but received a ${typeof path}`
|
|
6840
|
-
);
|
|
6841
|
-
}
|
|
6842
|
-
_mocker().queueUnmock(path, getImporter("unmock"));
|
|
6843
|
-
},
|
|
6844
|
-
doMock(path, factory) {
|
|
6845
|
-
if (typeof path !== "string") {
|
|
6846
|
-
throw new TypeError(
|
|
6847
|
-
`vi.doMock() expects a string path, but received a ${typeof path}`
|
|
6848
|
-
);
|
|
6849
|
-
}
|
|
6850
|
-
const importer = getImporter("doMock");
|
|
6851
|
-
_mocker().queueMock(
|
|
6852
|
-
path,
|
|
6853
|
-
importer,
|
|
6854
|
-
typeof factory === "function" ? () => factory(
|
|
6855
|
-
() => _mocker().importActual(
|
|
6856
|
-
path,
|
|
6857
|
-
importer,
|
|
6858
|
-
_mocker().getMockContext().callstack
|
|
6859
|
-
)
|
|
6860
|
-
) : factory
|
|
6861
|
-
);
|
|
6862
|
-
},
|
|
6863
|
-
doUnmock(path) {
|
|
6864
|
-
if (typeof path !== "string") {
|
|
6865
|
-
throw new TypeError(
|
|
6866
|
-
`vi.doUnmock() expects a string path, but received a ${typeof path}`
|
|
6867
|
-
);
|
|
6868
|
-
}
|
|
6869
|
-
_mocker().queueUnmock(path, getImporter("doUnmock"));
|
|
6870
|
-
},
|
|
6871
|
-
async importActual(path) {
|
|
6872
|
-
return _mocker().importActual(
|
|
6873
|
-
path,
|
|
6874
|
-
getImporter("importActual"),
|
|
6875
|
-
_mocker().getMockContext().callstack
|
|
6876
|
-
);
|
|
6877
|
-
},
|
|
6878
|
-
async importMock(path) {
|
|
6879
|
-
return _mocker().importMock(path, getImporter("importMock"));
|
|
6880
|
-
},
|
|
6881
|
-
// this is typed in the interface so it's not necessary to type it here
|
|
6882
|
-
mocked(item, _options = {}) {
|
|
6883
|
-
return item;
|
|
6884
|
-
},
|
|
6885
|
-
isMockFunction(fn2) {
|
|
6886
|
-
return isMockFunction(fn2);
|
|
6887
|
-
},
|
|
6888
|
-
clearAllMocks() {
|
|
6889
|
-
mocks.forEach((spy) => spy.mockClear());
|
|
6890
|
-
return utils;
|
|
6891
|
-
},
|
|
6892
|
-
resetAllMocks() {
|
|
6893
|
-
mocks.forEach((spy) => spy.mockReset());
|
|
6894
|
-
return utils;
|
|
6895
|
-
},
|
|
6896
|
-
restoreAllMocks() {
|
|
6897
|
-
mocks.forEach((spy) => spy.mockRestore());
|
|
6898
|
-
return utils;
|
|
6899
|
-
},
|
|
6900
|
-
stubGlobal(name, value) {
|
|
6901
|
-
if (!_stubsGlobal.has(name)) {
|
|
6902
|
-
_stubsGlobal.set(
|
|
6903
|
-
name,
|
|
6904
|
-
Object.getOwnPropertyDescriptor(globalThis, name)
|
|
6905
|
-
);
|
|
6906
|
-
}
|
|
6907
|
-
Object.defineProperty(globalThis, name, {
|
|
6908
|
-
value,
|
|
6909
|
-
writable: true,
|
|
6910
|
-
configurable: true,
|
|
6911
|
-
enumerable: true
|
|
6912
|
-
});
|
|
6913
|
-
return utils;
|
|
6914
|
-
},
|
|
6915
|
-
stubEnv(name, value) {
|
|
6916
|
-
if (!_stubsEnv.has(name)) {
|
|
6917
|
-
_stubsEnv.set(name, process.env[name]);
|
|
6918
|
-
}
|
|
6919
|
-
if (_envBooleans.includes(name)) {
|
|
6920
|
-
process.env[name] = value ? "1" : "";
|
|
6921
|
-
} else if (value === void 0) {
|
|
6922
|
-
delete process.env[name];
|
|
6923
|
-
} else {
|
|
6924
|
-
process.env[name] = String(value);
|
|
6925
|
-
}
|
|
6926
|
-
return utils;
|
|
6927
|
-
},
|
|
6928
|
-
unstubAllGlobals() {
|
|
6929
|
-
_stubsGlobal.forEach((original, name) => {
|
|
6930
|
-
if (!original) {
|
|
6931
|
-
Reflect.deleteProperty(globalThis, name);
|
|
6932
|
-
} else {
|
|
6933
|
-
Object.defineProperty(globalThis, name, original);
|
|
6934
|
-
}
|
|
6935
|
-
});
|
|
6936
|
-
_stubsGlobal.clear();
|
|
6937
|
-
return utils;
|
|
6938
|
-
},
|
|
6939
|
-
unstubAllEnvs() {
|
|
6940
|
-
_stubsEnv.forEach((original, name) => {
|
|
6941
|
-
if (original === void 0) {
|
|
6942
|
-
delete process.env[name];
|
|
6943
|
-
} else {
|
|
6944
|
-
process.env[name] = original;
|
|
6945
|
-
}
|
|
6946
|
-
});
|
|
6947
|
-
_stubsEnv.clear();
|
|
6948
|
-
return utils;
|
|
6949
|
-
},
|
|
6950
|
-
resetModules() {
|
|
6951
|
-
resetModules(workerState.moduleCache);
|
|
6952
|
-
return utils;
|
|
6953
|
-
},
|
|
6954
|
-
async dynamicImportSettled() {
|
|
6955
|
-
return waitForImportsToResolve();
|
|
6956
|
-
},
|
|
6957
|
-
setConfig(config2) {
|
|
6958
|
-
if (!_config) {
|
|
6959
|
-
_config = { ...workerState.config };
|
|
6960
|
-
}
|
|
6961
|
-
Object.assign(workerState.config, config2);
|
|
6962
|
-
},
|
|
6963
|
-
resetConfig() {
|
|
6964
|
-
if (_config) {
|
|
6965
|
-
Object.assign(workerState.config, _config);
|
|
6966
|
-
}
|
|
6967
|
-
}
|
|
6968
|
-
};
|
|
6969
|
-
return utils;
|
|
6970
|
-
}
|
|
6971
|
-
var vitest = createVitest();
|
|
6972
|
-
var vi = vitest;
|
|
6973
|
-
function _mocker() {
|
|
6974
|
-
return typeof __vitest_mocker__ !== "undefined" ? __vitest_mocker__ : new Proxy(
|
|
6975
|
-
{},
|
|
6976
|
-
{
|
|
6977
|
-
get(_, name) {
|
|
6978
|
-
throw new Error(
|
|
6979
|
-
`Vitest mocker was not initialized in this environment. vi.${String(name)}() is forbidden.`
|
|
6980
|
-
);
|
|
6981
|
-
}
|
|
6982
|
-
}
|
|
6983
|
-
);
|
|
6984
|
-
}
|
|
6985
|
-
function getImporter(name) {
|
|
6986
|
-
const stackTrace = createSimpleStackTrace({ stackTraceLimit: 5 });
|
|
6987
|
-
const stackArray = stackTrace.split("\n");
|
|
6988
|
-
const importerStackIndex = stackArray.findIndex((stack2) => {
|
|
6989
|
-
return stack2.includes(` at Object.${name}`) || stack2.includes(`${name}@`);
|
|
6990
|
-
});
|
|
6991
|
-
const stack = parseSingleStack(stackArray[importerStackIndex + 1]);
|
|
6992
|
-
return stack?.file || "";
|
|
6357
|
+
var customizationHookNamespace = "vite-module-runner:import-meta-resolve/v1/";
|
|
6358
|
+
`
|
|
6359
|
+
|
|
6360
|
+
export async function resolve(specifier, context, nextResolve) {
|
|
6361
|
+
if (specifier.startsWith(${JSON.stringify(customizationHookNamespace)})) {
|
|
6362
|
+
const data = specifier.slice(${JSON.stringify(customizationHookNamespace)}.length)
|
|
6363
|
+
const [parsedSpecifier, parsedImporter] = JSON.parse(data)
|
|
6364
|
+
specifier = parsedSpecifier
|
|
6365
|
+
context.parentURL = parsedImporter
|
|
6366
|
+
}
|
|
6367
|
+
return nextResolve(specifier, context)
|
|
6993
6368
|
}
|
|
6994
6369
|
|
|
6370
|
+
`;
|
|
6371
|
+
new Proxy({}, { get(_, p) {
|
|
6372
|
+
throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
|
|
6373
|
+
} });
|
|
6374
|
+
|
|
6995
6375
|
// src/test/setup.ts
|
|
6996
6376
|
globalExpect.extend(matchers_exports);
|
|
6997
6377
|
afterEach$1(() => {
|