vitest 5.0.0-rc.2 → 5.0.0-rc.3

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 (54) hide show
  1. package/dist/browser.js +6 -6
  2. package/dist/chunks/{base.C1WTaPOM.js → base.CZYgpg5z.js} +13 -13
  3. package/dist/chunks/{browser.d.C9OF2Et_.d.ts → browser.d.g5Thl309.d.ts} +1 -1
  4. package/dist/chunks/{cac.D09XQ6pO.js → cac.AVSgLgX0.js} +10 -10
  5. package/dist/chunks/{cli-api.te-1Pvjs.js → cli-api.BsG_KUyt.js} +3 -3
  6. package/dist/chunks/{console.DWNMLVgF.js → console.CHi0lDgQ.js} +2 -2
  7. package/dist/chunks/{coverage.CPiksdSj.js → coverage.BcXK1DsQ.js} +1 -1
  8. package/dist/chunks/{coverage.VANpXofm.js → coverage.BtDxDqSU.js} +1 -1
  9. package/dist/chunks/{creator.Cqwo9lsW.js → creator.CYvpourF.js} +23 -13
  10. package/dist/chunks/{doctor.CNpBUniZ.js → doctor.CzJ1dA-i.js} +2 -2
  11. package/dist/chunks/{environment.d.C0fjmVGG.d.ts → environment.d.C6xYahWA.d.ts} +8 -0
  12. package/dist/chunks/{globals.C5MA6F-b.js → globals.B4gJ9mZH.js} +6 -6
  13. package/dist/chunks/{index.BH4BaN4R.js → index.CSoBZWW_.js} +14 -13
  14. package/dist/chunks/{index.DzzDnMj8.js → index.CVFiuVPx.js} +5697 -293
  15. package/dist/chunks/{index.BfU4rh_M.js → index.DQO7054M.js} +9 -3
  16. package/dist/chunks/{index.CCh1Pb8k.js → index.DmDMHCg8.js} +1 -1
  17. package/dist/chunks/{index.C0qliBI-.js → index.okypXZ97.js} +5 -5
  18. package/dist/chunks/{init-forks.Bo2g6tWs.js → init-forks.BqnYxpzU.js} +1 -1
  19. package/dist/chunks/{init-threads.BSTHIk3P.js → init-threads.CL4Y0HC6.js} +1 -1
  20. package/dist/chunks/{init.i_K8EJrW.js → init.DJ2lKyjE.js} +6 -5
  21. package/dist/chunks/{native.offEPk9l.js → native.cLbCmZDO.js} +1 -1
  22. package/dist/chunks/{nativeModuleMocker.0CD1hdFV.js → nativeModuleMocker.DBSXgC3F.js} +2 -2
  23. package/dist/chunks/{nativeModuleRunner.Bc3kXpWn.js → nativeModuleRunner.BOvBCgI_.js} +1 -1
  24. package/dist/chunks/{node.CS-X6Ymg.js → node.Es9ukMGX.js} +1 -1
  25. package/dist/chunks/{pathe.M-eThtNZ.k2RS39sQ.js → pathe.M-eThtNZ.Clq7AXhv.js} +1 -1
  26. package/dist/chunks/{plugin.d.CNqvINDS.d.ts → plugin.d.DAuMAWfb.d.ts} +446 -140
  27. package/dist/chunks/{resolver.B_5CI0Kh.js → resolver.CBCHRZ7j.js} +1 -1
  28. package/dist/chunks/{rpc.DaPTofpf.js → rpc.DWKX1ZbI.js} +3 -3
  29. package/dist/chunks/{run.COOMV-72.js → run.DyRH7m0-.js} +3 -8
  30. package/dist/chunks/{setup-common.AcXJaDWq.js → setup-common.p8NqUXPi.js} +2 -2
  31. package/dist/chunks/{source-map.CTObTzjj.js → source-map.Dx3YPjIe.js} +2 -2
  32. package/dist/chunks/{utils.DtdLoSPT.js → utils.CtqmNjXD.js} +1 -1
  33. package/dist/chunks/{vm.FXMbMqlj.js → vm.gGBei5ET.js} +93 -59
  34. package/dist/chunks/{worker.d.XSpk7g5N.d.ts → worker.d.MLmnzOJE.d.ts} +1 -1
  35. package/dist/cli.js +2 -2
  36. package/dist/config.d.ts +6 -5
  37. package/dist/index.d.ts +7 -7
  38. package/dist/index.js +6 -6
  39. package/dist/module-evaluator.d.ts +1 -0
  40. package/dist/node.d.ts +6 -5
  41. package/dist/node.js +26 -17
  42. package/dist/runtime.d.ts +2 -2
  43. package/dist/runtime.js +4 -4
  44. package/dist/task-utils.js +1 -1
  45. package/dist/worker.d.ts +2 -2
  46. package/dist/worker.js +13 -13
  47. package/dist/workers/forks.js +14 -14
  48. package/dist/workers/runVmTests.js +10 -10
  49. package/dist/workers/threads.js +14 -14
  50. package/dist/workers/vmForks.js +11 -11
  51. package/dist/workers/vmThreads.js +11 -11
  52. package/package.json +22 -22
  53. package/dist/chunks/check.Cz_-YojU.js +0 -15
  54. package/dist/chunks/setup.CBDqPUzi.js +0 -5405
package/dist/browser.js CHANGED
@@ -1,11 +1,11 @@
1
- export { s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.VANpXofm.js';
2
- export { p as collectTests, a as processError, s as startTests } from './chunks/run.COOMV-72.js';
3
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as setupEnv } from './chunks/setup-common.AcXJaDWq.js';
1
+ export { s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.BtDxDqSU.js';
2
+ export { p as collectTests, a as processError, s as startTests } from './chunks/run.DyRH7m0-.js';
3
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as setupEnv } from './chunks/setup-common.p8NqUXPi.js';
4
4
  export { s as SpyModule } from './chunks/spy.DPpyuUIA.js';
5
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.k2RS39sQ.js';
7
- export { D as DecodedMap, g as getOriginalPosition, a as getSafeTimers, s as setSafeTimers } from './chunks/source-map.CTObTzjj.js';
8
- import './chunks/coverage.CPiksdSj.js';
6
+ export { g as getType } from './chunks/pathe.M-eThtNZ.Clq7AXhv.js';
7
+ export { D as DecodedMap, g as getOriginalPosition, a as getSafeTimers, s as setSafeTimers } from './chunks/source-map.Dx3YPjIe.js';
8
+ import './chunks/coverage.BcXK1DsQ.js';
9
9
  import './chunks/index.M2dsQ_UQ.js';
10
10
  import './chunks/tinyrainbow.Ht9iggcq.js';
11
11
  import './task-utils.js';
@@ -1,21 +1,21 @@
1
1
  import { runInThisContext } from 'node:vm';
2
2
  import { s as spyModule } from './spy.DPpyuUIA.js';
3
- import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.C0qliBI-.js';
4
- import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.i_K8EJrW.js';
3
+ import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.okypXZ97.js';
4
+ import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.DJ2lKyjE.js';
5
5
  import { Traces } from '../traces.js';
6
- import { V as VitestEvaluatedModules } from './rpc.DaPTofpf.js';
7
- import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.BfU4rh_M.js';
6
+ import { V as VitestEvaluatedModules } from './rpc.DWKX1ZbI.js';
7
+ import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.DQO7054M.js';
8
8
  import { performance as performance$1 } from 'node:perf_hooks';
9
- import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.VANpXofm.js';
10
- import { i as index, g as globalExpect, v as vi } from './index.BH4BaN4R.js';
9
+ import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.BtDxDqSU.js';
10
+ import { i as index, g as globalExpect, v as vi } from './index.CSoBZWW_.js';
11
11
  import { c as closeInspector } from './inspector.CvyFGlXm.js';
12
- import { s as startTests, p as publicCollect } from './run.COOMV-72.js';
12
+ import { s as startTests, p as publicCollect } from './run.DyRH7m0-.js';
13
13
  import { createRequire } from 'node:module';
14
14
  import timers from 'node:timers';
15
15
  import timersPromises from 'node:timers/promises';
16
16
  import util from 'node:util';
17
- import { K as KNOWN_ASSET_TYPES } from './pathe.M-eThtNZ.k2RS39sQ.js';
18
- import { s as setupCommonEnv, b as setupEnv } from './setup-common.AcXJaDWq.js';
17
+ import { K as KNOWN_ASSET_TYPES } from './pathe.M-eThtNZ.Clq7AXhv.js';
18
+ import { s as setupCommonEnv, b as setupEnv } from './setup-common.p8NqUXPi.js';
19
19
  import { g as getWorkerState, r as resetModules, p as provideWorkerState, a as getSafeWorkerState } from './utils.DYj33du9.js';
20
20
 
21
21
  // this should only be used in Node
@@ -57,7 +57,7 @@ function resolveAsset(mod, url) {
57
57
  mod.exports = url;
58
58
  }
59
59
  async function setupConsoleLogSpy() {
60
- const { createCustomConsole } = await import('./console.DWNMLVgF.js');
60
+ const { createCustomConsole } = await import('./console.CHi0lDgQ.js');
61
61
  globalThis.console = createCustomConsole();
62
62
  }
63
63
 
@@ -119,7 +119,7 @@ async function startModuleRunner(options) {
119
119
  let mocker;
120
120
  if (options.state.config.experimental.nodeLoader !== false) {
121
121
  // this additionally imports acorn/magic-string
122
- const { NativeModuleMocker } = await import('./nativeModuleMocker.0CD1hdFV.js');
122
+ const { NativeModuleMocker } = await import('./nativeModuleMocker.DBSXgC3F.js');
123
123
  mocker = new NativeModuleMocker({
124
124
  async resolveId(id, importer) {
125
125
  // TODO: use import.meta.resolve instead
@@ -136,7 +136,7 @@ async function startModuleRunner(options) {
136
136
  }
137
137
  // imported lazily (pulls in `local-pkg`) so it stays out of the default
138
138
  // worker startup graph; only the `viteModuleRunner: false` path needs it
139
- const { NativeModuleRunner } = await import('./nativeModuleRunner.Bc3kXpWn.js').then(function (n) { return n.n; });
139
+ const { NativeModuleRunner } = await import('./nativeModuleRunner.BOvBCgI_.js').then(function (n) { return n.n; });
140
140
  _moduleRunner = new NativeModuleRunner(root, mocker);
141
141
  return _moduleRunner;
142
142
  }
@@ -148,7 +148,7 @@ let _environmentTime;
148
148
  /** @experimental */
149
149
  async function setupBaseEnvironment(context) {
150
150
  if (context.config.experimental.viteModuleRunner === false) {
151
- const { setupNodeLoaderHooks } = await import('./native.offEPk9l.js');
151
+ const { setupNodeLoaderHooks } = await import('./native.cLbCmZDO.js');
152
152
  await setupNodeLoaderHooks(context);
153
153
  }
154
154
  const startTime = performance.now();
@@ -1,6 +1,6 @@
1
1
  import { F as FileSpecification } from './config.d.CU_b-wJj.js';
2
2
  import { O as OTELCarrier } from './rpc.d.DA9Utv4e.js';
3
- import { T as TestExecutionMethod } from './worker.d.XSpk7g5N.js';
3
+ import { T as TestExecutionMethod } from './worker.d.MLmnzOJE.js';
4
4
 
5
5
  interface ModuleDefinitionLocation {
6
6
  line: number;
@@ -1,4 +1,4 @@
1
- import { n as normalize, t as toArray } from './pathe.M-eThtNZ.k2RS39sQ.js';
1
+ import { n as normalize, t as toArray } from './pathe.M-eThtNZ.Clq7AXhv.js';
2
2
  import { EventEmitter } from 'events';
3
3
  import { m } from './tinyrainbow.Ht9iggcq.js';
4
4
  import { a as isForceColor } from './env.DzFJjrmK.js';
@@ -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.0-rc.2";
623
+ var version = "5.0.0-rc.3";
624
624
 
625
625
  const apiConfig = (port) => ({
626
626
  port: {
@@ -1129,7 +1129,7 @@ const cliOptionsConfig = {
1129
1129
  },
1130
1130
  project: {
1131
1131
  shorthand: "p",
1132
- description: "The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: `--project=1 --project=2`. You can also filter projects using wildcards like `--project=packages*`, and exclude projects with `--project=!pattern`.",
1132
+ description: "The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: `--project=1 --project=2`. You can also filter projects using wildcards like `--project=packages*`, and exclude projects with `--project=!pattern`. A project runs if it matches no negated pattern and, when regular patterns are also given, matches at least one of them.",
1133
1133
  argument: "<name>",
1134
1134
  array: true
1135
1135
  },
@@ -2363,11 +2363,11 @@ function normalizeCliOptions(cliFilters, argv) {
2363
2363
  }
2364
2364
  async function start(cliFilters, options) {
2365
2365
  try {
2366
- const { startVitest } = await import('./cli-api.te-1Pvjs.js').then(function (n) { return n.a; });
2366
+ const { startVitest } = await import('./cli-api.BsG_KUyt.js').then(function (n) { return n.a; });
2367
2367
  const ctx = await startVitest(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2368
2368
  if (!ctx.shouldKeepServer()) await ctx.exit();
2369
2369
  } catch (e) {
2370
- const { errorBanner } = await import('./utils.DtdLoSPT.js').then(function (n) { return n.u; });
2370
+ const { errorBanner } = await import('./utils.CtqmNjXD.js').then(function (n) { return n.u; });
2371
2371
  console.error(`\n${errorBanner("Startup Error")}`);
2372
2372
  console.error(e);
2373
2373
  console.error("\n\n");
@@ -2377,11 +2377,11 @@ async function start(cliFilters, options) {
2377
2377
  }
2378
2378
  async function doctorCommand(cliFilters, options) {
2379
2379
  try {
2380
- const { doctor } = await import('./doctor.CNpBUniZ.js');
2380
+ const { doctor } = await import('./doctor.CzJ1dA-i.js');
2381
2381
  await doctor(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2382
2382
  process.exit();
2383
2383
  } catch (e) {
2384
- const { errorBanner } = await import('./utils.DtdLoSPT.js').then(function (n) { return n.u; });
2384
+ const { errorBanner } = await import('./utils.CtqmNjXD.js').then(function (n) { return n.u; });
2385
2385
  console.error(`\n${errorBanner("Doctor Error")}`);
2386
2386
  console.error(e);
2387
2387
  console.error("\n\n");
@@ -2394,12 +2394,12 @@ async function init(project) {
2394
2394
  console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
2395
2395
  process.exit(1);
2396
2396
  }
2397
- const { create } = await import('./creator.Cqwo9lsW.js');
2397
+ const { create } = await import('./creator.CYvpourF.js');
2398
2398
  await create();
2399
2399
  }
2400
2400
  async function collect(cliFilters, options) {
2401
2401
  try {
2402
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.te-1Pvjs.js').then(function (n) { return n.a; });
2402
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.BsG_KUyt.js').then(function (n) { return n.a; });
2403
2403
  const ctx = await prepareVitest({
2404
2404
  ...normalizeCliOptions(cliFilters, options),
2405
2405
  watch: false,
@@ -2421,7 +2421,7 @@ async function collect(cliFilters, options) {
2421
2421
  } else outputFileList(await ctx.getRelevantTestSpecifications(cliFilters.map(normalize)), options);
2422
2422
  await ctx.close();
2423
2423
  } catch (e) {
2424
- const { errorBanner } = await import('./utils.DtdLoSPT.js').then(function (n) { return n.u; });
2424
+ const { errorBanner } = await import('./utils.CtqmNjXD.js').then(function (n) { return n.u; });
2425
2425
  console.error(`\n${errorBanner("Collect Error")}`);
2426
2426
  console.error(e);
2427
2427
  console.error("\n\n");
@@ -1,11 +1,11 @@
1
1
  import { mkdirSync, writeFileSync } from 'node:fs';
2
- import { C as CoverageProviderMap } from './coverage.CPiksdSj.js';
3
- import { L as Logger, k as VitestPackageInstaller, P as PluginHarness, v as resolveConfig, V as Vitest, z as stdout, x as prompt, g as FilesNotFoundError, G as GitNotFoundError, I as IncludeTaskLocationDisabledError, A as RangeLocationFilterProvidedError, C as LocationFilterFileNotFoundError } from './index.DzzDnMj8.js';
2
+ import { C as CoverageProviderMap } from './coverage.BcXK1DsQ.js';
3
+ import { L as Logger, k as VitestPackageInstaller, P as PluginHarness, w as resolveConfig, V as Vitest, A as stdout, y as prompt, g as FilesNotFoundError, G as GitNotFoundError, I as IncludeTaskLocationDisabledError, C as RangeLocationFilterProvidedError, E as LocationFilterFileNotFoundError } from './index.CVFiuVPx.js';
4
4
  import readline from 'node:readline';
5
5
  import { y } from './tinyrainbow.Ht9iggcq.js';
6
6
  import { i as isWindows } from './env.DzFJjrmK.js';
7
7
  import { stripVTControlCharacters } from 'node:util';
8
- import { e as createDefer, a as relative, r as resolve, d as dirname, i as isAbsolute } from './pathe.M-eThtNZ.k2RS39sQ.js';
8
+ import { e as createDefer, a as relative, r as resolve, d as dirname, i as isAbsolute } from './pathe.M-eThtNZ.Clq7AXhv.js';
9
9
 
10
10
  async function createVitest(modeOrOptions, optionsOrViteOverrides = {}, viteOverridesOrVitestOptions = {}, maybeVitestOptions = {}) {
11
11
  let options;
@@ -1,10 +1,10 @@
1
1
  import { Console } from 'node:console';
2
2
  import { relative } from 'node:path';
3
3
  import { Writable } from 'node:stream';
4
- import { a as getSafeTimers } from './source-map.CTObTzjj.js';
4
+ import { a as getSafeTimers } from './source-map.Dx3YPjIe.js';
5
5
  import { y } from './tinyrainbow.Ht9iggcq.js';
6
6
  import { g as getWorkerState } from './utils.DYj33du9.js';
7
- import './pathe.M-eThtNZ.k2RS39sQ.js';
7
+ import './pathe.M-eThtNZ.Clq7AXhv.js';
8
8
 
9
9
  const RealDate = globalThis.Date;
10
10
  const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
@@ -1,4 +1,4 @@
1
- import { r as resolve } from './pathe.M-eThtNZ.k2RS39sQ.js';
1
+ import { r as resolve } from './pathe.M-eThtNZ.Clq7AXhv.js';
2
2
 
3
3
  function getCoverageFilesDirectory(reportsDirectory, shard) {
4
4
  return resolve(reportsDirectory, `.tmp${shard ? `-${shard.index}-${shard.count}` : ""}`);
@@ -1,4 +1,4 @@
1
- import { r as resolveCoverageProviderModule } from './coverage.CPiksdSj.js';
1
+ import { r as resolveCoverageProviderModule } from './coverage.BcXK1DsQ.js';
2
2
 
3
3
  async function startCoverageInsideWorker(options, loader, runtimeOptions) {
4
4
  const coverageModule = await resolveCoverageProviderModule(options, loader);
@@ -2,51 +2,61 @@ import { existsSync, writeFileSync, readFileSync } from 'node:fs';
2
2
  import { mkdir, writeFile } from 'node:fs/promises';
3
3
  import { resolve, dirname, relative } from 'node:path';
4
4
  import { detectPackageManager, installPackage } from './index.DXQx-kDM.js';
5
- import { x as prompt, y as findConfigFile } from './index.DzzDnMj8.js';
5
+ import { y as prompt, z as findConfigFile } from './index.CVFiuVPx.js';
6
6
  import { x } from 'tinyexec';
7
7
  import { y } from './tinyrainbow.Ht9iggcq.js';
8
8
  import 'node:process';
9
9
  import 'node:os';
10
- import './pathe.M-eThtNZ.k2RS39sQ.js';
11
- import './source-map.CTObTzjj.js';
12
- import './cac.D09XQ6pO.js';
10
+ import './pathe.M-eThtNZ.Clq7AXhv.js';
11
+ import './source-map.Dx3YPjIe.js';
12
+ import './cac.AVSgLgX0.js';
13
13
  import 'events';
14
14
  import './env.DzFJjrmK.js';
15
15
  import 'std-env';
16
16
  import './constants.-juJ8b_4.js';
17
17
  import 'node:assert';
18
+ import 'node:perf_hooks';
19
+ import './index.DmDMHCg8.js';
20
+ import 'https';
21
+ import 'http';
22
+ import 'net';
23
+ import 'tls';
24
+ import 'crypto';
25
+ import 'stream';
26
+ import 'url';
27
+ import 'zlib';
28
+ import 'buffer';
29
+ import 'util';
30
+ import 'vite';
31
+ import 'node:crypto';
18
32
  import '../path.js';
19
33
  import 'node:url';
20
- import './run.COOMV-72.js';
34
+ import './run.DyRH7m0-.js';
21
35
  import './index.M2dsQ_UQ.js';
22
36
  import './display.pkpxlVcY.js';
23
37
  import '../task-utils.js';
24
- import './nativeModuleRunner.Bc3kXpWn.js';
38
+ import './nativeModuleRunner.BOvBCgI_.js';
25
39
  import 'node:module';
26
40
  import 'node:v8';
27
41
  import 'node:util';
28
42
  import 'vite/module-runner';
29
43
  import '../traces.js';
30
- import 'vite';
31
44
  import 'obug';
32
- import 'node:crypto';
33
45
  import 'tinyglobby';
34
46
  import './defaults.D2ip7f-X.js';
35
47
  import 'magic-string';
36
48
  import '@vitest/mocker/node';
37
49
  import 'node:console';
38
50
  import 'node:stream';
39
- import 'node:perf_hooks';
40
51
  import './offset.Dy-5Fdfn.js';
41
- import './utils.DtdLoSPT.js';
52
+ import './utils.CtqmNjXD.js';
42
53
  import '#module-evaluator';
43
54
  import 'picomatch';
44
- import './coverage.CPiksdSj.js';
45
- import './resolver.B_5CI0Kh.js';
55
+ import './coverage.BcXK1DsQ.js';
56
+ import './resolver.CBCHRZ7j.js';
46
57
  import 'es-module-lexer';
47
58
  import 'node:tty';
48
59
  import 'node:events';
49
- import './index.CCh1Pb8k.js';
50
60
  import './modules.BJuCwlRJ.js';
51
61
  import 'node:child_process';
52
62
  import 'node:worker_threads';
@@ -4,7 +4,7 @@ import { availableParallelism, tmpdir } from 'node:os';
4
4
  import { join } from 'node:path';
5
5
  import { performance } from 'node:perf_hooks';
6
6
  import { pathToFileURL } from 'node:url';
7
- import { t as toArray, r as resolve } from './pathe.M-eThtNZ.k2RS39sQ.js';
7
+ import { t as toArray, r as resolve } from './pathe.M-eThtNZ.Clq7AXhv.js';
8
8
  import { y } from './tinyrainbow.Ht9iggcq.js';
9
9
  import { distDir } from '../path.js';
10
10
 
@@ -99,7 +99,7 @@ function log(...args) {
99
99
  console.log(...args);
100
100
  }
101
101
  async function doctor(cliFilters, options) {
102
- const { prepareVitest } = await import('./cli-api.te-1Pvjs.js').then(function (n) { return n.a; });
102
+ const { prepareVitest } = await import('./cli-api.BsG_KUyt.js').then(function (n) { return n.a; });
103
103
  log();
104
104
  log(y.inverse(y.bold(y.blue(" DOCTOR "))), "resolving the current configuration...");
105
105
  const ctx = await prepareVitest({
@@ -22,6 +22,14 @@ interface Environment {
22
22
  * By default, fallbacks to `name`.
23
23
  */
24
24
  viteEnvironment?: "client" | "ssr" | ({} & string);
25
+ /**
26
+ * Let the server transform the test file's import graph while `setupVM`
27
+ * runs. Only worth it when `setupVM` is slow (jsdom, happy-dom): otherwise
28
+ * the transforms compete with the worker's own module requests.
29
+ *
30
+ * @default `true`
31
+ */
32
+ prewarmModules?: boolean;
25
33
  setupVM?: (options: Record<string, any>) => Awaitable<VmEnvironmentReturn>;
26
34
  setup: (global: any, options: Record<string, any>) => Awaitable<EnvironmentReturn>;
27
35
  }
@@ -1,20 +1,20 @@
1
1
  import { g as globalApis } from './constants.-juJ8b_4.js';
2
- import { i as index } from './index.BH4BaN4R.js';
3
- import './run.COOMV-72.js';
2
+ import { i as index } from './index.CSoBZWW_.js';
3
+ import './run.DyRH7m0-.js';
4
4
  import './index.M2dsQ_UQ.js';
5
5
  import './tinyrainbow.Ht9iggcq.js';
6
6
  import './display.pkpxlVcY.js';
7
- import './pathe.M-eThtNZ.k2RS39sQ.js';
8
- import './source-map.CTObTzjj.js';
7
+ import './pathe.M-eThtNZ.Clq7AXhv.js';
8
+ import './source-map.Dx3YPjIe.js';
9
9
  import '../task-utils.js';
10
10
  import './utils.DYj33du9.js';
11
11
  import './spy.DPpyuUIA.js';
12
12
  import 'chai';
13
13
  import './plugins.Cigb0uSy.js';
14
14
  import './offset.Dy-5Fdfn.js';
15
- import './rpc.DaPTofpf.js';
15
+ import './rpc.DWKX1ZbI.js';
16
16
  import 'vite/module-runner';
17
- import './index.CCh1Pb8k.js';
17
+ import './index.DmDMHCg8.js';
18
18
  import 'tinybench';
19
19
  import 'expect-type';
20
20
 
@@ -1,8 +1,8 @@
1
- import { b as printDiffOrStringify, d as diff, a as processError, T as TestSyntaxError, g as getCurrentTest, c as createTaskCollector, e as getCurrentSuite, f as createChainable, h as getHooks, i as getFn, m as matchesTags, j as afterAll, k as afterEach, l as aroundAll, n as aroundEach, o as beforeAll, q as beforeEach, r as describe, t as it, u as onTestFailed, v as onTestFinished, w as recordArtifact, x as suite, y as test } from './run.COOMV-72.js';
1
+ import { b as printDiffOrStringify, d as diff, a as processError, T as TestSyntaxError, g as getCurrentTest, c as createTaskCollector, e as getCurrentSuite, f as createChainable, h as getHooks, i as getFn, m as matchesTags, j as afterAll, k as afterEach, l as aroundAll, n as aroundEach, o as beforeAll, q as beforeEach, r as describe, t as it, u as onTestFailed, v as onTestFinished, w as recordArtifact, x as suite, y as test } from './run.DyRH7m0-.js';
2
2
  import { i as isChildProcess, r as resetModules, g as getWorkerState } from './utils.DYj33du9.js';
3
- import { d as getDefaultExportFromCjs, h as parseErrorStacktrace, i as commonjsGlobal, a as getSafeTimers, f as parseSingleStack, j as delay } from './source-map.CTObTzjj.js';
3
+ import { e as getDefaultExportFromCjs, f as parseErrorStacktrace, h as commonjsGlobal, a as getSafeTimers, i as parseSingleStack, j as delay } from './source-map.Dx3YPjIe.js';
4
4
  import { i as isMockFunction, f as fn, a as spyOn, r as restoreAllMocks, b as resetAllMocks, c as clearAllMocks } from './spy.DPpyuUIA.js';
5
- import { v as isObject, D as getCallLastIndex, g as getType, p as noop, y as assertTypes, x as ordinal, E as createSimpleStackTrace, i as isAbsolute, a as relative, n as normalize } from './pathe.M-eThtNZ.k2RS39sQ.js';
5
+ import { u as isObject, B as getCallLastIndex, g as getType, D as noop, x as assertTypes, w as ordinal, E as createSimpleStackTrace, i as isAbsolute, a as relative, n as normalize } from './pathe.M-eThtNZ.Clq7AXhv.js';
6
6
  import { s as stringify, i as inspect } from './display.pkpxlVcY.js';
7
7
  import { y } from './tinyrainbow.Ht9iggcq.js';
8
8
  import * as chai from 'chai';
@@ -11,7 +11,7 @@ import { getNames, getTests, getTestName, createFileTask } from '../task-utils.j
11
11
  import { g as getSerializers, a as addSerializer } from './plugins.Cigb0uSy.js';
12
12
  import { p as positionToOffset, o as offsetToLineNumber, l as lineSplitRE } from './offset.Dy-5Fdfn.js';
13
13
  import { f as format } from './index.M2dsQ_UQ.js';
14
- import { r as rpc, V as VitestEvaluatedModules } from './rpc.DaPTofpf.js';
14
+ import { r as rpc, V as VitestEvaluatedModules } from './rpc.DWKX1ZbI.js';
15
15
  import { Bench } from 'tinybench';
16
16
  import { expectTypeOf } from 'expect-type';
17
17
 
@@ -815,6 +815,11 @@ class SnapshotClient {
815
815
  let { received } = options;
816
816
  if (!filepath) throw new Error("Snapshot cannot be used outside of test");
817
817
  const snapshotState = this.getSnapshotState(filepath);
818
+ if (rawSnapshot?.file === snapshotState.snapshotPath)
819
+ // note that this hard rejection is best-effort in a sense that,
820
+ // if `toMatchFileSnapshot` is called with a different test file's snapshot path,
821
+ // this check will not catch it.
822
+ throw new Error(`File snapshot cannot use the same path as the test snapshot file: ${rawSnapshot.file}`);
818
823
  const testName = [name, ...message ? [message] : []].join(" > ");
819
824
  // Probe first so we can mark as checked even on early return
820
825
  const expectedSnapshot = snapshotState.probeExpectedSnapshot({
@@ -1605,13 +1610,10 @@ function getState(expect) {
1605
1610
  }
1606
1611
  function setState(state, expect) {
1607
1612
  const map = globalThis[MATCHERS_OBJECT];
1608
- const current = map.get(expect) || {};
1613
+ const current = map.get(expect);
1609
1614
  // so it keeps getters from `testPath`
1610
- const results = Object.defineProperties(current, {
1611
- ...Object.getOwnPropertyDescriptors(current),
1612
- ...Object.getOwnPropertyDescriptors(state)
1613
- });
1614
- map.set(expect, results);
1615
+ const next = Object.defineProperties(current || {}, Object.getOwnPropertyDescriptors(state));
1616
+ if (!current) map.set(expect, next);
1615
1617
  }
1616
1618
 
1617
1619
  class AsymmetricMatcher {
@@ -8414,11 +8416,10 @@ class TestRunner {
8414
8416
  if (this.pool !== "vmThreads" && this.pool !== "vmForks") this.onCleanupWorkerContext = (listener) => this.workerState.onCleanup(listener);
8415
8417
  }
8416
8418
  importFile(filepath, source) {
8417
- const moduleNode = this.workerState.evaluatedModules.getModuleById(filepath);
8418
- if (moduleNode && (source === "setup" || moduleNode.evaluated)) this.workerState.evaluatedModules.invalidateModule(moduleNode);
8419
8419
  return this._otel.$(`vitest.module.import_${source === "setup" ? "setup" : "spec"}`, { attributes: { "code.file.path": filepath } }, () => {
8420
8420
  if (!this.viteModuleRunner) filepath = `${filepath}?vitest=${Date.now()}`;
8421
- return this.moduleRunner.import(filepath);
8421
+ const options = this.viteModuleRunner ? { invalidate: true } : void 0;
8422
+ return this.moduleRunner.import(filepath, options);
8422
8423
  });
8423
8424
  }
8424
8425
  onCollectStart(file) {