vitest 3.2.4 → 4.0.0-beta.10
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 +2 -2
- package/dist/browser.d.ts +13 -16
- package/dist/browser.js +6 -5
- package/dist/chunks/base.Cjha6usc.js +129 -0
- package/dist/chunks/{benchmark.CYdenmiT.js → benchmark.CJUa-Hsa.js} +6 -8
- package/dist/chunks/{benchmark.d.BwvBVTda.d.ts → benchmark.d.DAaHLpsq.d.ts} +4 -4
- package/dist/chunks/browser.d.yFAklsD1.d.ts +18 -0
- package/dist/chunks/{cac.Cb-PYCCB.js → cac.DCxo_nSu.js} +72 -163
- package/dist/chunks/{cli-api.BkDphVBG.js → cli-api.BJJXh9BV.js} +1331 -1678
- package/dist/chunks/{config.d.D2ROskhv.d.ts → config.d.B_LthbQq.d.ts} +59 -65
- package/dist/chunks/{console.CtFJOzRO.js → console.7h5kHUIf.js} +34 -70
- package/dist/chunks/{constants.DnKduX2e.js → constants.D_Q9UYh-.js} +1 -9
- package/dist/chunks/{coverage.DL5VHqXY.js → coverage.BCU-r2QL.js} +538 -765
- package/dist/chunks/{coverage.DVF1vEu8.js → coverage.D_JHT54q.js} +2 -2
- package/dist/chunks/{coverage.d.S9RMNXIe.d.ts → coverage.d.BZtK59WP.d.ts} +10 -8
- package/dist/chunks/{creator.GK6I-cL4.js → creator.08Gi-vCA.js} +93 -77
- package/dist/chunks/{date.Bq6ZW5rf.js → date.-jtEtIeV.js} +6 -17
- package/dist/chunks/{defaults.B7q_naMc.js → defaults.CXFFjsi8.js} +2 -42
- package/dist/chunks/environment.d.BsToaxti.d.ts +65 -0
- package/dist/chunks/{git.BVQ8w_Sw.js → git.BFNcloKD.js} +1 -2
- package/dist/chunks/{global.d.MAmajcmJ.d.ts → global.d.BK3X7FW1.d.ts} +7 -32
- package/dist/chunks/{globals.DEHgCU4V.js → globals.DG-S3xFe.js} +8 -8
- package/dist/chunks/{index.VByaPkjc.js → index.BIP7prJq.js} +472 -803
- package/dist/chunks/{index.B521nVV-.js → index.Bgo3tNWt.js} +23 -4
- package/dist/chunks/{index.BCWujgDG.js → index.BjKEiSn0.js} +14 -24
- package/dist/chunks/{index.CdQS2e2Q.js → index.CMfqw92x.js} +7 -8
- package/dist/chunks/{index.CmSc2RE5.js → index.DIWhzsUh.js} +72 -118
- package/dist/chunks/{inspector.C914Efll.js → inspector.CvQD-Nie.js} +10 -25
- package/dist/chunks/moduleRunner.d.D9nBoC4p.d.ts +201 -0
- package/dist/chunks/moduleTransport.I-bgQy0S.js +19 -0
- package/dist/chunks/{node.fjCdwEIl.js → node.CyipiPvJ.js} +1 -1
- package/dist/chunks/plugin.d.BMVSnsGV.d.ts +9 -0
- package/dist/chunks/{reporters.d.BFLkQcL6.d.ts → reporters.d.BUWjmRYq.d.ts} +2086 -2146
- package/dist/chunks/resolveSnapshotEnvironment.Bkht6Yor.js +81 -0
- package/dist/chunks/resolver.Bx6lE0iq.js +119 -0
- package/dist/chunks/rpc.BKr6mtxz.js +65 -0
- package/dist/chunks/{setup-common.Dd054P77.js → setup-common.uiMcU3cv.js} +17 -29
- package/dist/chunks/startModuleRunner.p67gbNo9.js +665 -0
- package/dist/chunks/{suite.d.FvehnV49.d.ts → suite.d.BJWk38HB.d.ts} +1 -1
- package/dist/chunks/test.BiqSKISg.js +214 -0
- package/dist/chunks/{typechecker.DRKU1-1g.js → typechecker.DB-fIMaH.js} +165 -234
- package/dist/chunks/{utils.CAioKnHs.js → utils.C2YI6McM.js} +5 -14
- package/dist/chunks/{utils.XdZDrNZV.js → utils.D2R2NiOH.js} +8 -27
- package/dist/chunks/{vi.bdSIJ99Y.js → vi.ZPgvtBao.js} +156 -305
- package/dist/chunks/{vm.BThCzidc.js → vm.Ca0Y0W5f.js} +116 -226
- package/dist/chunks/{worker.d.1GmBbd7G.d.ts → worker.d.BDsXGkwh.d.ts} +31 -32
- package/dist/chunks/{worker.d.CKwWzBSj.d.ts → worker.d.BNcX_2mH.d.ts} +1 -1
- package/dist/cli.js +10 -10
- package/dist/config.cjs +5 -58
- package/dist/config.d.ts +72 -71
- package/dist/config.js +3 -9
- package/dist/coverage.d.ts +31 -24
- package/dist/coverage.js +9 -9
- package/dist/environments.d.ts +9 -14
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +52 -213
- package/dist/index.js +7 -9
- package/dist/module-evaluator.d.ts +13 -0
- package/dist/module-evaluator.js +276 -0
- package/dist/module-runner.js +15 -0
- package/dist/node.d.ts +62 -51
- package/dist/node.js +26 -42
- package/dist/reporters.d.ts +11 -12
- package/dist/reporters.js +12 -12
- package/dist/runners.d.ts +3 -4
- package/dist/runners.js +13 -231
- package/dist/snapshot.js +2 -2
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +90 -47
- package/dist/workers/forks.js +34 -10
- package/dist/workers/runVmTests.js +36 -56
- package/dist/workers/threads.js +34 -10
- package/dist/workers/vmForks.js +11 -10
- package/dist/workers/vmThreads.js +11 -10
- package/dist/workers.d.ts +5 -7
- package/dist/workers.js +35 -17
- package/globals.d.ts +17 -17
- package/package.json +32 -31
- package/dist/chunks/base.DfmxU-tU.js +0 -38
- package/dist/chunks/environment.d.cL3nLXbE.d.ts +0 -119
- package/dist/chunks/execute.B7h3T_Hc.js +0 -708
- package/dist/chunks/index.CwejwG0H.js +0 -105
- package/dist/chunks/rpc.-pEldfrD.js +0 -83
- package/dist/chunks/runBaseTests.9Ij9_de-.js +0 -129
- package/dist/chunks/vite.d.CMLlLIFP.d.ts +0 -25
- package/dist/execute.d.ts +0 -150
- package/dist/execute.js +0 -13
|
@@ -11,37 +11,25 @@ function getWorkerState() {
|
|
|
11
11
|
return workerState;
|
|
12
12
|
}
|
|
13
13
|
function provideWorkerState(context, state) {
|
|
14
|
-
Object.defineProperty(context, NAME_WORKER_STATE, {
|
|
14
|
+
return Object.defineProperty(context, NAME_WORKER_STATE, {
|
|
15
15
|
value: state,
|
|
16
16
|
configurable: true,
|
|
17
17
|
writable: true,
|
|
18
18
|
enumerable: false
|
|
19
|
-
});
|
|
20
|
-
return state;
|
|
21
|
-
}
|
|
22
|
-
function getCurrentEnvironment() {
|
|
23
|
-
const state = getWorkerState();
|
|
24
|
-
return state?.environment.name;
|
|
19
|
+
}), state;
|
|
25
20
|
}
|
|
26
21
|
function isChildProcess() {
|
|
27
22
|
return typeof process !== "undefined" && !!process.send;
|
|
28
23
|
}
|
|
29
|
-
function setProcessTitle(title) {
|
|
30
|
-
try {
|
|
31
|
-
process.title = `node (${title})`;
|
|
32
|
-
} catch {}
|
|
33
|
-
}
|
|
34
24
|
function resetModules(modules, resetMocks = false) {
|
|
35
25
|
const skipPaths = [
|
|
36
26
|
/\/vitest\/dist\//,
|
|
37
|
-
/\/vite-node\/dist\//,
|
|
38
27
|
/vitest-virtual-\w+\/dist/,
|
|
39
28
|
/@vitest\/dist/,
|
|
40
29
|
...!resetMocks ? [/^mock:/] : []
|
|
41
30
|
];
|
|
42
|
-
modules.forEach((
|
|
43
|
-
|
|
44
|
-
modules.invalidateModule(mod);
|
|
31
|
+
modules.idToModuleMap.forEach((node, path) => {
|
|
32
|
+
skipPaths.some((re) => re.test(path)) || (node.promise = void 0, node.exports = void 0, node.evaluated = false, node.importers.clear());
|
|
45
33
|
});
|
|
46
34
|
}
|
|
47
35
|
function waitNextTick() {
|
|
@@ -50,16 +38,9 @@ function waitNextTick() {
|
|
|
50
38
|
}
|
|
51
39
|
async function waitForImportsToResolve() {
|
|
52
40
|
await waitNextTick();
|
|
53
|
-
const state = getWorkerState();
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
for (const mod of state.moduleCache.values()) {
|
|
57
|
-
if (mod.promise && !mod.evaluated) promises.push(mod.promise);
|
|
58
|
-
if (mod.resolving) resolvingCount++;
|
|
59
|
-
}
|
|
60
|
-
if (!promises.length && !resolvingCount) return;
|
|
61
|
-
await Promise.allSettled(promises);
|
|
62
|
-
await waitForImportsToResolve();
|
|
41
|
+
const state = getWorkerState(), promises = [], resolvingCount = state.resolvingModules.size;
|
|
42
|
+
for (const [_, mod] of state.evaluatedModules.idToModuleMap) if (mod.promise && !mod.evaluated) promises.push(mod.promise);
|
|
43
|
+
!promises.length && !resolvingCount || (await Promise.allSettled(promises), await waitForImportsToResolve());
|
|
63
44
|
}
|
|
64
45
|
|
|
65
|
-
export {
|
|
46
|
+
export { getWorkerState as g, isChildProcess as i, provideWorkerState as p, resetModules as r, waitForImportsToResolve as w };
|