vitest 4.0.0-beta.7 → 4.0.0-beta.9
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 +5 -5
- package/dist/browser.js +4 -4
- package/dist/chunks/{runBaseTests.D6sfuWBM.js → base.CA5N8Af0.js} +55 -26
- package/dist/chunks/{benchmark.UW6Ezvxy.js → benchmark.CJUa-Hsa.js} +1 -1
- package/dist/chunks/{browser.d.DOMmqJQx.d.ts → browser.d.DtfyY9yS.d.ts} +1 -1
- package/dist/chunks/{cac.Dsn7ixFt.js → cac.Dt7e1TIu.js} +6 -25
- package/dist/chunks/{cli-api.DfGJyldU.js → cli-api.eAzsLIxz.js} +88 -209
- package/dist/chunks/{config.d._GBBbReY.d.ts → config.d.DacWrqWe.d.ts} +1 -0
- package/dist/chunks/{console.B0quX7yH.js → console.7h5kHUIf.js} +1 -1
- package/dist/chunks/{coverage.Dvxug1RM.js → coverage.CDRAMTt7.js} +25 -56
- package/dist/chunks/{globals.lgsmH00r.js → globals.CJrTTbxC.js} +5 -6
- package/dist/chunks/{index.C3EbxYwt.js → index.BIP7prJq.js} +7 -3
- package/dist/chunks/{index.D2B6d2vv.js → index.BjKEiSn0.js} +1 -1
- package/dist/chunks/{index.AR8aAkCC.js → index.C832ioot.js} +5 -6
- package/dist/chunks/{moduleRunner.d.CX4DuqOx.d.ts → moduleRunner.d.DxTLreRD.d.ts} +4 -1
- package/dist/chunks/{node.BOqcT2jW.js → node.CyipiPvJ.js} +1 -1
- package/dist/chunks/{plugin.d.vcD4xbMS.d.ts → plugin.d.CIk0YiKb.d.ts} +1 -1
- package/dist/chunks/{reporters.d.BC86JJdB.d.ts → reporters.d.DmP-iHLr.d.ts} +451 -561
- package/dist/chunks/{index.CsFXYRkW.js → resolveSnapshotEnvironment.Bvv2zr69.js} +16 -21
- package/dist/chunks/{rpc.RpPylpp0.js → rpc.BKr6mtxz.js} +1 -1
- package/dist/chunks/{setup-common.hLGRxhC8.js → setup-common.B7I37Tji.js} +4 -4
- package/dist/chunks/{startModuleRunner.C8TW8zTN.js → startModuleRunner.BDRvKSdz.js} +7 -2
- package/dist/chunks/test.BAlBebnP.js +214 -0
- package/dist/chunks/{typechecker.DSo_maXz.js → typechecker.DB-fIMaH.js} +44 -1
- package/dist/chunks/{utils.C7__0Iv5.js → utils.D2R2NiOH.js} +1 -10
- package/dist/chunks/{vi.BfdOiD4j.js → vi.BB37KeLx.js} +16 -16
- package/dist/chunks/{vm.BHBje7cC.js → vm.CjLTDaST.js} +12 -7
- package/dist/chunks/{worker.d.DYlqbejz.d.ts → worker.d.B2r4Ln6p.d.ts} +1 -1
- package/dist/chunks/{worker.d.BKu8cnnX.d.ts → worker.d.DJ6qxO2w.d.ts} +1 -1
- package/dist/cli.js +3 -3
- package/dist/config.d.ts +10 -10
- package/dist/coverage.d.ts +8 -8
- package/dist/coverage.js +2 -2
- package/dist/index.d.ts +11 -12
- package/dist/index.js +5 -8
- package/dist/module-evaluator.d.ts +4 -3
- package/dist/module-evaluator.js +3 -3
- package/dist/module-runner.js +2 -2
- package/dist/node.d.ts +23 -14
- package/dist/node.js +8 -8
- package/dist/reporters.d.ts +8 -8
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +11 -215
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +2 -3
- package/dist/workers/forks.js +27 -4
- package/dist/workers/runVmTests.js +18 -19
- package/dist/workers/threads.js +27 -4
- package/dist/workers/vmForks.js +4 -4
- package/dist/workers/vmThreads.js +4 -4
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +26 -8
- package/package.json +10 -14
- package/dist/chunks/base.BXI97p6t.js +0 -39
package/dist/browser.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.d.
|
|
1
|
+
import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.d.DacWrqWe.js';
|
|
2
2
|
import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.BZtK59WP.js';
|
|
3
3
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
4
|
-
import { V as VitestModuleRunner } from './chunks/moduleRunner.d.
|
|
4
|
+
import { V as VitestModuleRunner } from './chunks/moduleRunner.d.DxTLreRD.js';
|
|
5
5
|
export { collectTests, processError, startTests } from '@vitest/runner';
|
|
6
|
-
import * as
|
|
7
|
-
export {
|
|
6
|
+
import * as _vitest_spy from '@vitest/spy';
|
|
7
|
+
export { _vitest_spy as SpyModule };
|
|
8
8
|
export { LoupeOptions, ParsedStack, StringifyOptions, format, getSafeTimers, inspect, stringify } from '@vitest/utils';
|
|
9
9
|
export { TraceMap, originalPositionFor } from '@vitest/utils/source-map';
|
|
10
10
|
import '@vitest/pretty-format';
|
|
11
11
|
import '@vitest/snapshot';
|
|
12
12
|
import 'node:vm';
|
|
13
13
|
import 'vite/module-runner';
|
|
14
|
-
import './chunks/worker.d.
|
|
14
|
+
import './chunks/worker.d.B2r4Ln6p.js';
|
|
15
15
|
import './chunks/environment.d.2fYMoz3o.js';
|
|
16
16
|
import '@vitest/mocker';
|
|
17
17
|
import './chunks/mocker.d.BE_2ls6u.js';
|
package/dist/browser.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.
|
|
1
|
+
export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.B7I37Tji.js';
|
|
2
2
|
export { collectTests, processError, startTests } from '@vitest/runner';
|
|
3
|
-
import * as
|
|
4
|
-
export {
|
|
3
|
+
import * as spyModule from '@vitest/spy';
|
|
4
|
+
export { spyModule as SpyModule };
|
|
5
5
|
export { format, getSafeTimers, inspect, stringify } from '@vitest/utils';
|
|
6
6
|
export { TraceMap, originalPositionFor } from '@vitest/utils/source-map';
|
|
7
7
|
import './chunks/coverage.D_JHT54q.js';
|
|
8
8
|
import '@vitest/snapshot';
|
|
9
|
-
import './chunks/utils.
|
|
9
|
+
import './chunks/utils.D2R2NiOH.js';
|
|
@@ -1,40 +1,26 @@
|
|
|
1
|
+
import { runInThisContext } from 'node:vm';
|
|
2
|
+
import * as spyModule from '@vitest/spy';
|
|
3
|
+
import { EvaluatedModules } from 'vite/module-runner';
|
|
4
|
+
import { s as startVitestModuleRunner } from './startModuleRunner.BDRvKSdz.js';
|
|
1
5
|
import { performance } from 'node:perf_hooks';
|
|
2
6
|
import { startTests, collectTests } from '@vitest/runner';
|
|
3
|
-
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './
|
|
4
|
-
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.
|
|
5
|
-
import {
|
|
7
|
+
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './resolveSnapshotEnvironment.Bvv2zr69.js';
|
|
8
|
+
import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.B7I37Tji.js';
|
|
9
|
+
import { g as globalExpect, v as vi } from './vi.BB37KeLx.js';
|
|
6
10
|
import { c as closeInspector } from './inspector.CvQD-Nie.js';
|
|
7
11
|
import { createRequire } from 'node:module';
|
|
8
12
|
import timers from 'node:timers';
|
|
9
13
|
import timersPromises from 'node:timers/promises';
|
|
10
14
|
import util from 'node:util';
|
|
11
15
|
import { KNOWN_ASSET_TYPES, getSafeTimers } from '@vitest/utils';
|
|
12
|
-
import {
|
|
13
|
-
import { g as getWorkerState, r as resetModules } from './utils.
|
|
14
|
-
import 'chai';
|
|
15
|
-
import 'node:path';
|
|
16
|
-
import '../path.js';
|
|
17
|
-
import 'node:url';
|
|
18
|
-
import './rpc.RpPylpp0.js';
|
|
19
|
-
import './index.Bgo3tNWt.js';
|
|
20
|
-
import './coverage.D_JHT54q.js';
|
|
21
|
-
import '@vitest/snapshot';
|
|
22
|
-
import '@vitest/expect';
|
|
23
|
-
import '@vitest/runner/utils';
|
|
24
|
-
import './_commonjsHelpers.BFTU3MAI.js';
|
|
25
|
-
import '@vitest/utils/error';
|
|
26
|
-
import '@vitest/spy';
|
|
27
|
-
import '@vitest/utils/source-map';
|
|
28
|
-
import './date.-jtEtIeV.js';
|
|
29
|
-
import './benchmark.UW6Ezvxy.js';
|
|
30
|
-
import 'expect-type';
|
|
31
|
-
import 'vite/module-runner';
|
|
16
|
+
import { i as index } from './index.C832ioot.js';
|
|
17
|
+
import { g as getWorkerState, r as resetModules, p as provideWorkerState } from './utils.D2R2NiOH.js';
|
|
32
18
|
|
|
33
19
|
// this should only be used in Node
|
|
34
20
|
let globalSetup = false;
|
|
35
21
|
async function setupGlobalEnv(config, { environment }, moduleRunner) {
|
|
36
22
|
await setupCommonEnv(config), Object.defineProperty(globalThis, "__vitest_index__", {
|
|
37
|
-
value:
|
|
23
|
+
value: index,
|
|
38
24
|
enumerable: false
|
|
39
25
|
});
|
|
40
26
|
const state = getWorkerState();
|
|
@@ -61,7 +47,7 @@ function resolveAsset(mod, url) {
|
|
|
61
47
|
mod.exports = url;
|
|
62
48
|
}
|
|
63
49
|
async function setupConsoleLogSpy() {
|
|
64
|
-
const { createCustomConsole } = await import('./console.
|
|
50
|
+
const { createCustomConsole } = await import('./console.7h5kHUIf.js');
|
|
65
51
|
globalThis.console = createCustomConsole();
|
|
66
52
|
}
|
|
67
53
|
async function withEnv({ environment }, options, fn) {
|
|
@@ -96,4 +82,47 @@ async function run(method, files, config, environment, moduleRunner) {
|
|
|
96
82
|
}), workerState.environmentTeardownRun = true;
|
|
97
83
|
}
|
|
98
84
|
|
|
99
|
-
|
|
85
|
+
let _moduleRunner;
|
|
86
|
+
const evaluatedModules = new EvaluatedModules(), moduleExecutionInfo = /* @__PURE__ */ new Map();
|
|
87
|
+
function startModuleRunner(options) {
|
|
88
|
+
return _moduleRunner || (_moduleRunner = startVitestModuleRunner(options), _moduleRunner);
|
|
89
|
+
}
|
|
90
|
+
async function runBaseTests(method, state) {
|
|
91
|
+
const { ctx } = state;
|
|
92
|
+
if (state.evaluatedModules = evaluatedModules, state.moduleExecutionInfo = moduleExecutionInfo, provideWorkerState(globalThis, state), ctx.invalidates) ctx.invalidates.forEach((filepath) => {
|
|
93
|
+
const modules = state.evaluatedModules.fileToModulesMap.get(filepath) || [];
|
|
94
|
+
modules.forEach((module) => {
|
|
95
|
+
state.evaluatedModules.invalidateModule(module);
|
|
96
|
+
});
|
|
97
|
+
// evaluatedModules.delete(fsPath)
|
|
98
|
+
// evaluatedModules.delete(`mock:${fsPath}`)
|
|
99
|
+
});
|
|
100
|
+
ctx.files.forEach((i) => {
|
|
101
|
+
const filepath = typeof i === "string" ? i : i.filepath, modules = state.evaluatedModules.fileToModulesMap.get(filepath) || [];
|
|
102
|
+
modules.forEach((module) => {
|
|
103
|
+
state.evaluatedModules.invalidateModule(module);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
const executor = startModuleRunner({
|
|
107
|
+
state,
|
|
108
|
+
evaluatedModules: state.evaluatedModules,
|
|
109
|
+
spyModule
|
|
110
|
+
}), fileSpecs = ctx.files.map((f) => typeof f === "string" ? {
|
|
111
|
+
filepath: f,
|
|
112
|
+
testLocations: void 0
|
|
113
|
+
} : f);
|
|
114
|
+
if (ctx.config.serializedDefines) try {
|
|
115
|
+
runInThisContext(`(() =>{\n${ctx.config.serializedDefines}})()`, {
|
|
116
|
+
lineOffset: 1,
|
|
117
|
+
filename: "virtual:load-defines.js"
|
|
118
|
+
});
|
|
119
|
+
} catch (error) {
|
|
120
|
+
throw new Error(`Failed to load custom "defines": ${error.message}`);
|
|
121
|
+
}
|
|
122
|
+
await run(method, fileSpecs, ctx.config, {
|
|
123
|
+
environment: state.environment,
|
|
124
|
+
options: ctx.environment.options
|
|
125
|
+
}, executor);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { runBaseTests as r };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCurrentSuite } from '@vitest/runner';
|
|
2
2
|
import { createChainable } from '@vitest/runner/utils';
|
|
3
3
|
import { noop } from '@vitest/utils';
|
|
4
|
-
import { g as getWorkerState } from './utils.
|
|
4
|
+
import { g as getWorkerState } from './utils.D2R2NiOH.js';
|
|
5
5
|
|
|
6
6
|
const benchFns = /* @__PURE__ */ new WeakMap(), benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
function getBenchOptions(key) {
|
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
import { normalize } from 'pathe';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
5
5
|
import { a as defaultPort, d as defaultBrowserPort } from './constants.D_Q9UYh-.js';
|
|
6
|
-
import { R as ReportersMap } from './index.
|
|
6
|
+
import { R as ReportersMap } from './index.BIP7prJq.js';
|
|
7
7
|
|
|
8
8
|
function toArr(any) {
|
|
9
9
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -619,7 +619,7 @@ class CAC extends EventEmitter {
|
|
|
619
619
|
|
|
620
620
|
const cac = (name = "") => new CAC(name);
|
|
621
621
|
|
|
622
|
-
var version = "4.0.0-beta.
|
|
622
|
+
var version = "4.0.0-beta.9";
|
|
623
623
|
|
|
624
624
|
const apiConfig = (port) => ({
|
|
625
625
|
port: {
|
|
@@ -639,10 +639,6 @@ const apiConfig = (port) => ({
|
|
|
639
639
|
description: "Maximum number or percentage of threads to run tests in",
|
|
640
640
|
argument: "<workers>"
|
|
641
641
|
},
|
|
642
|
-
minThreads: {
|
|
643
|
-
description: "Minimum number or percentage of threads to run tests in",
|
|
644
|
-
argument: "<workers>"
|
|
645
|
-
},
|
|
646
642
|
useAtomics: { description: "Use Atomics to synchronize threads. This can improve performance in some cases, but might cause segfault in older Node versions (default: `false`)" },
|
|
647
643
|
execArgv: null
|
|
648
644
|
}, poolForksCommands = {
|
|
@@ -652,10 +648,6 @@ const apiConfig = (port) => ({
|
|
|
652
648
|
description: "Maximum number or percentage of processes to run tests in",
|
|
653
649
|
argument: "<workers>"
|
|
654
650
|
},
|
|
655
|
-
minForks: {
|
|
656
|
-
description: "Minimum number or percentage of processes to run tests in",
|
|
657
|
-
argument: "<workers>"
|
|
658
|
-
},
|
|
659
651
|
execArgv: null
|
|
660
652
|
};
|
|
661
653
|
function watermarkTransform(value) {
|
|
@@ -872,7 +864,6 @@ const cliOptionsConfig = {
|
|
|
872
864
|
},
|
|
873
865
|
trackUnhandledErrors: { description: "Control if Vitest catches uncaught exceptions so they can be reported (default: `true`)" },
|
|
874
866
|
orchestratorScripts: null,
|
|
875
|
-
testerScripts: null,
|
|
876
867
|
commands: null,
|
|
877
868
|
viewport: null,
|
|
878
869
|
screenshotDirectory: null,
|
|
@@ -931,10 +922,6 @@ const cliOptionsConfig = {
|
|
|
931
922
|
description: "Maximum number or percentage of workers to run tests in",
|
|
932
923
|
argument: "<workers>"
|
|
933
924
|
},
|
|
934
|
-
minWorkers: {
|
|
935
|
-
description: "Minimum number or percentage of workers to run tests in",
|
|
936
|
-
argument: "<workers>"
|
|
937
|
-
},
|
|
938
925
|
environment: {
|
|
939
926
|
description: "Specify runner environment, if not running in the browser (default: `node`)",
|
|
940
927
|
argument: "<name>",
|
|
@@ -1333,13 +1320,10 @@ function normalizeCliOptions(cliFilters, argv) {
|
|
|
1333
1320
|
}
|
|
1334
1321
|
async function start(mode, cliFilters, options) {
|
|
1335
1322
|
try {
|
|
1336
|
-
|
|
1337
|
-
} catch {}
|
|
1338
|
-
try {
|
|
1339
|
-
const { startVitest } = await import('./cli-api.DfGJyldU.js').then(function (n) { return n.j; }), ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1323
|
+
const { startVitest } = await import('./cli-api.eAzsLIxz.js').then(function (n) { return n.j; }), ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1340
1324
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
1341
1325
|
} catch (e) {
|
|
1342
|
-
const { errorBanner } = await import('./index.
|
|
1326
|
+
const { errorBanner } = await import('./index.BIP7prJq.js').then(function (n) { return n.u; });
|
|
1343
1327
|
if (console.error(`\n${errorBanner("Startup Error")}`), console.error(e), console.error("\n\n"), process.exitCode == null) process.exitCode = 1;
|
|
1344
1328
|
process.exit();
|
|
1345
1329
|
}
|
|
@@ -1351,10 +1335,7 @@ async function init(project) {
|
|
|
1351
1335
|
}
|
|
1352
1336
|
async function collect(mode, cliFilters, options) {
|
|
1353
1337
|
try {
|
|
1354
|
-
|
|
1355
|
-
} catch {}
|
|
1356
|
-
try {
|
|
1357
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.DfGJyldU.js').then(function (n) { return n.j; }), ctx = await prepareVitest(mode, {
|
|
1338
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.eAzsLIxz.js').then(function (n) { return n.j; }), ctx = await prepareVitest(mode, {
|
|
1358
1339
|
...normalizeCliOptions(cliFilters, options),
|
|
1359
1340
|
watch: false,
|
|
1360
1341
|
run: true
|
|
@@ -1372,7 +1353,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1372
1353
|
}
|
|
1373
1354
|
await ctx.close();
|
|
1374
1355
|
} catch (e) {
|
|
1375
|
-
const { errorBanner } = await import('./index.
|
|
1356
|
+
const { errorBanner } = await import('./index.BIP7prJq.js').then(function (n) { return n.u; });
|
|
1376
1357
|
if (console.error(`\n${errorBanner("Collect Error")}`), console.error(e), console.error("\n\n"), process.exitCode == null) process.exitCode = 1;
|
|
1377
1358
|
process.exit();
|
|
1378
1359
|
}
|