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.
Files changed (58) hide show
  1. package/dist/browser.d.ts +1 -1
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{base.XJJQZiKB.js → base.CBRNZa3k.js} +8 -7
  4. package/dist/chunks/{browser.d.ChKACdzH.d.ts → browser.d.8hOapKZr.d.ts} +3 -1
  5. package/dist/chunks/{cac.jRCLJDDc.js → cac.B1v3xxoC.js} +26 -8
  6. package/dist/chunks/{cli-api.Cx2DW4Bc.js → cli-api.B4CqEpI6.js} +102 -54
  7. package/dist/chunks/{config.d.Cy95HiCx.d.ts → config.d.idH22YSr.d.ts} +8 -11
  8. package/dist/chunks/{console.Cf-YriPC.js → console.uGgdMhyZ.js} +2 -1
  9. package/dist/chunks/{coverage.AVPTjMgw.js → coverage.BMlOMIWl.js} +14 -4
  10. package/dist/chunks/{creator.DAmOKTvJ.js → creator.C7WwjkuR.js} +32 -1
  11. package/dist/chunks/{globals.DOayXfHP.js → globals.DjuGMoMc.js} +10 -9
  12. package/dist/chunks/{index.Z5E_ObnR.js → index.BEFi2-_3.js} +3 -1
  13. package/dist/chunks/{index.6Qv1eEA6.js → index.BiOAd_ki.js} +16 -4
  14. package/dist/chunks/{index.M8mOzt4Y.js → index.Dm4xqZ0s.js} +2 -2
  15. package/dist/chunks/{index.C5r1PdPD.js → index.DyBZXrH3.js} +1 -1
  16. package/dist/chunks/{init-forks.BC6ZwHQN.js → init-forks.CHeQ9Moq.js} +1 -1
  17. package/dist/chunks/{init-threads.CxSxLC0N.js → init-threads.uZiNAuPk.js} +1 -1
  18. package/dist/chunks/{init.C9kljSTm.js → init.DVtKdFty.js} +21 -6
  19. package/dist/chunks/{plugin.d.CtqpEehP.d.ts → plugin.d.D8KU2PY_.d.ts} +1 -1
  20. package/dist/chunks/{reporters.d.CWXNI2jG.d.ts → reporters.d.Db3MiIWX.d.ts} +48 -20
  21. package/dist/chunks/rpc.HLmECnw_.js +148 -0
  22. package/dist/chunks/{setup-common.Cm-kSBVi.js → setup-common.BcqLPsn5.js} +1 -1
  23. package/dist/chunks/{startModuleRunner.DEj0jb3e.js → startModuleRunner.C5CcWyXW.js} +22 -22
  24. package/dist/chunks/{vi.2VT5v0um.js → test.prxIahgM.js} +500 -119
  25. package/dist/chunks/{vm.CMjifoPa.js → vm.CrifS09m.js} +5 -8
  26. package/dist/chunks/{worker.d.Dyxm8DEL.d.ts → worker.d.Bji1eq5g.d.ts} +1 -1
  27. package/dist/cli.js +2 -2
  28. package/dist/config.d.ts +9 -9
  29. package/dist/coverage.d.ts +7 -7
  30. package/dist/coverage.js +3 -1
  31. package/dist/environments.js +2 -0
  32. package/dist/index.d.ts +21 -9
  33. package/dist/index.js +8 -7
  34. package/dist/module-evaluator.js +1 -5
  35. package/dist/node.d.ts +11 -10
  36. package/dist/node.js +19 -19
  37. package/dist/reporters.d.ts +7 -7
  38. package/dist/reporters.js +4 -2
  39. package/dist/runners.d.ts +23 -4
  40. package/dist/runners.js +4 -4
  41. package/dist/runtime.d.ts +6 -0
  42. package/dist/runtime.js +36 -0
  43. package/dist/snapshot.js +2 -0
  44. package/dist/suite.js +2 -0
  45. package/dist/worker.d.ts +4 -3
  46. package/dist/worker.js +8 -10
  47. package/dist/workers/forks.js +9 -11
  48. package/dist/workers/runVmTests.js +10 -12
  49. package/dist/workers/threads.js +9 -11
  50. package/dist/workers/vmForks.js +6 -7
  51. package/dist/workers/vmThreads.js +6 -7
  52. package/package.json +23 -27
  53. package/dist/chunks/date.Bq6ZW5rf.js +0 -73
  54. package/dist/chunks/rpc.BoxB0q7B.js +0 -76
  55. package/dist/chunks/test.B8ej_ZHS.js +0 -254
  56. package/dist/mocker.d.ts +0 -1
  57. package/dist/mocker.js +0 -1
  58. 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 { VitestModuleRunner as V, VITEST_VM_CONTEXT_SYMBOL as a, VitestTransport as b, createNodeImportMeta as c, startVitestModuleRunner as s };
861
+ export { VITEST_VM_CONTEXT_SYMBOL as V, VitestModuleRunner as a, VitestTransport as b, createNodeImportMeta as c, startVitestModuleRunner as s };