vitest 2.0.0-beta.10 → 2.0.0-beta.12

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 (70) hide show
  1. package/dist/browser.d.ts +1 -1
  2. package/dist/browser.js +3 -3
  3. package/dist/chunks/browser-creator.Bw94IHrL.js +673 -0
  4. package/dist/chunks/{environments-node.39w4gmlF.js → environments-node.XE5FbRPQ.js} +1 -1
  5. package/dist/chunks/{integrations-globals.C6Ah-pUW.js → integrations-globals.DSNOaUHv.js} +10 -10
  6. package/dist/chunks/{node-git.CCI8evVZ.js → node-git.ZtkbKc8u.js} +14 -15
  7. package/dist/chunks/{runtime-console.DiVMr5d4.js → runtime-console.O41g23Zj.js} +26 -11
  8. package/dist/chunks/{runtime-runBaseTests.Cukyr5-I.js → runtime-runBaseTests.BDt9gQFB.js} +41 -33
  9. package/dist/cli.js +3 -3
  10. package/dist/config.cjs +45 -21
  11. package/dist/config.d.ts +1 -1
  12. package/dist/config.js +45 -22
  13. package/dist/coverage.d.ts +5 -4
  14. package/dist/coverage.js +100 -37
  15. package/dist/environments.d.ts +1 -1
  16. package/dist/environments.js +1 -1
  17. package/dist/execute.d.ts +1 -1
  18. package/dist/execute.js +2 -2
  19. package/dist/index.d.ts +37 -11
  20. package/dist/index.js +10 -10
  21. package/dist/node.d.ts +20 -7
  22. package/dist/node.js +29 -20
  23. package/dist/path.js +4 -1
  24. package/dist/{reporters-CYVC6LOl.d.ts → reporters-Cd1vkLMZ.d.ts} +134 -182
  25. package/dist/reporters.d.ts +1 -1
  26. package/dist/reporters.js +8 -8
  27. package/dist/runners.d.ts +1 -1
  28. package/dist/runners.js +99 -61
  29. package/dist/snapshot.js +2 -2
  30. package/dist/{suite-Dpu9EC_k.d.ts → suite-BS2CV79a.d.ts} +1 -1
  31. package/dist/suite.d.ts +2 -2
  32. package/dist/suite.js +3 -3
  33. package/dist/utils.d.ts +1 -5
  34. package/dist/utils.js +1 -6
  35. package/dist/vendor/{base._gnK9Slw.js → base.CTYV4Gnz.js} +24 -17
  36. package/dist/vendor/{base.Dln9yllP.js → base.Cy97mmVC.js} +4 -3
  37. package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.B6pblCp2.js} +13 -14
  38. package/dist/vendor/{cac.CtYFkoSJ.js → cac.DRNUX42m.js} +82 -38
  39. package/dist/vendor/{cli-api.CUtJc4r3.js → cli-api.Bu-PSdzx.js} +5908 -13271
  40. package/dist/vendor/{constants.TCjCaw2D.js → constants.BWsVtsAj.js} +5 -22
  41. package/dist/vendor/{coverage.ChSqD-qS.js → coverage.BhYSDdTT.js} +27 -11
  42. package/dist/vendor/{date.BKM1wewY.js → date.W2xKR2qe.js} +5 -3
  43. package/dist/vendor/env.2ltrQNq0.js +8 -0
  44. package/dist/vendor/{execute.BHj6OMh4.js → execute.T3gg2ZK6.js} +174 -60
  45. package/dist/vendor/{index.B5SKBLvV.js → index.B7pSlOSa.js} +18 -10
  46. package/dist/vendor/{index._7XLd8Kd.js → index.BJmtb_7W.js} +3 -2
  47. package/dist/vendor/{index.CThipSqB.js → index.BMmMjLIQ.js} +2540 -2540
  48. package/dist/vendor/{index.kpsSqFiz.js → index.D4nqnQWz.js} +69 -73
  49. package/dist/vendor/index.D6GZqexG.js +6575 -0
  50. package/dist/vendor/{index.D3hs2WiI.js → index.Hqvcg1pf.js} +3 -3
  51. package/dist/vendor/{index.BOMEjpjj.js → index.ZtQtNPP2.js} +962 -471
  52. package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
  53. package/dist/vendor/{run-once.DLomgGUH.js → run-once.Db8Hgq9X.js} +2 -1
  54. package/dist/vendor/{setup-common.DAu7t7mY.js → setup-common.CWnv_2-5.js} +30 -15
  55. package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
  56. package/dist/vendor/{utils.YuQ3LT2a.js → utils.DSO2UK15.js} +40 -25
  57. package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
  58. package/dist/vendor/{vi.hATFzZbX.js → vi.DXACdGTu.js} +267 -138
  59. package/dist/vendor/{vm.Ow-X2mkS.js → vm.D9wVR14y.js} +152 -87
  60. package/dist/worker.js +31 -15
  61. package/dist/workers/forks.js +4 -4
  62. package/dist/workers/runVmTests.js +15 -14
  63. package/dist/workers/threads.js +4 -4
  64. package/dist/workers/vmForks.js +7 -7
  65. package/dist/workers/vmThreads.js +7 -7
  66. package/dist/workers.d.ts +2 -2
  67. package/dist/workers.js +10 -10
  68. package/package.json +11 -11
  69. package/suppress-warnings.cjs +1 -4
  70. package/dist/vendor/env.bmJgw1qP.js +0 -7
@@ -2,9 +2,9 @@ import * as chai from 'chai';
2
2
  import { resolve } from 'pathe';
3
3
  import { distDir } from '../path.js';
4
4
  import { g as getWorkerState } from './global.7bFbnyXl.js';
5
- import { r as rpc } from './rpc.DRDE9Pu1.js';
6
- import { t as takeCoverageInsideWorker } from './coverage.ChSqD-qS.js';
7
- import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.DAu7t7mY.js';
5
+ import { r as rpc } from './rpc.BGx7q_k2.js';
6
+ import { t as takeCoverageInsideWorker } from './coverage.BhYSDdTT.js';
7
+ import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.CWnv_2-5.js';
8
8
 
9
9
  function setupChaiConfig(config) {
10
10
  Object.assign(chai.config, config);
@@ -12,12 +12,15 @@ function setupChaiConfig(config) {
12
12
 
13
13
  async function resolveSnapshotEnvironment(config, executor) {
14
14
  if (!config.snapshotEnvironment) {
15
- const { VitestNodeSnapshotEnvironment } = await import('../chunks/environments-node.39w4gmlF.js');
15
+ const { VitestNodeSnapshotEnvironment } = await import('../chunks/environments-node.XE5FbRPQ.js');
16
16
  return new VitestNodeSnapshotEnvironment();
17
17
  }
18
18
  const mod = await executor.executeId(config.snapshotEnvironment);
19
- if (typeof mod.default !== "object" || !mod.default)
20
- throw new Error("Snapshot environment module must have a default export object with a shape of `SnapshotEnvironment`");
19
+ if (typeof mod.default !== "object" || !mod.default) {
20
+ throw new Error(
21
+ "Snapshot environment module must have a default export object with a shape of `SnapshotEnvironment`"
22
+ );
23
+ }
21
24
  return mod.default;
22
25
  }
23
26
 
@@ -28,8 +31,11 @@ async function getTestRunnerConstructor(config, executor) {
28
31
  return config.mode === "test" ? VitestTestRunner : NodeBenchmarkRunner;
29
32
  }
30
33
  const mod = await executor.executeId(config.runner);
31
- if (!mod.default && typeof mod.default !== "function")
32
- throw new Error(`Runner must export a default function, but got ${typeof mod.default} imported from ${config.runner}`);
34
+ if (!mod.default && typeof mod.default !== "function") {
35
+ throw new Error(
36
+ `Runner must export a default function, but got ${typeof mod.default} imported from ${config.runner}`
37
+ );
38
+ }
33
39
  return mod.default;
34
40
  }
35
41
  async function resolveTestRunner(config, executor) {
@@ -40,10 +46,12 @@ async function resolveTestRunner(config, executor) {
40
46
  enumerable: false,
41
47
  configurable: false
42
48
  });
43
- if (!testRunner.config)
49
+ if (!testRunner.config) {
44
50
  testRunner.config = config;
45
- if (!testRunner.importFile)
51
+ }
52
+ if (!testRunner.importFile) {
46
53
  throw new Error('Runner must implement "importFile" method.');
54
+ }
47
55
  const [diffOptions] = await Promise.all([
48
56
  loadDiffConfig(config, executor),
49
57
  loadSnapshotSerializers(config, executor)
@@ -2,7 +2,7 @@ import { relative } from 'pathe';
2
2
  import '@vitest/runner/utils';
3
3
  import '@vitest/utils';
4
4
  import { g as getWorkerState } from './global.7bFbnyXl.js';
5
- import './env.bmJgw1qP.js';
5
+ import './env.2ltrQNq0.js';
6
6
 
7
7
  function getRunMode() {
8
8
  return getWorkerState().config.mode;
@@ -13,8 +13,9 @@ function isRunningInBenchmark() {
13
13
  const relativePath = relative;
14
14
  function removeUndefinedValues(obj) {
15
15
  for (const key in Object.keys(obj)) {
16
- if (obj[key] === void 0)
16
+ if (obj[key] === void 0) {
17
17
  delete obj[key];
18
+ }
18
19
  }
19
20
  return obj;
20
21
  }