vitest 1.6.0 → 2.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.
Files changed (74) hide show
  1. package/LICENSE.md +173 -1
  2. package/dist/browser.d.ts +22 -2
  3. package/dist/browser.js +6 -4
  4. package/dist/chunks/{environments-node.vcoXCoKs.js → environments-node.39w4gmlF.js} +2 -2
  5. package/dist/chunks/{install-pkg.LE8oaA1t.js → install-pkg.DNUmWFkO.js} +2 -2
  6. package/dist/chunks/integrations-globals.C6Ah-pUW.js +31 -0
  7. package/dist/chunks/{runtime-console.EO5ha7qv.js → runtime-console.DiVMr5d4.js} +62 -32
  8. package/dist/chunks/{runtime-runBaseTests.oAvMKtQC.js → runtime-runBaseTests.Cukyr5-I.js} +18 -18
  9. package/dist/cli.js +3 -3
  10. package/dist/config.cjs +4 -5
  11. package/dist/config.d.ts +2 -2
  12. package/dist/config.js +4 -5
  13. package/dist/coverage.d.ts +1 -1
  14. package/dist/coverage.js +34 -8
  15. package/dist/environments.d.ts +1 -1
  16. package/dist/environments.js +1 -1
  17. package/dist/execute.d.ts +3 -2
  18. package/dist/execute.js +2 -2
  19. package/dist/index.d.ts +777 -65
  20. package/dist/index.js +12 -12
  21. package/dist/node.d.ts +7 -7
  22. package/dist/node.js +24 -23
  23. package/dist/{reporters-yx5ZTtEV.d.ts → reporters-CYVC6LOl.d.ts} +439 -219
  24. package/dist/reporters.d.ts +1 -1
  25. package/dist/reporters.js +11 -12
  26. package/dist/runners.d.ts +4 -2
  27. package/dist/runners.js +25 -18
  28. package/dist/snapshot.js +3 -3
  29. package/dist/{suite-IbNSsUWN.d.ts → suite-Dpu9EC_k.d.ts} +1 -1
  30. package/dist/suite.d.ts +2 -2
  31. package/dist/suite.js +4 -4
  32. package/dist/vendor/{base.Ybri3C14.js → base.Dln9yllP.js} +3 -3
  33. package/dist/vendor/{base.5NT-gWu5.js → base._gnK9Slw.js} +1 -2
  34. package/dist/vendor/{benchmark.yGkUTKnC.js → benchmark.BNLebNi5.js} +1 -1
  35. package/dist/vendor/{cac.EdDItJD-.js → cac.CtYFkoSJ.js} +66 -25
  36. package/dist/vendor/{cli-api.E07AF1Yq.js → cli-api.CUtJc4r3.js} +11851 -7276
  37. package/dist/vendor/{constants.5J7I254_.js → constants.TCjCaw2D.js} +4 -3
  38. package/dist/vendor/{execute.fL3szUAI.js → execute.BHj6OMh4.js} +4 -4
  39. package/dist/vendor/{index.DpVgvm2P.js → index.B5SKBLvV.js} +5 -5
  40. package/dist/vendor/{index.Q04MCqDO.js → index.BOMEjpjj.js} +680 -160
  41. package/dist/vendor/{index.8bPxjt7g.js → index.BpSiYbpB.js} +5 -1
  42. package/dist/vendor/{index.xL8XjTLv.js → index.CThipSqB.js} +2538 -2525
  43. package/dist/vendor/{index.dI9lHwVn.js → index.D3hs2WiI.js} +8 -6
  44. package/dist/vendor/{index.SMVOaj7F.js → index._7XLd8Kd.js} +2 -2
  45. package/dist/vendor/{index.GVFv9dZ0.js → index.kpsSqFiz.js} +2 -1
  46. package/dist/vendor/{rpc.joBhAkyK.js → rpc.DRDE9Pu1.js} +2 -2
  47. package/dist/vendor/{run-once.Olz_Zkd8.js → run-once.DLomgGUH.js} +1 -1
  48. package/dist/vendor/{setup-common.8nJLd4ay.js → setup-common.DAu7t7mY.js} +2 -2
  49. package/dist/vendor/spy.Cf_4R5Oe.js +22 -0
  50. package/dist/vendor/{tasks.IknbGB2n.js → tasks.WC7M-K-v.js} +4 -1
  51. package/dist/vendor/{utils.dEtNIEgr.js → utils.YuQ3LT2a.js} +2 -2
  52. package/dist/vendor/{vi.YFlodzP_.js → vi.hATFzZbX.js} +124 -56
  53. package/dist/vendor/{vm.QEE48c0T.js → vm.Ow-X2mkS.js} +47 -59
  54. package/dist/worker.js +6 -6
  55. package/dist/workers/forks.js +5 -5
  56. package/dist/workers/runVmTests.js +17 -17
  57. package/dist/workers/threads.js +5 -5
  58. package/dist/workers/vmForks.js +8 -8
  59. package/dist/workers/vmThreads.js +8 -8
  60. package/dist/workers.d.ts +1 -1
  61. package/dist/workers.js +13 -13
  62. package/package.json +35 -35
  63. package/suppress-warnings.cjs +2 -1
  64. package/vitest.mjs +1 -1
  65. package/dist/chunks/integrations-globals.kw4co3rx.js +0 -31
  66. package/dist/cli-wrapper.js +0 -119
  67. /package/dist/chunks/{node-git.Hw101KjS.js → node-git.CCI8evVZ.js} +0 -0
  68. /package/dist/vendor/{_commonjsHelpers.jjO7Zipk.js → _commonjsHelpers.BFTU3MAI.js} +0 -0
  69. /package/dist/vendor/{coverage.E7sG1b3r.js → coverage.ChSqD-qS.js} +0 -0
  70. /package/dist/vendor/{date.Ns1pGd_X.js → date.BKM1wewY.js} +0 -0
  71. /package/dist/vendor/{env.AtSIuHFg.js → env.bmJgw1qP.js} +0 -0
  72. /package/dist/vendor/{global.CkGT_TMy.js → global.7bFbnyXl.js} +0 -0
  73. /package/dist/vendor/{inspector.IgLX3ur5.js → inspector.hPQncR7V.js} +0 -0
  74. /package/dist/vendor/{utils.0uYuCbzo.js → utils.CUjzkRH7.js} +0 -0
package/dist/coverage.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { relative } from 'pathe';
2
- import { m as mm } from './vendor/index.xL8XjTLv.js';
3
- import './vendor/_commonjsHelpers.jjO7Zipk.js';
2
+ import { m as mm } from './vendor/index.CThipSqB.js';
3
+ import './vendor/_commonjsHelpers.BFTU3MAI.js';
4
4
  import 'util';
5
5
  import 'path';
6
6
 
@@ -45,8 +45,9 @@ class BaseCoverageProvider {
45
45
  */
46
46
  checkThresholds({ thresholds: allThresholds, perFile }) {
47
47
  for (const { coverageMap, thresholds, name } of allThresholds) {
48
- if (thresholds.branches === void 0 && thresholds.functions === void 0 && thresholds.lines === void 0 && thresholds.statements === void 0)
48
+ if (thresholds.branches === void 0 && thresholds.functions === void 0 && thresholds.lines === void 0 && thresholds.statements === void 0) {
49
49
  continue;
50
+ }
50
51
  const summaries = perFile ? coverageMap.files().map((file) => ({
51
52
  file,
52
53
  summary: coverageMap.fileCoverageFor(file).toSummary()
@@ -171,16 +172,41 @@ function resolveConfig(configModule) {
171
172
  try {
172
173
  if (mod.$type === "object")
173
174
  return mod;
174
- if (mod.$type === "function-call") {
175
- if (mod.$args[0].$type === "object")
176
- return mod.$args[0];
177
- if (mod.$args[0].$type === "arrow-function-expression" && mod.$args[0].$body.$type === "object")
178
- return mod.$args[0].$body;
175
+ let config = resolveDefineConfig(mod);
176
+ if (config)
177
+ return config;
178
+ if (mod.$type === "function-call" && mod.$callee === "mergeConfig") {
179
+ config = resolveMergeConfig(mod);
180
+ if (config)
181
+ return config;
179
182
  }
180
183
  } catch (error) {
181
184
  throw new Error(error instanceof Error ? error.message : String(error));
182
185
  }
183
186
  throw new Error("Failed to update coverage thresholds. Configuration file is too complex.");
184
187
  }
188
+ function resolveDefineConfig(mod) {
189
+ if (mod.$type === "function-call" && mod.$callee === "defineConfig") {
190
+ if (mod.$args[0].$type === "object")
191
+ return mod.$args[0];
192
+ if (mod.$args[0].$type === "arrow-function-expression") {
193
+ if (mod.$args[0].$body.$type === "object") {
194
+ return mod.$args[0].$body;
195
+ }
196
+ const config = resolveMergeConfig(mod.$args[0].$body);
197
+ if (config)
198
+ return config;
199
+ }
200
+ }
201
+ }
202
+ function resolveMergeConfig(mod) {
203
+ if (mod.$type === "function-call" && mod.$callee === "mergeConfig") {
204
+ for (const arg of mod.$args) {
205
+ const config = resolveDefineConfig(arg);
206
+ if (config)
207
+ return config;
208
+ }
209
+ }
210
+ }
185
211
 
186
212
  export { BaseCoverageProvider };
@@ -1,4 +1,4 @@
1
- import { E as Environment } from './reporters-yx5ZTtEV.js';
1
+ import { E as Environment } from './reporters-CYVC6LOl.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
@@ -1,2 +1,2 @@
1
- export { e as builtinEnvironments, p as populateGlobal } from './vendor/index.GVFv9dZ0.js';
1
+ export { e as builtinEnvironments, p as populateGlobal } from './vendor/index.kpsSqFiz.js';
2
2
  import 'node:console';
package/dist/execute.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import vm from 'node:vm';
2
2
  import { ViteNodeRunner } from 'vite-node/client';
3
3
  import { ViteNodeRunnerOptions } from 'vite-node';
4
- import { ar as PendingSuiteMock, as as MockFactory, e as RuntimeRPC, W as WorkerGlobalState, at as MockMap } from './reporters-yx5ZTtEV.js';
4
+ import { aF as PendingSuiteMock, aG as MockFactory, e as RuntimeRPC, W as WorkerGlobalState, aH as MockMap } from './reporters-CYVC6LOl.js';
5
5
  import 'vite';
6
6
  import '@vitest/runner';
7
7
  import '@vitest/snapshot';
@@ -38,7 +38,7 @@ declare class VitestMocker {
38
38
  private get moduleDirectories();
39
39
  initializeSpyModule(): Promise<void>;
40
40
  private deleteCachedItem;
41
- private isAModuleDirectory;
41
+ private isModuleDirectory;
42
42
  getSuiteFilepath(): string;
43
43
  private createError;
44
44
  getMocks(): {
@@ -84,6 +84,7 @@ declare class VMModule {
84
84
  declare class FileMap {
85
85
  private fsCache;
86
86
  private fsBufferCache;
87
+ readFileAsync(path: string): Promise<string>;
87
88
  readFile(path: string): string;
88
89
  readBuffer(path: string): Buffer;
89
90
  }
package/dist/execute.js CHANGED
@@ -1,4 +1,4 @@
1
- export { V as VitestExecutor } from './vendor/execute.fL3szUAI.js';
1
+ export { V as VitestExecutor } from './vendor/execute.BHj6OMh4.js';
2
2
  import 'node:vm';
3
3
  import 'node:url';
4
4
  import 'node:fs';
@@ -8,4 +8,4 @@ import 'pathe';
8
8
  import '@vitest/utils/error';
9
9
  import './path.js';
10
10
  import '@vitest/utils';
11
- import './vendor/base.5NT-gWu5.js';
11
+ import './vendor/base._gnK9Slw.js';