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.
Files changed (57) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/browser.js +2 -2
  4. package/dist/chunks/{base.DMfOuRWD.js → base.BXI97p6t.js} +7 -16
  5. package/dist/chunks/{benchmark.CtuRzf-i.js → benchmark.UW6Ezvxy.js} +4 -9
  6. package/dist/chunks/{cac.CKnbxhn2.js → cac.WE-urWw5.js} +37 -113
  7. package/dist/chunks/{cli-api.COn58yrl.js → cli-api.CZz3evYC.js} +505 -1211
  8. package/dist/chunks/{console.Duv2dVIC.js → console.B0quX7yH.js} +32 -68
  9. package/dist/chunks/{coverage.B6cReEn1.js → coverage.BPRS6xgn.js} +210 -579
  10. package/dist/chunks/{creator.DUVZ6rfm.js → creator.KEg6n5IC.js} +28 -74
  11. package/dist/chunks/{date.Bq6ZW5rf.js → date.-jtEtIeV.js} +6 -17
  12. package/dist/chunks/{git.BVQ8w_Sw.js → git.BFNcloKD.js} +1 -2
  13. package/dist/chunks/{globals.CJQ63oO0.js → globals.lgsmH00r.js} +5 -5
  14. package/dist/chunks/{index.DgN0Zk9a.js → index.7w0eqmYM.js} +14 -24
  15. package/dist/chunks/{index.QZr3S3vQ.js → index.AR8aAkCC.js} +2 -2
  16. package/dist/chunks/{index.BRtIe7r8.js → index.BG0gqZH-.js} +39 -102
  17. package/dist/chunks/{index.oWRWx-nj.js → index.CsFXYRkW.js} +17 -36
  18. package/dist/chunks/{index.DQhAfQQU.js → index.VNI-1z5c.js} +270 -606
  19. package/dist/chunks/{inspector.C914Efll.js → inspector.CvQD-Nie.js} +10 -25
  20. package/dist/chunks/{moduleRunner.d.mmOmOGrW.d.ts → moduleRunner.d.8kKUsuDg.d.ts} +1 -1
  21. package/dist/chunks/{node.4JV5OXkt.js → node.BOqcT2jW.js} +1 -1
  22. package/dist/chunks/{plugin.d.CvOlgjxK.d.ts → plugin.d.DuiQJfUL.d.ts} +1 -1
  23. package/dist/chunks/{reporters.d.CYE9sT5z.d.ts → reporters.d.CqR9-CDJ.d.ts} +16 -33
  24. package/dist/chunks/{resolver.D5bG4zy5.js → resolver.Bx6lE0iq.js} +21 -64
  25. package/dist/chunks/{rpc.DGoW_Vl-.js → rpc.RpPylpp0.js} +7 -21
  26. package/dist/chunks/{runBaseTests.B3KcKqlF.js → runBaseTests.D6sfuWBM.js} +25 -54
  27. package/dist/chunks/{setup-common.lgPs-bYv.js → setup-common.hLGRxhC8.js} +9 -22
  28. package/dist/chunks/{startModuleRunner.C8FtT_BY.js → startModuleRunner.C8TW8zTN.js} +83 -205
  29. package/dist/chunks/{typechecker.BgoW4nTA.js → typechecker.Cd1wvxUM.js} +96 -208
  30. package/dist/chunks/{utils.CcGm2cd1.js → utils.C2YI6McM.js} +4 -13
  31. package/dist/chunks/{utils.B9FY3b73.js → utils.C7__0Iv5.js} +5 -14
  32. package/dist/chunks/{vi.DGAfBY4R.js → vi.BfdOiD4j.js} +110 -267
  33. package/dist/chunks/{vm.BKfKvaKl.js → vm.BHBje7cC.js} +73 -177
  34. package/dist/cli.js +3 -3
  35. package/dist/config.d.ts +4 -4
  36. package/dist/coverage.d.ts +1 -1
  37. package/dist/coverage.js +2 -2
  38. package/dist/environments.js +1 -1
  39. package/dist/index.js +5 -5
  40. package/dist/module-evaluator.d.ts +1 -1
  41. package/dist/module-evaluator.js +33 -84
  42. package/dist/module-runner.js +2 -2
  43. package/dist/node.d.ts +3 -3
  44. package/dist/node.js +13 -19
  45. package/dist/reporters.d.ts +2 -2
  46. package/dist/reporters.js +3 -3
  47. package/dist/runners.js +23 -51
  48. package/dist/snapshot.js +2 -2
  49. package/dist/suite.js +2 -2
  50. package/dist/worker.js +18 -34
  51. package/dist/workers/forks.js +4 -4
  52. package/dist/workers/runVmTests.js +19 -37
  53. package/dist/workers/threads.js +4 -4
  54. package/dist/workers/vmForks.js +7 -7
  55. package/dist/workers/vmThreads.js +7 -7
  56. package/dist/workers.js +11 -11
  57. 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.B9FY3b73.js';
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
- if (coverageModule) return coverageModule.startCoverage?.(runtimeOptions);
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
- if (coverageModule) return coverageModule.takeCoverage?.({ moduleExecutionInfo: loader.moduleExecutionInfo });
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
- if (coverageModule) return coverageModule.stopCoverage?.(runtimeOptions);
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
- // same boolean-to-string assignment as VitestPlugin.configResolved
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
- else throw new Error(`invalid diff config file ${config.diff}. Must have a default export with config object`);
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;