vitest 4.0.0-beta.1 → 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 (85) hide show
  1. package/LICENSE.md +2 -2
  2. package/dist/browser.d.ts +13 -14
  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.q8Z0P0q1.d.ts → browser.d.yFAklsD1.d.ts} +5 -5
  8. package/dist/chunks/{cac.D3EzDDZd.js → cac.DCxo_nSu.js} +70 -152
  9. package/dist/chunks/{cli-api.Dn5gKePv.js → cli-api.BJJXh9BV.js} +1330 -1677
  10. package/dist/chunks/{config.d.HJdfX-8k.d.ts → config.d.B_LthbQq.d.ts} +58 -63
  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.Cwa-XhJt.js → coverage.BCU-r2QL.js} +515 -781
  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/{environment.d.CUq4cUgQ.d.ts → environment.d.BsToaxti.d.ts} +27 -6
  19. package/dist/chunks/{git.BVQ8w_Sw.js → git.BFNcloKD.js} +1 -2
  20. package/dist/chunks/{global.d.CVbXEflG.d.ts → global.d.BK3X7FW1.d.ts} +2 -5
  21. package/dist/chunks/{globals.Cxal6MLI.js → globals.DG-S3xFe.js} +8 -8
  22. package/dist/chunks/{index.CZI_8rVt.js → index.BIP7prJq.js} +289 -608
  23. package/dist/chunks/{index.B521nVV-.js → index.Bgo3tNWt.js} +23 -4
  24. package/dist/chunks/{index.TfbsX-3I.js → index.BjKEiSn0.js} +14 -24
  25. package/dist/chunks/{index.BWf_gE5n.js → index.CMfqw92x.js} +7 -6
  26. package/dist/chunks/{index.CmSc2RE5.js → index.DIWhzsUh.js} +72 -118
  27. package/dist/chunks/{inspector.C914Efll.js → inspector.CvQD-Nie.js} +10 -25
  28. package/dist/chunks/moduleRunner.d.D9nBoC4p.d.ts +201 -0
  29. package/dist/chunks/moduleTransport.I-bgQy0S.js +19 -0
  30. package/dist/chunks/{node.fjCdwEIl.js → node.CyipiPvJ.js} +1 -1
  31. package/dist/chunks/{plugin.d.C2EcJUjo.d.ts → plugin.d.BMVSnsGV.d.ts} +1 -1
  32. package/dist/chunks/{reporters.d.DxZg19fy.d.ts → reporters.d.BUWjmRYq.d.ts} +1226 -1291
  33. package/dist/chunks/resolveSnapshotEnvironment.Bkht6Yor.js +81 -0
  34. package/dist/chunks/resolver.Bx6lE0iq.js +119 -0
  35. package/dist/chunks/rpc.BKr6mtxz.js +65 -0
  36. package/dist/chunks/{setup-common.D7ZqXFx-.js → setup-common.uiMcU3cv.js} +17 -29
  37. package/dist/chunks/startModuleRunner.p67gbNo9.js +665 -0
  38. package/dist/chunks/{suite.d.FvehnV49.d.ts → suite.d.BJWk38HB.d.ts} +1 -1
  39. package/dist/chunks/test.BiqSKISg.js +214 -0
  40. package/dist/chunks/{typechecker.CVytUJuF.js → typechecker.DB-fIMaH.js} +144 -213
  41. package/dist/chunks/{utils.CAioKnHs.js → utils.C2YI6McM.js} +5 -14
  42. package/dist/chunks/{utils.XdZDrNZV.js → utils.D2R2NiOH.js} +8 -27
  43. package/dist/chunks/{vi.bdSIJ99Y.js → vi.ZPgvtBao.js} +156 -305
  44. package/dist/chunks/{vm.BThCzidc.js → vm.Ca0Y0W5f.js} +116 -226
  45. package/dist/chunks/{worker.d.DoNjFAiv.d.ts → worker.d.BDsXGkwh.d.ts} +28 -22
  46. package/dist/chunks/{worker.d.CmvJfRGs.d.ts → worker.d.BNcX_2mH.d.ts} +1 -1
  47. package/dist/cli.js +4 -4
  48. package/dist/config.cjs +3 -9
  49. package/dist/config.d.ts +49 -54
  50. package/dist/config.js +1 -1
  51. package/dist/coverage.d.ts +27 -26
  52. package/dist/coverage.js +6 -7
  53. package/dist/environments.d.ts +9 -13
  54. package/dist/environments.js +1 -1
  55. package/dist/index.d.ts +38 -45
  56. package/dist/index.js +7 -9
  57. package/dist/module-evaluator.d.ts +13 -0
  58. package/dist/module-evaluator.js +276 -0
  59. package/dist/module-runner.js +15 -0
  60. package/dist/node.d.ts +40 -41
  61. package/dist/node.js +23 -33
  62. package/dist/reporters.d.ts +12 -13
  63. package/dist/reporters.js +3 -3
  64. package/dist/runners.d.ts +3 -3
  65. package/dist/runners.js +13 -232
  66. package/dist/snapshot.js +2 -2
  67. package/dist/suite.d.ts +2 -2
  68. package/dist/suite.js +2 -2
  69. package/dist/worker.js +90 -47
  70. package/dist/workers/forks.js +34 -10
  71. package/dist/workers/runVmTests.js +36 -56
  72. package/dist/workers/threads.js +34 -10
  73. package/dist/workers/vmForks.js +11 -10
  74. package/dist/workers/vmThreads.js +11 -10
  75. package/dist/workers.d.ts +5 -4
  76. package/dist/workers.js +35 -17
  77. package/globals.d.ts +17 -17
  78. package/package.json +32 -31
  79. package/dist/chunks/base.Bj3pWTr1.js +0 -38
  80. package/dist/chunks/execute.B7h3T_Hc.js +0 -708
  81. package/dist/chunks/index.D-VkfKhf.js +0 -105
  82. package/dist/chunks/rpc.CsFtxqeq.js +0 -83
  83. package/dist/chunks/runBaseTests.BC7ZIH5L.js +0 -129
  84. package/dist/execute.d.ts +0 -148
  85. package/dist/execute.js +0 -13
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "4.0.0-beta.1",
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": "4.0.0-beta.1",
123
- "@vitest/ui": "4.0.0-beta.1"
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": "4.0.0-beta.1",
165
- "@vitest/mocker": "4.0.0-beta.1",
166
- "@vitest/runner": "4.0.0-beta.1",
167
- "@vitest/snapshot": "4.0.0-beta.1",
168
- "@vitest/spy": "4.0.0-beta.1",
169
- "@vitest/pretty-format": "^4.0.0-beta.1",
170
- "@vitest/utils": "4.0.0-beta.1",
171
- "vite-node": "4.0.0-beta.1"
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.BC7ZIH5L.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 };