vitest 0.27.2 → 0.27.3
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/browser.d.ts +3 -3
- package/dist/browser.js +12 -11
- package/dist/{chunk-api-setup.029198e3.js → chunk-api-setup.0a2398d8.js} +4 -3
- package/dist/{chunk-env-node.787e9561.js → chunk-env-node.ffd1183b.js} +26 -0
- package/dist/{chunk-integrations-coverage.44413252.js → chunk-integrations-coverage.18366936.js} +3 -1
- package/dist/{chunk-integrations-globals.0024ce21.js → chunk-integrations-globals.59b4d460.js} +7 -6
- package/dist/{chunk-mock-date.c543fa3e.js → chunk-mock-date.91595ccd.js} +3 -2
- package/dist/{chunk-node-git.125c9008.js → chunk-node-git.59caac18.js} +2 -1
- package/dist/{chunk-runtime-chain.2da9e75c.js → chunk-runtime-chain.07d16eac.js} +15 -16
- package/dist/{chunk-runtime-error.de671af0.js → chunk-runtime-error.f2062967.js} +1 -1
- package/dist/{chunk-runtime-mocker.58511c38.js → chunk-runtime-mocker.66533d65.js} +3 -3
- package/dist/{chunk-runtime-rpc.d709e91b.js → chunk-runtime-rpc.e79efa9a.js} +1 -1
- package/dist/{chunk-runtime-setup.35da9209.js → chunk-runtime-setup.8ca273cd.js} +17 -13
- package/dist/{chunk-snapshot-manager.ce714e21.js → chunk-snapshot-manager.d16903ef.js} +89 -4028
- package/dist/{chunk-utils-env.f4a39d2c.js → chunk-utils-env.4ebb0106.js} +1 -0
- package/dist/{chunk-utils-import.054ab315.js → chunk-utils-import.eb63557e.js} +3 -3
- package/dist/{chunk-utils-source-map.5f5d12cf.js → chunk-utils-source-map.832515f7.js} +2 -2
- package/dist/cli-wrapper.js +2 -1
- package/dist/cli.js +8 -6
- package/dist/config.cjs +10 -7
- package/dist/config.d.ts +16 -3
- package/dist/config.js +10 -8
- package/dist/entry.js +24 -13
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/{index-50755efe.d.ts → index-2dd51af4.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8 -7
- package/dist/loader.js +5 -4
- package/dist/node.d.ts +2 -2
- package/dist/node.js +9 -7
- package/dist/suite.js +6 -5
- package/dist/{types-d97c72c7.d.ts → types-c1386a7d.d.ts} +332 -308
- package/dist/vendor-index.57682f0c.js +3964 -0
- package/dist/worker.js +11 -8
- package/package.json +7 -6
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-
|
|
2
|
-
import { b as ResolvedConfig } from './types-
|
|
3
|
-
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, j as CSSModuleScopeStrategy, C as CollectLineNumbers, g as CollectLines, ab as Constructable, i as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, aj as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ah as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, c as ModuleGraphData, aa as MutableArray, a5 as Nullable, ai as OnServerRestartHandler, O as OnTestFailedHandler, ag as ParsedStack, e as RawErrsMap, ak as ReportContext, d as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, h as RootAndTarget, m as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, q as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, o as TaskBase, p as TaskResult, T as TaskResultPack, n as TaskState, r as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, f as TscErrorInfo, l as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, k as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-
|
|
1
|
+
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-2dd51af4.js';
|
|
2
|
+
import { b as ResolvedConfig } from './types-c1386a7d.js';
|
|
3
|
+
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, j as CSSModuleScopeStrategy, C as CollectLineNumbers, g as CollectLines, ab as Constructable, i as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, aj as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ah as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, c as ModuleGraphData, aa as MutableArray, a5 as Nullable, ai as OnServerRestartHandler, O as OnTestFailedHandler, ag as ParsedStack, e as RawErrsMap, ak as ReportContext, d as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, h as RootAndTarget, m as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, q as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, o as TaskBase, p as TaskResult, T as TaskResultPack, n as TaskState, r as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, f as TscErrorInfo, l as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, k as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-c1386a7d.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
package/dist/browser.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.
|
|
2
|
-
import { e as dist } from './chunk-utils-import.
|
|
3
|
-
export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-utils-import.
|
|
4
|
-
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.
|
|
1
|
+
export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.07d16eac.js';
|
|
2
|
+
import { e as dist } from './chunk-utils-import.eb63557e.js';
|
|
3
|
+
export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-utils-import.eb63557e.js';
|
|
4
|
+
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.8ca273cd.js';
|
|
5
5
|
import * as chai from 'chai';
|
|
6
6
|
export { chai };
|
|
7
7
|
export { assert, should } from 'chai';
|
|
8
8
|
import 'util';
|
|
9
|
-
import './chunk-mock-date.
|
|
9
|
+
import './chunk-mock-date.91595ccd.js';
|
|
10
10
|
import 'node:path';
|
|
11
11
|
import 'picocolors';
|
|
12
12
|
import 'local-pkg';
|
|
13
|
-
import './chunk-utils-env.
|
|
13
|
+
import './chunk-utils-env.4ebb0106.js';
|
|
14
14
|
import 'node:url';
|
|
15
15
|
import 'path';
|
|
16
|
+
import 'std-env';
|
|
16
17
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
17
18
|
import './chunk-utils-timers.52534f96.js';
|
|
18
19
|
import './vendor-index.723a074f.js';
|
|
19
20
|
import 'tinyspy';
|
|
20
|
-
import './chunk-utils-source-map.
|
|
21
|
-
import './chunk-runtime-rpc.
|
|
21
|
+
import './chunk-utils-source-map.832515f7.js';
|
|
22
|
+
import './chunk-runtime-rpc.e79efa9a.js';
|
|
22
23
|
import 'node:fs';
|
|
23
24
|
import 'fs';
|
|
24
25
|
import 'perf_hooks';
|
|
25
|
-
import './chunk-integrations-coverage.
|
|
26
|
-
import './chunk-runtime-error.
|
|
26
|
+
import './chunk-integrations-coverage.18366936.js';
|
|
27
|
+
import './chunk-runtime-error.f2062967.js';
|
|
27
28
|
import 'vite-node/source-map';
|
|
28
|
-
import './chunk-env-node.
|
|
29
|
+
import './chunk-env-node.ffd1183b.js';
|
|
29
30
|
import 'node:console';
|
|
30
31
|
|
|
31
32
|
|
|
@@ -10,11 +10,12 @@ import require$$2 from 'events';
|
|
|
10
10
|
import require$$1 from 'https';
|
|
11
11
|
import require$$2$1 from 'http';
|
|
12
12
|
import require$$7 from 'url';
|
|
13
|
-
import { A as API_PATH } from './chunk-utils-env.
|
|
14
|
-
import './chunk-mock-date.
|
|
15
|
-
import { b as parseStacktrace } from './chunk-utils-source-map.
|
|
13
|
+
import { A as API_PATH } from './chunk-utils-env.4ebb0106.js';
|
|
14
|
+
import './chunk-mock-date.91595ccd.js';
|
|
15
|
+
import { b as parseStacktrace } from './chunk-utils-source-map.832515f7.js';
|
|
16
16
|
import 'node:url';
|
|
17
17
|
import 'path';
|
|
18
|
+
import 'std-env';
|
|
18
19
|
import 'node:path';
|
|
19
20
|
import 'picocolors';
|
|
20
21
|
import 'local-pkg';
|
|
@@ -301,6 +301,29 @@ function populateGlobal(global, win, options = {}) {
|
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
+
function catchWindowErrors(window) {
|
|
305
|
+
let userErrorListenerCount = 0;
|
|
306
|
+
function throwUnhandlerError(e) {
|
|
307
|
+
if (userErrorListenerCount === 0 && e.error != null)
|
|
308
|
+
process.emit("uncaughtException", e.error);
|
|
309
|
+
}
|
|
310
|
+
const addEventListener = window.addEventListener.bind(window);
|
|
311
|
+
const removeEventListener = window.removeEventListener.bind(window);
|
|
312
|
+
window.addEventListener("error", throwUnhandlerError);
|
|
313
|
+
window.addEventListener = function(...args) {
|
|
314
|
+
if (args[0] === "error")
|
|
315
|
+
userErrorListenerCount++;
|
|
316
|
+
return addEventListener.apply(this, args);
|
|
317
|
+
};
|
|
318
|
+
window.removeEventListener = function(...args) {
|
|
319
|
+
if (args[0] === "error" && userErrorListenerCount)
|
|
320
|
+
userErrorListenerCount--;
|
|
321
|
+
return removeEventListener.apply(this, args);
|
|
322
|
+
};
|
|
323
|
+
return function clearErrorHandlers() {
|
|
324
|
+
window.removeEventListener("error", throwUnhandlerError);
|
|
325
|
+
};
|
|
326
|
+
}
|
|
304
327
|
var jsdom = {
|
|
305
328
|
name: "jsdom",
|
|
306
329
|
async setup(global, { jsdom = {} }) {
|
|
@@ -339,8 +362,11 @@ var jsdom = {
|
|
|
339
362
|
}
|
|
340
363
|
);
|
|
341
364
|
const { keys, originals } = populateGlobal(global, dom.window, { bindFunctions: true });
|
|
365
|
+
const clearWindowErrors = catchWindowErrors(global);
|
|
342
366
|
return {
|
|
343
367
|
teardown(global2) {
|
|
368
|
+
clearWindowErrors();
|
|
369
|
+
dom.window.close();
|
|
344
370
|
keys.forEach((key) => delete global2[key]);
|
|
345
371
|
originals.forEach((v, k) => global2[k] = v);
|
|
346
372
|
}
|
package/dist/{chunk-integrations-coverage.44413252.js → chunk-integrations-coverage.18366936.js}
RENAMED
|
@@ -213,9 +213,11 @@ function skipAllTasks(suite) {
|
|
|
213
213
|
function checkAllowOnly(task, allowOnly) {
|
|
214
214
|
if (allowOnly)
|
|
215
215
|
return;
|
|
216
|
+
const error = new Error("[Vitest] Unexpected .only modifier. Remove it or pass --allowOnly argument to bypass this error");
|
|
216
217
|
task.result = {
|
|
217
218
|
state: "fail",
|
|
218
|
-
error
|
|
219
|
+
error,
|
|
220
|
+
errors: [error]
|
|
219
221
|
};
|
|
220
222
|
}
|
|
221
223
|
function generateHash(str) {
|
package/dist/{chunk-integrations-globals.0024ce21.js → chunk-integrations-globals.59b4d460.js}
RENAMED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { m as globalApis } from './chunk-utils-env.
|
|
2
|
-
import { i as index } from './chunk-utils-import.
|
|
1
|
+
import { m as globalApis } from './chunk-utils-env.4ebb0106.js';
|
|
2
|
+
import { i as index } from './chunk-utils-import.eb63557e.js';
|
|
3
3
|
import 'node:url';
|
|
4
4
|
import 'path';
|
|
5
|
-
import '
|
|
5
|
+
import 'std-env';
|
|
6
|
+
import './chunk-runtime-chain.07d16eac.js';
|
|
6
7
|
import 'util';
|
|
7
8
|
import 'chai';
|
|
8
|
-
import './chunk-mock-date.
|
|
9
|
+
import './chunk-mock-date.91595ccd.js';
|
|
9
10
|
import 'node:path';
|
|
10
11
|
import 'picocolors';
|
|
11
12
|
import 'local-pkg';
|
|
@@ -13,8 +14,8 @@ import './vendor-_commonjsHelpers.addc3445.js';
|
|
|
13
14
|
import './chunk-utils-timers.52534f96.js';
|
|
14
15
|
import './vendor-index.723a074f.js';
|
|
15
16
|
import 'tinyspy';
|
|
16
|
-
import './chunk-utils-source-map.
|
|
17
|
-
import './chunk-runtime-rpc.
|
|
17
|
+
import './chunk-utils-source-map.832515f7.js';
|
|
18
|
+
import './chunk-runtime-rpc.e79efa9a.js';
|
|
18
19
|
import 'node:fs';
|
|
19
20
|
import 'fs';
|
|
20
21
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { relative } from 'node:path';
|
|
2
2
|
import c from 'picocolors';
|
|
3
3
|
import { isPackageExists } from 'local-pkg';
|
|
4
|
-
import { i as isNode, a as isBrowser, r as relative$1, E as EXIT_CODE_RESTART } from './chunk-utils-env.
|
|
4
|
+
import { i as isNode, a as isBrowser, r as relative$1, E as EXIT_CODE_RESTART } from './chunk-utils-env.4ebb0106.js';
|
|
5
|
+
import { isCI } from 'std-env';
|
|
5
6
|
|
|
6
7
|
const RealDate = Date;
|
|
7
8
|
let now = null;
|
|
@@ -267,7 +268,7 @@ function removeUndefinedValues(obj) {
|
|
|
267
268
|
async function ensurePackageInstalled(dependency, root) {
|
|
268
269
|
if (isPackageExists(dependency, { paths: [root] }))
|
|
269
270
|
return true;
|
|
270
|
-
const promptInstall = !
|
|
271
|
+
const promptInstall = !isCI && process.stdout.isTTY;
|
|
271
272
|
process.stderr.write(c.red(`${c.inverse(c.red(" MISSING DEP "))} Can not find dependency '${dependency}'
|
|
272
273
|
|
|
273
274
|
`));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { b as resolve } from './chunk-utils-env.
|
|
1
|
+
import { b as resolve } from './chunk-utils-env.4ebb0106.js';
|
|
2
2
|
import { e as execa } from './vendor-index.451e37bc.js';
|
|
3
3
|
import 'node:url';
|
|
4
4
|
import 'path';
|
|
5
|
+
import 'std-env';
|
|
5
6
|
import 'node:buffer';
|
|
6
7
|
import 'node:path';
|
|
7
8
|
import 'node:child_process';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import util$1 from 'util';
|
|
2
2
|
import * as chai$2 from 'chai';
|
|
3
3
|
import { AssertionError, util, expect } from 'chai';
|
|
4
|
-
import { i as isObject$1, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as getCurrentEnvironment, e as getFullName, o as objectAttr, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-mock-date.
|
|
4
|
+
import { i as isObject$1, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as getCurrentEnvironment, e as getFullName, o as objectAttr, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-mock-date.91595ccd.js';
|
|
5
5
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
6
6
|
import c from 'picocolors';
|
|
7
7
|
import { c as createPatch, a as stringify, p as plugins_1, f as format_1, s as safeSetTimeout, b as safeClearTimeout } from './chunk-utils-timers.52534f96.js';
|
|
8
8
|
import { i as isMockFunction } from './vendor-index.723a074f.js';
|
|
9
|
-
import { c as cliTruncate, a as positionToOffset, o as offsetToLineNumber, l as lineSplitRE, b as parseStacktrace } from './chunk-utils-source-map.
|
|
10
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
9
|
+
import { c as cliTruncate, a as positionToOffset, o as offsetToLineNumber, l as lineSplitRE, b as parseStacktrace } from './chunk-utils-source-map.832515f7.js';
|
|
10
|
+
import { r as rpc } from './chunk-runtime-rpc.e79efa9a.js';
|
|
11
11
|
import fs from 'node:fs';
|
|
12
|
-
import { j as join, d as dirname } from './chunk-utils-env.
|
|
12
|
+
import { j as join, d as dirname } from './chunk-utils-env.4ebb0106.js';
|
|
13
13
|
import { promises } from 'fs';
|
|
14
14
|
|
|
15
15
|
function createChainable(keys, fn) {
|
|
@@ -1416,7 +1416,6 @@ Number of calls: ${c.bold(spy.mock.calls.length)}
|
|
|
1416
1416
|
return proxy;
|
|
1417
1417
|
});
|
|
1418
1418
|
};
|
|
1419
|
-
const isAsyncFunction = (fn) => typeof fn === "function" && fn[Symbol.toStringTag] === "AsyncFunction";
|
|
1420
1419
|
const getMatcherState = (assertion, expect) => {
|
|
1421
1420
|
const obj = assertion._obj;
|
|
1422
1421
|
const isNot = util.flag(assertion, "negate");
|
|
@@ -1450,21 +1449,21 @@ class JestExtendError extends Error {
|
|
|
1450
1449
|
function JestExtendPlugin(expect, matchers) {
|
|
1451
1450
|
return (c2, utils) => {
|
|
1452
1451
|
Object.entries(matchers).forEach(([expectAssertionName, expectAssertion]) => {
|
|
1453
|
-
function
|
|
1452
|
+
function expectWrapper(...args) {
|
|
1454
1453
|
const { state, isNot, obj } = getMatcherState(this, expect);
|
|
1455
|
-
const
|
|
1456
|
-
if (
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1454
|
+
const result = expectAssertion.call(state, obj, ...args);
|
|
1455
|
+
if (result && typeof result === "object" && result instanceof Promise) {
|
|
1456
|
+
return result.then(({ pass: pass2, message: message2, actual: actual2, expected: expected2 }) => {
|
|
1457
|
+
if (pass2 && isNot || !pass2 && !isNot)
|
|
1458
|
+
throw new JestExtendError(message2(), actual2, expected2);
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1461
|
+
const { pass, message, actual, expected } = result;
|
|
1462
1462
|
if (pass && isNot || !pass && !isNot)
|
|
1463
1463
|
throw new JestExtendError(message(), actual, expected);
|
|
1464
1464
|
}
|
|
1465
|
-
|
|
1466
|
-
utils.addMethod(
|
|
1467
|
-
utils.addMethod(c2.Assertion.prototype, expectAssertionName, expectAssertionWrapper);
|
|
1465
|
+
utils.addMethod(globalThis[JEST_MATCHERS_OBJECT].matchers, expectAssertionName, expectWrapper);
|
|
1466
|
+
utils.addMethod(c2.Assertion.prototype, expectAssertionName, expectWrapper);
|
|
1468
1467
|
class CustomMatcher extends AsymmetricMatcher$1 {
|
|
1469
1468
|
constructor(inverse = false, ...sample) {
|
|
1470
1469
|
super(sample, inverse);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import util$1 from 'util';
|
|
2
2
|
import { util } from 'chai';
|
|
3
3
|
import { a as stringify } from './chunk-utils-timers.52534f96.js';
|
|
4
|
-
import { w as deepClone, g as getWorkerState, x as getType } from './chunk-mock-date.
|
|
4
|
+
import { w as deepClone, g as getWorkerState, x as getType } from './chunk-mock-date.91595ccd.js';
|
|
5
5
|
|
|
6
6
|
const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
|
|
7
7
|
const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
@@ -2,9 +2,9 @@ import { ViteNodeRunner } from 'vite-node/client';
|
|
|
2
2
|
import { isInternalRequest } from 'vite-node/utils';
|
|
3
3
|
import { normalizePath } from 'vite';
|
|
4
4
|
import { i as isNodeBuiltin } from './vendor-index.b0346fe4.js';
|
|
5
|
-
import { g as getWorkerState, x as getType, I as getAllMockableProperties, d as getCurrentEnvironment } from './chunk-mock-date.
|
|
5
|
+
import { g as getWorkerState, x as getType, I as getAllMockableProperties, d as getCurrentEnvironment } from './chunk-mock-date.91595ccd.js';
|
|
6
6
|
import { existsSync, readdirSync } from 'node:fs';
|
|
7
|
-
import { b as resolve, f as distDir, h as isAbsolute, d as dirname, j as join, c as basename, e as extname } from './chunk-utils-env.
|
|
7
|
+
import { b as resolve, f as distDir, h as isAbsolute, d as dirname, j as join, c as basename, e as extname } from './chunk-utils-env.4ebb0106.js';
|
|
8
8
|
import c from 'picocolors';
|
|
9
9
|
|
|
10
10
|
class RefTracker {
|
|
@@ -314,7 +314,7 @@ class VitestRunner extends ViteNodeRunner {
|
|
|
314
314
|
if (isInternalRequest(id))
|
|
315
315
|
return false;
|
|
316
316
|
const environment = getCurrentEnvironment();
|
|
317
|
-
return environment === "node" ? !isNodeBuiltin(id) :
|
|
317
|
+
return environment === "node" ? !isNodeBuiltin(id) : !id.startsWith("node:");
|
|
318
318
|
}
|
|
319
319
|
async resolveUrl(id, importee) {
|
|
320
320
|
if (importee && importee.startsWith("mock:"))
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { performance } from 'perf_hooks';
|
|
2
|
-
import { g as generateHash, c as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, t as takeCoverageInsideWorker, p as pLimit } from './chunk-integrations-coverage.
|
|
3
|
-
import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getBenchOptions, n as getFn, o as setState, p as getSnapshotClient, G as GLOBAL_EXPECT, q as getState } from './chunk-runtime-chain.
|
|
4
|
-
import { r as resetRunOnceCounter, i as index, v as vi, s as setCurrentTest } from './chunk-utils-import.
|
|
5
|
-
import { g as getWorkerState, R as RealDate, t as toArray, k as relativePath, h as isRunningInBenchmark, p as partitionSuiteChildren, l as shuffle, q as hasTests, u as hasFailed, v as createDefer, e as getFullName } from './chunk-mock-date.
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
7
|
-
import { p as processError } from './chunk-runtime-error.
|
|
2
|
+
import { g as generateHash, c as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, t as takeCoverageInsideWorker, p as pLimit } from './chunk-integrations-coverage.18366936.js';
|
|
3
|
+
import { e as globalExpect, f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getBenchOptions, n as getFn, o as setState, p as getSnapshotClient, G as GLOBAL_EXPECT, q as getState } from './chunk-runtime-chain.07d16eac.js';
|
|
4
|
+
import { r as resetRunOnceCounter, i as index, v as vi, s as setCurrentTest } from './chunk-utils-import.eb63557e.js';
|
|
5
|
+
import { g as getWorkerState, R as RealDate, t as toArray, k as relativePath, h as isRunningInBenchmark, p as partitionSuiteChildren, l as shuffle, q as hasTests, u as hasFailed, v as createDefer, e as getFullName } from './chunk-mock-date.91595ccd.js';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.e79efa9a.js';
|
|
7
|
+
import { p as processError } from './chunk-runtime-error.f2062967.js';
|
|
8
8
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
9
|
-
import { e as environments } from './chunk-env-node.
|
|
10
|
-
import { i as isNode, a as isBrowser } from './chunk-utils-env.
|
|
9
|
+
import { e as environments } from './chunk-env-node.ffd1183b.js';
|
|
10
|
+
import { i as isNode, a as isBrowser } from './chunk-utils-env.4ebb0106.js';
|
|
11
11
|
import { b as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.52534f96.js';
|
|
12
12
|
|
|
13
13
|
let globalSetup = false;
|
|
@@ -32,7 +32,7 @@ async function setupGlobalEnv(config) {
|
|
|
32
32
|
await setupConsoleLogSpy();
|
|
33
33
|
}
|
|
34
34
|
if (config.globals)
|
|
35
|
-
(await import('./chunk-integrations-globals.
|
|
35
|
+
(await import('./chunk-integrations-globals.59b4d460.js')).registerApiGlobally();
|
|
36
36
|
}
|
|
37
37
|
function setupDefines(defines) {
|
|
38
38
|
for (const key in defines)
|
|
@@ -155,6 +155,10 @@ async function loadEnvironment(name) {
|
|
|
155
155
|
}
|
|
156
156
|
async function withEnv(name, options, fn) {
|
|
157
157
|
const config = environments[name] || await loadEnvironment(name);
|
|
158
|
+
globalThis.__vitest_environment__ = config.name || name;
|
|
159
|
+
globalExpect.setState({
|
|
160
|
+
environment: config.name || name || "node"
|
|
161
|
+
});
|
|
158
162
|
const env = await config.setup(globalThis, options);
|
|
159
163
|
try {
|
|
160
164
|
await fn();
|
|
@@ -317,7 +321,7 @@ const callCleanupHooks = async (cleanups) => {
|
|
|
317
321
|
async function runTest(test) {
|
|
318
322
|
var _a, _b, _c;
|
|
319
323
|
if (test.mode !== "run") {
|
|
320
|
-
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.
|
|
324
|
+
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.07d16eac.js').then(function (n) { return n.u; });
|
|
321
325
|
getSnapshotClient2().skipTestSnapshots(test);
|
|
322
326
|
return;
|
|
323
327
|
}
|
|
@@ -334,7 +338,7 @@ async function runTest(test) {
|
|
|
334
338
|
clearModuleMocks();
|
|
335
339
|
setCurrentTest(test);
|
|
336
340
|
if (isNode) {
|
|
337
|
-
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.
|
|
341
|
+
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.07d16eac.js').then(function (n) { return n.u; });
|
|
338
342
|
await getSnapshotClient2().setTest(test);
|
|
339
343
|
}
|
|
340
344
|
const workerState = getWorkerState();
|
|
@@ -405,7 +409,7 @@ async function runTest(test) {
|
|
|
405
409
|
console.error(test.result.error.message, test.result.error.stackStr);
|
|
406
410
|
setCurrentTest(void 0);
|
|
407
411
|
if (isNode) {
|
|
408
|
-
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.
|
|
412
|
+
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.07d16eac.js').then(function (n) { return n.u; });
|
|
409
413
|
getSnapshotClient2().clearTest();
|
|
410
414
|
}
|
|
411
415
|
test.result.duration = now() - start;
|
|
@@ -618,7 +622,7 @@ async function startTestsBrowser(paths, config) {
|
|
|
618
622
|
async function startTestsNode(paths, config) {
|
|
619
623
|
const files = await collectTests(paths, config);
|
|
620
624
|
rpc().onCollected(files);
|
|
621
|
-
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.
|
|
625
|
+
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.07d16eac.js').then(function (n) { return n.u; });
|
|
622
626
|
getSnapshotClient2().clear();
|
|
623
627
|
await runFiles(files, config);
|
|
624
628
|
const coverage = await takeCoverageInsideWorker(config.coverage);
|