vitest 2.0.0-beta.1 → 2.0.0-beta.11
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 +22 -2
- package/dist/browser.js +5 -3
- package/dist/chunks/{integrations-globals.B5Jl0grA.js → integrations-globals.CC2ed6Py.js} +9 -9
- package/dist/chunks/{node-git.CCI8evVZ.js → node-git.ZtkbKc8u.js} +14 -15
- package/dist/chunks/{runtime-console.CUES-L8X.js → runtime-console.Ckl0vEQr.js} +76 -31
- package/dist/chunks/{runtime-runBaseTests._dXkRAZc.js → runtime-runBaseTests.BXW_BJeO.js} +40 -32
- package/dist/cli.js +3 -3
- package/dist/config.cjs +43 -20
- package/dist/config.d.ts +2 -2
- package/dist/config.js +43 -21
- package/dist/coverage.d.ts +4 -4
- package/dist/coverage.js +125 -37
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +2 -2
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +20 -30
- package/dist/index.js +9 -9
- package/dist/node.d.ts +22 -9
- package/dist/node.js +25 -15
- package/dist/path.js +4 -1
- package/dist/{reporters-MGvT5U9f.d.ts → reporters-fiIq_dT9.d.ts} +310 -148
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +8 -8
- package/dist/runners.d.ts +4 -2
- package/dist/runners.js +103 -57
- package/dist/{suite-8WAe-urM.d.ts → suite-D4aoU9rI.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +2 -2
- package/dist/utils.d.ts +1 -5
- package/dist/utils.js +1 -6
- package/dist/vendor/{base.VFkIJ66g.js → base.C2DbLEfT.js} +4 -3
- package/dist/vendor/{base._gnK9Slw.js → base.CTYV4Gnz.js} +24 -17
- package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.CMp8QfyL.js} +13 -14
- package/dist/vendor/{cac.DzKZaJu2.js → cac.BcJW7n2j.js} +127 -51
- package/dist/vendor/{cli-api.DTeni0Qq.js → cli-api.C8t8m4__.js} +2771 -1711
- package/dist/vendor/{constants.5SOfHUj0.js → constants.BWsVtsAj.js} +6 -22
- package/dist/vendor/{coverage.ChSqD-qS.js → coverage.BhYSDdTT.js} +27 -11
- package/dist/vendor/{date.BKM1wewY.js → date.W2xKR2qe.js} +5 -3
- package/dist/vendor/{execute.CLLNVNnK.js → execute.T3gg2ZK6.js} +177 -63
- package/dist/vendor/{index.BfoZyXD1.js → index.-dbR4KUi.js} +17 -9
- package/dist/vendor/{index.CRxYS9H3.js → index.BC5zhX9y.js} +1201 -491
- package/dist/vendor/{index.DP-km6lF.js → index.BMmMjLIQ.js} +64 -51
- package/dist/vendor/{index._7XLd8Kd.js → index.C9Thslzw.js} +2 -1
- package/dist/vendor/{index.CmILuxzC.js → index.CQJ2m700.js} +3 -3
- package/dist/vendor/{index.DeR1hhfY.js → index.D4nqnQWz.js} +71 -74
- package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
- package/dist/vendor/{run-once.DLomgGUH.js → run-once.Db8Hgq9X.js} +2 -1
- package/dist/vendor/{setup-common.XeoZAW8t.js → setup-common.uqZOEWuR.js} +30 -15
- package/dist/vendor/spy.Cf_4R5Oe.js +22 -0
- package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
- package/dist/vendor/{utils.D5gGkwyH.js → utils.DSO2UK15.js} +41 -26
- package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
- package/dist/vendor/{vi.ClD3hi7L.js → vi.BPjl8cAZ.js} +350 -166
- package/dist/vendor/{vm.Bi3bljci.js → vm.CycSoHnJ.js} +151 -86
- package/dist/worker.js +31 -15
- package/dist/workers/forks.js +4 -4
- package/dist/workers/runVmTests.js +14 -13
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +6 -6
- package/dist/workers/vmThreads.js +6 -6
- package/dist/workers.d.ts +2 -2
- package/dist/workers.js +9 -9
- package/package.json +22 -22
- package/suppress-warnings.cjs +2 -4
|
@@ -2,9 +2,9 @@ import * as chai from 'chai';
|
|
|
2
2
|
import { resolve } from 'pathe';
|
|
3
3
|
import { distDir } from '../path.js';
|
|
4
4
|
import { g as getWorkerState } from './global.7bFbnyXl.js';
|
|
5
|
-
import { r as rpc } from './rpc.
|
|
6
|
-
import { t as takeCoverageInsideWorker } from './coverage.
|
|
7
|
-
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.
|
|
5
|
+
import { r as rpc } from './rpc.BGx7q_k2.js';
|
|
6
|
+
import { t as takeCoverageInsideWorker } from './coverage.BhYSDdTT.js';
|
|
7
|
+
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.uqZOEWuR.js';
|
|
8
8
|
|
|
9
9
|
function setupChaiConfig(config) {
|
|
10
10
|
Object.assign(chai.config, config);
|
|
@@ -16,8 +16,11 @@ async function resolveSnapshotEnvironment(config, executor) {
|
|
|
16
16
|
return new VitestNodeSnapshotEnvironment();
|
|
17
17
|
}
|
|
18
18
|
const mod = await executor.executeId(config.snapshotEnvironment);
|
|
19
|
-
if (typeof mod.default !== "object" || !mod.default)
|
|
20
|
-
throw new Error(
|
|
19
|
+
if (typeof mod.default !== "object" || !mod.default) {
|
|
20
|
+
throw new Error(
|
|
21
|
+
"Snapshot environment module must have a default export object with a shape of `SnapshotEnvironment`"
|
|
22
|
+
);
|
|
23
|
+
}
|
|
21
24
|
return mod.default;
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -28,8 +31,11 @@ async function getTestRunnerConstructor(config, executor) {
|
|
|
28
31
|
return config.mode === "test" ? VitestTestRunner : NodeBenchmarkRunner;
|
|
29
32
|
}
|
|
30
33
|
const mod = await executor.executeId(config.runner);
|
|
31
|
-
if (!mod.default && typeof mod.default !== "function")
|
|
32
|
-
throw new Error(
|
|
34
|
+
if (!mod.default && typeof mod.default !== "function") {
|
|
35
|
+
throw new Error(
|
|
36
|
+
`Runner must export a default function, but got ${typeof mod.default} imported from ${config.runner}`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
33
39
|
return mod.default;
|
|
34
40
|
}
|
|
35
41
|
async function resolveTestRunner(config, executor) {
|
|
@@ -40,10 +46,12 @@ async function resolveTestRunner(config, executor) {
|
|
|
40
46
|
enumerable: false,
|
|
41
47
|
configurable: false
|
|
42
48
|
});
|
|
43
|
-
if (!testRunner.config)
|
|
49
|
+
if (!testRunner.config) {
|
|
44
50
|
testRunner.config = config;
|
|
45
|
-
|
|
51
|
+
}
|
|
52
|
+
if (!testRunner.importFile) {
|
|
46
53
|
throw new Error('Runner must implement "importFile" method.');
|
|
54
|
+
}
|
|
47
55
|
const [diffOptions] = await Promise.all([
|
|
48
56
|
loadDiffConfig(config, executor),
|
|
49
57
|
loadSnapshotSerializers(config, executor)
|