vitest 2.0.0-beta.10 → 2.0.0-beta.11

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 (64) hide show
  1. package/dist/browser.d.ts +1 -1
  2. package/dist/browser.js +3 -3
  3. package/dist/chunks/{integrations-globals.C6Ah-pUW.js → integrations-globals.CC2ed6Py.js} +9 -9
  4. package/dist/chunks/{node-git.CCI8evVZ.js → node-git.ZtkbKc8u.js} +14 -15
  5. package/dist/chunks/{runtime-console.DiVMr5d4.js → runtime-console.Ckl0vEQr.js} +25 -10
  6. package/dist/chunks/{runtime-runBaseTests.Cukyr5-I.js → runtime-runBaseTests.BXW_BJeO.js} +40 -32
  7. package/dist/cli.js +3 -3
  8. package/dist/config.cjs +42 -19
  9. package/dist/config.d.ts +1 -1
  10. package/dist/config.js +42 -20
  11. package/dist/coverage.d.ts +4 -4
  12. package/dist/coverage.js +98 -36
  13. package/dist/environments.d.ts +1 -1
  14. package/dist/environments.js +1 -1
  15. package/dist/execute.d.ts +1 -1
  16. package/dist/execute.js +2 -2
  17. package/dist/index.d.ts +34 -8
  18. package/dist/index.js +9 -9
  19. package/dist/node.d.ts +19 -6
  20. package/dist/node.js +24 -16
  21. package/dist/path.js +4 -1
  22. package/dist/{reporters-CYVC6LOl.d.ts → reporters-fiIq_dT9.d.ts} +118 -179
  23. package/dist/reporters.d.ts +1 -1
  24. package/dist/reporters.js +7 -7
  25. package/dist/runners.d.ts +1 -1
  26. package/dist/runners.js +98 -60
  27. package/dist/{suite-Dpu9EC_k.d.ts → suite-D4aoU9rI.d.ts} +1 -1
  28. package/dist/suite.d.ts +2 -2
  29. package/dist/suite.js +2 -2
  30. package/dist/utils.d.ts +1 -5
  31. package/dist/utils.js +1 -6
  32. package/dist/vendor/{base.Dln9yllP.js → base.C2DbLEfT.js} +4 -3
  33. package/dist/vendor/{base._gnK9Slw.js → base.CTYV4Gnz.js} +24 -17
  34. package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.CMp8QfyL.js} +13 -14
  35. package/dist/vendor/{cac.CtYFkoSJ.js → cac.BcJW7n2j.js} +71 -37
  36. package/dist/vendor/{cli-api.CUtJc4r3.js → cli-api.C8t8m4__.js} +4012 -4828
  37. package/dist/vendor/{constants.TCjCaw2D.js → constants.BWsVtsAj.js} +5 -22
  38. package/dist/vendor/{coverage.ChSqD-qS.js → coverage.BhYSDdTT.js} +27 -11
  39. package/dist/vendor/{date.BKM1wewY.js → date.W2xKR2qe.js} +5 -3
  40. package/dist/vendor/{execute.BHj6OMh4.js → execute.T3gg2ZK6.js} +174 -60
  41. package/dist/vendor/{index.B5SKBLvV.js → index.-dbR4KUi.js} +17 -9
  42. package/dist/vendor/{index.BOMEjpjj.js → index.BC5zhX9y.js} +960 -469
  43. package/dist/vendor/{index.CThipSqB.js → index.BMmMjLIQ.js} +2540 -2540
  44. package/dist/vendor/{index._7XLd8Kd.js → index.C9Thslzw.js} +2 -1
  45. package/dist/vendor/{index.D3hs2WiI.js → index.CQJ2m700.js} +3 -3
  46. package/dist/vendor/{index.kpsSqFiz.js → index.D4nqnQWz.js} +69 -73
  47. package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
  48. package/dist/vendor/{run-once.DLomgGUH.js → run-once.Db8Hgq9X.js} +2 -1
  49. package/dist/vendor/{setup-common.DAu7t7mY.js → setup-common.uqZOEWuR.js} +30 -15
  50. package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
  51. package/dist/vendor/{utils.YuQ3LT2a.js → utils.DSO2UK15.js} +40 -25
  52. package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
  53. package/dist/vendor/{vi.hATFzZbX.js → vi.BPjl8cAZ.js} +266 -137
  54. package/dist/vendor/{vm.Ow-X2mkS.js → vm.CycSoHnJ.js} +151 -86
  55. package/dist/worker.js +31 -15
  56. package/dist/workers/forks.js +4 -4
  57. package/dist/workers/runVmTests.js +14 -13
  58. package/dist/workers/threads.js +4 -4
  59. package/dist/workers/vmForks.js +6 -6
  60. package/dist/workers/vmThreads.js +6 -6
  61. package/dist/workers.d.ts +2 -2
  62. package/dist/workers.js +9 -9
  63. package/package.json +11 -11
  64. package/suppress-warnings.cjs +1 -4
package/dist/coverage.js CHANGED
@@ -1,30 +1,46 @@
1
1
  import { relative } from 'pathe';
2
- import { m as mm } from './vendor/index.CThipSqB.js';
2
+ import { m as mm } from './vendor/index.BMmMjLIQ.js';
3
3
  import './vendor/_commonjsHelpers.BFTU3MAI.js';
4
4
  import 'util';
5
5
  import 'path';
6
6
 
7
- const THRESHOLD_KEYS = ["lines", "functions", "statements", "branches"];
7
+ const THRESHOLD_KEYS = [
8
+ "lines",
9
+ "functions",
10
+ "statements",
11
+ "branches"
12
+ ];
8
13
  const GLOBAL_THRESHOLDS_KEY = "global";
9
14
  class BaseCoverageProvider {
10
15
  /**
11
16
  * Check if current coverage is above configured thresholds and bump the thresholds if needed
12
17
  */
13
- updateThresholds({ thresholds: allThresholds, perFile, configurationFile, onUpdate }) {
18
+ updateThresholds({
19
+ thresholds: allThresholds,
20
+ perFile,
21
+ configurationFile,
22
+ onUpdate
23
+ }) {
14
24
  let updatedThresholds = false;
15
25
  const config = resolveConfig(configurationFile);
16
26
  assertConfigurationModule(config);
17
27
  for (const { coverageMap, thresholds, name } of allThresholds) {
18
- const summaries = perFile ? coverageMap.files().map((file) => coverageMap.fileCoverageFor(file).toSummary()) : [coverageMap.getCoverageSummary()];
28
+ const summaries = perFile ? coverageMap.files().map(
29
+ (file) => coverageMap.fileCoverageFor(file).toSummary()
30
+ ) : [coverageMap.getCoverageSummary()];
19
31
  const thresholdsToUpdate = [];
20
32
  for (const key of THRESHOLD_KEYS) {
21
33
  const threshold = thresholds[key] ?? 100;
22
- const actual = Math.min(...summaries.map((summary) => summary[key].pct));
23
- if (actual > threshold)
34
+ const actual = Math.min(
35
+ ...summaries.map((summary) => summary[key].pct)
36
+ );
37
+ if (actual > threshold) {
24
38
  thresholdsToUpdate.push([key, actual]);
39
+ }
25
40
  }
26
- if (thresholdsToUpdate.length === 0)
41
+ if (thresholdsToUpdate.length === 0) {
27
42
  continue;
43
+ }
28
44
  updatedThresholds = true;
29
45
  for (const [threshold, newValue] of thresholdsToUpdate) {
30
46
  if (name === GLOBAL_THRESHOLDS_KEY) {
@@ -36,14 +52,19 @@ class BaseCoverageProvider {
36
52
  }
37
53
  }
38
54
  if (updatedThresholds) {
39
- console.log("Updating thresholds to configuration file. You may want to push with updated coverage thresholds.");
55
+ console.log(
56
+ "Updating thresholds to configuration file. You may want to push with updated coverage thresholds."
57
+ );
40
58
  onUpdate();
41
59
  }
42
60
  }
43
61
  /**
44
62
  * Check collected coverage against configured thresholds. Sets exit code to 1 when thresholds not reached.
45
63
  */
46
- checkThresholds({ thresholds: allThresholds, perFile }) {
64
+ checkThresholds({
65
+ thresholds: allThresholds,
66
+ perFile
67
+ }) {
47
68
  for (const { coverageMap, thresholds, name } of allThresholds) {
48
69
  if (thresholds.branches === void 0 && thresholds.functions === void 0 && thresholds.lines === void 0 && thresholds.statements === void 0) {
49
70
  continue;
@@ -51,20 +72,31 @@ class BaseCoverageProvider {
51
72
  const summaries = perFile ? coverageMap.files().map((file) => ({
52
73
  file,
53
74
  summary: coverageMap.fileCoverageFor(file).toSummary()
54
- })) : [{
55
- file: null,
56
- summary: coverageMap.getCoverageSummary()
57
- }];
75
+ })) : [
76
+ {
77
+ file: null,
78
+ summary: coverageMap.getCoverageSummary()
79
+ }
80
+ ];
58
81
  for (const { summary, file } of summaries) {
59
- for (const thresholdKey of ["lines", "functions", "statements", "branches"]) {
82
+ for (const thresholdKey of [
83
+ "lines",
84
+ "functions",
85
+ "statements",
86
+ "branches"
87
+ ]) {
60
88
  const threshold = thresholds[thresholdKey];
61
89
  if (threshold !== void 0) {
62
90
  const coverage = summary.data[thresholdKey].pct;
63
91
  if (coverage < threshold) {
64
92
  process.exitCode = 1;
65
93
  let errorMessage = `ERROR: Coverage for ${thresholdKey} (${coverage}%) does not meet ${name === GLOBAL_THRESHOLDS_KEY ? name : `"${name}"`} threshold (${threshold}%)`;
66
- if (perFile && file)
67
- errorMessage += ` for ${relative("./", file).replace(/\\/g, "/")}`;
94
+ if (perFile && file) {
95
+ errorMessage += ` for ${relative("./", file).replace(
96
+ /\\/g,
97
+ "/"
98
+ )}`;
99
+ }
68
100
  console.error(errorMessage);
69
101
  }
70
102
  }
@@ -77,18 +109,28 @@ class BaseCoverageProvider {
77
109
  * where each threshold set holds their own coverage maps. Threshold set is either
78
110
  * for specific files defined by glob pattern or global for all other files.
79
111
  */
80
- resolveThresholds({ coverageMap, thresholds, createCoverageMap, root }) {
112
+ resolveThresholds({
113
+ coverageMap,
114
+ thresholds,
115
+ createCoverageMap,
116
+ root
117
+ }) {
81
118
  const resolvedThresholds = [];
82
119
  const files = coverageMap.files();
83
120
  const filesMatchedByGlobs = [];
84
121
  const globalCoverageMap = createCoverageMap();
85
- for (const key of Object.keys(thresholds)) {
86
- if (key === "perFile" || key === "autoUpdate" || key === "100" || THRESHOLD_KEYS.includes(key))
122
+ for (const key of Object.keys(
123
+ thresholds
124
+ )) {
125
+ if (key === "perFile" || key === "autoUpdate" || key === "100" || THRESHOLD_KEYS.includes(key)) {
87
126
  continue;
127
+ }
88
128
  const glob = key;
89
129
  const globThresholds = resolveGlobThresholds(thresholds[glob]);
90
130
  const globCoverageMap = createCoverageMap();
91
- const matchingFiles = files.filter((file) => mm.isMatch(relative(root, file), glob));
131
+ const matchingFiles = files.filter(
132
+ (file) => mm.isMatch(relative(root, file), glob)
133
+ );
92
134
  filesMatchedByGlobs.push(...matchingFiles);
93
135
  for (const file of matchingFiles) {
94
136
  const fileCoverage = coverageMap.fileCoverageFor(file);
@@ -100,7 +142,9 @@ class BaseCoverageProvider {
100
142
  thresholds: globThresholds
101
143
  });
102
144
  }
103
- for (const file of files.filter((file2) => !filesMatchedByGlobs.includes(file2))) {
145
+ for (const file of files.filter(
146
+ (file2) => !filesMatchedByGlobs.includes(file2)
147
+ )) {
104
148
  const fileCoverage = coverageMap.fileCoverageFor(file);
105
149
  globalCoverageMap.addFileCoverage(fileCoverage);
106
150
  }
@@ -120,8 +164,9 @@ class BaseCoverageProvider {
120
164
  * Resolve reporters from various configuration options
121
165
  */
122
166
  resolveReporters(configReporters) {
123
- if (!Array.isArray(configReporters))
167
+ if (!Array.isArray(configReporters)) {
124
168
  return [[configReporters, {}]];
169
+ }
125
170
  const resolvedReporters = [];
126
171
  for (const reporter of configReporters) {
127
172
  if (Array.isArray(reporter)) {
@@ -133,24 +178,28 @@ class BaseCoverageProvider {
133
178
  return resolvedReporters;
134
179
  }
135
180
  hasTerminalReporter(reporters) {
136
- return reporters.some(([reporter]) => reporter === "text" || reporter === "text-summary" || reporter === "text-lcov" || reporter === "teamcity");
181
+ return reporters.some(
182
+ ([reporter]) => reporter === "text" || reporter === "text-summary" || reporter === "text-lcov" || reporter === "teamcity"
183
+ );
137
184
  }
138
185
  toSlices(array, size) {
139
186
  return array.reduce((chunks, item) => {
140
187
  const index = Math.max(0, chunks.length - 1);
141
188
  const lastChunk = chunks[index] || [];
142
189
  chunks[index] = lastChunk;
143
- if (lastChunk.length >= size)
190
+ if (lastChunk.length >= size) {
144
191
  chunks.push([item]);
145
- else
192
+ } else {
146
193
  lastChunk.push(item);
194
+ }
147
195
  return chunks;
148
196
  }, []);
149
197
  }
150
198
  }
151
199
  function resolveGlobThresholds(thresholds) {
152
- if (!thresholds || typeof thresholds !== "object")
200
+ if (!thresholds || typeof thresholds !== "object") {
153
201
  return {};
202
+ }
154
203
  return {
155
204
  lines: "lines" in thresholds && typeof thresholds.lines === "number" ? thresholds.lines : void 0,
156
205
  branches: "branches" in thresholds && typeof thresholds.branches === "number" ? thresholds.branches : void 0,
@@ -160,42 +209,54 @@ function resolveGlobThresholds(thresholds) {
160
209
  }
161
210
  function assertConfigurationModule(config) {
162
211
  try {
163
- if (typeof config.test.coverage.thresholds !== "object")
164
- throw new Error("Expected config.test.coverage.thresholds to be an object");
212
+ if (typeof config.test.coverage.thresholds !== "object") {
213
+ throw new TypeError(
214
+ "Expected config.test.coverage.thresholds to be an object"
215
+ );
216
+ }
165
217
  } catch (error) {
166
218
  const message = error instanceof Error ? error.message : String(error);
167
- throw new Error(`Unable to parse thresholds from configuration file: ${message}`);
219
+ throw new Error(
220
+ `Unable to parse thresholds from configuration file: ${message}`
221
+ );
168
222
  }
169
223
  }
170
224
  function resolveConfig(configModule) {
171
225
  const mod = configModule.exports.default;
172
226
  try {
173
- if (mod.$type === "object")
227
+ if (mod.$type === "object") {
174
228
  return mod;
229
+ }
175
230
  let config = resolveDefineConfig(mod);
176
- if (config)
231
+ if (config) {
177
232
  return config;
233
+ }
178
234
  if (mod.$type === "function-call" && mod.$callee === "mergeConfig") {
179
235
  config = resolveMergeConfig(mod);
180
- if (config)
236
+ if (config) {
181
237
  return config;
238
+ }
182
239
  }
183
240
  } catch (error) {
184
241
  throw new Error(error instanceof Error ? error.message : String(error));
185
242
  }
186
- throw new Error("Failed to update coverage thresholds. Configuration file is too complex.");
243
+ throw new Error(
244
+ "Failed to update coverage thresholds. Configuration file is too complex."
245
+ );
187
246
  }
188
247
  function resolveDefineConfig(mod) {
189
248
  if (mod.$type === "function-call" && mod.$callee === "defineConfig") {
190
- if (mod.$args[0].$type === "object")
249
+ if (mod.$args[0].$type === "object") {
191
250
  return mod.$args[0];
251
+ }
192
252
  if (mod.$args[0].$type === "arrow-function-expression") {
193
253
  if (mod.$args[0].$body.$type === "object") {
194
254
  return mod.$args[0].$body;
195
255
  }
196
256
  const config = resolveMergeConfig(mod.$args[0].$body);
197
- if (config)
257
+ if (config) {
198
258
  return config;
259
+ }
199
260
  }
200
261
  }
201
262
  }
@@ -203,8 +264,9 @@ function resolveMergeConfig(mod) {
203
264
  if (mod.$type === "function-call" && mod.$callee === "mergeConfig") {
204
265
  for (const arg of mod.$args) {
205
266
  const config = resolveDefineConfig(arg);
206
- if (config)
267
+ if (config) {
207
268
  return config;
269
+ }
208
270
  }
209
271
  }
210
272
  }
@@ -1,4 +1,4 @@
1
- import { E as Environment } from './reporters-CYVC6LOl.js';
1
+ import { E as Environment } from './reporters-fiIq_dT9.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
@@ -1,2 +1,2 @@
1
- export { e as builtinEnvironments, p as populateGlobal } from './vendor/index.kpsSqFiz.js';
1
+ export { e as builtinEnvironments, p as populateGlobal } from './vendor/index.D4nqnQWz.js';
2
2
  import 'node:console';
package/dist/execute.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import vm from 'node:vm';
2
2
  import { ViteNodeRunner } from 'vite-node/client';
3
3
  import { ViteNodeRunnerOptions } from 'vite-node';
4
- import { aF as PendingSuiteMock, aG as MockFactory, e as RuntimeRPC, W as WorkerGlobalState, aH as MockMap } from './reporters-CYVC6LOl.js';
4
+ import { aG as PendingSuiteMock, aH as MockFactory, e as RuntimeRPC, W as WorkerGlobalState, aI as MockMap } from './reporters-fiIq_dT9.js';
5
5
  import 'vite';
6
6
  import '@vitest/runner';
7
7
  import '@vitest/snapshot';
package/dist/execute.js CHANGED
@@ -1,4 +1,4 @@
1
- export { V as VitestExecutor } from './vendor/execute.BHj6OMh4.js';
1
+ export { V as VitestExecutor } from './vendor/execute.T3gg2ZK6.js';
2
2
  import 'node:vm';
3
3
  import 'node:url';
4
4
  import 'node:fs';
@@ -8,4 +8,4 @@ import 'pathe';
8
8
  import '@vitest/utils/error';
9
9
  import './path.js';
10
10
  import '@vitest/utils';
11
- import './vendor/base._gnK9Slw.js';
11
+ import './vendor/base.CTYV4Gnz.js';
package/dist/index.d.ts CHANGED
@@ -1,21 +1,21 @@
1
- import { TaskPopulated } from '@vitest/runner';
2
- export { Custom, DoneCallback, ExtendedContext, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskContext, TaskCustomOptions, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
3
- export { b as bench } from './suite-Dpu9EC_k.js';
1
+ import { TaskPopulated, File, TaskResultPack } from '@vitest/runner';
2
+ export { CancelReason, Custom, DoneCallback, ExtendedContext, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskContext, TaskCustomOptions, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
3
+ export { b as bench } from './suite-D4aoU9rI.js';
4
4
  import { ExpectStatic } from '@vitest/expect';
5
5
  export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
6
- import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, h as RuntimeConfig, P as ProvidedContext } from './reporters-CYVC6LOl.js';
7
- export { Q as AfterSuiteRunMeta, A as ApiConfig, $ as ArgumentsType, _ as Arrayable, Y as Awaitable, B as BaseCoverageOptions, ag as BenchFunction, ae as Benchmark, ah as BenchmarkAPI, af as BenchmarkResult, ad as BenchmarkUserOptions, x as BrowserConfigOptions, w as BrowserScript, p as BuiltinEnvironment, q as CSSModuleScopeStrategy, j as CollectLineNumbers, k as CollectLines, a1 as Constructable, m as Context, f as ContextRPC, G as ContextTestEnvironment, aa as CoverageIstanbulOptions, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, a9 as CoverageReporter, ab as CoverageV8Options, ac as CustomProviderOptions, D as DepsOptimizationOptions, E as Environment, r as EnvironmentOptions, a3 as EnvironmentReturn, H as HappyDOMOptions, I as InlineConfig, J as JSDOMOptions, a2 as ModuleCache, a6 as ModuleGraphData, a0 as MutableArray, Z as Nullable, a7 as OnServerRestartHandler, n as Pool, o as PoolOptions, v as ProjectConfig, i as RawErrsMap, a8 as ReportContext, N as Reporter, O as ResolveIdFunction, R as ResolvedConfig, a as ResolvedCoverageOptions, K as ResolvedTestEnvironment, l as RootAndTarget, z as RunnerRPC, e as RuntimeRPC, S as SerializableSpec, t as TransformModePatterns, ai as TransformResultWithSource, T as TscErrorInfo, u as TypecheckConfig, U as UserConfig, a5 as UserConsoleLog, y as UserWorkspaceConfig, L as Vitest, V as VitestEnvironment, s as VitestRunMode, a4 as VmEnvironmentReturn, am as WebSocketBrowserEvents, ak as WebSocketBrowserHandlers, ao as WebSocketBrowserRPC, al as WebSocketEvents, aj as WebSocketHandlers, an as WebSocketRPC, g as WorkerContext, W as WorkerGlobalState, X as WorkerRPC } from './reporters-CYVC6LOl.js';
6
+ import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, h as RuntimeConfig, P as ProvidedContext, R as ResolvedConfig, i as ModuleGraphData, j as Reporter, k as BirpcReturn } from './reporters-fiIq_dT9.js';
7
+ export { Y as AfterSuiteRunMeta, A as ApiConfig, a1 as ArgumentsType, a0 as Arrayable, _ as Awaitable, B as BaseCoverageOptions, ah as BenchFunction, af as Benchmark, ai as BenchmarkAPI, ag as BenchmarkResult, ae as BenchmarkUserOptions, G as BrowserConfigOptions, z as BrowserScript, s as BuiltinEnvironment, t as CSSModuleScopeStrategy, m as CollectLineNumbers, n as CollectLines, a3 as Constructable, p as Context, f as ContextRPC, N as ContextTestEnvironment, ab as CoverageIstanbulOptions, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, aa as CoverageReporter, ac as CoverageV8Options, ad as CustomProviderOptions, D as DepsOptimizationOptions, E as Environment, u as EnvironmentOptions, a5 as EnvironmentReturn, H as HappyDOMOptions, I as InlineConfig, J as JSDOMOptions, a4 as ModuleCache, a2 as MutableArray, $ as Nullable, a8 as OnServerRestartHandler, q as Pool, r as PoolOptions, y as ProjectConfig, l as RawErrsMap, a9 as ReportContext, X as ResolveIdFunction, a as ResolvedCoverageOptions, O as ResolvedTestEnvironment, o as RootAndTarget, L as RunnerRPC, e as RuntimeRPC, S as SerializableSpec, w as TransformModePatterns, T as TscErrorInfo, x as TypecheckConfig, U as UserConfig, a7 as UserConsoleLog, K as UserWorkspaceConfig, Q as Vitest, V as VitestEnvironment, v as VitestRunMode, a6 as VmEnvironmentReturn, g as WorkerContext, W as WorkerGlobalState, Z as WorkerRPC } from './reporters-fiIq_dT9.js';
8
8
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
9
9
  export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
10
10
  export { SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotSerializer, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, UncheckedSnapshot } from '@vitest/snapshot';
11
11
  export { DiffOptions } from '@vitest/utils/diff';
12
+ import { TransformResult } from 'vite';
12
13
  import * as chai from 'chai';
13
14
  export { chai };
14
15
  export { assert, should } from 'chai';
15
16
  export { ErrorWithDiff, ParsedStack } from '@vitest/utils';
16
17
  export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
17
18
  import '@vitest/runner/utils';
18
- import 'vite';
19
19
  import 'vite-node';
20
20
  import 'node:stream';
21
21
  import 'vite-node/client';
@@ -1067,7 +1067,7 @@ interface BrowserUI {
1067
1067
  *
1068
1068
  * @experimental
1069
1069
  */
1070
- declare function runOnce<T>(fn: (() => T), key?: string): T;
1070
+ declare function runOnce<T>(fn: () => T, key?: string): T;
1071
1071
  /**
1072
1072
  * Get a boolean indicates whether the task is running in the first time.
1073
1073
  * Could only be `false` in watch mode.
@@ -1422,4 +1422,30 @@ declare function isWatchMode(): boolean;
1422
1422
  */
1423
1423
  declare function inject<T extends keyof ProvidedContext>(key: T): ProvidedContext[T];
1424
1424
 
1425
- export { type AssertType, type BrowserUI, type ExpectTypeOf, ProvidedContext, RuntimeConfig, type VitestUtils, assertType, createExpect, globalExpect as expect, expectTypeOf, getRunningMode, inject, isFirstRun, isWatchMode, runOnce, vi, vitest };
1425
+ interface TransformResultWithSource extends TransformResult {
1426
+ source?: string;
1427
+ }
1428
+ interface WebSocketHandlers {
1429
+ onCollected: (files?: File[]) => Promise<void>;
1430
+ onTaskUpdate: (packs: TaskResultPack[]) => void;
1431
+ getFiles: () => File[];
1432
+ getTestFiles: () => Promise<[{
1433
+ name: string;
1434
+ root: string;
1435
+ }, file: string][]>;
1436
+ getPaths: () => string[];
1437
+ getConfig: () => ResolvedConfig;
1438
+ getModuleGraph: (projectName: string, id: string, browser?: boolean) => Promise<ModuleGraphData>;
1439
+ getTransformResult: (projectName: string, id: string, browser?: boolean) => Promise<TransformResultWithSource | undefined>;
1440
+ readTestFile: (id: string) => Promise<string | null>;
1441
+ saveTestFile: (id: string, content: string) => Promise<void>;
1442
+ rerun: (files: string[]) => Promise<void>;
1443
+ updateSnapshot: (file?: File) => Promise<void>;
1444
+ getUnhandledErrors: () => unknown[];
1445
+ }
1446
+ interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onFinished' | 'onTaskUpdate' | 'onUserConsoleLog' | 'onPathsCollected' | 'onSpecsCollected'> {
1447
+ onFinishedReportCoverage: () => void;
1448
+ }
1449
+ type WebSocketRPC = BirpcReturn<WebSocketEvents, WebSocketHandlers>;
1450
+
1451
+ export { type AssertType, type BrowserUI, type ExpectTypeOf, ModuleGraphData, ProvidedContext, Reporter, ResolvedConfig, RuntimeConfig, type TransformResultWithSource, type VitestUtils, type WebSocketEvents, type WebSocketHandlers, type WebSocketRPC, assertType, createExpect, globalExpect as expect, expectTypeOf, getRunningMode, inject, isFirstRun, isWatchMode, runOnce, vi, vitest };
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
2
- export { b as bench } from './vendor/benchmark.BNLebNi5.js';
3
- export { i as isFirstRun, a as runOnce } from './vendor/run-once.DLomgGUH.js';
4
- export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.hATFzZbX.js';
5
- import { d as dist } from './vendor/index.D3hs2WiI.js';
6
- export { b as assertType, g as getRunningMode, i as inject, a as isWatchMode } from './vendor/index.D3hs2WiI.js';
2
+ export { b as bench } from './vendor/benchmark.CMp8QfyL.js';
3
+ export { i as isFirstRun, a as runOnce } from './vendor/run-once.Db8Hgq9X.js';
4
+ export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.BPjl8cAZ.js';
5
+ import { d as dist } from './vendor/index.CQJ2m700.js';
6
+ export { b as assertType, g as getRunningMode, i as inject, a as isWatchMode } from './vendor/index.CQJ2m700.js';
7
7
  import * as chai from 'chai';
8
8
  export { chai };
9
9
  export { assert, should } from 'chai';
10
10
  import '@vitest/runner/utils';
11
11
  import '@vitest/utils';
12
- import './vendor/index._7XLd8Kd.js';
12
+ import './vendor/index.C9Thslzw.js';
13
13
  import 'pathe';
14
14
  import './vendor/global.7bFbnyXl.js';
15
15
  import './vendor/env.bmJgw1qP.js';
@@ -18,10 +18,10 @@ import './vendor/_commonjsHelpers.BFTU3MAI.js';
18
18
  import '@vitest/expect';
19
19
  import '@vitest/snapshot';
20
20
  import '@vitest/utils/error';
21
- import './vendor/tasks.WC7M-K-v.js';
21
+ import './vendor/tasks.DhVtQBtW.js';
22
22
  import '@vitest/utils/source-map';
23
- import './vendor/base._gnK9Slw.js';
24
- import './vendor/date.BKM1wewY.js';
23
+ import './vendor/base.CTYV4Gnz.js';
24
+ import './vendor/date.W2xKR2qe.js';
25
25
  import '@vitest/spy';
26
26
 
27
27
 
package/dist/node.d.ts CHANGED
@@ -1,8 +1,11 @@
1
- import { s as VitestRunMode, U as UserConfig, ap as VitestOptions, L as Vitest, R as ResolvedConfig, P as ProvidedContext, aq as WorkspaceProject, e as RuntimeRPC, ar as TestSequencer, as as WorkspaceSpec } from './reporters-CYVC6LOl.js';
2
- export { aA as BrowserCommand, aB as BrowserCommandContext, ay as BrowserProvider, ax as BrowserProviderInitializationOptions, az as BrowserProviderOptions, w as BrowserScript, aE as HTMLOptions, aD as JUnitOptions, aC as JsonOptions, at as ProcessPool, aw as TestSequencerConstructor, av as VitestPackageInstaller, au as getFilePoolName } from './reporters-CYVC6LOl.js';
3
- import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
- export { isFileServingAllowed } from 'vite';
1
+ import { v as VitestRunMode, U as UserConfig, aj as VitestOptions, Q as Vitest, R as ResolvedConfig, P as ProvidedContext, ak as WorkspaceProject, e as RuntimeRPC, A as ApiConfig, al as Logger, am as TestSequencer, an as WorkspaceSpec } from './reporters-fiIq_dT9.js';
2
+ export { ax as BrowserCommand, ay as BrowserCommandContext, aC as BrowserOrchestrator, at as BrowserProvider, as as BrowserProviderInitializationOptions, au as BrowserProviderModule, aw as BrowserProviderOptions, z as BrowserScript, az as BrowserServer, aA as BrowserServerState, aB as BrowserServerStateContext, aF as HTMLOptions, aE as JUnitOptions, aD as JsonOptions, ao as ProcessPool, av as ResolvedBrowserOptions, ar as TestSequencerConstructor, aq as VitestPackageInstaller, ap as getFilePoolName } from './reporters-fiIq_dT9.js';
3
+ import { UserConfig as UserConfig$1, Plugin, ResolvedConfig as ResolvedConfig$1 } from 'vite';
4
+ import * as vite from 'vite';
5
+ export { vite as Vite };
6
+ export { createServer, isFileServingAllowed } from 'vite';
5
7
  import { Writable } from 'node:stream';
8
+ import createDebug from 'debug';
6
9
  import '@vitest/runner';
7
10
  import 'vite-node';
8
11
  import '@vitest/snapshot';
@@ -53,7 +56,17 @@ interface GlobalSetupContext {
53
56
  provide: <T extends keyof ProvidedContext>(key: T, value: ProvidedContext[T]) => void;
54
57
  }
55
58
 
56
- declare function createMethodsRPC(project: WorkspaceProject): RuntimeRPC;
59
+ interface MethodsOptions {
60
+ cacheFs?: boolean;
61
+ }
62
+ declare function createMethodsRPC(project: WorkspaceProject, options?: MethodsOptions): RuntimeRPC;
63
+
64
+ declare function createDebugger(namespace: `vitest:${string}`): createDebug.Debugger | undefined;
65
+
66
+ declare function resolveFsAllow(projectRoot: string, rootConfigFile: string | false | undefined): string[];
67
+
68
+ declare function resolveApiServerConfig<Options extends ApiConfig & UserConfig>(options: Options, defaultPort: number): ApiConfig | undefined;
69
+ declare function resolveConfig(mode: VitestRunMode, options: UserConfig, viteConfig: ResolvedConfig$1, logger: Logger): ResolvedConfig;
57
70
 
58
71
  declare const rootDir: string;
59
72
  declare const distDir: string;
@@ -65,4 +78,4 @@ declare class BaseSequencer implements TestSequencer {
65
78
  sort(files: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
66
79
  }
67
80
 
68
- export { BaseSequencer, type GlobalSetupContext, TestSequencer, Vitest, VitestPlugin, WorkspaceProject, WorkspaceSpec, createMethodsRPC, createVitest, distDir, parseCLI, registerConsoleShortcuts, rootDir, startVitest };
81
+ export { BaseSequencer, type GlobalSetupContext, TestSequencer, Vitest, VitestPlugin, WorkspaceProject, WorkspaceSpec, createDebugger, createMethodsRPC, createVitest, distDir, parseCLI, registerConsoleShortcuts, resolveApiServerConfig, resolveConfig, resolveFsAllow, rootDir, startVitest };
package/dist/node.js CHANGED
@@ -1,12 +1,13 @@
1
- export { b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest, g as getFilePoolName, r as registerConsoleShortcuts, s as startVitest } from './vendor/cli-api.CUtJc4r3.js';
2
- export { p as parseCLI } from './vendor/cac.CtYFkoSJ.js';
1
+ export { b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest, g as getFilePoolName, r as registerConsoleShortcuts, e as resolveApiServerConfig, f as resolveConfig, d as resolveFsAllow, s as startVitest } from './vendor/cli-api.C8t8m4__.js';
2
+ export { p as parseCLI } from './vendor/cac.BcJW7n2j.js';
3
+ import createDebug from 'debug';
3
4
  export { distDir, rootDir } from './path.js';
4
- export { B as BaseSequencer } from './vendor/index.BOMEjpjj.js';
5
- export { isFileServingAllowed } from 'vite';
5
+ export { e as BaseSequencer } from './vendor/index.BC5zhX9y.js';
6
+ export { createServer, isFileServingAllowed } from 'vite';
6
7
  import 'pathe';
7
- import './vendor/constants.TCjCaw2D.js';
8
- import './vendor/coverage.ChSqD-qS.js';
9
- import './vendor/index.kpsSqFiz.js';
8
+ import './vendor/constants.BWsVtsAj.js';
9
+ import './vendor/coverage.BhYSDdTT.js';
10
+ import './vendor/index.D4nqnQWz.js';
10
11
  import 'node:console';
11
12
  import 'node:path';
12
13
  import 'node:url';
@@ -17,7 +18,7 @@ import './vendor/_commonjsHelpers.BFTU3MAI.js';
17
18
  import 'os';
18
19
  import 'path';
19
20
  import 'util';
20
- import './vendor/index.CThipSqB.js';
21
+ import './vendor/index.BMmMjLIQ.js';
21
22
  import 'stream';
22
23
  import 'events';
23
24
  import 'fs';
@@ -26,7 +27,7 @@ import 'vite-node/client';
26
27
  import '@vitest/snapshot/manager';
27
28
  import 'vite-node/server';
28
29
  import '@vitest/runner/utils';
29
- import './vendor/base._gnK9Slw.js';
30
+ import './vendor/base.CTYV4Gnz.js';
30
31
  import '@vitest/utils';
31
32
  import './vendor/env.bmJgw1qP.js';
32
33
  import 'std-env';
@@ -46,24 +47,31 @@ import 'node:events';
46
47
  import 'tinypool';
47
48
  import 'node:crypto';
48
49
  import 'node:fs/promises';
49
- import 'debug';
50
50
  import 'node:module';
51
51
  import 'node:assert';
52
52
  import 'node:util';
53
53
  import 'vite-node/utils';
54
54
  import 'magic-string';
55
55
  import '@vitest/utils/ast';
56
- import '@ampproject/remapping';
57
- import './vendor/index._7XLd8Kd.js';
56
+ import './vendor/index.C9Thslzw.js';
58
57
  import './vendor/global.7bFbnyXl.js';
59
58
  import 'node:readline';
60
59
  import 'readline';
61
- import './vendor/utils.YuQ3LT2a.js';
62
- import './vendor/tasks.WC7M-K-v.js';
60
+ import './vendor/utils.DSO2UK15.js';
61
+ import './vendor/tasks.DhVtQBtW.js';
63
62
  import 'node:perf_hooks';
64
- import './chunks/runtime-console.DiVMr5d4.js';
63
+ import './chunks/runtime-console.Ckl0vEQr.js';
65
64
  import 'node:stream';
66
- import './vendor/date.BKM1wewY.js';
65
+ import './vendor/date.W2xKR2qe.js';
67
66
  import 'execa';
68
67
  import 'module';
69
68
  import 'assert';
69
+
70
+ function createDebugger(namespace) {
71
+ const debug = createDebug(namespace);
72
+ if (debug.enabled) {
73
+ return debug;
74
+ }
75
+ }
76
+
77
+ export { createDebugger };
package/dist/path.js CHANGED
@@ -2,6 +2,9 @@ import url from 'node:url';
2
2
  import { resolve } from 'pathe';
3
3
 
4
4
  const rootDir = resolve(url.fileURLToPath(import.meta.url), "../../");
5
- const distDir = resolve(url.fileURLToPath(import.meta.url), "../../dist");
5
+ const distDir = resolve(
6
+ url.fileURLToPath(import.meta.url),
7
+ "../../dist"
8
+ );
6
9
 
7
10
  export { distDir, rootDir };