vitest 4.0.17 → 4.1.0-beta.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/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/chunks/{base.XJJQZiKB.js → base.CBRNZa3k.js} +8 -7
- package/dist/chunks/{browser.d.ChKACdzH.d.ts → browser.d.8hOapKZr.d.ts} +3 -1
- package/dist/chunks/{cac.jRCLJDDc.js → cac.B1v3xxoC.js} +26 -8
- package/dist/chunks/{cli-api.Cx2DW4Bc.js → cli-api.B4CqEpI6.js} +102 -54
- package/dist/chunks/{config.d.Cy95HiCx.d.ts → config.d.idH22YSr.d.ts} +8 -11
- package/dist/chunks/{console.Cf-YriPC.js → console.uGgdMhyZ.js} +2 -1
- package/dist/chunks/{coverage.AVPTjMgw.js → coverage.BMlOMIWl.js} +14 -4
- package/dist/chunks/{creator.DAmOKTvJ.js → creator.C7WwjkuR.js} +32 -1
- package/dist/chunks/{globals.DOayXfHP.js → globals.DjuGMoMc.js} +10 -9
- package/dist/chunks/{index.Z5E_ObnR.js → index.BEFi2-_3.js} +3 -1
- package/dist/chunks/{index.6Qv1eEA6.js → index.BiOAd_ki.js} +16 -4
- package/dist/chunks/{index.M8mOzt4Y.js → index.Dm4xqZ0s.js} +2 -2
- package/dist/chunks/{index.C5r1PdPD.js → index.DyBZXrH3.js} +1 -1
- package/dist/chunks/{init-forks.BC6ZwHQN.js → init-forks.CHeQ9Moq.js} +1 -1
- package/dist/chunks/{init-threads.CxSxLC0N.js → init-threads.uZiNAuPk.js} +1 -1
- package/dist/chunks/{init.C9kljSTm.js → init.DVtKdFty.js} +21 -6
- package/dist/chunks/{plugin.d.CtqpEehP.d.ts → plugin.d.D8KU2PY_.d.ts} +1 -1
- package/dist/chunks/{reporters.d.CWXNI2jG.d.ts → reporters.d.Db3MiIWX.d.ts} +48 -20
- package/dist/chunks/rpc.HLmECnw_.js +148 -0
- package/dist/chunks/{setup-common.Cm-kSBVi.js → setup-common.BcqLPsn5.js} +1 -1
- package/dist/chunks/{startModuleRunner.DEj0jb3e.js → startModuleRunner.C5CcWyXW.js} +22 -22
- package/dist/chunks/{vi.2VT5v0um.js → test.prxIahgM.js} +500 -119
- package/dist/chunks/{vm.CMjifoPa.js → vm.CrifS09m.js} +5 -8
- package/dist/chunks/{worker.d.Dyxm8DEL.d.ts → worker.d.Bji1eq5g.d.ts} +1 -1
- package/dist/cli.js +2 -2
- package/dist/config.d.ts +9 -9
- package/dist/coverage.d.ts +7 -7
- package/dist/coverage.js +3 -1
- package/dist/environments.js +2 -0
- package/dist/index.d.ts +21 -9
- package/dist/index.js +8 -7
- package/dist/module-evaluator.js +1 -5
- package/dist/node.d.ts +11 -10
- package/dist/node.js +19 -19
- package/dist/reporters.d.ts +7 -7
- package/dist/reporters.js +4 -2
- package/dist/runners.d.ts +23 -4
- package/dist/runners.js +4 -4
- package/dist/runtime.d.ts +6 -0
- package/dist/runtime.js +36 -0
- package/dist/snapshot.js +2 -0
- package/dist/suite.js +2 -0
- package/dist/worker.d.ts +4 -3
- package/dist/worker.js +8 -10
- package/dist/workers/forks.js +9 -11
- package/dist/workers/runVmTests.js +10 -12
- package/dist/workers/threads.js +9 -11
- package/dist/workers/vmForks.js +6 -7
- package/dist/workers/vmThreads.js +6 -7
- package/package.json +23 -27
- package/dist/chunks/date.Bq6ZW5rf.js +0 -73
- package/dist/chunks/rpc.BoxB0q7B.js +0 -76
- package/dist/chunks/test.B8ej_ZHS.js +0 -254
- package/dist/mocker.d.ts +0 -1
- package/dist/mocker.js +0 -1
- package/dist/module-runner.js +0 -17
|
@@ -13,27 +13,6 @@ import nodeModule from 'node:module';
|
|
|
13
13
|
import * as viteModuleRunner from 'vite/module-runner';
|
|
14
14
|
import { T as Traces } from './traces.CCmnQaNT.js';
|
|
15
15
|
|
|
16
|
-
class VitestTransport {
|
|
17
|
-
constructor(options) {
|
|
18
|
-
this.options = options;
|
|
19
|
-
}
|
|
20
|
-
async invoke(event) {
|
|
21
|
-
if (event.type !== "custom") return { error: /* @__PURE__ */ new Error(`Vitest Module Runner doesn't support Vite HMR events.`) };
|
|
22
|
-
if (event.event !== "vite:invoke") return { error: /* @__PURE__ */ new Error(`Vitest Module Runner doesn't support ${event.event} event.`) };
|
|
23
|
-
const { name, data } = event.data;
|
|
24
|
-
if (name === "getBuiltins")
|
|
25
|
-
// we return an empty array here to avoid client-side builtin check,
|
|
26
|
-
// as we need builtins to go through `fetchModule`
|
|
27
|
-
return { result: [] };
|
|
28
|
-
if (name !== "fetchModule") return { error: /* @__PURE__ */ new Error(`Unknown method: ${name}. Expected "fetchModule".`) };
|
|
29
|
-
try {
|
|
30
|
-
return { result: await this.options.fetchModule(...data) };
|
|
31
|
-
} catch (error) {
|
|
32
|
-
return { error };
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
16
|
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
38
17
|
function normalizeWindowsPath(input = "") {
|
|
39
18
|
if (!input) return input;
|
|
@@ -567,6 +546,27 @@ function fixLeadingSlashes(id) {
|
|
|
567
546
|
return id;
|
|
568
547
|
}
|
|
569
548
|
|
|
549
|
+
class VitestTransport {
|
|
550
|
+
constructor(options) {
|
|
551
|
+
this.options = options;
|
|
552
|
+
}
|
|
553
|
+
async invoke(event) {
|
|
554
|
+
if (event.type !== "custom") return { error: /* @__PURE__ */ new Error(`Vitest Module Runner doesn't support Vite HMR events.`) };
|
|
555
|
+
if (event.event !== "vite:invoke") return { error: /* @__PURE__ */ new Error(`Vitest Module Runner doesn't support ${event.event} event.`) };
|
|
556
|
+
const { name, data } = event.data;
|
|
557
|
+
if (name === "getBuiltins")
|
|
558
|
+
// we return an empty array here to avoid client-side builtin check,
|
|
559
|
+
// as we need builtins to go through `fetchModule`
|
|
560
|
+
return { result: [] };
|
|
561
|
+
if (name !== "fetchModule") return { error: /* @__PURE__ */ new Error(`Unknown method: ${name}. Expected "fetchModule".`) };
|
|
562
|
+
try {
|
|
563
|
+
return { result: await this.options.fetchModule(...data) };
|
|
564
|
+
} catch (error) {
|
|
565
|
+
return { error };
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
570
|
const createNodeImportMeta = (modulePath) => {
|
|
571
571
|
if (!viteModuleRunner.createDefaultImportMeta) throw new Error(`createNodeImportMeta is not supported in this version of Vite.`);
|
|
572
572
|
const defaultMeta = viteModuleRunner.createDefaultImportMeta(modulePath);
|
|
@@ -858,4 +858,4 @@ function startVitestModuleRunner(options) {
|
|
|
858
858
|
return moduleRunner;
|
|
859
859
|
}
|
|
860
860
|
|
|
861
|
-
export {
|
|
861
|
+
export { VITEST_VM_CONTEXT_SYMBOL as V, VitestModuleRunner as a, VitestTransport as b, createNodeImportMeta as c, startVitestModuleRunner as s };
|