vitest 0.27.1 → 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.2be3cc38.js → chunk-api-setup.0a2398d8.js} +4 -3
- package/dist/{chunk-env-node.b3664da2.js → chunk-env-node.ffd1183b.js} +33 -0
- package/dist/{chunk-integrations-coverage.44413252.js → chunk-integrations-coverage.18366936.js} +3 -1
- package/dist/{chunk-integrations-globals.02f1259c.js → chunk-integrations-globals.59b4d460.js} +7 -6
- package/dist/{chunk-mock-date.149ed990.js → chunk-mock-date.91595ccd.js} +7 -3
- package/dist/{chunk-node-git.125c9008.js → chunk-node-git.59caac18.js} +2 -1
- package/dist/{chunk-runtime-chain.4e2aa823.js → chunk-runtime-chain.07d16eac.js} +15 -16
- package/dist/{chunk-runtime-error.97854396.js → chunk-runtime-error.f2062967.js} +1 -1
- package/dist/{chunk-runtime-mocker.4755840f.js → chunk-runtime-mocker.66533d65.js} +3 -3
- package/dist/{chunk-runtime-rpc.25cc9413.js → chunk-runtime-rpc.e79efa9a.js} +1 -1
- package/dist/{chunk-runtime-setup.56d71d30.js → chunk-runtime-setup.8ca273cd.js} +20 -13
- package/dist/{chunk-snapshot-manager.1a2dbf96.js → chunk-snapshot-manager.d16903ef.js} +147 -4046
- package/dist/{chunk-utils-env.f4a39d2c.js → chunk-utils-env.4ebb0106.js} +1 -0
- package/dist/{chunk-utils-import.16d9fb0d.js → chunk-utils-import.eb63557e.js} +47 -4
- package/dist/{chunk-utils-source-map.4e9b891d.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 +11 -8
- package/dist/config.d.ts +16 -3
- package/dist/config.js +11 -9
- package/dist/entry.js +24 -13
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/{index-1cfc7f58.d.ts → index-2dd51af4.d.ts} +1 -1
- package/dist/index.d.ts +8 -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-5617096e.d.ts → types-c1386a7d.d.ts} +337 -307
- 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,
|
|
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';
|
|
@@ -286,6 +286,13 @@ function populateGlobal(global, win, options = {}) {
|
|
|
286
286
|
global.parent = global;
|
|
287
287
|
if (global.global)
|
|
288
288
|
global.global = global;
|
|
289
|
+
if (global.document && global.document.defaultView) {
|
|
290
|
+
Object.defineProperty(global.document, "defaultView", {
|
|
291
|
+
get: () => global,
|
|
292
|
+
enumerable: true,
|
|
293
|
+
configurable: true
|
|
294
|
+
});
|
|
295
|
+
}
|
|
289
296
|
skipKeys.forEach((k) => keys.add(k));
|
|
290
297
|
return {
|
|
291
298
|
keys,
|
|
@@ -294,6 +301,29 @@ function populateGlobal(global, win, options = {}) {
|
|
|
294
301
|
};
|
|
295
302
|
}
|
|
296
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
|
+
}
|
|
297
327
|
var jsdom = {
|
|
298
328
|
name: "jsdom",
|
|
299
329
|
async setup(global, { jsdom = {} }) {
|
|
@@ -332,8 +362,11 @@ var jsdom = {
|
|
|
332
362
|
}
|
|
333
363
|
);
|
|
334
364
|
const { keys, originals } = populateGlobal(global, dom.window, { bindFunctions: true });
|
|
365
|
+
const clearWindowErrors = catchWindowErrors(global);
|
|
335
366
|
return {
|
|
336
367
|
teardown(global2) {
|
|
368
|
+
clearWindowErrors();
|
|
369
|
+
dom.window.close();
|
|
337
370
|
keys.forEach((key) => delete global2[key]);
|
|
338
371
|
originals.forEach((v, k) => global2[k] = v);
|
|
339
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.02f1259c.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;
|
|
@@ -181,6 +182,9 @@ function isAtomTest(s) {
|
|
|
181
182
|
function getTests(suite) {
|
|
182
183
|
return toArray(suite).flatMap((s) => isAtomTest(s) ? [s] : s.tasks.flatMap((c) => isAtomTest(c) ? [c] : getTests(c)));
|
|
183
184
|
}
|
|
185
|
+
function getTasks(tasks = []) {
|
|
186
|
+
return toArray(tasks).flatMap((s) => isAtomTest(s) ? [s] : [s, ...getTasks(s.tasks)]);
|
|
187
|
+
}
|
|
184
188
|
function getSuites(suite) {
|
|
185
189
|
return toArray(suite).flatMap((s) => s.type === "suite" ? [s, ...getSuites(s.tasks)] : []);
|
|
186
190
|
}
|
|
@@ -264,7 +268,7 @@ function removeUndefinedValues(obj) {
|
|
|
264
268
|
async function ensurePackageInstalled(dependency, root) {
|
|
265
269
|
if (isPackageExists(dependency, { paths: [root] }))
|
|
266
270
|
return true;
|
|
267
|
-
const promptInstall = !
|
|
271
|
+
const promptInstall = !isCI && process.stdout.isTTY;
|
|
268
272
|
process.stderr.write(c.red(`${c.inverse(c.red(" MISSING DEP "))} Can not find dependency '${dependency}'
|
|
269
273
|
|
|
270
274
|
`));
|
|
@@ -343,4 +347,4 @@ function objectAttr(source, path, defaultValue = void 0) {
|
|
|
343
347
|
return result;
|
|
344
348
|
}
|
|
345
349
|
|
|
346
|
-
export { AggregateErrorPonyfill as A,
|
|
350
|
+
export { AggregateErrorPonyfill as A, getTests as B, hasFailedSnapshot as C, getSuites as D, deepMerge as E, removeUndefinedValues as F, isWindows as G, stdout as H, getAllMockableProperties as I, RealDate as R, resetModules as a, getCallLastIndex as b, getNames as c, getCurrentEnvironment as d, getFullName as e, isRunningInTest as f, getWorkerState as g, isRunningInBenchmark as h, isObject as i, notNullish as j, relativePath as k, shuffle as l, mockDate as m, noop as n, objectAttr as o, partitionSuiteChildren as p, hasTests as q, resetDate as r, slash as s, toArray as t, hasFailed as u, createDefer as v, deepClone as w, getType as x, ensurePackageInstalled as y, getTasks as z };
|
|
@@ -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,
|
|
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;
|
|
@@ -20,6 +20,9 @@ async function setupGlobalEnv(config) {
|
|
|
20
20
|
setupDefines(config.defines);
|
|
21
21
|
if (globalSetup)
|
|
22
22
|
return;
|
|
23
|
+
require.extensions[".css"] = () => ({});
|
|
24
|
+
require.extensions[".scss"] = () => ({});
|
|
25
|
+
require.extensions[".sass"] = () => ({});
|
|
23
26
|
globalSetup = true;
|
|
24
27
|
if (isNode) {
|
|
25
28
|
const state = getWorkerState();
|
|
@@ -29,7 +32,7 @@ async function setupGlobalEnv(config) {
|
|
|
29
32
|
await setupConsoleLogSpy();
|
|
30
33
|
}
|
|
31
34
|
if (config.globals)
|
|
32
|
-
(await import('./chunk-integrations-globals.
|
|
35
|
+
(await import('./chunk-integrations-globals.59b4d460.js')).registerApiGlobally();
|
|
33
36
|
}
|
|
34
37
|
function setupDefines(defines) {
|
|
35
38
|
for (const key in defines)
|
|
@@ -152,6 +155,10 @@ async function loadEnvironment(name) {
|
|
|
152
155
|
}
|
|
153
156
|
async function withEnv(name, options, fn) {
|
|
154
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
|
+
});
|
|
155
162
|
const env = await config.setup(globalThis, options);
|
|
156
163
|
try {
|
|
157
164
|
await fn();
|
|
@@ -314,7 +321,7 @@ const callCleanupHooks = async (cleanups) => {
|
|
|
314
321
|
async function runTest(test) {
|
|
315
322
|
var _a, _b, _c;
|
|
316
323
|
if (test.mode !== "run") {
|
|
317
|
-
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; });
|
|
318
325
|
getSnapshotClient2().skipTestSnapshots(test);
|
|
319
326
|
return;
|
|
320
327
|
}
|
|
@@ -331,7 +338,7 @@ async function runTest(test) {
|
|
|
331
338
|
clearModuleMocks();
|
|
332
339
|
setCurrentTest(test);
|
|
333
340
|
if (isNode) {
|
|
334
|
-
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; });
|
|
335
342
|
await getSnapshotClient2().setTest(test);
|
|
336
343
|
}
|
|
337
344
|
const workerState = getWorkerState();
|
|
@@ -402,7 +409,7 @@ async function runTest(test) {
|
|
|
402
409
|
console.error(test.result.error.message, test.result.error.stackStr);
|
|
403
410
|
setCurrentTest(void 0);
|
|
404
411
|
if (isNode) {
|
|
405
|
-
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; });
|
|
406
413
|
getSnapshotClient2().clearTest();
|
|
407
414
|
}
|
|
408
415
|
test.result.duration = now() - start;
|
|
@@ -615,7 +622,7 @@ async function startTestsBrowser(paths, config) {
|
|
|
615
622
|
async function startTestsNode(paths, config) {
|
|
616
623
|
const files = await collectTests(paths, config);
|
|
617
624
|
rpc().onCollected(files);
|
|
618
|
-
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; });
|
|
619
626
|
getSnapshotClient2().clear();
|
|
620
627
|
await runFiles(files, config);
|
|
621
628
|
const coverage = await takeCoverageInsideWorker(config.coverage);
|