vitest 2.0.0-beta.12 → 2.0.0-beta.13

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 (43) hide show
  1. package/LICENSE.md +0 -21
  2. package/dist/browser.d.ts +3 -2
  3. package/dist/browser.js +2 -2
  4. package/dist/chunks/{browser-creator.Bw94IHrL.js → browser-creator.DSqYDthP.js} +1 -1
  5. package/dist/chunks/{integrations-globals.DSNOaUHv.js → integrations-globals.CzYWb38r.js} +1 -1
  6. package/dist/chunks/{runtime-runBaseTests.BDt9gQFB.js → runtime-runBaseTests.DX3h28Mp.js} +9 -5
  7. package/dist/cli.js +2 -2
  8. package/dist/config.cjs +3 -2
  9. package/dist/config.d.ts +2 -1
  10. package/dist/config.js +3 -2
  11. package/dist/coverage.d.ts +2 -1
  12. package/dist/environments.d.ts +2 -1
  13. package/dist/execute.d.ts +4 -3
  14. package/dist/execute.js +1 -1
  15. package/dist/index.d.ts +4 -3
  16. package/dist/node.d.ts +18 -4
  17. package/dist/node.js +8 -8
  18. package/dist/{reporters-Cd1vkLMZ.d.ts → reporters-DrywOHjt.d.ts} +56 -19
  19. package/dist/reporters.d.ts +2 -1
  20. package/dist/reporters.js +2 -2
  21. package/dist/runners.d.ts +3 -1
  22. package/dist/runners.js +1 -0
  23. package/dist/{suite-BS2CV79a.d.ts → suite-CrOPuDIk.d.ts} +1 -1
  24. package/dist/suite.d.ts +3 -2
  25. package/dist/vendor/{base.Cy97mmVC.js → base.CdA1i5tB.js} +4 -3
  26. package/dist/vendor/{cac.DRNUX42m.js → cac.CpoEMnGk.js} +62 -15
  27. package/dist/vendor/{cli-api.Bu-PSdzx.js → cli-api.CXFLjKVN.js} +369 -97
  28. package/dist/vendor/{constants.BWsVtsAj.js → constants.CsnA4eRy.js} +1 -2
  29. package/dist/vendor/{execute.T3gg2ZK6.js → execute.Dx503nGn.js} +12 -4
  30. package/dist/vendor/{index.ZtQtNPP2.js → index.3x3MdmUV.js} +135 -78
  31. package/dist/vendor/{index.B7pSlOSa.js → index.CROIsoiT.js} +1 -1
  32. package/dist/vendor/{setup-common.CWnv_2-5.js → setup-common.yHaxjRhz.js} +1 -1
  33. package/dist/vendor/{utils.DSO2UK15.js → utils.BVMrsl6E.js} +15 -5
  34. package/dist/vendor/{vm.D9wVR14y.js → vm.BrDS6p7h.js} +6 -4
  35. package/dist/worker.js +11 -4
  36. package/dist/workers/forks.js +10 -4
  37. package/dist/workers/runVmTests.js +9 -5
  38. package/dist/workers/threads.js +6 -3
  39. package/dist/workers/vmForks.js +10 -4
  40. package/dist/workers/vmThreads.js +6 -3
  41. package/dist/workers.d.ts +7 -4
  42. package/dist/workers.js +4 -4
  43. package/package.json +12 -12
@@ -3,14 +3,14 @@ import { createRequire } from 'node:module';
3
3
  import util from 'node:util';
4
4
  import timers from 'node:timers';
5
5
  import { performance } from 'node:perf_hooks';
6
- import { startTests } from '@vitest/runner';
6
+ import { startTests, collectTests } from '@vitest/runner';
7
7
  import { setupColors, createColors } from '@vitest/utils';
8
8
  import { installSourcemapsSupport } from 'vite-node/source-map';
9
- import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../vendor/index.B7pSlOSa.js';
9
+ import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../vendor/index.CROIsoiT.js';
10
10
  import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.BhYSDdTT.js';
11
11
  import { g as getWorkerState } from '../vendor/global.7bFbnyXl.js';
12
12
  import { V as VitestIndex } from '../vendor/index.Hqvcg1pf.js';
13
- import { s as setupCommonEnv } from '../vendor/setup-common.CWnv_2-5.js';
13
+ import { s as setupCommonEnv } from '../vendor/setup-common.yHaxjRhz.js';
14
14
  import { c as closeInspector } from '../vendor/inspector.hPQncR7V.js';
15
15
  import 'chai';
16
16
  import 'pathe';
@@ -35,7 +35,7 @@ import '../vendor/base.CTYV4Gnz.js';
35
35
  import '../vendor/date.W2xKR2qe.js';
36
36
  import '@vitest/spy';
37
37
 
38
- async function run(files, config, executor) {
38
+ async function run(method, files, config, executor) {
39
39
  const workerState = getWorkerState();
40
40
  await setupCommonEnv(config);
41
41
  Object.defineProperty(globalThis, "__vitest_index__", {
@@ -75,7 +75,11 @@ async function run(files, config, executor) {
75
75
  const { vi } = VitestIndex;
76
76
  for (const file of files) {
77
77
  workerState.filepath = file;
78
- await startTests([file], runner);
78
+ if (method === "run") {
79
+ await startTests([file], runner);
80
+ } else {
81
+ await collectTests([file], runner);
82
+ }
79
83
  vi.resetConfig();
80
84
  vi.restoreAllMocks();
81
85
  }
@@ -1,8 +1,8 @@
1
- import { r as runBaseTests } from '../vendor/base.Cy97mmVC.js';
1
+ import { r as runBaseTests } from '../vendor/base.CdA1i5tB.js';
2
2
  import { a as createThreadsRpcOptions } from '../vendor/utils.DkxLWvS1.js';
3
3
  import 'vite-node/client';
4
4
  import '../vendor/global.7bFbnyXl.js';
5
- import '../vendor/execute.T3gg2ZK6.js';
5
+ import '../vendor/execute.Dx503nGn.js';
6
6
  import 'node:vm';
7
7
  import 'node:url';
8
8
  import 'node:fs';
@@ -18,7 +18,10 @@ class ThreadsBaseWorker {
18
18
  return createThreadsRpcOptions(ctx);
19
19
  }
20
20
  runTests(state) {
21
- return runBaseTests(state);
21
+ return runBaseTests("run", state);
22
+ }
23
+ collectTests(state) {
24
+ return runBaseTests("collect", state);
22
25
  }
23
26
  }
24
27
  var threads = new ThreadsBaseWorker();
@@ -1,6 +1,6 @@
1
1
  import v8 from 'node:v8';
2
2
  import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.DkxLWvS1.js';
3
- import { r as runVmTests } from '../vendor/vm.D9wVR14y.js';
3
+ import { r as runVmTests } from '../vendor/vm.BrDS6p7h.js';
4
4
  import '@vitest/utils';
5
5
  import 'node:vm';
6
6
  import 'node:url';
@@ -14,7 +14,7 @@ import '@vitest/runner/utils';
14
14
  import '../vendor/global.7bFbnyXl.js';
15
15
  import '../vendor/env.2ltrQNq0.js';
16
16
  import 'std-env';
17
- import '../vendor/execute.T3gg2ZK6.js';
17
+ import '../vendor/execute.Dx503nGn.js';
18
18
  import 'node:fs';
19
19
  import 'vite-node/client';
20
20
  import 'vite-node/utils';
@@ -28,15 +28,21 @@ class ForksVmWorker {
28
28
  getRpcOptions() {
29
29
  return createForksRpcOptions(v8);
30
30
  }
31
- async runTests(state) {
31
+ async executeTests(method, state) {
32
32
  const exit = process.exit;
33
33
  state.ctx.config = unwrapSerializableConfig(state.ctx.config);
34
34
  try {
35
- await runVmTests(state);
35
+ await runVmTests(method, state);
36
36
  } finally {
37
37
  process.exit = exit;
38
38
  }
39
39
  }
40
+ runTests(state) {
41
+ return this.executeTests("run", state);
42
+ }
43
+ collectTests(state) {
44
+ return this.executeTests("collect", state);
45
+ }
40
46
  }
41
47
  var vmForks = new ForksVmWorker();
42
48
 
@@ -1,5 +1,5 @@
1
1
  import { a as createThreadsRpcOptions } from '../vendor/utils.DkxLWvS1.js';
2
- import { r as runVmTests } from '../vendor/vm.D9wVR14y.js';
2
+ import { r as runVmTests } from '../vendor/vm.BrDS6p7h.js';
3
3
  import '@vitest/utils';
4
4
  import 'node:vm';
5
5
  import 'node:url';
@@ -13,7 +13,7 @@ import '@vitest/runner/utils';
13
13
  import '../vendor/global.7bFbnyXl.js';
14
14
  import '../vendor/env.2ltrQNq0.js';
15
15
  import 'std-env';
16
- import '../vendor/execute.T3gg2ZK6.js';
16
+ import '../vendor/execute.Dx503nGn.js';
17
17
  import 'node:fs';
18
18
  import 'vite-node/client';
19
19
  import 'vite-node/utils';
@@ -28,7 +28,10 @@ class ThreadsVmWorker {
28
28
  return createThreadsRpcOptions(ctx);
29
29
  }
30
30
  runTests(state) {
31
- return runVmTests(state);
31
+ return runVmTests("run", state);
32
+ }
33
+ collectTests(state) {
34
+ return runVmTests("collect", state);
32
35
  }
33
36
  }
34
37
  var vmThreads = new ThreadsVmWorker();
package/dist/workers.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as v8 from 'v8';
2
- import { d as BirpcOptions, e as RuntimeRPC, f as ContextRPC, W as WorkerGlobalState, g as WorkerContext, R as ResolvedConfig } from './reporters-Cd1vkLMZ.js';
2
+ import { d as BirpcOptions, e as RuntimeRPC, f as ContextRPC, W as WorkerGlobalState, g as WorkerContext, R as ResolvedConfig } from './reporters-DrywOHjt.js';
3
3
  import { Awaitable } from '@vitest/utils';
4
4
  import 'vite';
5
5
  import '@vitest/runner';
@@ -13,6 +13,7 @@ import 'vite-node/client';
13
13
  import '@vitest/snapshot/manager';
14
14
  import 'vite-node/server';
15
15
  import 'node:worker_threads';
16
+ import '@vitest/utils/source-map';
16
17
  import 'node:fs';
17
18
  import 'chai';
18
19
 
@@ -20,6 +21,7 @@ type WorkerRpcOptions = Pick<BirpcOptions<RuntimeRPC>, 'on' | 'post' | 'serializ
20
21
  interface VitestWorker {
21
22
  getRpcOptions: (ctx: ContextRPC) => WorkerRpcOptions;
22
23
  runTests: (state: WorkerGlobalState) => Awaitable<unknown>;
24
+ collectTests: (state: WorkerGlobalState) => Awaitable<unknown>;
23
25
  }
24
26
 
25
27
  declare function createThreadsRpcOptions({ port, }: WorkerContext): WorkerRpcOptions;
@@ -32,9 +34,10 @@ declare function unwrapSerializableConfig(config: ResolvedConfig): ResolvedConfi
32
34
  declare function provideWorkerState(context: any, state: WorkerGlobalState): WorkerGlobalState;
33
35
 
34
36
  declare function run(ctx: ContextRPC): Promise<void>;
37
+ declare function collect(ctx: ContextRPC): Promise<void>;
35
38
 
36
- declare function runVmTests(state: WorkerGlobalState): Promise<void>;
39
+ declare function runVmTests(method: 'run' | 'collect', state: WorkerGlobalState): Promise<void>;
37
40
 
38
- declare function runBaseTests(state: WorkerGlobalState): Promise<void>;
41
+ declare function runBaseTests(method: 'run' | 'collect', state: WorkerGlobalState): Promise<void>;
39
42
 
40
- export { type VitestWorker, type WorkerRpcOptions, createForksRpcOptions, createThreadsRpcOptions, provideWorkerState, runBaseTests, run as runVitestWorker, runVmTests, unwrapSerializableConfig };
43
+ export { type VitestWorker, type WorkerRpcOptions, collect as collectVitestWorkerTests, createForksRpcOptions, createThreadsRpcOptions, provideWorkerState, runBaseTests, run as runVitestWorker, runVmTests, unwrapSerializableConfig };
package/dist/workers.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './vendor/utils.DkxLWvS1.js';
2
2
  export { p as provideWorkerState } from './vendor/global.7bFbnyXl.js';
3
- export { run as runVitestWorker } from './worker.js';
4
- export { r as runVmTests } from './vendor/vm.D9wVR14y.js';
5
- export { r as runBaseTests } from './vendor/base.Cy97mmVC.js';
3
+ export { collect as collectVitestWorkerTests, run as runVitestWorker } from './worker.js';
4
+ export { r as runVmTests } from './vendor/vm.BrDS6p7h.js';
5
+ export { r as runBaseTests } from './vendor/base.CdA1i5tB.js';
6
6
  import '@vitest/utils';
7
7
  import 'node:url';
8
8
  import 'tinypool';
@@ -24,7 +24,7 @@ import './vendor/date.W2xKR2qe.js';
24
24
  import '@vitest/runner/utils';
25
25
  import './vendor/env.2ltrQNq0.js';
26
26
  import 'std-env';
27
- import './vendor/execute.T3gg2ZK6.js';
27
+ import './vendor/execute.Dx503nGn.js';
28
28
  import 'vite-node/utils';
29
29
  import '@vitest/utils/error';
30
30
  import './path.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.12",
4
+ "version": "2.0.0-beta.13",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -119,8 +119,8 @@
119
119
  "@types/node": "^18.0.0 || >=20.0.0",
120
120
  "happy-dom": "*",
121
121
  "jsdom": "*",
122
- "@vitest/browser": "2.0.0-beta.12",
123
- "@vitest/ui": "2.0.0-beta.12"
122
+ "@vitest/browser": "2.0.0-beta.13",
123
+ "@vitest/ui": "2.0.0-beta.13"
124
124
  },
125
125
  "peerDependenciesMeta": {
126
126
  "@edge-runtime/vm": {
@@ -155,12 +155,12 @@
155
155
  "tinypool": "^1.0.0",
156
156
  "vite": "^5.0.0",
157
157
  "why-is-node-running": "^2.2.2",
158
- "@vitest/expect": "2.0.0-beta.12",
159
- "@vitest/snapshot": "2.0.0-beta.12",
160
- "@vitest/runner": "2.0.0-beta.12",
161
- "@vitest/spy": "2.0.0-beta.12",
162
- "vite-node": "2.0.0-beta.12",
163
- "@vitest/utils": "2.0.0-beta.12"
158
+ "@vitest/expect": "2.0.0-beta.13",
159
+ "@vitest/runner": "2.0.0-beta.13",
160
+ "@vitest/spy": "2.0.0-beta.13",
161
+ "@vitest/utils": "2.0.0-beta.13",
162
+ "vite-node": "2.0.0-beta.13",
163
+ "@vitest/snapshot": "2.0.0-beta.13"
164
164
  },
165
165
  "devDependencies": {
166
166
  "@antfu/install-pkg": "0.3.1",
@@ -171,8 +171,8 @@
171
171
  "@types/istanbul-lib-coverage": "^2.0.6",
172
172
  "@types/istanbul-reports": "^3.0.4",
173
173
  "@types/jsdom": "^21.1.7",
174
- "@types/micromatch": "^4.0.7",
175
- "@types/node": "^20.14.2",
174
+ "@types/micromatch": "^4.0.9",
175
+ "@types/node": "^20.14.9",
176
176
  "@types/prompts": "^2.4.9",
177
177
  "@types/sinonjs__fake-timers": "^8.1.5",
178
178
  "acorn-walk": "^8.3.3",
@@ -185,7 +185,7 @@
185
185
  "find-up": "^6.3.0",
186
186
  "flatted": "^3.3.1",
187
187
  "get-tsconfig": "^4.7.5",
188
- "happy-dom": "^14.12.0",
188
+ "happy-dom": "^14.12.3",
189
189
  "jsdom": "^24.1.0",
190
190
  "local-pkg": "^0.5.0",
191
191
  "log-update": "^5.0.1",