vitest 2.0.0-beta.9 → 2.0.1

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 (73) hide show
  1. package/LICENSE.md +1 -22
  2. package/dist/browser.d.ts +24 -7
  3. package/dist/browser.js +5 -19
  4. package/dist/chunks/browser-creator.DSqYDthP.js +673 -0
  5. package/dist/chunks/{environments-node.39w4gmlF.js → environments-node.XE5FbRPQ.js} +1 -1
  6. package/dist/chunks/{integrations-globals.BK0Cn4q1.js → integrations-globals.CzYWb38r.js} +10 -9
  7. package/dist/chunks/{node-git.CCI8evVZ.js → node-git.ZtkbKc8u.js} +14 -15
  8. package/dist/chunks/{runtime-console.DiVMr5d4.js → runtime-console.O41g23Zj.js} +26 -11
  9. package/dist/chunks/{runtime-runBaseTests.C-Bkopka.js → runtime-runBaseTests.DX3h28Mp.js} +47 -34
  10. package/dist/cli.js +3 -3
  11. package/dist/config.cjs +48 -23
  12. package/dist/config.d.ts +2 -1
  13. package/dist/config.js +48 -24
  14. package/dist/coverage.d.ts +6 -4
  15. package/dist/coverage.js +102 -38
  16. package/dist/environments.d.ts +2 -1
  17. package/dist/environments.js +1 -1
  18. package/dist/execute.d.ts +4 -3
  19. package/dist/execute.js +2 -2
  20. package/dist/index.d.ts +1437 -7
  21. package/dist/index.js +10 -9
  22. package/dist/node.d.ts +34 -7
  23. package/dist/node.js +31 -20
  24. package/dist/path.js +4 -1
  25. package/dist/{reporters-DaDey3o0.d.ts → reporters-BU_vXAUX.d.ts} +216 -206
  26. package/dist/reporters.d.ts +2 -1
  27. package/dist/reporters.js +8 -8
  28. package/dist/runners.d.ts +3 -1
  29. package/dist/runners.js +100 -61
  30. package/dist/snapshot.js +2 -2
  31. package/dist/{suite-BHSUxUib.d.ts → suite-BRl_IYuM.d.ts} +1 -1
  32. package/dist/suite.d.ts +3 -2
  33. package/dist/suite.js +3 -3
  34. package/dist/utils.d.ts +1 -5
  35. package/dist/utils.js +1 -6
  36. package/dist/vendor/{base._gnK9Slw.js → base.CTYV4Gnz.js} +24 -17
  37. package/dist/vendor/{base.D4XK-wRp.js → base.CdA1i5tB.js} +6 -4
  38. package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.B6pblCp2.js} +13 -14
  39. package/dist/vendor/{cac.DCg3FnEs.js → cac.BQc6bsef.js} +142 -47
  40. package/dist/vendor/{cli-api.LMvYagQ5.js → cli-api.BGRtK_Kj.js} +4189 -9537
  41. package/dist/vendor/{constants.TCjCaw2D.js → constants.CsnA4eRy.js} +5 -23
  42. package/dist/vendor/{coverage.ChSqD-qS.js → coverage.BhYSDdTT.js} +27 -11
  43. package/dist/vendor/{date.BKM1wewY.js → date.W2xKR2qe.js} +5 -3
  44. package/dist/vendor/env.2ltrQNq0.js +8 -0
  45. package/dist/vendor/{execute.BHj6OMh4.js → execute.Dx503nGn.js} +186 -64
  46. package/dist/vendor/{index.TBU3GqRP.js → index.3x3MdmUV.js} +1075 -526
  47. package/dist/vendor/{index._7XLd8Kd.js → index.BJmtb_7W.js} +3 -2
  48. package/dist/vendor/{index.DP-km6lF.js → index.BMmMjLIQ.js} +64 -51
  49. package/dist/vendor/{index.DHRpy7zp.js → index.CROIsoiT.js} +18 -10
  50. package/dist/vendor/{index.DeR1hhfY.js → index.D4nqnQWz.js} +71 -74
  51. package/dist/vendor/index.D6GZqexG.js +6575 -0
  52. package/dist/vendor/{index.DwR86H5i.js → index.Hqvcg1pf.js} +4 -27
  53. package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
  54. package/dist/vendor/run-once.Db8Hgq9X.js +28 -0
  55. package/dist/vendor/{setup-common.BhJvzjns.js → setup-common.yHaxjRhz.js} +30 -15
  56. package/dist/vendor/spy.Cf_4R5Oe.js +22 -0
  57. package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
  58. package/dist/vendor/{utils.YuQ3LT2a.js → utils.BVMrsl6E.js} +55 -30
  59. package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
  60. package/dist/vendor/{vi.C6AfDXK6.js → vi.DXACdGTu.js} +269 -136
  61. package/dist/vendor/{vm.Ow-X2mkS.js → vm.BrDS6p7h.js} +157 -90
  62. package/dist/worker.js +41 -18
  63. package/dist/workers/forks.js +12 -6
  64. package/dist/workers/runVmTests.js +22 -16
  65. package/dist/workers/threads.js +8 -5
  66. package/dist/workers/vmForks.js +15 -9
  67. package/dist/workers/vmThreads.js +11 -8
  68. package/dist/workers.d.ts +8 -5
  69. package/dist/workers.js +11 -11
  70. package/package.json +22 -21
  71. package/suppress-warnings.cjs +2 -4
  72. package/dist/index-B0dCycbN.d.ts +0 -1571
  73. package/dist/vendor/env.bmJgw1qP.js +0 -7
package/dist/worker.js CHANGED
@@ -3,10 +3,10 @@ import { workerId } from 'tinypool';
3
3
  import { ViteNodeRunner, ModuleCacheMap } from 'vite-node/client';
4
4
  import { readFileSync } from 'node:fs';
5
5
  import { resolve, normalize } from 'pathe';
6
- import { e as environments } from './vendor/index.DeR1hhfY.js';
7
- import { i as isChildProcess, s as setProcessTitle } from './vendor/base._gnK9Slw.js';
6
+ import { e as environments } from './vendor/index.D4nqnQWz.js';
7
+ import { i as isChildProcess, s as setProcessTitle } from './vendor/base.CTYV4Gnz.js';
8
8
  import { s as setupInspect } from './vendor/inspector.hPQncR7V.js';
9
- import { c as createRuntimeRpc, a as rpcDone } from './vendor/rpc.DRDE9Pu1.js';
9
+ import { c as createRuntimeRpc, a as rpcDone } from './vendor/rpc.BGx7q_k2.js';
10
10
  import 'node:console';
11
11
  import '@vitest/utils';
12
12
  import 'node:module';
@@ -28,14 +28,16 @@ async function createEnvironmentLoader(options) {
28
28
  async function loadEnvironment(ctx, rpc) {
29
29
  var _a;
30
30
  const name = ctx.environment.name;
31
- if (isBuiltinEnvironment(name))
31
+ if (isBuiltinEnvironment(name)) {
32
32
  return environments[name];
33
+ }
33
34
  const loader = await createEnvironmentLoader({
34
35
  root: ctx.config.root,
35
36
  fetchModule: async (id) => {
36
37
  const result = await rpc.fetch(id, "ssr");
37
- if (result.id)
38
+ if (result.id) {
38
39
  return { code: readFileSync(result.id, "utf-8") };
40
+ }
39
41
  return result;
40
42
  },
41
43
  resolveId: (id, importer) => rpc.resolveId(id, importer, "ssr")
@@ -57,28 +59,39 @@ async function loadEnvironment(ctx, rpc) {
57
59
  return environment;
58
60
  }
59
61
 
60
- if (isChildProcess())
62
+ if (isChildProcess()) {
61
63
  setProcessTitle(`vitest ${workerId}`);
62
- async function run(ctx) {
64
+ }
65
+ async function execute(mehtod, ctx) {
63
66
  const prepareStart = performance.now();
64
67
  const inspectorCleanup = setupInspect(ctx);
65
68
  process.env.VITEST_WORKER_ID = String(ctx.workerId);
66
69
  process.env.VITEST_POOL_ID = String(workerId);
67
70
  try {
68
- if (ctx.worker[0] === ".")
69
- throw new Error(`Path to the test runner cannot be relative, received "${ctx.worker}"`);
71
+ if (ctx.worker[0] === ".") {
72
+ throw new Error(
73
+ `Path to the test runner cannot be relative, received "${ctx.worker}"`
74
+ );
75
+ }
70
76
  const file = ctx.worker.startsWith("file:") ? ctx.worker : pathToFileURL(ctx.worker).toString();
71
77
  const testRunnerModule = await import(file);
72
- if (!testRunnerModule.default || typeof testRunnerModule.default !== "object")
73
- throw new TypeError(`Test worker object should be exposed as a default export. Received "${typeof testRunnerModule.default}"`);
78
+ if (!testRunnerModule.default || typeof testRunnerModule.default !== "object") {
79
+ throw new TypeError(
80
+ `Test worker object should be exposed as a default export. Received "${typeof testRunnerModule.default}"`
81
+ );
82
+ }
74
83
  const worker = testRunnerModule.default;
75
- if (!worker.getRpcOptions || typeof worker.getRpcOptions !== "function")
76
- throw new TypeError(`Test worker should expose "getRpcOptions" method. Received "${typeof worker.getRpcOptions}".`);
84
+ if (!worker.getRpcOptions || typeof worker.getRpcOptions !== "function") {
85
+ throw new TypeError(
86
+ `Test worker should expose "getRpcOptions" method. Received "${typeof worker.getRpcOptions}".`
87
+ );
88
+ }
77
89
  const { rpc, onCancel } = createRuntimeRpc(worker.getRpcOptions(ctx));
78
90
  const beforeEnvironmentTime = performance.now();
79
91
  const environment = await loadEnvironment(ctx, rpc);
80
- if (ctx.environment.transformMode)
92
+ if (ctx.environment.transformMode) {
81
93
  environment.transformMode = ctx.environment.transformMode;
94
+ }
82
95
  const state = {
83
96
  ctx,
84
97
  // here we create a new one, workers can reassign this if they need to keep it non-isolated
@@ -94,14 +107,24 @@ async function run(ctx) {
94
107
  rpc,
95
108
  providedContext: ctx.providedContext
96
109
  };
97
- if (!worker.runTests || typeof worker.runTests !== "function")
98
- throw new TypeError(`Test worker should expose "runTests" method. Received "${typeof worker.runTests}".`);
99
- await worker.runTests(state);
110
+ const methodName = mehtod === "collect" ? "collectTests" : "runTests";
111
+ if (!worker[methodName] || typeof worker[methodName] !== "function") {
112
+ throw new TypeError(
113
+ `Test worker should expose "runTests" method. Received "${typeof worker.runTests}".`
114
+ );
115
+ }
116
+ await worker[methodName](state);
100
117
  } finally {
101
118
  await rpcDone().catch(() => {
102
119
  });
103
120
  inspectorCleanup();
104
121
  }
105
122
  }
123
+ function run(ctx) {
124
+ return execute("run", ctx);
125
+ }
126
+ function collect(ctx) {
127
+ return execute("collect", ctx);
128
+ }
106
129
 
107
- export { run };
130
+ export { collect, run };
@@ -1,10 +1,10 @@
1
1
  import v8 from 'node:v8';
2
- import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.CUjzkRH7.js';
3
- import { r as runBaseTests } from '../vendor/base.D4XK-wRp.js';
2
+ import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.DkxLWvS1.js';
3
+ import { r as runBaseTests } from '../vendor/base.CdA1i5tB.js';
4
4
  import '@vitest/utils';
5
5
  import 'vite-node/client';
6
6
  import '../vendor/global.7bFbnyXl.js';
7
- import '../vendor/execute.BHj6OMh4.js';
7
+ import '../vendor/execute.Dx503nGn.js';
8
8
  import 'node:vm';
9
9
  import 'node:url';
10
10
  import 'node:fs';
@@ -12,21 +12,27 @@ import 'vite-node/utils';
12
12
  import 'pathe';
13
13
  import '@vitest/utils/error';
14
14
  import '../path.js';
15
- import '../vendor/base._gnK9Slw.js';
15
+ import '../vendor/base.CTYV4Gnz.js';
16
16
 
17
17
  class ForksBaseWorker {
18
18
  getRpcOptions() {
19
19
  return createForksRpcOptions(v8);
20
20
  }
21
- async runTests(state) {
21
+ async executeTests(method, state) {
22
22
  const exit = process.exit;
23
23
  state.ctx.config = unwrapSerializableConfig(state.ctx.config);
24
24
  try {
25
- await runBaseTests(state);
25
+ await runBaseTests(method, state);
26
26
  } finally {
27
27
  process.exit = exit;
28
28
  }
29
29
  }
30
+ runTests(state) {
31
+ return this.executeTests("run", state);
32
+ }
33
+ collectTests(state) {
34
+ return this.executeTests("collect", state);
35
+ }
30
36
  }
31
37
  var forks = new ForksBaseWorker();
32
38
 
@@ -3,38 +3,39 @@ 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.DHRpy7zp.js';
10
- import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.ChSqD-qS.js';
9
+ import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../vendor/index.CROIsoiT.js';
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
- import { V as VitestIndex } from '../vendor/index.DwR86H5i.js';
13
- import { s as setupCommonEnv } from '../vendor/setup-common.BhJvzjns.js';
12
+ import { V as VitestIndex } from '../vendor/index.Hqvcg1pf.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';
17
17
  import '../path.js';
18
18
  import 'node:url';
19
- import '../vendor/rpc.DRDE9Pu1.js';
19
+ import '../vendor/rpc.BGx7q_k2.js';
20
20
  import '../vendor/index.BpSiYbpB.js';
21
- import '../vendor/benchmark.BNLebNi5.js';
21
+ import '../vendor/benchmark.B6pblCp2.js';
22
22
  import '@vitest/runner/utils';
23
- import '../vendor/index._7XLd8Kd.js';
24
- import '../vendor/env.bmJgw1qP.js';
23
+ import '../vendor/index.BJmtb_7W.js';
24
+ import '../vendor/env.2ltrQNq0.js';
25
25
  import 'std-env';
26
- import '../vendor/vi.C6AfDXK6.js';
26
+ import '../vendor/run-once.Db8Hgq9X.js';
27
+ import '../vendor/vi.DXACdGTu.js';
27
28
  import '../vendor/_commonjsHelpers.BFTU3MAI.js';
28
29
  import '@vitest/expect';
29
30
  import '@vitest/snapshot';
30
31
  import '@vitest/utils/error';
31
- import '../vendor/tasks.WC7M-K-v.js';
32
+ import '../vendor/tasks.DhVtQBtW.js';
32
33
  import '@vitest/utils/source-map';
33
- import '../vendor/base._gnK9Slw.js';
34
- import '../vendor/date.BKM1wewY.js';
34
+ import '../vendor/base.CTYV4Gnz.js';
35
+ import '../vendor/date.W2xKR2qe.js';
35
36
  import '@vitest/spy';
36
37
 
37
- async function run(files, config, executor) {
38
+ async function run(method, files, config, executor) {
38
39
  const workerState = getWorkerState();
39
40
  await setupCommonEnv(config);
40
41
  Object.defineProperty(globalThis, "__vitest_index__", {
@@ -57,8 +58,9 @@ async function run(files, config, executor) {
57
58
  getSourceMap: (source) => workerState.moduleCache.getSourceMap(source)
58
59
  });
59
60
  await startCoverageInsideWorker(config.coverage, executor);
60
- if (config.chaiConfig)
61
+ if (config.chaiConfig) {
61
62
  setupChaiConfig(config.chaiConfig);
63
+ }
62
64
  const [runner, snapshotEnvironment] = await Promise.all([
63
65
  resolveTestRunner(config, executor),
64
66
  resolveSnapshotEnvironment(config, executor)
@@ -73,7 +75,11 @@ async function run(files, config, executor) {
73
75
  const { vi } = VitestIndex;
74
76
  for (const file of files) {
75
77
  workerState.filepath = file;
76
- await startTests([file], runner);
78
+ if (method === "run") {
79
+ await startTests([file], runner);
80
+ } else {
81
+ await collectTests([file], runner);
82
+ }
77
83
  vi.resetConfig();
78
84
  vi.restoreAllMocks();
79
85
  }
@@ -1,8 +1,8 @@
1
- import { r as runBaseTests } from '../vendor/base.D4XK-wRp.js';
2
- import { a as createThreadsRpcOptions } from '../vendor/utils.CUjzkRH7.js';
1
+ import { r as runBaseTests } from '../vendor/base.CdA1i5tB.js';
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.BHj6OMh4.js';
5
+ import '../vendor/execute.Dx503nGn.js';
6
6
  import 'node:vm';
7
7
  import 'node:url';
8
8
  import 'node:fs';
@@ -11,14 +11,17 @@ import 'pathe';
11
11
  import '@vitest/utils/error';
12
12
  import '../path.js';
13
13
  import '@vitest/utils';
14
- import '../vendor/base._gnK9Slw.js';
14
+ import '../vendor/base.CTYV4Gnz.js';
15
15
 
16
16
  class ThreadsBaseWorker {
17
17
  getRpcOptions(ctx) {
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,26 +1,26 @@
1
1
  import v8 from 'node:v8';
2
- import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.CUjzkRH7.js';
3
- import { r as runVmTests } from '../vendor/vm.Ow-X2mkS.js';
2
+ import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.DkxLWvS1.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';
7
7
  import 'pathe';
8
- import '../chunks/runtime-console.DiVMr5d4.js';
8
+ import '../chunks/runtime-console.O41g23Zj.js';
9
9
  import 'node:stream';
10
10
  import 'node:console';
11
11
  import 'node:path';
12
- import '../vendor/date.BKM1wewY.js';
12
+ import '../vendor/date.W2xKR2qe.js';
13
13
  import '@vitest/runner/utils';
14
14
  import '../vendor/global.7bFbnyXl.js';
15
- import '../vendor/env.bmJgw1qP.js';
15
+ import '../vendor/env.2ltrQNq0.js';
16
16
  import 'std-env';
17
- import '../vendor/execute.BHj6OMh4.js';
17
+ import '../vendor/execute.Dx503nGn.js';
18
18
  import 'node:fs';
19
19
  import 'vite-node/client';
20
20
  import 'vite-node/utils';
21
21
  import '@vitest/utils/error';
22
22
  import '../path.js';
23
- import '../vendor/base._gnK9Slw.js';
23
+ import '../vendor/base.CTYV4Gnz.js';
24
24
  import 'node:module';
25
25
  import 'vite-node/constants';
26
26
 
@@ -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,25 +1,25 @@
1
- import { a as createThreadsRpcOptions } from '../vendor/utils.CUjzkRH7.js';
2
- import { r as runVmTests } from '../vendor/vm.Ow-X2mkS.js';
1
+ import { a as createThreadsRpcOptions } from '../vendor/utils.DkxLWvS1.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';
6
6
  import 'pathe';
7
- import '../chunks/runtime-console.DiVMr5d4.js';
7
+ import '../chunks/runtime-console.O41g23Zj.js';
8
8
  import 'node:stream';
9
9
  import 'node:console';
10
10
  import 'node:path';
11
- import '../vendor/date.BKM1wewY.js';
11
+ import '../vendor/date.W2xKR2qe.js';
12
12
  import '@vitest/runner/utils';
13
13
  import '../vendor/global.7bFbnyXl.js';
14
- import '../vendor/env.bmJgw1qP.js';
14
+ import '../vendor/env.2ltrQNq0.js';
15
15
  import 'std-env';
16
- import '../vendor/execute.BHj6OMh4.js';
16
+ import '../vendor/execute.Dx503nGn.js';
17
17
  import 'node:fs';
18
18
  import 'vite-node/client';
19
19
  import 'vite-node/utils';
20
20
  import '@vitest/utils/error';
21
21
  import '../path.js';
22
- import '../vendor/base._gnK9Slw.js';
22
+ import '../vendor/base.CTYV4Gnz.js';
23
23
  import 'node:module';
24
24
  import 'vite-node/constants';
25
25
 
@@ -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-DaDey3o0.js';
2
+ import { d as BirpcOptions, e as RuntimeRPC, f as ContextRPC, W as WorkerGlobalState, g as WorkerContext, R as ResolvedConfig } from './reporters-BU_vXAUX.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,9 +21,10 @@ 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
- declare function createThreadsRpcOptions({ port }: WorkerContext): WorkerRpcOptions;
27
+ declare function createThreadsRpcOptions({ port, }: WorkerContext): WorkerRpcOptions;
26
28
  declare function createForksRpcOptions(nodeV8: typeof v8): WorkerRpcOptions;
27
29
  /**
28
30
  * Reverts the wrapping done by `utils/config-helpers.ts`'s `wrapSerializableConfig`
@@ -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,30 +1,30 @@
1
- export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './vendor/utils.CUjzkRH7.js';
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.Ow-X2mkS.js';
5
- export { r as runBaseTests } from './vendor/base.D4XK-wRp.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';
9
9
  import 'vite-node/client';
10
10
  import 'node:fs';
11
11
  import 'pathe';
12
- import './vendor/index.DeR1hhfY.js';
12
+ import './vendor/index.D4nqnQWz.js';
13
13
  import 'node:console';
14
- import './vendor/base._gnK9Slw.js';
14
+ import './vendor/base.CTYV4Gnz.js';
15
15
  import './vendor/inspector.hPQncR7V.js';
16
16
  import 'node:module';
17
- import './vendor/rpc.DRDE9Pu1.js';
17
+ import './vendor/rpc.BGx7q_k2.js';
18
18
  import './vendor/index.BpSiYbpB.js';
19
19
  import 'node:vm';
20
- import './chunks/runtime-console.DiVMr5d4.js';
20
+ import './chunks/runtime-console.O41g23Zj.js';
21
21
  import 'node:stream';
22
22
  import 'node:path';
23
- import './vendor/date.BKM1wewY.js';
23
+ import './vendor/date.W2xKR2qe.js';
24
24
  import '@vitest/runner/utils';
25
- import './vendor/env.bmJgw1qP.js';
25
+ import './vendor/env.2ltrQNq0.js';
26
26
  import 'std-env';
27
- import './vendor/execute.BHj6OMh4.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.9",
4
+ "version": "2.0.1",
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.9",
123
- "@vitest/ui": "2.0.0-beta.9"
122
+ "@vitest/ui": "2.0.1",
123
+ "@vitest/browser": "2.0.1"
124
124
  },
125
125
  "peerDependenciesMeta": {
126
126
  "@edge-runtime/vm": {
@@ -143,38 +143,39 @@
143
143
  }
144
144
  },
145
145
  "dependencies": {
146
+ "@ampproject/remapping": "^2.3.0",
146
147
  "chai": "^5.1.1",
147
- "debug": "^4.3.4",
148
+ "debug": "^4.3.5",
148
149
  "execa": "^8.0.1",
149
150
  "magic-string": "^0.30.10",
150
151
  "pathe": "^1.1.2",
151
- "picocolors": "^1.0.0",
152
+ "picocolors": "^1.0.1",
152
153
  "std-env": "^3.7.0",
153
154
  "tinybench": "^2.8.0",
154
155
  "tinypool": "^1.0.0",
155
156
  "vite": "^5.0.0",
156
157
  "why-is-node-running": "^2.2.2",
157
- "@vitest/expect": "2.0.0-beta.9",
158
- "@vitest/snapshot": "2.0.0-beta.9",
159
- "@vitest/runner": "2.0.0-beta.9",
160
- "@vitest/spy": "2.0.0-beta.9",
161
- "@vitest/utils": "2.0.0-beta.9",
162
- "vite-node": "2.0.0-beta.9"
158
+ "@vitest/runner": "2.0.1",
159
+ "@vitest/expect": "2.0.1",
160
+ "@vitest/snapshot": "2.0.1",
161
+ "@vitest/spy": "2.0.1",
162
+ "@vitest/utils": "2.0.1",
163
+ "vite-node": "2.0.1"
163
164
  },
164
165
  "devDependencies": {
165
- "@ampproject/remapping": "^2.3.0",
166
166
  "@antfu/install-pkg": "0.3.1",
167
167
  "@edge-runtime/vm": "^3.2.0",
168
168
  "@sinonjs/fake-timers": "11.1.0",
169
+ "@types/debug": "^4.1.12",
169
170
  "@types/estree": "^1.0.5",
170
171
  "@types/istanbul-lib-coverage": "^2.0.6",
171
172
  "@types/istanbul-reports": "^3.0.4",
172
- "@types/jsdom": "^21.1.6",
173
- "@types/micromatch": "^4.0.7",
174
- "@types/node": "^20.12.11",
173
+ "@types/jsdom": "^21.1.7",
174
+ "@types/micromatch": "^4.0.9",
175
+ "@types/node": "^20.14.9",
175
176
  "@types/prompts": "^2.4.9",
176
177
  "@types/sinonjs__fake-timers": "^8.1.5",
177
- "acorn-walk": "^8.3.2",
178
+ "acorn-walk": "^8.3.3",
178
179
  "birpc": "0.2.17",
179
180
  "cac": "^6.7.14",
180
181
  "chai-subset": "^1.6.0",
@@ -183,17 +184,17 @@
183
184
  "fast-glob": "^3.3.2",
184
185
  "find-up": "^6.3.0",
185
186
  "flatted": "^3.3.1",
186
- "get-tsconfig": "^4.7.4",
187
- "happy-dom": "^14.10.1",
188
- "jsdom": "^24.0.0",
187
+ "get-tsconfig": "^4.7.5",
188
+ "happy-dom": "^14.12.3",
189
+ "jsdom": "^24.1.0",
189
190
  "local-pkg": "^0.5.0",
190
191
  "log-update": "^5.0.1",
191
- "micromatch": "^4.0.5",
192
+ "micromatch": "^4.0.7",
192
193
  "pretty-format": "^29.7.0",
193
194
  "prompts": "^2.4.2",
194
195
  "strip-ansi": "^7.1.0",
195
196
  "strip-literal": "^2.1.0",
196
- "ws": "^8.17.0"
197
+ "ws": "^8.17.1"
197
198
  },
198
199
  "scripts": {
199
200
  "build": "rimraf dist && rollup -c",
@@ -12,11 +12,9 @@ const ignoreWarnings = new Set([
12
12
  const { emit } = process
13
13
 
14
14
  process.emit = function (event, warning) {
15
- if (
16
- event === 'warning'
17
- && ignoreWarnings.has(warning.message)
18
- )
15
+ if (event === 'warning' && ignoreWarnings.has(warning.message)) {
19
16
  return
17
+ }
20
18
 
21
19
  // eslint-disable-next-line prefer-rest-params
22
20
  return Reflect.apply(emit, this, arguments)