vitest 3.2.4 → 4.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 (88) hide show
  1. package/LICENSE.md +2 -2
  2. package/dist/browser.d.ts +13 -16
  3. package/dist/browser.js +6 -5
  4. package/dist/chunks/base.Cjha6usc.js +129 -0
  5. package/dist/chunks/{benchmark.CYdenmiT.js → benchmark.CJUa-Hsa.js} +6 -8
  6. package/dist/chunks/{benchmark.d.BwvBVTda.d.ts → benchmark.d.DAaHLpsq.d.ts} +4 -4
  7. package/dist/chunks/browser.d.yFAklsD1.d.ts +18 -0
  8. package/dist/chunks/{cac.Cb-PYCCB.js → cac.DCxo_nSu.js} +72 -163
  9. package/dist/chunks/{cli-api.BkDphVBG.js → cli-api.BJJXh9BV.js} +1331 -1678
  10. package/dist/chunks/{config.d.D2ROskhv.d.ts → config.d.B_LthbQq.d.ts} +59 -65
  11. package/dist/chunks/{console.CtFJOzRO.js → console.7h5kHUIf.js} +34 -70
  12. package/dist/chunks/{constants.DnKduX2e.js → constants.D_Q9UYh-.js} +1 -9
  13. package/dist/chunks/{coverage.DL5VHqXY.js → coverage.BCU-r2QL.js} +538 -765
  14. package/dist/chunks/{coverage.DVF1vEu8.js → coverage.D_JHT54q.js} +2 -2
  15. package/dist/chunks/{coverage.d.S9RMNXIe.d.ts → coverage.d.BZtK59WP.d.ts} +10 -8
  16. package/dist/chunks/{creator.GK6I-cL4.js → creator.08Gi-vCA.js} +93 -77
  17. package/dist/chunks/{date.Bq6ZW5rf.js → date.-jtEtIeV.js} +6 -17
  18. package/dist/chunks/{defaults.B7q_naMc.js → defaults.CXFFjsi8.js} +2 -42
  19. package/dist/chunks/environment.d.BsToaxti.d.ts +65 -0
  20. package/dist/chunks/{git.BVQ8w_Sw.js → git.BFNcloKD.js} +1 -2
  21. package/dist/chunks/{global.d.MAmajcmJ.d.ts → global.d.BK3X7FW1.d.ts} +7 -32
  22. package/dist/chunks/{globals.DEHgCU4V.js → globals.DG-S3xFe.js} +8 -8
  23. package/dist/chunks/{index.VByaPkjc.js → index.BIP7prJq.js} +472 -803
  24. package/dist/chunks/{index.B521nVV-.js → index.Bgo3tNWt.js} +23 -4
  25. package/dist/chunks/{index.BCWujgDG.js → index.BjKEiSn0.js} +14 -24
  26. package/dist/chunks/{index.CdQS2e2Q.js → index.CMfqw92x.js} +7 -8
  27. package/dist/chunks/{index.CmSc2RE5.js → index.DIWhzsUh.js} +72 -118
  28. package/dist/chunks/{inspector.C914Efll.js → inspector.CvQD-Nie.js} +10 -25
  29. package/dist/chunks/moduleRunner.d.D9nBoC4p.d.ts +201 -0
  30. package/dist/chunks/moduleTransport.I-bgQy0S.js +19 -0
  31. package/dist/chunks/{node.fjCdwEIl.js → node.CyipiPvJ.js} +1 -1
  32. package/dist/chunks/plugin.d.BMVSnsGV.d.ts +9 -0
  33. package/dist/chunks/{reporters.d.BFLkQcL6.d.ts → reporters.d.BUWjmRYq.d.ts} +2086 -2146
  34. package/dist/chunks/resolveSnapshotEnvironment.Bkht6Yor.js +81 -0
  35. package/dist/chunks/resolver.Bx6lE0iq.js +119 -0
  36. package/dist/chunks/rpc.BKr6mtxz.js +65 -0
  37. package/dist/chunks/{setup-common.Dd054P77.js → setup-common.uiMcU3cv.js} +17 -29
  38. package/dist/chunks/startModuleRunner.p67gbNo9.js +665 -0
  39. package/dist/chunks/{suite.d.FvehnV49.d.ts → suite.d.BJWk38HB.d.ts} +1 -1
  40. package/dist/chunks/test.BiqSKISg.js +214 -0
  41. package/dist/chunks/{typechecker.DRKU1-1g.js → typechecker.DB-fIMaH.js} +165 -234
  42. package/dist/chunks/{utils.CAioKnHs.js → utils.C2YI6McM.js} +5 -14
  43. package/dist/chunks/{utils.XdZDrNZV.js → utils.D2R2NiOH.js} +8 -27
  44. package/dist/chunks/{vi.bdSIJ99Y.js → vi.ZPgvtBao.js} +156 -305
  45. package/dist/chunks/{vm.BThCzidc.js → vm.Ca0Y0W5f.js} +116 -226
  46. package/dist/chunks/{worker.d.1GmBbd7G.d.ts → worker.d.BDsXGkwh.d.ts} +31 -32
  47. package/dist/chunks/{worker.d.CKwWzBSj.d.ts → worker.d.BNcX_2mH.d.ts} +1 -1
  48. package/dist/cli.js +10 -10
  49. package/dist/config.cjs +5 -58
  50. package/dist/config.d.ts +72 -71
  51. package/dist/config.js +3 -9
  52. package/dist/coverage.d.ts +31 -24
  53. package/dist/coverage.js +9 -9
  54. package/dist/environments.d.ts +9 -14
  55. package/dist/environments.js +1 -1
  56. package/dist/index.d.ts +52 -213
  57. package/dist/index.js +7 -9
  58. package/dist/module-evaluator.d.ts +13 -0
  59. package/dist/module-evaluator.js +276 -0
  60. package/dist/module-runner.js +15 -0
  61. package/dist/node.d.ts +62 -51
  62. package/dist/node.js +26 -42
  63. package/dist/reporters.d.ts +11 -12
  64. package/dist/reporters.js +12 -12
  65. package/dist/runners.d.ts +3 -4
  66. package/dist/runners.js +13 -231
  67. package/dist/snapshot.js +2 -2
  68. package/dist/suite.d.ts +2 -2
  69. package/dist/suite.js +2 -2
  70. package/dist/worker.js +90 -47
  71. package/dist/workers/forks.js +34 -10
  72. package/dist/workers/runVmTests.js +36 -56
  73. package/dist/workers/threads.js +34 -10
  74. package/dist/workers/vmForks.js +11 -10
  75. package/dist/workers/vmThreads.js +11 -10
  76. package/dist/workers.d.ts +5 -7
  77. package/dist/workers.js +35 -17
  78. package/globals.d.ts +17 -17
  79. package/package.json +32 -31
  80. package/dist/chunks/base.DfmxU-tU.js +0 -38
  81. package/dist/chunks/environment.d.cL3nLXbE.d.ts +0 -119
  82. package/dist/chunks/execute.B7h3T_Hc.js +0 -708
  83. package/dist/chunks/index.CwejwG0H.js +0 -105
  84. package/dist/chunks/rpc.-pEldfrD.js +0 -83
  85. package/dist/chunks/runBaseTests.9Ij9_de-.js +0 -129
  86. package/dist/chunks/vite.d.CMLlLIFP.d.ts +0 -25
  87. package/dist/execute.d.ts +0 -150
  88. package/dist/execute.js +0 -13
@@ -4,81 +4,61 @@ import timers from 'node:timers';
4
4
  import timersPromises from 'node:timers/promises';
5
5
  import util from 'node:util';
6
6
  import { startTests, collectTests } from '@vitest/runner';
7
- import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
8
- import { installSourcemapsSupport } from 'vite-node/source-map';
9
- import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../chunks/index.CwejwG0H.js';
10
- import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from '../chunks/setup-common.Dd054P77.js';
11
- import { V as VitestIndex } from '../chunks/index.CdQS2e2Q.js';
12
- import { c as closeInspector } from '../chunks/inspector.C914Efll.js';
13
- import { g as getWorkerState } from '../chunks/utils.XdZDrNZV.js';
14
- import 'chai';
15
- import 'node:path';
16
- import '../path.js';
17
- import 'node:url';
18
- import '../chunks/rpc.-pEldfrD.js';
19
- import '@vitest/utils';
20
- import '../chunks/index.B521nVV-.js';
21
- import '../chunks/coverage.DVF1vEu8.js';
22
- import '@vitest/snapshot';
23
- import '../chunks/vi.bdSIJ99Y.js';
7
+ import { KNOWN_ASSET_TYPES } from '@vitest/utils';
8
+ import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../chunks/resolveSnapshotEnvironment.Bkht6Yor.js';
9
+ import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from '../chunks/setup-common.uiMcU3cv.js';
10
+ import { i as index } from '../chunks/index.CMfqw92x.js';
11
+ import { c as closeInspector } from '../chunks/inspector.CvQD-Nie.js';
12
+ import { g as getWorkerState } from '../chunks/utils.D2R2NiOH.js';
13
+ import { g as globalExpect } from '../chunks/vi.ZPgvtBao.js';
24
14
  import '@vitest/expect';
15
+ import '../chunks/rpc.BKr6mtxz.js';
16
+ import '../chunks/index.Bgo3tNWt.js';
17
+ import '../chunks/test.BiqSKISg.js';
18
+ import '../chunks/benchmark.CJUa-Hsa.js';
25
19
  import '@vitest/runner/utils';
26
- import '../chunks/_commonjsHelpers.BFTU3MAI.js';
27
20
  import '@vitest/utils/error';
21
+ import 'pathe';
22
+ import '../chunks/coverage.D_JHT54q.js';
23
+ import '@vitest/snapshot';
24
+ import 'expect-type';
25
+ import 'vite/module-runner';
26
+ import 'node:url';
27
+ import '../chunks/_commonjsHelpers.BFTU3MAI.js';
28
28
  import '@vitest/spy';
29
29
  import '@vitest/utils/source-map';
30
- import '../chunks/date.Bq6ZW5rf.js';
31
- import '../chunks/benchmark.CYdenmiT.js';
32
- import 'expect-type';
30
+ import '../chunks/date.-jtEtIeV.js';
33
31
 
34
- async function run(method, files, config, executor) {
32
+ async function run(method, files, config, moduleRunner) {
35
33
  const workerState = getWorkerState();
36
- await setupCommonEnv(config);
37
- Object.defineProperty(globalThis, "__vitest_index__", {
38
- value: VitestIndex,
34
+ await setupCommonEnv(config), Object.defineProperty(globalThis, "__vitest_index__", {
35
+ value: index,
39
36
  enumerable: false
40
37
  });
41
- if (workerState.environment.transformMode === "web") {
38
+ const viteEnvironment = workerState.environment.viteEnvironment || workerState.environment.name;
39
+ if (globalExpect.setState({ environment: workerState.environment.name }), viteEnvironment === "client") {
42
40
  const _require = createRequire(import.meta.url);
43
- // always mock "required" `css` files, because we cannot process them
44
- _require.extensions[".css"] = resolveCss;
45
- _require.extensions[".scss"] = resolveCss;
46
- _require.extensions[".sass"] = resolveCss;
47
- _require.extensions[".less"] = resolveCss;
48
- // since we are using Vite, we can assume how these will be resolved
49
- KNOWN_ASSET_TYPES.forEach((type) => {
41
+ _require.extensions[".css"] = resolveCss, _require.extensions[".scss"] = resolveCss, _require.extensions[".sass"] = resolveCss, _require.extensions[".less"] = resolveCss, KNOWN_ASSET_TYPES.forEach((type) => {
50
42
  _require.extensions[`.${type}`] = resolveAsset;
51
- });
52
- process.env.SSR = "";
43
+ }), process.env.SSR = "";
53
44
  } else process.env.SSR = "1";
54
- // @ts-expect-error not typed global for patched timers
55
- globalThis.__vitest_required__ = {
45
+ if (globalThis.__vitest_required__ = {
56
46
  util,
57
47
  timers,
58
48
  timersPromises
59
- };
60
- installSourcemapsSupport({ getSourceMap: (source) => workerState.moduleCache.getSourceMap(source) });
61
- await startCoverageInsideWorker(config.coverage, executor, { isolate: false });
62
- if (config.chaiConfig) setupChaiConfig(config.chaiConfig);
63
- const [runner, snapshotEnvironment] = await Promise.all([resolveTestRunner(config, executor), resolveSnapshotEnvironment(config, executor)]);
64
- config.snapshotOptions.snapshotEnvironment = snapshotEnvironment;
65
- runner.getWorkerContext = void 0;
66
- workerState.onCancel.then((reason) => {
67
- closeInspector(config);
68
- runner.cancel?.(reason);
69
- });
70
- workerState.durations.prepare = performance.now() - workerState.durations.prepare;
71
- const { vi } = VitestIndex;
49
+ }, await startCoverageInsideWorker(config.coverage, moduleRunner, { isolate: false }), config.chaiConfig) setupChaiConfig(config.chaiConfig);
50
+ const [runner, snapshotEnvironment] = await Promise.all([resolveTestRunner(config, moduleRunner), resolveSnapshotEnvironment(config, moduleRunner)]);
51
+ config.snapshotOptions.snapshotEnvironment = snapshotEnvironment, runner.getWorkerContext = void 0, workerState.onCancel.then((reason) => {
52
+ closeInspector(config), runner.cancel?.(reason);
53
+ }), workerState.durations.prepare = performance.now() - workerState.durations.prepare;
54
+ const { vi } = index;
72
55
  for (const file of files) {
73
- workerState.filepath = file.filepath;
74
- if (method === "run") await startTests([file], runner);
56
+ if (workerState.filepath = file.filepath, method === "run") await startTests([file], runner);
75
57
  else await collectTests([file], runner);
76
- // reset after tests, because user might call `vi.setConfig` in setupFile
77
- vi.resetConfig();
78
58
  // mocks should not affect different files
79
- vi.restoreAllMocks();
59
+ vi.resetConfig(), vi.restoreAllMocks();
80
60
  }
81
- await stopCoverageInsideWorker(config.coverage, executor, { isolate: false });
61
+ await stopCoverageInsideWorker(config.coverage, moduleRunner, { isolate: false });
82
62
  }
83
63
  function resolveCss(mod) {
84
64
  mod.exports = "";
@@ -1,19 +1,43 @@
1
- import { r as runBaseTests } from '../chunks/base.DfmxU-tU.js';
2
- import { a as createThreadsRpcOptions } from '../chunks/utils.CAioKnHs.js';
3
- import 'vite-node/client';
4
- import '../chunks/execute.B7h3T_Hc.js';
1
+ import { r as runBaseTests } from '../chunks/base.Cjha6usc.js';
2
+ import { a as createThreadsRpcOptions } from '../chunks/utils.C2YI6McM.js';
3
+ import 'node:vm';
4
+ import '@vitest/spy';
5
+ import 'vite/module-runner';
6
+ import '../chunks/startModuleRunner.p67gbNo9.js';
5
7
  import 'node:fs';
8
+ import 'node:module';
9
+ import '@vitest/utils';
6
10
  import 'node:url';
7
- import 'node:vm';
8
- import '@vitest/utils/error';
9
11
  import 'pathe';
10
- import 'vite-node/utils';
11
12
  import '../path.js';
12
13
  import 'node:path';
14
+ import '@vitest/utils/error';
15
+ import '../module-evaluator.js';
13
16
  import '@vitest/mocker';
14
- import 'node:module';
15
- import '@vitest/utils';
16
- import '../chunks/utils.XdZDrNZV.js';
17
+ import '../chunks/moduleTransport.I-bgQy0S.js';
18
+ import 'node:perf_hooks';
19
+ import '@vitest/runner';
20
+ import '../chunks/resolveSnapshotEnvironment.Bkht6Yor.js';
21
+ import '@vitest/expect';
22
+ import '../chunks/setup-common.uiMcU3cv.js';
23
+ import '../chunks/coverage.D_JHT54q.js';
24
+ import '@vitest/snapshot';
25
+ import '../chunks/utils.D2R2NiOH.js';
26
+ import '../chunks/rpc.BKr6mtxz.js';
27
+ import '../chunks/index.Bgo3tNWt.js';
28
+ import '../chunks/test.BiqSKISg.js';
29
+ import '../chunks/benchmark.CJUa-Hsa.js';
30
+ import '@vitest/runner/utils';
31
+ import '../chunks/vi.ZPgvtBao.js';
32
+ import '../chunks/_commonjsHelpers.BFTU3MAI.js';
33
+ import '@vitest/utils/source-map';
34
+ import '../chunks/date.-jtEtIeV.js';
35
+ import '../chunks/inspector.CvQD-Nie.js';
36
+ import 'node:timers';
37
+ import 'node:timers/promises';
38
+ import 'node:util';
39
+ import '../chunks/index.CMfqw92x.js';
40
+ import 'expect-type';
17
41
 
18
42
  class ThreadsBaseWorker {
19
43
  getRpcOptions(ctx) {
@@ -1,26 +1,27 @@
1
1
  import v8 from 'node:v8';
2
- import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../chunks/utils.CAioKnHs.js';
3
- import { r as runVmTests } from '../chunks/vm.BThCzidc.js';
2
+ import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../chunks/utils.C2YI6McM.js';
3
+ import { r as runVmTests } from '../chunks/vm.Ca0Y0W5f.js';
4
4
  import '@vitest/utils';
5
5
  import 'node:url';
6
6
  import 'node:vm';
7
7
  import 'pathe';
8
8
  import '../path.js';
9
9
  import 'node:path';
10
- import '../chunks/console.CtFJOzRO.js';
10
+ import '../chunks/console.7h5kHUIf.js';
11
11
  import 'node:console';
12
12
  import 'node:stream';
13
13
  import 'tinyrainbow';
14
- import '../chunks/date.Bq6ZW5rf.js';
15
- import '../chunks/utils.XdZDrNZV.js';
16
- import '../chunks/execute.B7h3T_Hc.js';
14
+ import '../chunks/date.-jtEtIeV.js';
15
+ import '../chunks/utils.D2R2NiOH.js';
17
16
  import 'node:fs';
17
+ import 'node:module';
18
+ import '../chunks/resolver.Bx6lE0iq.js';
19
+ import '../module-evaluator.js';
20
+ import 'vite/module-runner';
21
+ import '../chunks/startModuleRunner.p67gbNo9.js';
18
22
  import '@vitest/utils/error';
19
- import 'vite-node/client';
20
- import 'vite-node/utils';
21
23
  import '@vitest/mocker';
22
- import 'node:module';
23
- import 'vite-node/constants';
24
+ import '../chunks/moduleTransport.I-bgQy0S.js';
24
25
 
25
26
  class ForksVmWorker {
26
27
  getRpcOptions() {
@@ -1,25 +1,26 @@
1
- import { a as createThreadsRpcOptions } from '../chunks/utils.CAioKnHs.js';
2
- import { r as runVmTests } from '../chunks/vm.BThCzidc.js';
1
+ import { a as createThreadsRpcOptions } from '../chunks/utils.C2YI6McM.js';
2
+ import { r as runVmTests } from '../chunks/vm.Ca0Y0W5f.js';
3
3
  import '@vitest/utils';
4
4
  import 'node:url';
5
5
  import 'node:vm';
6
6
  import 'pathe';
7
7
  import '../path.js';
8
8
  import 'node:path';
9
- import '../chunks/console.CtFJOzRO.js';
9
+ import '../chunks/console.7h5kHUIf.js';
10
10
  import 'node:console';
11
11
  import 'node:stream';
12
12
  import 'tinyrainbow';
13
- import '../chunks/date.Bq6ZW5rf.js';
14
- import '../chunks/utils.XdZDrNZV.js';
15
- import '../chunks/execute.B7h3T_Hc.js';
13
+ import '../chunks/date.-jtEtIeV.js';
14
+ import '../chunks/utils.D2R2NiOH.js';
16
15
  import 'node:fs';
16
+ import 'node:module';
17
+ import '../chunks/resolver.Bx6lE0iq.js';
18
+ import '../module-evaluator.js';
19
+ import 'vite/module-runner';
20
+ import '../chunks/startModuleRunner.p67gbNo9.js';
17
21
  import '@vitest/utils/error';
18
- import 'vite-node/client';
19
- import 'vite-node/utils';
20
22
  import '@vitest/mocker';
21
- import 'node:module';
22
- import 'vite-node/constants';
23
+ import '../chunks/moduleTransport.I-bgQy0S.js';
23
24
 
24
25
  class ThreadsVmWorker {
25
26
  getRpcOptions(ctx) {
package/dist/workers.d.ts CHANGED
@@ -1,15 +1,13 @@
1
- import { W as WorkerGlobalState, C as ContextRPC, B as BirpcOptions, R as RuntimeRPC } from './chunks/worker.d.1GmBbd7G.js';
1
+ import { W as WorkerGlobalState, C as ContextRPC, B as BirpcOptions, R as RuntimeRPC } from './chunks/worker.d.BDsXGkwh.js';
2
2
  import { Awaitable } from '@vitest/utils';
3
3
  import * as v8 from 'v8';
4
- import { a as SerializedConfig } from './chunks/config.d.D2ROskhv.js';
5
- import { W as WorkerContext } from './chunks/worker.d.CKwWzBSj.js';
4
+ import { a as SerializedConfig } from './chunks/config.d.B_LthbQq.js';
5
+ import { W as WorkerContext } from './chunks/worker.d.BNcX_2mH.js';
6
6
  import '@vitest/runner';
7
- import 'vite-node';
8
- import './chunks/environment.d.cL3nLXbE.js';
9
- import 'vitest/optional-types.js';
7
+ import 'vite/module-runner';
8
+ import './chunks/environment.d.BsToaxti.js';
10
9
  import '@vitest/snapshot';
11
10
  import '@vitest/pretty-format';
12
- import '@vitest/snapshot/environment';
13
11
  import '@vitest/utils/diff';
14
12
  import 'node:worker_threads';
15
13
 
package/dist/workers.js CHANGED
@@ -1,30 +1,48 @@
1
- export { p as provideWorkerState } from './chunks/utils.XdZDrNZV.js';
1
+ export { p as provideWorkerState } from './chunks/utils.D2R2NiOH.js';
2
2
  export { collect as collectVitestWorkerTests, run as runVitestWorker } from './worker.js';
3
- export { r as runBaseTests } from './chunks/base.DfmxU-tU.js';
4
- export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './chunks/utils.CAioKnHs.js';
5
- export { r as runVmTests } from './chunks/vm.BThCzidc.js';
3
+ export { r as runBaseTests } from './chunks/base.Cjha6usc.js';
4
+ export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './chunks/utils.C2YI6McM.js';
5
+ export { r as runVmTests } from './chunks/vm.Ca0Y0W5f.js';
6
6
  import '@vitest/utils';
7
7
  import 'node:url';
8
8
  import '@vitest/utils/source-map';
9
- import 'tinypool';
10
- import 'vite-node/client';
9
+ import 'vite/module-runner';
11
10
  import 'node:fs';
11
+ import 'node:module';
12
12
  import 'pathe';
13
- import './chunks/index.CmSc2RE5.js';
13
+ import './chunks/moduleTransport.I-bgQy0S.js';
14
+ import './chunks/index.DIWhzsUh.js';
14
15
  import 'node:console';
15
- import './chunks/inspector.C914Efll.js';
16
- import 'node:module';
17
- import './chunks/rpc.-pEldfrD.js';
18
- import './chunks/index.B521nVV-.js';
19
- import './chunks/execute.B7h3T_Hc.js';
16
+ import './chunks/inspector.CvQD-Nie.js';
17
+ import './chunks/rpc.BKr6mtxz.js';
18
+ import './chunks/index.Bgo3tNWt.js';
20
19
  import 'node:vm';
21
- import '@vitest/utils/error';
22
- import 'vite-node/utils';
20
+ import '@vitest/spy';
21
+ import './chunks/startModuleRunner.p67gbNo9.js';
23
22
  import './path.js';
24
23
  import 'node:path';
24
+ import '@vitest/utils/error';
25
+ import './module-evaluator.js';
25
26
  import '@vitest/mocker';
26
- import './chunks/console.CtFJOzRO.js';
27
+ import 'node:perf_hooks';
28
+ import '@vitest/runner';
29
+ import './chunks/resolveSnapshotEnvironment.Bkht6Yor.js';
30
+ import '@vitest/expect';
31
+ import './chunks/setup-common.uiMcU3cv.js';
32
+ import './chunks/coverage.D_JHT54q.js';
33
+ import '@vitest/snapshot';
34
+ import './chunks/test.BiqSKISg.js';
35
+ import './chunks/benchmark.CJUa-Hsa.js';
36
+ import '@vitest/runner/utils';
37
+ import './chunks/vi.ZPgvtBao.js';
38
+ import './chunks/_commonjsHelpers.BFTU3MAI.js';
39
+ import './chunks/date.-jtEtIeV.js';
40
+ import 'node:timers';
41
+ import 'node:timers/promises';
42
+ import 'node:util';
43
+ import './chunks/index.CMfqw92x.js';
44
+ import 'expect-type';
45
+ import './chunks/console.7h5kHUIf.js';
27
46
  import 'node:stream';
28
47
  import 'tinyrainbow';
29
- import './chunks/date.Bq6ZW5rf.js';
30
- import 'vite-node/constants';
48
+ import './chunks/resolver.Bx6lE0iq.js';
package/globals.d.ts CHANGED
@@ -1,20 +1,20 @@
1
1
  declare global {
2
- const suite: typeof import('vitest')['suite']
3
- const test: typeof import('vitest')['test']
4
- const chai: typeof import("vitest")["chai"]
5
- const describe: typeof import('vitest')['describe']
6
- const it: typeof import('vitest')['it']
7
- const expectTypeOf: typeof import('vitest')['expectTypeOf']
8
- const assertType: typeof import('vitest')['assertType']
9
- const expect: typeof import('vitest')['expect']
10
- const assert: typeof import('vitest')['assert']
11
- const vitest: typeof import('vitest')['vitest']
12
- const vi: typeof import('vitest')['vitest']
13
- const beforeAll: typeof import('vitest')['beforeAll']
14
- const afterAll: typeof import('vitest')['afterAll']
15
- const beforeEach: typeof import('vitest')['beforeEach']
16
- const afterEach: typeof import('vitest')['afterEach']
17
- const onTestFailed: typeof import('vitest')['onTestFailed']
18
- const onTestFinished: typeof import('vitest')['onTestFinished']
2
+ let suite: typeof import('vitest')['suite']
3
+ let test: typeof import('vitest')['test']
4
+ let chai: typeof import("vitest")["chai"]
5
+ let describe: typeof import('vitest')['describe']
6
+ let it: typeof import('vitest')['it']
7
+ let expectTypeOf: typeof import('vitest')['expectTypeOf']
8
+ let assertType: typeof import('vitest')['assertType']
9
+ let expect: typeof import('vitest')['expect']
10
+ let assert: typeof import('vitest')['assert']
11
+ let vitest: typeof import('vitest')['vitest']
12
+ let vi: typeof import('vitest')['vitest']
13
+ let beforeAll: typeof import('vitest')['beforeAll']
14
+ let afterAll: typeof import('vitest')['afterAll']
15
+ let beforeEach: typeof import('vitest')['beforeEach']
16
+ let afterEach: typeof import('vitest')['afterEach']
17
+ let onTestFailed: typeof import('vitest')['onTestFailed']
18
+ let onTestFinished: typeof import('vitest')['onTestFinished']
19
19
  }
20
20
  export {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "3.2.4",
4
+ "version": "4.0.0-beta.10",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -22,6 +22,12 @@
22
22
  "jest"
23
23
  ],
24
24
  "sideEffects": false,
25
+ "imports": {
26
+ "#module-evaluator": {
27
+ "types": "./dist/module-evaluator.d.ts",
28
+ "default": "./dist/module-evaluator.js"
29
+ }
30
+ },
25
31
  "exports": {
26
32
  ".": {
27
33
  "import": {
@@ -50,10 +56,6 @@
50
56
  "types": "./dist/node.d.ts",
51
57
  "default": "./dist/node.js"
52
58
  },
53
- "./execute": {
54
- "types": "./dist/execute.d.ts",
55
- "default": "./dist/execute.js"
56
- },
57
59
  "./workers": {
58
60
  "types": "./dist/workers.d.ts",
59
61
  "import": "./dist/workers.js"
@@ -62,6 +64,10 @@
62
64
  "types": "./dist/browser.d.ts",
63
65
  "default": "./dist/browser.js"
64
66
  },
67
+ "./internal/module-runner": {
68
+ "types": "./dist/module-runner.d.ts",
69
+ "default": "./dist/module-runner.js"
70
+ },
65
71
  "./runners": {
66
72
  "types": "./dist/runners.d.ts",
67
73
  "default": "./dist/runners.js"
@@ -119,8 +125,8 @@
119
125
  "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
120
126
  "happy-dom": "*",
121
127
  "jsdom": "*",
122
- "@vitest/browser": "3.2.4",
123
- "@vitest/ui": "3.2.4"
128
+ "@vitest/browser": "4.0.0-beta.10",
129
+ "@vitest/ui": "4.0.0-beta.10"
124
130
  },
125
131
  "peerDependenciesMeta": {
126
132
  "@edge-runtime/vm": {
@@ -146,32 +152,29 @@
146
152
  }
147
153
  },
148
154
  "dependencies": {
149
- "@types/chai": "^5.2.2",
150
- "chai": "^5.2.0",
151
155
  "debug": "^4.4.1",
152
- "expect-type": "^1.2.1",
153
- "magic-string": "^0.30.17",
156
+ "es-module-lexer": "^1.7.0",
157
+ "expect-type": "^1.2.2",
158
+ "magic-string": "^0.30.18",
154
159
  "pathe": "^2.0.3",
155
- "picomatch": "^4.0.2",
160
+ "picomatch": "^4.0.3",
156
161
  "std-env": "^3.9.0",
157
162
  "tinybench": "^2.9.0",
158
163
  "tinyexec": "^0.3.2",
159
164
  "tinyglobby": "^0.2.14",
160
- "tinypool": "^1.1.1",
165
+ "tinypool": "^2.0.0",
161
166
  "tinyrainbow": "^2.0.0",
162
- "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0",
167
+ "vite": "^6.0.0 || ^7.0.0-0",
163
168
  "why-is-node-running": "^2.3.0",
164
- "@vitest/expect": "3.2.4",
165
- "@vitest/mocker": "3.2.4",
166
- "@vitest/snapshot": "3.2.4",
167
- "@vitest/runner": "3.2.4",
168
- "@vitest/pretty-format": "^3.2.4",
169
- "@vitest/spy": "3.2.4",
170
- "vite-node": "3.2.4",
171
- "@vitest/utils": "3.2.4"
169
+ "@vitest/expect": "4.0.0-beta.10",
170
+ "@vitest/pretty-format": "^4.0.0-beta.10",
171
+ "@vitest/runner": "4.0.0-beta.10",
172
+ "@vitest/spy": "4.0.0-beta.10",
173
+ "@vitest/mocker": "4.0.0-beta.10",
174
+ "@vitest/snapshot": "4.0.0-beta.10",
175
+ "@vitest/utils": "4.0.0-beta.10"
172
176
  },
173
177
  "devDependencies": {
174
- "@ampproject/remapping": "^2.3.0",
175
178
  "@antfu/install-pkg": "^1.1.0",
176
179
  "@edge-runtime/vm": "^5.0.0",
177
180
  "@sinonjs/fake-timers": "14.0.0",
@@ -180,25 +183,23 @@
180
183
  "@types/istanbul-lib-coverage": "^2.0.6",
181
184
  "@types/istanbul-reports": "^3.0.4",
182
185
  "@types/jsdom": "^21.1.7",
183
- "@types/mime": "^4.0.0",
184
- "@types/node": "^22.15.32",
185
- "@types/picomatch": "^4.0.0",
186
+ "@types/node": "^22.18.0",
187
+ "@types/picomatch": "^4.0.2",
186
188
  "@types/prompts": "^2.4.9",
187
189
  "@types/sinonjs__fake-timers": "^8.1.5",
188
190
  "acorn-walk": "^8.3.4",
189
- "birpc": "2.4.0",
191
+ "birpc": "^2.5.0",
190
192
  "cac": "^6.7.14",
191
193
  "chai-subset": "^1.6.0",
192
194
  "find-up": "^6.3.0",
193
195
  "flatted": "^3.3.3",
194
- "happy-dom": "^17.6.3",
196
+ "happy-dom": "^18.0.1",
195
197
  "jsdom": "^26.1.0",
196
- "local-pkg": "^1.1.1",
198
+ "local-pkg": "^1.1.2",
197
199
  "mime": "^4.0.7",
198
- "pretty-format": "^29.7.0",
199
200
  "prompts": "^2.4.2",
200
201
  "strip-literal": "^3.0.0",
201
- "ws": "^8.18.2"
202
+ "ws": "^8.18.3"
202
203
  },
203
204
  "scripts": {
204
205
  "build": "rimraf dist && rollup -c",
@@ -1,38 +0,0 @@
1
- import { ModuleCacheMap } from 'vite-node/client';
2
- import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.B7h3T_Hc.js';
3
- import { p as provideWorkerState } from './utils.XdZDrNZV.js';
4
-
5
- let _viteNode;
6
- const moduleCache = new ModuleCacheMap();
7
- const moduleExecutionInfo = /* @__PURE__ */ new Map();
8
- async function startViteNode(options) {
9
- if (_viteNode) return _viteNode;
10
- _viteNode = await startVitestExecutor(options);
11
- return _viteNode;
12
- }
13
- async function runBaseTests(method, state) {
14
- const { ctx } = state;
15
- // state has new context, but we want to reuse existing ones
16
- state.moduleCache = moduleCache;
17
- state.moduleExecutionInfo = moduleExecutionInfo;
18
- provideWorkerState(globalThis, state);
19
- if (ctx.invalidates) ctx.invalidates.forEach((fsPath) => {
20
- moduleCache.delete(fsPath);
21
- moduleCache.delete(`mock:${fsPath}`);
22
- });
23
- ctx.files.forEach((i) => state.moduleCache.delete(typeof i === "string" ? i : i.filepath));
24
- const [executor, { run }] = await Promise.all([startViteNode({
25
- state,
26
- requestStubs: getDefaultRequestStubs()
27
- }), import('./runBaseTests.9Ij9_de-.js')]);
28
- const fileSpecs = ctx.files.map((f) => typeof f === "string" ? {
29
- filepath: f,
30
- testLocations: void 0
31
- } : f);
32
- await run(method, fileSpecs, ctx.config, {
33
- environment: state.environment,
34
- options: ctx.environment.options
35
- }, executor);
36
- }
37
-
38
- export { runBaseTests as r };