vitest 3.1.0-beta.1 → 3.1.0

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 +29 -0
  2. package/dist/browser.js +4 -4
  3. package/dist/chunks/base.bV8rwssx.js +41 -0
  4. package/dist/chunks/benchmark.BKUatJGy.js +39 -0
  5. package/dist/chunks/cac.1WcTh-zl.js +1529 -0
  6. package/dist/chunks/{cli-api.BwkkJsRe.js → cli-api.2yb7XCwB.js} +4640 -5072
  7. package/dist/chunks/console.D6t261w0.js +173 -0
  8. package/dist/chunks/constants.BZZyIeIE.js +43 -0
  9. package/dist/chunks/coverage.0iPg4Wrz.js +33 -0
  10. package/dist/chunks/{coverage.gV8doR2Y.js → coverage.SfnlalVs.js} +2424 -2482
  11. package/dist/chunks/creator.CuL7xDWI.js +705 -0
  12. package/dist/chunks/date.CDOsz-HY.js +53 -0
  13. package/dist/chunks/defaults.DmfNPoe5.js +114 -0
  14. package/dist/chunks/{env.D4Lgay0q.js → env.Dq0hM4Xv.js} +1 -1
  15. package/dist/chunks/execute.CwmnH2oH.js +791 -0
  16. package/dist/chunks/git.DXfdBEfR.js +74 -0
  17. package/dist/chunks/{globals.BEpDe-k3.js → globals.DCbUWjip.js} +10 -10
  18. package/dist/chunks/{index.D7Ny8f_s.js → index.BDobFbcz.js} +6 -7
  19. package/dist/chunks/index.CwHmn5H5.js +2422 -0
  20. package/dist/chunks/index.DFXFpH3w.js +607 -0
  21. package/dist/chunks/index.VfYQ6MXY.js +104 -0
  22. package/dist/chunks/inspector.DbDkSkFn.js +54 -0
  23. package/dist/chunks/node.IqGoMrm4.js +15 -0
  24. package/dist/chunks/{reporters.d.r7poTZjA.d.ts → reporters.d.CfRkRKN2.d.ts} +52 -20
  25. package/dist/chunks/rpc.DGgL5dw7.js +92 -0
  26. package/dist/chunks/run-once.I7PpBOk1.js +47 -0
  27. package/dist/chunks/runBaseTests.CqmKSG99.js +134 -0
  28. package/dist/chunks/setup-common.DEGDGBiA.js +88 -0
  29. package/dist/chunks/{typechecker.BlF3eHsb.js → typechecker.CG0zmr19.js} +620 -622
  30. package/dist/chunks/utils.BfxieIyZ.js +66 -0
  31. package/dist/chunks/utils.CtocqOoE.js +72 -0
  32. package/dist/chunks/utils.Lot3J_8U.js +194 -0
  33. package/dist/chunks/{vi.nSCvwQ7l.js → vi.B-PuvDzu.js} +878 -1019
  34. package/dist/chunks/vite.d.4pkSbgmp.d.ts +23 -0
  35. package/dist/chunks/vm.Lp7mPCVW.js +796 -0
  36. package/dist/cli.js +2 -2
  37. package/dist/config.cjs +97 -103
  38. package/dist/config.d.ts +6 -4
  39. package/dist/config.js +6 -6
  40. package/dist/coverage.d.ts +2 -1
  41. package/dist/coverage.js +7 -7
  42. package/dist/environments.js +1 -1
  43. package/dist/execute.d.ts +0 -2
  44. package/dist/execute.js +1 -1
  45. package/dist/index.d.ts +6 -5
  46. package/dist/index.js +6 -6
  47. package/dist/node.d.ts +17 -6
  48. package/dist/node.js +36 -45
  49. package/dist/path.js +1 -4
  50. package/dist/reporters.d.ts +2 -1
  51. package/dist/reporters.js +4 -4
  52. package/dist/runners.js +231 -267
  53. package/dist/snapshot.js +2 -2
  54. package/dist/suite.js +2 -2
  55. package/dist/worker.js +98 -114
  56. package/dist/workers/forks.js +22 -22
  57. package/dist/workers/runVmTests.js +61 -66
  58. package/dist/workers/threads.js +13 -13
  59. package/dist/workers/vmForks.js +24 -24
  60. package/dist/workers/vmThreads.js +15 -15
  61. package/dist/workers.d.ts +2 -1
  62. package/dist/workers.js +10 -10
  63. package/package.json +17 -17
  64. package/dist/chunks/base.DV59CbtV.js +0 -45
  65. package/dist/chunks/benchmark.DL72EVN-.js +0 -40
  66. package/dist/chunks/cac.BjmXy7OV.js +0 -1664
  67. package/dist/chunks/console.CN7AiMGV.js +0 -179
  68. package/dist/chunks/constants.DTYd6dNH.js +0 -46
  69. package/dist/chunks/coverage.A3sS5-Wm.js +0 -40
  70. package/dist/chunks/creator.BsBnpTzI.js +0 -670
  71. package/dist/chunks/date.W2xKR2qe.js +0 -53
  72. package/dist/chunks/defaults.C2Ndd9wx.js +0 -119
  73. package/dist/chunks/execute.eDH0aFFd.js +0 -839
  74. package/dist/chunks/git.B5SDxu-n.js +0 -69
  75. package/dist/chunks/index.DOyx6FYJ.js +0 -2551
  76. package/dist/chunks/index.K90BXFOx.js +0 -658
  77. package/dist/chunks/index.uXkkC4xl.js +0 -111
  78. package/dist/chunks/inspector.DKLceBVD.js +0 -54
  79. package/dist/chunks/node.AKq966Jp.js +0 -15
  80. package/dist/chunks/rpc.TVf73xOu.js +0 -102
  81. package/dist/chunks/run-once.2ogXb3JV.js +0 -28
  82. package/dist/chunks/runBaseTests.BVrL_ow3.js +0 -142
  83. package/dist/chunks/setup-common.CPvtqi8q.js +0 -96
  84. package/dist/chunks/utils.C8RiOc4B.js +0 -77
  85. package/dist/chunks/utils.Cn0zI1t3.js +0 -68
  86. package/dist/chunks/utils.bLM2atbD.js +0 -198
  87. package/dist/chunks/vite.d.Fvq-NZoa.d.ts +0 -11
  88. package/dist/chunks/vm.jEFQDlX_.js +0 -852
package/dist/workers.js CHANGED
@@ -1,8 +1,8 @@
1
- export { p as provideWorkerState } from './chunks/utils.C8RiOc4B.js';
1
+ export { p as provideWorkerState } from './chunks/utils.CtocqOoE.js';
2
2
  export { collect as collectVitestWorkerTests, run as runVitestWorker } from './worker.js';
3
- export { r as runBaseTests } from './chunks/base.DV59CbtV.js';
4
- export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './chunks/utils.Cn0zI1t3.js';
5
- export { r as runVmTests } from './chunks/vm.jEFQDlX_.js';
3
+ export { r as runBaseTests } from './chunks/base.bV8rwssx.js';
4
+ export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './chunks/utils.BfxieIyZ.js';
5
+ export { r as runVmTests } from './chunks/vm.Lp7mPCVW.js';
6
6
  import '@vitest/utils';
7
7
  import 'node:url';
8
8
  import '@vitest/utils/source-map';
@@ -10,21 +10,21 @@ import 'tinypool';
10
10
  import 'vite-node/client';
11
11
  import 'node:fs';
12
12
  import 'pathe';
13
- import './chunks/index.K90BXFOx.js';
13
+ import './chunks/index.DFXFpH3w.js';
14
14
  import 'node:console';
15
- import './chunks/inspector.DKLceBVD.js';
15
+ import './chunks/inspector.DbDkSkFn.js';
16
16
  import 'node:module';
17
- import './chunks/rpc.TVf73xOu.js';
17
+ import './chunks/rpc.DGgL5dw7.js';
18
18
  import './chunks/index.68735LiX.js';
19
- import './chunks/execute.eDH0aFFd.js';
19
+ import './chunks/execute.CwmnH2oH.js';
20
20
  import 'node:vm';
21
21
  import '@vitest/utils/error';
22
22
  import 'vite-node/utils';
23
23
  import './path.js';
24
24
  import 'node:path';
25
25
  import '@vitest/mocker';
26
- import './chunks/console.CN7AiMGV.js';
26
+ import './chunks/console.D6t261w0.js';
27
27
  import 'node:stream';
28
28
  import 'tinyrainbow';
29
- import './chunks/date.W2xKR2qe.js';
29
+ import './chunks/date.CDOsz-HY.js';
30
30
  import 'vite-node/constants';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "3.1.0-beta.1",
4
+ "version": "3.1.0",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -123,8 +123,8 @@
123
123
  "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
124
124
  "happy-dom": "*",
125
125
  "jsdom": "*",
126
- "@vitest/browser": "3.1.0-beta.1",
127
- "@vitest/ui": "3.1.0-beta.1"
126
+ "@vitest/browser": "3.1.0",
127
+ "@vitest/ui": "3.1.0"
128
128
  },
129
129
  "peerDependenciesMeta": {
130
130
  "@edge-runtime/vm": {
@@ -152,24 +152,24 @@
152
152
  "dependencies": {
153
153
  "chai": "^5.2.0",
154
154
  "debug": "^4.4.0",
155
- "expect-type": "^1.1.0",
155
+ "expect-type": "^1.2.0",
156
156
  "magic-string": "^0.30.17",
157
157
  "pathe": "^2.0.3",
158
- "std-env": "^3.8.0",
158
+ "std-env": "^3.8.1",
159
159
  "tinybench": "^2.9.0",
160
160
  "tinyexec": "^0.3.2",
161
161
  "tinypool": "^1.0.2",
162
162
  "tinyrainbow": "^2.0.0",
163
163
  "vite": "^5.0.0 || ^6.0.0",
164
164
  "why-is-node-running": "^2.3.0",
165
- "@vitest/expect": "3.1.0-beta.1",
166
- "@vitest/pretty-format": "^3.1.0-beta.1",
167
- "@vitest/mocker": "3.1.0-beta.1",
168
- "@vitest/runner": "3.1.0-beta.1",
169
- "@vitest/spy": "3.1.0-beta.1",
170
- "@vitest/snapshot": "3.1.0-beta.1",
171
- "@vitest/utils": "3.1.0-beta.1",
172
- "vite-node": "3.1.0-beta.1"
165
+ "@vitest/expect": "3.1.0",
166
+ "@vitest/pretty-format": "^3.1.0",
167
+ "@vitest/runner": "3.1.0",
168
+ "@vitest/mocker": "3.1.0",
169
+ "@vitest/snapshot": "3.1.0",
170
+ "@vitest/spy": "3.1.0",
171
+ "@vitest/utils": "3.1.0",
172
+ "vite-node": "3.1.0"
173
173
  },
174
174
  "devDependencies": {
175
175
  "@ampproject/remapping": "^2.3.0",
@@ -177,12 +177,12 @@
177
177
  "@edge-runtime/vm": "^5.0.0",
178
178
  "@sinonjs/fake-timers": "14.0.0",
179
179
  "@types/debug": "^4.1.12",
180
- "@types/estree": "^1.0.6",
180
+ "@types/estree": "^1.0.7",
181
181
  "@types/istanbul-lib-coverage": "^2.0.6",
182
182
  "@types/istanbul-reports": "^3.0.4",
183
183
  "@types/jsdom": "^21.1.7",
184
184
  "@types/micromatch": "^4.0.9",
185
- "@types/node": "^22.13.5",
185
+ "@types/node": "^22.13.13",
186
186
  "@types/prompts": "^2.4.9",
187
187
  "@types/sinonjs__fake-timers": "^8.1.5",
188
188
  "acorn-walk": "^8.3.4",
@@ -192,9 +192,9 @@
192
192
  "find-up": "^6.3.0",
193
193
  "flatted": "^3.3.3",
194
194
  "get-tsconfig": "^4.10.0",
195
- "happy-dom": "^17.1.4",
195
+ "happy-dom": "^17.4.4",
196
196
  "jsdom": "^26.0.0",
197
- "local-pkg": "^1.0.0",
197
+ "local-pkg": "^1.1.1",
198
198
  "micromatch": "^4.0.8",
199
199
  "pretty-format": "^29.7.0",
200
200
  "prompts": "^2.4.2",
@@ -1,45 +0,0 @@
1
- import { ModuleCacheMap } from 'vite-node/client';
2
- import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.eDH0aFFd.js';
3
- import { p as provideWorkerState } from './utils.C8RiOc4B.js';
4
-
5
- let _viteNode;
6
- const moduleCache = new ModuleCacheMap();
7
- const moduleExecutionInfo = /* @__PURE__ */ new Map();
8
- async function startViteNode(options) {
9
- if (_viteNode) {
10
- return _viteNode;
11
- }
12
- _viteNode = await startVitestExecutor(options);
13
- return _viteNode;
14
- }
15
- async function runBaseTests(method, state) {
16
- const { ctx } = state;
17
- state.moduleCache = moduleCache;
18
- state.moduleExecutionInfo = moduleExecutionInfo;
19
- provideWorkerState(globalThis, state);
20
- if (ctx.invalidates) {
21
- ctx.invalidates.forEach((fsPath) => {
22
- moduleCache.delete(fsPath);
23
- moduleCache.delete(`mock:${fsPath}`);
24
- });
25
- }
26
- ctx.files.forEach((i) => state.moduleCache.delete(
27
- typeof i === "string" ? i : i.filepath
28
- ));
29
- const [executor, { run }] = await Promise.all([
30
- startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
31
- import('./runBaseTests.BVrL_ow3.js')
32
- ]);
33
- const fileSpecs = ctx.files.map(
34
- (f) => typeof f === "string" ? { filepath: f, testLocations: void 0 } : f
35
- );
36
- await run(
37
- method,
38
- fileSpecs,
39
- ctx.config,
40
- { environment: state.environment, options: ctx.environment.options },
41
- executor
42
- );
43
- }
44
-
45
- export { runBaseTests as r };
@@ -1,40 +0,0 @@
1
- import { getCurrentSuite } from '@vitest/runner';
2
- import { createChainable } from '@vitest/runner/utils';
3
- import { noop } from '@vitest/utils';
4
- import { g as getWorkerState } from './utils.C8RiOc4B.js';
5
-
6
- const benchFns = /* @__PURE__ */ new WeakMap();
7
- const benchOptsMap = /* @__PURE__ */ new WeakMap();
8
- function getBenchOptions(key) {
9
- return benchOptsMap.get(key);
10
- }
11
- function getBenchFn(key) {
12
- return benchFns.get(key);
13
- }
14
- const bench = createBenchmark(function(name, fn = noop, options = {}) {
15
- if (getWorkerState().config.mode !== "benchmark") {
16
- throw new Error("`bench()` is only available in benchmark mode.");
17
- }
18
- const task = getCurrentSuite().task(formatName(name), {
19
- ...this,
20
- meta: {
21
- benchmark: true
22
- }
23
- });
24
- benchFns.set(task, fn);
25
- benchOptsMap.set(task, options);
26
- });
27
- function createBenchmark(fn) {
28
- const benchmark = createChainable(
29
- ["skip", "only", "todo"],
30
- fn
31
- );
32
- benchmark.skipIf = (condition) => condition ? benchmark.skip : benchmark;
33
- benchmark.runIf = (condition) => condition ? benchmark : benchmark.skip;
34
- return benchmark;
35
- }
36
- function formatName(name) {
37
- return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
38
- }
39
-
40
- export { getBenchOptions as a, bench as b, getBenchFn as g };