vitest 4.0.0-beta.5 → 4.0.0-beta.6
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 +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +2 -2
- package/dist/chunks/{base.DMfOuRWD.js → base.BXI97p6t.js} +7 -16
- package/dist/chunks/{benchmark.CtuRzf-i.js → benchmark.UW6Ezvxy.js} +4 -9
- package/dist/chunks/{cac.CKnbxhn2.js → cac.WE-urWw5.js} +37 -113
- package/dist/chunks/{cli-api.COn58yrl.js → cli-api.CZz3evYC.js} +505 -1211
- package/dist/chunks/{console.Duv2dVIC.js → console.B0quX7yH.js} +32 -68
- package/dist/chunks/{coverage.B6cReEn1.js → coverage.BPRS6xgn.js} +210 -579
- package/dist/chunks/{creator.DUVZ6rfm.js → creator.KEg6n5IC.js} +28 -74
- package/dist/chunks/{date.Bq6ZW5rf.js → date.-jtEtIeV.js} +6 -17
- package/dist/chunks/{git.BVQ8w_Sw.js → git.BFNcloKD.js} +1 -2
- package/dist/chunks/{globals.CJQ63oO0.js → globals.lgsmH00r.js} +5 -5
- package/dist/chunks/{index.DgN0Zk9a.js → index.7w0eqmYM.js} +14 -24
- package/dist/chunks/{index.QZr3S3vQ.js → index.AR8aAkCC.js} +2 -2
- package/dist/chunks/{index.BRtIe7r8.js → index.BG0gqZH-.js} +39 -102
- package/dist/chunks/{index.oWRWx-nj.js → index.CsFXYRkW.js} +17 -36
- package/dist/chunks/{index.DQhAfQQU.js → index.VNI-1z5c.js} +270 -606
- package/dist/chunks/{inspector.C914Efll.js → inspector.CvQD-Nie.js} +10 -25
- package/dist/chunks/{moduleRunner.d.mmOmOGrW.d.ts → moduleRunner.d.8kKUsuDg.d.ts} +1 -1
- package/dist/chunks/{node.4JV5OXkt.js → node.BOqcT2jW.js} +1 -1
- package/dist/chunks/{plugin.d.CvOlgjxK.d.ts → plugin.d.DuiQJfUL.d.ts} +1 -1
- package/dist/chunks/{reporters.d.CYE9sT5z.d.ts → reporters.d.CqR9-CDJ.d.ts} +16 -33
- package/dist/chunks/{resolver.D5bG4zy5.js → resolver.Bx6lE0iq.js} +21 -64
- package/dist/chunks/{rpc.DGoW_Vl-.js → rpc.RpPylpp0.js} +7 -21
- package/dist/chunks/{runBaseTests.B3KcKqlF.js → runBaseTests.D6sfuWBM.js} +25 -54
- package/dist/chunks/{setup-common.lgPs-bYv.js → setup-common.hLGRxhC8.js} +9 -22
- package/dist/chunks/{startModuleRunner.C8FtT_BY.js → startModuleRunner.C8TW8zTN.js} +83 -205
- package/dist/chunks/{typechecker.BgoW4nTA.js → typechecker.Cd1wvxUM.js} +96 -208
- package/dist/chunks/{utils.CcGm2cd1.js → utils.C2YI6McM.js} +4 -13
- package/dist/chunks/{utils.B9FY3b73.js → utils.C7__0Iv5.js} +5 -14
- package/dist/chunks/{vi.DGAfBY4R.js → vi.BfdOiD4j.js} +110 -267
- package/dist/chunks/{vm.BKfKvaKl.js → vm.BHBje7cC.js} +73 -177
- package/dist/cli.js +3 -3
- package/dist/config.d.ts +4 -4
- package/dist/coverage.d.ts +1 -1
- package/dist/coverage.js +2 -2
- package/dist/environments.js +1 -1
- package/dist/index.js +5 -5
- package/dist/module-evaluator.d.ts +1 -1
- package/dist/module-evaluator.js +33 -84
- package/dist/module-runner.js +2 -2
- package/dist/node.d.ts +3 -3
- package/dist/node.js +13 -19
- package/dist/reporters.d.ts +2 -2
- package/dist/reporters.js +3 -3
- package/dist/runners.js +23 -51
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +18 -34
- package/dist/workers/forks.js +4 -4
- package/dist/workers/runVmTests.js +19 -37
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +7 -7
- package/dist/workers/vmThreads.js +7 -7
- package/dist/workers.js +11 -11
- package/package.json +11 -11
|
@@ -1,54 +1,41 @@
|
|
|
1
1
|
import { r as resolveCoverageProviderModule } from './coverage.D_JHT54q.js';
|
|
2
2
|
import { addSerializer } from '@vitest/snapshot';
|
|
3
3
|
import { setSafeTimers } from '@vitest/utils';
|
|
4
|
-
import { g as getWorkerState } from './utils.
|
|
4
|
+
import { g as getWorkerState } from './utils.C7__0Iv5.js';
|
|
5
5
|
|
|
6
6
|
async function startCoverageInsideWorker(options, loader, runtimeOptions) {
|
|
7
7
|
const coverageModule = await resolveCoverageProviderModule(options, loader);
|
|
8
|
-
|
|
9
|
-
return null;
|
|
8
|
+
return coverageModule ? coverageModule.startCoverage?.(runtimeOptions) : null;
|
|
10
9
|
}
|
|
11
10
|
async function takeCoverageInsideWorker(options, loader) {
|
|
12
11
|
const coverageModule = await resolveCoverageProviderModule(options, loader);
|
|
13
|
-
|
|
14
|
-
return null;
|
|
12
|
+
return coverageModule ? coverageModule.takeCoverage?.({ moduleExecutionInfo: loader.moduleExecutionInfo }) : null;
|
|
15
13
|
}
|
|
16
14
|
async function stopCoverageInsideWorker(options, loader, runtimeOptions) {
|
|
17
15
|
const coverageModule = await resolveCoverageProviderModule(options, loader);
|
|
18
|
-
|
|
19
|
-
return null;
|
|
16
|
+
return coverageModule ? coverageModule.stopCoverage?.(runtimeOptions) : null;
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
let globalSetup = false;
|
|
23
20
|
async function setupCommonEnv(config) {
|
|
24
|
-
setupDefines(config.defines);
|
|
25
|
-
setupEnv(config.env);
|
|
26
|
-
if (globalSetup) return;
|
|
27
|
-
globalSetup = true;
|
|
28
|
-
setSafeTimers();
|
|
29
|
-
if (config.globals) (await import('./globals.CJQ63oO0.js')).registerApiGlobally();
|
|
21
|
+
if (setupDefines(config.defines), setupEnv(config.env), !globalSetup && (globalSetup = true, setSafeTimers(), config.globals)) (await import('./globals.lgsmH00r.js')).registerApiGlobally();
|
|
30
22
|
}
|
|
31
23
|
function setupDefines(defines) {
|
|
32
24
|
for (const key in defines) globalThis[key] = defines[key];
|
|
33
25
|
}
|
|
34
26
|
function setupEnv(env) {
|
|
35
|
-
const state = getWorkerState();
|
|
36
|
-
|
|
37
|
-
const { PROD, DEV,...restEnvs } = env;
|
|
38
|
-
state.metaEnv.PROD = PROD;
|
|
39
|
-
state.metaEnv.DEV = DEV;
|
|
40
|
-
for (const key in restEnvs) state.metaEnv[key] = env[key];
|
|
27
|
+
const state = getWorkerState(), { PROD, DEV,...restEnvs } = env;
|
|
28
|
+
for (const key in state.metaEnv.PROD = PROD, state.metaEnv.DEV = DEV, restEnvs) state.metaEnv[key] = env[key];
|
|
41
29
|
}
|
|
42
30
|
async function loadDiffConfig(config, moduleRunner) {
|
|
43
31
|
if (typeof config.diff === "object") return config.diff;
|
|
44
32
|
if (typeof config.diff !== "string") return;
|
|
45
33
|
const diffModule = await moduleRunner.import(config.diff);
|
|
46
34
|
if (diffModule && typeof diffModule.default === "object" && diffModule.default != null) return diffModule.default;
|
|
47
|
-
|
|
35
|
+
throw new Error(`invalid diff config file ${config.diff}. Must have a default export with config object`);
|
|
48
36
|
}
|
|
49
37
|
async function loadSnapshotSerializers(config, moduleRunner) {
|
|
50
|
-
const files = config.snapshotSerializers
|
|
51
|
-
const snapshotSerializers = await Promise.all(files.map(async (file) => {
|
|
38
|
+
const files = config.snapshotSerializers, snapshotSerializers = await Promise.all(files.map(async (file) => {
|
|
52
39
|
const mo = await moduleRunner.import(file);
|
|
53
40
|
if (!mo || typeof mo.default !== "object" || mo.default === null) throw new Error(`invalid snapshot serializer file ${file}. Must export a default object`);
|
|
54
41
|
const config = mo.default;
|