vitest 5.0.2 → 5.0.4

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 (79) hide show
  1. package/LICENSE.md +29 -1
  2. package/browser/context.d.ts +7 -1
  3. package/browser/context.js +5 -5
  4. package/dist/browser.d.ts +4 -4
  5. package/dist/browser.js +11 -11
  6. package/dist/chunks/{base.5tQXSzMP.js → base.CYbb9pQW.js} +39 -15
  7. package/dist/chunks/{browser.d.g5Thl309.d.ts → browser.d.FGQ9_rK6.d.ts} +3 -3
  8. package/dist/chunks/{cac.BLbEtnDd.js → cac.DTXWs6Ni.js} +21 -23
  9. package/dist/chunks/cli-api.Bx28WXzL.js +13879 -0
  10. package/dist/chunks/{config.d.CU_b-wJj.d.ts → config.d.QBNYCgFU.d.ts} +33 -24
  11. package/dist/chunks/{console.B09ye7y0.js → console.DtI4yxfN.js} +5 -4
  12. package/dist/chunks/{coverage.AipniaqB.js → coverage.-bm5IxnW.js} +1 -1
  13. package/dist/chunks/{coverage.CX7NN5s7.js → coverage.cTDc4uSS.js} +1 -1
  14. package/dist/chunks/{creator.2VTnpYzN.js → creator.CLL8QFMS.js} +44 -54
  15. package/dist/chunks/{defaults.D2ip7f-X.js → defaults.B1FCaFfh.js} +2 -2
  16. package/dist/chunks/{display.pkpxlVcY.js → display.BlTmubjj.js} +1 -1
  17. package/dist/chunks/{doctor.BCXa6-1R.js → doctor.Bqc8NDDb.js} +40 -41
  18. package/dist/chunks/{env.DzFJjrmK.js → env.BKKtU2WC.js} +1 -1
  19. package/dist/chunks/{environment.d.C6xYahWA.d.ts → environment.d.BY56MoGs.d.ts} +1 -1
  20. package/dist/chunks/{globals.Brdv9iOs.js → globals.CTWMSIPL.js} +10 -10
  21. package/dist/chunks/{index.C-uw7tH9.js → index.B8VfM7Mf.js} +8606 -20822
  22. package/dist/chunks/{index.DXQx-kDM.js → index.BoyTG_B7.js} +9 -4
  23. package/dist/chunks/{index.hTNFpC24.js → index.CPNMO3h-.js} +73 -50
  24. package/dist/chunks/{index.M2dsQ_UQ.js → index.D0heQG4v.js} +557 -183
  25. package/dist/chunks/{index.BgwtGYxD.js → index.GYMZ12wH.js} +5 -5
  26. package/dist/chunks/{index.DGdajAO2.js → index.uwTEEBsB.js} +94 -71
  27. package/dist/chunks/{init-forks.CdGu3HUy.js → init-forks.CbYYa5xq.js} +1 -1
  28. package/dist/chunks/{init-threads.2f_lsHNK.js → init-threads.DtjdvxPl.js} +1 -1
  29. package/dist/chunks/{init.IsjtLXKe.js → init.DrHtV5zd.js} +7 -7
  30. package/dist/chunks/module-dependencies.CwNPkcV4.js +71 -0
  31. package/dist/chunks/{native.CF4uT5hY.js → native.cdzHIdmv.js} +48 -34
  32. package/dist/chunks/{nativeModuleMocker.DwRB4F9R.js → nativeModuleMocker.D8f4cW4A.js} +2 -2
  33. package/dist/chunks/{nativeModuleRunner.J0QLzNtK.js → nativeModuleRunner.xi64Afb2.js} +1 -1
  34. package/dist/chunks/{node.CfQ_OGWr.js → node.uQulW0ei.js} +1 -1
  35. package/dist/chunks/{pathe.M-eThtNZ.DwEga6ro.js → pathe.M-eThtNZ.Ba-7h1rE.js} +9 -7
  36. package/dist/chunks/{plugin.d.My_z-jmU.d.ts → plugin.d.C8mmycim.d.ts} +109 -68
  37. package/dist/chunks/{plugins.Cigb0uSy.js → plugins.DPQHVT0p.js} +1 -1
  38. package/dist/chunks/{resolver.NpfwMKt9.js → resolver.CtCcxIy1.js} +1 -1
  39. package/dist/chunks/{rpc.CJVl3hZH.js → rpc.DpkUyY1N.js} +3 -2
  40. package/dist/chunks/{rpc.d.DA9Utv4e.d.ts → rpc.d.Cft1biqy.d.ts} +2 -1
  41. package/dist/chunks/{run.C5UmxDPh.js → run.Cm2sd7-x.js} +122 -97
  42. package/dist/chunks/{setup-common.Ct8rQvjH.js → setup-common.BABL3z3m.js} +3 -3
  43. package/dist/chunks/{source-map.BH0bbrs9.js → source-map.DdKI5IHB.js} +15 -10
  44. package/dist/chunks/{source-map.d.YqWNcp4e.d.ts → source-map.d.kzFtk_dj.d.ts} +1 -1
  45. package/dist/chunks/{spy.KLHgXex_.js → spy.DDMXghXv.js} +63 -32
  46. package/dist/chunks/{task-utils.d.BZm4GSQD.d.ts → task-utils.d.PFh2BV6Q.d.ts} +1 -1
  47. package/dist/chunks/tinyrainbow.Do8I1XRG.js +88 -0
  48. package/dist/chunks/{utils.CJ0JImL8.js → utils.DSfl_w8V.js} +44 -42
  49. package/dist/chunks/{vm.KI2AYADz.js → vm.Uo_C9Uld.js} +16 -13
  50. package/dist/chunks/{worker.d.MLmnzOJE.d.ts → worker.d.BH-r1bPu.d.ts} +8 -3
  51. package/dist/cli.js +4 -4
  52. package/dist/config.cjs +1 -1
  53. package/dist/config.d.ts +9 -10
  54. package/dist/config.js +2 -2
  55. package/dist/index.d.ts +10 -10
  56. package/dist/index.js +10 -10
  57. package/dist/module-evaluator.d.ts +3 -2
  58. package/dist/module-evaluator.js +8 -5
  59. package/dist/node.d.ts +9 -10
  60. package/dist/node.js +27 -26
  61. package/dist/runtime.d.ts +6 -6
  62. package/dist/runtime.js +4 -4
  63. package/dist/spy.js +1 -1
  64. package/dist/task-utils.js +7 -4
  65. package/dist/worker.d.ts +4 -4
  66. package/dist/worker.js +21 -20
  67. package/dist/workers/forks.js +19 -18
  68. package/dist/workers/runVmTests.js +23 -14
  69. package/dist/workers/threads.js +19 -18
  70. package/dist/workers/vmForks.js +13 -13
  71. package/dist/workers/vmThreads.js +13 -13
  72. package/globals.d.ts +19 -19
  73. package/index.cjs +3 -3
  74. package/optional-runtime-types.d.ts +1 -1
  75. package/optional-types.d.ts +1 -1
  76. package/package.json +35 -29
  77. package/suppress-warnings.cjs +1 -1
  78. package/dist/chunks/cli-api.DL4Bd7Vh.js +0 -528
  79. package/dist/chunks/tinyrainbow.Ht9iggcq.js +0 -95
package/LICENSE.md CHANGED
@@ -405,7 +405,7 @@ Repository: lydell/js-tokens
405
405
 
406
406
  > The MIT License (MIT)
407
407
  >
408
- > Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Simon Lydell
408
+ > Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025 Simon Lydell
409
409
  >
410
410
  > Permission is hereby granted, free of charge, to any person obtaining a copy
411
411
  > of this software and associated documentation files (the "Software"), to deal
@@ -713,6 +713,34 @@ Repository: git+https://github.com/quansync-dev/quansync.git
713
713
 
714
714
  ---------------------------------------
715
715
 
716
+ ## react-is
717
+ License: MIT
718
+ Repository: https://github.com/react/react.git
719
+
720
+ > MIT License
721
+ >
722
+ > Copyright (c) Meta Platforms, Inc. and affiliates.
723
+ >
724
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
725
+ > of this software and associated documentation files (the "Software"), to deal
726
+ > in the Software without restriction, including without limitation the rights
727
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
728
+ > copies of the Software, and to permit persons to whom the Software is
729
+ > furnished to do so, subject to the following conditions:
730
+ >
731
+ > The above copyright notice and this permission notice shall be included in all
732
+ > copies or substantial portions of the Software.
733
+ >
734
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
735
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
736
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
737
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
738
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
739
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
740
+ > SOFTWARE.
741
+
742
+ ---------------------------------------
743
+
716
744
  ## sisteransi
717
745
  License: MIT
718
746
  By: Terkel Gjervig
@@ -4,4 +4,10 @@ export * from '@vitest/browser-playwright/context'
4
4
  export * from '@vitest/browser-webdriverio/context'
5
5
  // @ts-ignore -- @vitest/browser-preview might not be installed
6
6
  export * from '@vitest/browser-preview/context'
7
- export { BrowserCommands, BrowserTraceEntryKind, CDPSession, FsOptions, MarkOptions } from 'vitest/internal/browser'
7
+ export {
8
+ BrowserCommands,
9
+ BrowserTraceEntryKind,
10
+ CDPSession,
11
+ FsOptions,
12
+ MarkOptions,
13
+ } from 'vitest/internal/browser'
@@ -12,9 +12,9 @@ export const utils = null
12
12
  const pool = globalThis.__vitest_worker__?.ctx?.pool
13
13
 
14
14
  throw new Error(
15
- // eslint-disable-next-line prefer-template
16
- 'vitest/browser can be imported only inside the Browser Mode. '
17
- + (pool
18
- ? `Your test is running in ${pool} pool. Make sure your regular tests are excluded from the "test.include" glob pattern.`
19
- : 'Instead, it was imported outside of Vitest.'),
15
+ // oxlint-disable-next-line prefer-template
16
+ 'vitest/browser can be imported only inside the Browser Mode. ' +
17
+ (pool
18
+ ? `Your test is running in ${pool} pool. Make sure your regular tests are excluded from the "test.include" glob pattern.`
19
+ : 'Instead, it was imported outside of Vitest.'),
20
20
  )
package/dist/browser.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { F as FileSpecification, c as SerializedDiffOptions } from './chunks/config.d.CU_b-wJj.js';
1
+ import { F as FileSpecification, c as SerializedDiffOptions } from './chunks/config.d.QBNYCgFU.js';
2
2
  import { SerializedCoverageConfig, RunnerTestFile as File, SerializedConfig, DiffOptions, TestError } from './index.js';
3
3
  import { VitestRunner } from './runtime.js';
4
- export { P as ParsedStack, _ as SpyModule, d as StringifyOptions, f as format, i as inspect, s as stringify } from './chunks/config.d.CU_b-wJj.js';
5
- import { R as RuntimeCoverageModuleLoader } from './chunks/source-map.d.YqWNcp4e.js';
6
- export { D as DecodedMap, g as getOriginalPosition } from './chunks/source-map.d.YqWNcp4e.js';
4
+ export { P as ParsedStack, _ as SpyModule, d as StringifyOptions, f as format, i as inspect, s as stringify } from './chunks/config.d.QBNYCgFU.js';
5
+ import { R as RuntimeCoverageModuleLoader } from './chunks/source-map.d.kzFtk_dj.js';
6
+ export { D as DecodedMap, g as getOriginalPosition } from './chunks/source-map.d.kzFtk_dj.js';
7
7
  import 'vitest/optional-runtime-types.js';
8
8
  import 'tinybench';
9
9
 
package/dist/browser.js CHANGED
@@ -1,15 +1,15 @@
1
- export { s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.AipniaqB.js';
2
- export { p as collectTests, a as processError, s as startTests } from './chunks/run.C5UmxDPh.js';
3
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as setupEnv } from './chunks/setup-common.Ct8rQvjH.js';
4
- export { s as SpyModule } from './chunks/spy.KLHgXex_.js';
5
- export { f as format, i as inspect, s as stringify } from './chunks/display.pkpxlVcY.js';
6
- export { g as getType } from './chunks/pathe.M-eThtNZ.DwEga6ro.js';
7
- export { D as DecodedMap, g as getOriginalPosition, a as getSafeTimers, s as setSafeTimers } from './chunks/source-map.BH0bbrs9.js';
8
- import './chunks/coverage.CX7NN5s7.js';
9
- import './chunks/index.M2dsQ_UQ.js';
10
- import './chunks/tinyrainbow.Ht9iggcq.js';
1
+ export { s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.-bm5IxnW.js';
2
+ export { p as collectTests, a as processError, s as startTests } from './chunks/run.Cm2sd7-x.js';
3
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as setupEnv } from './chunks/setup-common.BABL3z3m.js';
4
+ export { s as SpyModule } from './chunks/spy.DDMXghXv.js';
5
+ export { f as format, i as inspect, s as stringify } from './chunks/display.BlTmubjj.js';
6
+ export { g as getType } from './chunks/pathe.M-eThtNZ.Ba-7h1rE.js';
7
+ export { D as DecodedMap, g as getOriginalPosition, a as getSafeTimers, s as setSafeTimers } from './chunks/source-map.DdKI5IHB.js';
8
+ import './chunks/coverage.cTDc4uSS.js';
9
+ import './chunks/index.D0heQG4v.js';
10
+ import './chunks/tinyrainbow.Do8I1XRG.js';
11
11
  import './task-utils.js';
12
- import './chunks/plugins.Cigb0uSy.js';
12
+ import './chunks/plugins.DPQHVT0p.js';
13
13
 
14
14
  /**
15
15
  * @internal
@@ -1,21 +1,22 @@
1
1
  import { runInThisContext } from 'node:vm';
2
- import { s as spyModule } from './spy.KLHgXex_.js';
3
- import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.BgwtGYxD.js';
4
- import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.IsjtLXKe.js';
2
+ import { s as spyModule } from './spy.DDMXghXv.js';
3
+ import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.GYMZ12wH.js';
4
+ import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.DrHtV5zd.js';
5
+ import { n as nativeImports, g as getEvaluatedImports, c as collectDependencies } from './module-dependencies.CwNPkcV4.js';
5
6
  import { Traces } from '../traces.js';
6
- import { V as VitestEvaluatedModules } from './rpc.CJVl3hZH.js';
7
- import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.hTNFpC24.js';
7
+ import { V as VitestEvaluatedModules } from './rpc.DpkUyY1N.js';
8
+ import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.CPNMO3h-.js';
8
9
  import { performance as performance$1 } from 'node:perf_hooks';
9
- import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.AipniaqB.js';
10
- import { i as index, g as globalExpect, v as vi } from './index.DGdajAO2.js';
10
+ import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.-bm5IxnW.js';
11
+ import { i as index, g as globalExpect, v as vi } from './index.uwTEEBsB.js';
11
12
  import { c as closeInspector } from './inspector.CvyFGlXm.js';
12
- import { s as startTests, p as publicCollect } from './run.C5UmxDPh.js';
13
+ import { s as startTests, p as publicCollect } from './run.Cm2sd7-x.js';
13
14
  import { createRequire } from 'node:module';
14
15
  import timers from 'node:timers';
15
16
  import timersPromises from 'node:timers/promises';
16
17
  import util from 'node:util';
17
- import { K as KNOWN_ASSET_TYPES } from './pathe.M-eThtNZ.DwEga6ro.js';
18
- import { s as setupCommonEnv, b as setupEnv } from './setup-common.Ct8rQvjH.js';
18
+ import { K as KNOWN_ASSET_TYPES } from './pathe.M-eThtNZ.Ba-7h1rE.js';
19
+ import { s as setupCommonEnv, b as setupEnv } from './setup-common.BABL3z3m.js';
19
20
  import { g as getWorkerState, r as resetModules, p as provideWorkerState, a as getSafeWorkerState } from './utils.DYj33du9.js';
20
21
 
21
22
  // this should only be used in Node
@@ -57,7 +58,7 @@ function resolveAsset(mod, url) {
57
58
  mod.exports = url;
58
59
  }
59
60
  async function setupConsoleLogSpy() {
60
- const { createCustomConsole } = await import('./console.B09ye7y0.js');
61
+ const { createCustomConsole } = await import('./console.DtI4yxfN.js');
61
62
  globalThis.console = createCustomConsole();
62
63
  }
63
64
 
@@ -77,6 +78,10 @@ async function run(method, files, config, moduleRunner, environment, traces) {
77
78
  testRunner.cancel?.(reason);
78
79
  });
79
80
  workerState.durations.prepare = performance$1.now() - workerState.durations.prepare;
81
+ // modules loaded before the first file are shared by every file in this worker
82
+ const dependencies = workerState.dependencies;
83
+ const preparedModules = new Set(dependencies);
84
+ const getImports = config.experimental.viteModuleRunner === false ? nativeImports.getImports : getEvaluatedImports(workerState.evaluatedModules);
80
85
  try {
81
86
  await traces.$(`vitest.test.runner.${method}`, async () => {
82
87
  for (const file of files) {
@@ -85,9 +90,11 @@ async function run(method, files, config, moduleRunner, environment, traces) {
85
90
  resetModules(workerState.evaluatedModules, true);
86
91
  }
87
92
  workerState.filepath = file.filepath;
93
+ dependencies?.clear();
88
94
  if (method === "run") {
89
95
  const collectAsyncLeaks = config.detectAsyncLeaks ? detectAsyncLeaks(file.filepath, workerState.ctx.projectName) : void 0;
90
96
  await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => startTests([file], testRunner));
97
+ if (dependencies) workerState.rpc.onTestModuleDependencies(file.filepath, collectDependencies(getImports, preparedModules, dependencies));
91
98
  const leaks = await collectAsyncLeaks?.();
92
99
  if (leaks?.length) workerState.rpc.onAsyncLeaks(leaks);
93
100
  } else await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => publicCollect([file], testRunner));
@@ -119,7 +126,7 @@ async function startModuleRunner(options) {
119
126
  let mocker;
120
127
  if (options.state.config.experimental.nodeLoader !== false) {
121
128
  // this additionally imports acorn/magic-string
122
- const { NativeModuleMocker } = await import('./nativeModuleMocker.DwRB4F9R.js');
129
+ const { NativeModuleMocker } = await import('./nativeModuleMocker.D8f4cW4A.js');
123
130
  mocker = new NativeModuleMocker({
124
131
  async resolveId(id, importer) {
125
132
  // TODO: use import.meta.resolve instead
@@ -136,7 +143,7 @@ async function startModuleRunner(options) {
136
143
  }
137
144
  // imported lazily (pulls in `local-pkg`) so it stays out of the default
138
145
  // worker startup graph; only the `viteModuleRunner: false` path needs it
139
- const { NativeModuleRunner } = await import('./nativeModuleRunner.J0QLzNtK.js').then(function (n) { return n.n; });
146
+ const { NativeModuleRunner } = await import('./nativeModuleRunner.xi64Afb2.js').then(function (n) { return n.n; });
140
147
  _moduleRunner = new NativeModuleRunner(root, mocker);
141
148
  return _moduleRunner;
142
149
  }
@@ -144,12 +151,23 @@ async function startModuleRunner(options) {
144
151
  return _moduleRunner;
145
152
  }
146
153
  let _currentEnvironment;
154
+ let _environmentModules = [];
147
155
  let _environmentTime;
156
+ // the files reported by the resolve hook are added here when the module runner is disabled
157
+ let _nativeDependencies;
158
+ let _canRecordDependencies = true;
159
+ function recordNativeImport(url, parentURL) {
160
+ const file = nativeImports.record(url, parentURL);
161
+ if (file) _nativeDependencies?.add(file);
162
+ }
148
163
  /** @experimental */
149
164
  async function setupBaseEnvironment(context) {
150
165
  if (context.config.experimental.viteModuleRunner === false) {
151
- const { setupNodeLoaderHooks } = await import('./native.CF4uT5hY.js');
152
- await setupNodeLoaderHooks(context);
166
+ const { setupNodeLoaderHooks } = await import('./native.cdzHIdmv.js');
167
+ const recordDependencies = context.config.experimental.recordDependencies;
168
+ _canRecordDependencies = await setupNodeLoaderHooks(context, recordDependencies ? recordNativeImport : void 0);
169
+ // until the tests start, the imports belong to the environment
170
+ _nativeDependencies = recordDependencies ? /* @__PURE__ */ new Set() : void 0;
153
171
  }
154
172
  const startTime = performance.now();
155
173
  const { environment: { name: environmentName, options: environmentOptions }, rpc, config } = context;
@@ -157,6 +175,7 @@ async function setupBaseEnvironment(context) {
157
175
  const otel = context.traces;
158
176
  const { environment, loader } = await loadEnvironment(environmentName, config.root, rpc, otel, context.config.experimental.viteModuleRunner);
159
177
  _currentEnvironment = environment;
178
+ _environmentModules = loader ? Array.from(loader.evaluatedModules.idToModuleMap.keys()) : _nativeDependencies ?? [];
160
179
  const env = await otel.$("vitest.runtime.environment.setup", { attributes: {
161
180
  "vitest.environment": environment.name,
162
181
  "vitest.environment.vite_environment": environment.viteEnvironment || environment.name
@@ -176,6 +195,11 @@ async function runBaseTests(method, state, traces) {
176
195
  // state has new context, but we want to reuse existing ones
177
196
  state.evaluatedModules = evaluatedModules;
178
197
  state.moduleExecutionInfo = moduleExecutionInfo;
198
+ if (!_canRecordDependencies)
199
+ // a test file without a record always runs
200
+ state.dependencies = void 0;
201
+ for (const id of _environmentModules) state.dependencies?.add(id);
202
+ if (_nativeDependencies) _nativeDependencies = state.dependencies;
179
203
  provideWorkerState(globalThis, state);
180
204
  // we could load @vite/env, but it would take ~8ms, while this takes ~0,02ms
181
205
  if (state.config.serializedDefines) try {
@@ -1,6 +1,6 @@
1
- import { F as FileSpecification } from './config.d.CU_b-wJj.js';
2
- import { O as OTELCarrier } from './rpc.d.DA9Utv4e.js';
3
- import { T as TestExecutionMethod } from './worker.d.MLmnzOJE.js';
1
+ import { F as FileSpecification } from './config.d.QBNYCgFU.js';
2
+ import { O as OTELCarrier } from './rpc.d.Cft1biqy.js';
3
+ import { T as TestExecutionMethod } from './worker.d.BH-r1bPu.js';
4
4
 
5
5
  interface ModuleDefinitionLocation {
6
6
  line: number;
@@ -1,7 +1,7 @@
1
- import { n as normalize, t as toArray } from './pathe.M-eThtNZ.DwEga6ro.js';
1
+ import { n as normalize, t as toArray } from './pathe.M-eThtNZ.Ba-7h1rE.js';
2
2
  import { EventEmitter } from 'events';
3
- import { m } from './tinyrainbow.Ht9iggcq.js';
4
- import { a as isForceColor } from './env.DzFJjrmK.js';
3
+ import { w } from './tinyrainbow.Do8I1XRG.js';
4
+ import { i as isForceColor } from './env.BKKtU2WC.js';
5
5
  import { a as defaultPort, d as defaultBrowserPort } from './constants.-juJ8b_4.js';
6
6
  import assert from 'node:assert';
7
7
  import { isAgent } from 'std-env';
@@ -620,7 +620,7 @@ class CAC extends EventEmitter {
620
620
 
621
621
  const cac = (name = "") => new CAC(name);
622
622
 
623
- var version = "5.0.2";
623
+ var version = "5.0.4";
624
624
 
625
625
  const apiConfig = (port) => ({
626
626
  port: {
@@ -676,7 +676,11 @@ const cliOptionsConfig = {
676
676
  argument: "<path>",
677
677
  normalize: true
678
678
  },
679
- ui: { description: "Enable UI" },
679
+ ui: {
680
+ description: "Enable UI",
681
+ argument: "",
682
+ subcommands: null
683
+ },
680
684
  open: { description: "Open UI automatically (default: `!process.env.CI`)" },
681
685
  api: {
682
686
  argument: "[port]",
@@ -1142,22 +1146,15 @@ const cliOptionsConfig = {
1142
1146
  argument: "<timeout>"
1143
1147
  },
1144
1148
  cache: {
1145
- description: "Enable cache",
1149
+ description: "Store the results of test runs to run failed and longer test files first (default: `true`)",
1146
1150
  argument: "",
1147
- subcommands: { dir: null },
1148
- default: true,
1149
- // cache can only be "false" or an object
1150
- transform(cache) {
1151
- if (typeof cache !== "boolean" && cache) throw new Error("--cache.dir is deprecated");
1152
- if (cache) return {};
1153
- return cache;
1154
- }
1151
+ subcommands: null
1155
1152
  },
1156
1153
  maxConcurrency: {
1157
1154
  description: "Maximum number of concurrent tests and suites during test file execution (default: `5`)",
1158
1155
  argument: "<number>"
1159
1156
  },
1160
- fsModuleCache: { description: "Cache transformed modules on the file system and reuse them between reruns (default: `false`)" },
1157
+ fsModuleCache: { description: "Cache transformed modules on the file system and reuse them between reruns (default: `true`)" },
1161
1158
  fsModuleCachePath: {
1162
1159
  description: "Directory where the `fsModuleCache` is stored (default: `node_modules/.vitest-cache`)",
1163
1160
  argument: "<path>"
@@ -1278,6 +1275,7 @@ const cliOptionsConfig = {
1278
1275
  description: "Custom provider for detecting changed files. (default: `git`)",
1279
1276
  subcommands: null
1280
1277
  },
1278
+ recordDependencies: { description: "Record the modules loaded by every test file in the cache and use the records with `--changed` and `--related` instead of the static module graph. A test file without a record always runs. (default: `false`)" },
1281
1279
  preParse: { description: "Parse test specifications before running them. This will apply `.only` flag and test name pattern across all files without running them. (default: `false`)" },
1282
1280
  diagnostics: {
1283
1281
  description: "Print performance hints after the run when a configuration change would make it significantly faster. Hints never suggest changing options that were set explicitly. (default: `true`)",
@@ -2240,7 +2238,7 @@ function addCliOptions(cli, options) {
2240
2238
  for (const [optionName, option] of Object.entries(options)) if (option) addCommand(cli, optionName, option);
2241
2239
  }
2242
2240
  function createCLI(options = {}) {
2243
- if (isAgent && !isForceColor()) m();
2241
+ if (isAgent && !isForceColor()) w();
2244
2242
  const cli = cac("vitest");
2245
2243
  cli.version(version);
2246
2244
  addCliOptions(cli, cliOptionsConfig);
@@ -2366,11 +2364,11 @@ function normalizeCliOptions(cliFilters, argv) {
2366
2364
  }
2367
2365
  async function start(cliFilters, options) {
2368
2366
  try {
2369
- const { startVitest } = await import('./cli-api.DL4Bd7Vh.js').then(function (n) { return n.a; });
2367
+ const { startVitest } = await import('./cli-api.Bx28WXzL.js').then(function (n) { return n.g; });
2370
2368
  const ctx = await startVitest(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2371
2369
  if (!ctx.shouldKeepServer()) await ctx.exit();
2372
2370
  } catch (e) {
2373
- const { errorBanner } = await import('./utils.CJ0JImL8.js').then(function (n) { return n.u; });
2371
+ const { errorBanner } = await import('./utils.DSfl_w8V.js').then(function (n) { return n.u; });
2374
2372
  console.error(`\n${errorBanner("Startup Error")}`);
2375
2373
  console.error(e);
2376
2374
  console.error("\n\n");
@@ -2380,11 +2378,11 @@ async function start(cliFilters, options) {
2380
2378
  }
2381
2379
  async function doctorCommand(cliFilters, options) {
2382
2380
  try {
2383
- const { doctor } = await import('./doctor.BCXa6-1R.js');
2381
+ const { doctor } = await import('./doctor.Bqc8NDDb.js');
2384
2382
  await doctor(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2385
2383
  process.exit();
2386
2384
  } catch (e) {
2387
- const { errorBanner } = await import('./utils.CJ0JImL8.js').then(function (n) { return n.u; });
2385
+ const { errorBanner } = await import('./utils.DSfl_w8V.js').then(function (n) { return n.u; });
2388
2386
  console.error(`\n${errorBanner("Doctor Error")}`);
2389
2387
  console.error(e);
2390
2388
  console.error("\n\n");
@@ -2397,12 +2395,12 @@ async function init(project) {
2397
2395
  console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
2398
2396
  process.exit(1);
2399
2397
  }
2400
- const { create } = await import('./creator.2VTnpYzN.js');
2398
+ const { create } = await import('./creator.CLL8QFMS.js');
2401
2399
  await create();
2402
2400
  }
2403
2401
  async function collect(cliFilters, options) {
2404
2402
  try {
2405
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.DL4Bd7Vh.js').then(function (n) { return n.a; });
2403
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.Bx28WXzL.js').then(function (n) { return n.g; });
2406
2404
  const ctx = await prepareVitest({
2407
2405
  ...normalizeCliOptions(cliFilters, options),
2408
2406
  watch: false,
@@ -2424,7 +2422,7 @@ async function collect(cliFilters, options) {
2424
2422
  } else outputFileList(await ctx.getRelevantTestSpecifications(cliFilters.map(normalize)), options);
2425
2423
  await ctx.close();
2426
2424
  } catch (e) {
2427
- const { errorBanner } = await import('./utils.CJ0JImL8.js').then(function (n) { return n.u; });
2425
+ const { errorBanner } = await import('./utils.DSfl_w8V.js').then(function (n) { return n.u; });
2428
2426
  console.error(`\n${errorBanner("Collect Error")}`);
2429
2427
  console.error(e);
2430
2428
  console.error("\n\n");