vitest 4.0.0-beta.9 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +86 -102
- package/browser/context.d.ts +7 -0
- package/browser/context.js +20 -0
- package/dist/browser.d.ts +24 -7
- package/dist/browser.js +15 -5
- package/dist/chunks/{base.CA5N8Af0.js → base.BYPMk0VN.js} +36 -36
- package/dist/chunks/{benchmark.CJUa-Hsa.js → benchmark.DHKMYAts.js} +2 -2
- package/dist/chunks/{browser.d.DtfyY9yS.d.ts → browser.d.B9iJzZyn.d.ts} +3 -3
- package/dist/chunks/{cac.Dt7e1TIu.js → cac.DrF4Gm0S.js} +47 -73
- package/dist/chunks/{cli-api.eAzsLIxz.js → cli-api.W2Q-JQoO.js} +1524 -296
- package/dist/chunks/{config.d.DacWrqWe.d.ts → config.d.u2CUDWwS.d.ts} +5 -19
- package/dist/chunks/{console.7h5kHUIf.js → console.CTJL2nuH.js} +4 -6
- package/dist/chunks/{coverage.CDRAMTt7.js → coverage.FU3w4IrQ.js} +125 -1108
- package/dist/chunks/{creator.KEg6n5IC.js → creator.DucAaYBz.js} +10 -37
- package/dist/chunks/{defaults.CXFFjsi8.js → defaults.BOqNVLsY.js} +0 -1
- package/dist/chunks/environment.d.CrsxCzP1.d.ts +29 -0
- package/dist/chunks/evaluatedModules.Dg1zASAC.js +17 -0
- package/dist/chunks/{global.d.K6uBQHzY.d.ts → global.d.BgJSTpgQ.d.ts} +2 -17
- package/dist/chunks/{globals.CJrTTbxC.js → globals.BGT_RUsD.js} +11 -7
- package/dist/chunks/{index.BjKEiSn0.js → index.BdSLhLDZ.js} +3 -3
- package/dist/chunks/{index.DfviD7lX.js → index.CbWINfS7.js} +49 -21
- package/dist/chunks/{index.BIP7prJq.js → index.CcRZ6fUh.js} +1493 -114
- package/dist/chunks/{index.X0nbfr6-.js → index.Dc3xnDvT.js} +48 -289
- package/dist/chunks/{index.C832ioot.js → index.RwjEGCQ0.js} +4 -4
- package/dist/chunks/init-forks.WglB-sfY.js +54 -0
- package/dist/chunks/init-threads.Czek6eA5.js +17 -0
- package/dist/chunks/init.94FWN9pW.js +213 -0
- package/dist/chunks/{inspector.CvQD-Nie.js → inspector.DLZxSeU3.js} +2 -6
- package/dist/chunks/{moduleRunner.d.DxTLreRD.d.ts → moduleRunner.d.YtNsMIoJ.d.ts} +9 -14
- package/dist/chunks/{node.CyipiPvJ.js → node.BwAWWjHZ.js} +3 -4
- package/dist/chunks/{plugin.d.CIk0YiKb.d.ts → plugin.d.DQU1R5px.d.ts} +1 -1
- package/dist/chunks/{reporters.d.DmP-iHLr.d.ts → reporters.d.BMKt7f6I.d.ts} +1064 -1021
- package/dist/chunks/{resolveSnapshotEnvironment.Bvv2zr69.js → resolveSnapshotEnvironment.DJJKMKxb.js} +7 -8
- package/dist/chunks/{rpc.BKr6mtxz.js → rpc.cD77ENhU.js} +13 -14
- package/dist/chunks/{setup-common.B7I37Tji.js → setup-common.DR1sucx6.js} +6 -6
- package/dist/chunks/{startModuleRunner.BDRvKSdz.js → startModuleRunner.iF1E9Bt4.js} +126 -110
- package/dist/chunks/{test.BAlBebnP.js → test.C3RPt8JR.js} +7 -7
- package/dist/chunks/{utils.D2R2NiOH.js → utils.CG9h5ccR.js} +2 -5
- package/dist/chunks/{vi.BB37KeLx.js → vi.BZvkKVkM.js} +61 -164
- package/dist/chunks/{vm.CjLTDaST.js → vm.CuMWYx_F.js} +20 -29
- package/dist/chunks/{worker.d.B2r4Ln6p.d.ts → worker.d.BFk-vvBU.d.ts} +42 -6
- package/dist/cli.js +12 -11
- package/dist/config.cjs +0 -1
- package/dist/config.d.ts +11 -13
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +7 -6
- package/dist/coverage.js +3 -14
- package/dist/environments.d.ts +3 -6
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +20 -25
- package/dist/index.js +11 -7
- package/dist/module-evaluator.d.ts +5 -4
- package/dist/module-evaluator.js +11 -13
- package/dist/module-runner.js +5 -5
- package/dist/node.d.ts +82 -25
- package/dist/node.js +23 -20
- package/dist/reporters.d.ts +10 -9
- package/dist/reporters.js +12 -11
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +9 -7
- package/dist/snapshot.js +3 -3
- package/dist/suite.js +4 -3
- package/dist/worker.d.ts +26 -0
- package/dist/worker.js +45 -165
- package/dist/workers/forks.js +26 -43
- package/dist/workers/runVmTests.js +16 -12
- package/dist/workers/threads.js +26 -31
- package/dist/workers/vmForks.js +26 -39
- package/dist/workers/vmThreads.js +26 -29
- package/package.json +48 -32
- package/worker.d.ts +1 -0
- package/browser.d.ts +0 -1
- package/dist/chunks/environment.d.2fYMoz3o.d.ts +0 -66
- package/dist/chunks/moduleTransport.I-bgQy0S.js +0 -19
- package/dist/chunks/resolver.Bx6lE0iq.js +0 -119
- package/dist/chunks/typechecker.DB-fIMaH.js +0 -805
- package/dist/chunks/utils.C2YI6McM.js +0 -52
- package/dist/chunks/worker.d.DJ6qxO2w.d.ts +0 -8
- package/dist/workers.d.ts +0 -38
- package/dist/workers.js +0 -49
- package/execute.d.ts +0 -1
- package/utils.d.ts +0 -1
- package/workers.d.ts +0 -1
|
@@ -78,6 +78,8 @@ interface SerializedConfig {
|
|
|
78
78
|
disableConsoleIntercept: boolean | undefined;
|
|
79
79
|
runner: string | undefined;
|
|
80
80
|
isolate: boolean;
|
|
81
|
+
fileParallelism: boolean;
|
|
82
|
+
maxWorkers: number;
|
|
81
83
|
mode: "test" | "benchmark";
|
|
82
84
|
bail: number | undefined;
|
|
83
85
|
environmentOptions?: Record<string, any>;
|
|
@@ -93,7 +95,6 @@ interface SerializedConfig {
|
|
|
93
95
|
restoreMocks: boolean;
|
|
94
96
|
unstubGlobals: boolean;
|
|
95
97
|
unstubEnvs: boolean;
|
|
96
|
-
// TODO: make optional
|
|
97
98
|
fakeTimers: FakeTimerInstallOpts;
|
|
98
99
|
maxConcurrency: number;
|
|
99
100
|
defines: Record<string, any>;
|
|
@@ -112,22 +113,6 @@ interface SerializedConfig {
|
|
|
112
113
|
hooks: SequenceHooks;
|
|
113
114
|
setupFiles: SequenceSetupFiles;
|
|
114
115
|
};
|
|
115
|
-
poolOptions: {
|
|
116
|
-
forks: {
|
|
117
|
-
singleFork: boolean;
|
|
118
|
-
isolate: boolean;
|
|
119
|
-
};
|
|
120
|
-
threads: {
|
|
121
|
-
singleThread: boolean;
|
|
122
|
-
isolate: boolean;
|
|
123
|
-
};
|
|
124
|
-
vmThreads: {
|
|
125
|
-
singleThread: boolean;
|
|
126
|
-
};
|
|
127
|
-
vmForks: {
|
|
128
|
-
singleFork: boolean;
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
116
|
deps: {
|
|
132
117
|
web: {
|
|
133
118
|
transformAssets?: boolean;
|
|
@@ -184,9 +169,9 @@ interface SerializedConfig {
|
|
|
184
169
|
};
|
|
185
170
|
screenshotFailures: boolean;
|
|
186
171
|
providerOptions: {
|
|
187
|
-
// for playwright
|
|
188
172
|
actionTimeout?: number;
|
|
189
173
|
};
|
|
174
|
+
trace: BrowserTraceViewMode;
|
|
190
175
|
trackUnhandledErrors: boolean;
|
|
191
176
|
};
|
|
192
177
|
standalone: boolean;
|
|
@@ -212,5 +197,6 @@ type RuntimeConfig = Pick<SerializedConfig, "allowOnly" | "testTimeout" | "hookT
|
|
|
212
197
|
};
|
|
213
198
|
};
|
|
214
199
|
type RuntimeOptions = Partial<RuntimeConfig>;
|
|
200
|
+
type BrowserTraceViewMode = "on" | "off" | "on-first-retry" | "on-all-retries" | "retain-on-failure";
|
|
215
201
|
|
|
216
|
-
export type { FakeTimerInstallOpts as F, RuntimeOptions as R,
|
|
202
|
+
export type { BrowserTraceViewMode as B, FakeTimerInstallOpts as F, RuntimeOptions as R, SerializedConfig as S, SerializedCoverageConfig as a, RuntimeConfig as b };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Console } from 'node:console';
|
|
2
2
|
import { relative } from 'node:path';
|
|
3
3
|
import { Writable } from 'node:stream';
|
|
4
|
-
import { getSafeTimers } from '@vitest/utils';
|
|
4
|
+
import { getSafeTimers } from '@vitest/utils/timers';
|
|
5
5
|
import c from 'tinyrainbow';
|
|
6
6
|
import { R as RealDate } from './date.-jtEtIeV.js';
|
|
7
|
-
import { g as getWorkerState } from './utils.
|
|
7
|
+
import { g as getWorkerState } from './utils.CG9h5ccR.js';
|
|
8
8
|
|
|
9
9
|
const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
|
|
10
10
|
function getTaskIdByStack(root) {
|
|
@@ -78,7 +78,7 @@ function createCustomConsole(defaultState) {
|
|
|
78
78
|
if (state().config.printConsoleTrace) {
|
|
79
79
|
const limit = Error.stackTraceLimit;
|
|
80
80
|
Error.stackTraceLimit = limit + 6;
|
|
81
|
-
const
|
|
81
|
+
const trace = (/* @__PURE__ */ new Error("STACK_TRACE")).stack?.split("\n").slice(7).join("\n");
|
|
82
82
|
Error.stackTraceLimit = limit, buffer.push([data, trace]);
|
|
83
83
|
} else buffer.push([data, void 0]);
|
|
84
84
|
schedule(id), callback();
|
|
@@ -96,9 +96,7 @@ function createCustomConsole(defaultState) {
|
|
|
96
96
|
const limit = Error.stackTraceLimit;
|
|
97
97
|
Error.stackTraceLimit = limit + 6;
|
|
98
98
|
const stack = (/* @__PURE__ */ new Error("STACK_TRACE")).stack?.split("\n");
|
|
99
|
-
Error.stackTraceLimit = limit;
|
|
100
|
-
const isTrace = stack?.some((line) => line.includes("at Console.trace"));
|
|
101
|
-
if (isTrace) buffer.push([data, void 0]);
|
|
99
|
+
if (Error.stackTraceLimit = limit, stack?.some((line) => line.includes("at Console.trace"))) buffer.push([data, void 0]);
|
|
102
100
|
else {
|
|
103
101
|
const trace = stack?.slice(7).join("\n");
|
|
104
102
|
Error.stackTraceLimit = limit, buffer.push([data, trace]);
|