vitest 5.0.0-rc.4 → 5.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 (49) hide show
  1. package/browser/context.d.ts +1 -1
  2. package/config.d.ts +0 -2
  3. package/dist/browser.d.ts +14 -1
  4. package/dist/browser.js +7 -7
  5. package/dist/chunks/{base.DE9oA_9r.js → base.Cc3oda2V.js} +14 -14
  6. package/dist/chunks/{cac.Bf8-pv1O.js → cac.fSuRXrAx.js} +9 -9
  7. package/dist/chunks/{cli-api.rZIctZe8.js → cli-api.DcLieX4F.js} +3 -3
  8. package/dist/chunks/{console.CHi0lDgQ.js → console.B09ye7y0.js} +2 -2
  9. package/dist/chunks/{coverage.BtDxDqSU.js → coverage.AipniaqB.js} +1 -1
  10. package/dist/chunks/{coverage.BcXK1DsQ.js → coverage.CX7NN5s7.js} +1 -1
  11. package/dist/chunks/{creator.BNqrBW1W.js → creator.BEj8pIIH.js} +10 -10
  12. package/dist/chunks/{doctor.heFfAozl.js → doctor.DR3u0Z_G.js} +7 -6
  13. package/dist/chunks/{globals.xG0BzeWF.js → globals.D9ucJdZZ.js} +6 -6
  14. package/dist/chunks/{index.DQO7054M.js → index.D4dXTzh9.js} +24 -9
  15. package/dist/chunks/{index.DKvCqCMl.js → index.DNv8WNGe.js} +5 -5
  16. package/dist/chunks/{index.Cd7SnpwO.js → index.DzobfTyw.js} +3707 -3677
  17. package/dist/chunks/{index.CD2j-4_2.js → index.m3L2HgmY.js} +11 -7
  18. package/dist/chunks/{init-forks.BqnYxpzU.js → init-forks.DgHqDQHC.js} +1 -1
  19. package/dist/chunks/{init-threads.CL4Y0HC6.js → init-threads.B-t1iYCi.js} +1 -1
  20. package/dist/chunks/{init.DJ2lKyjE.js → init.3UJvPvQg.js} +4 -4
  21. package/dist/chunks/{native.cLbCmZDO.js → native.CF4uT5hY.js} +1 -1
  22. package/dist/chunks/{nativeModuleMocker.DBSXgC3F.js → nativeModuleMocker.B20FEd-E.js} +2 -2
  23. package/dist/chunks/{nativeModuleRunner.BOvBCgI_.js → nativeModuleRunner.J0QLzNtK.js} +1 -1
  24. package/dist/chunks/{node.Es9ukMGX.js → node.CfQ_OGWr.js} +1 -1
  25. package/dist/chunks/{pathe.M-eThtNZ.Clq7AXhv.js → pathe.M-eThtNZ.DwEga6ro.js} +2 -1
  26. package/dist/chunks/{plugin.d.BbcoZhuj.d.ts → plugin.d.CN87HSxv.d.ts} +3 -3
  27. package/dist/chunks/{resolver.CBCHRZ7j.js → resolver.NpfwMKt9.js} +1 -1
  28. package/dist/chunks/{rpc.DWKX1ZbI.js → rpc.Bvs-iVxs.js} +2 -2
  29. package/dist/chunks/{run.CQOUYP-x.js → run.C5UmxDPh.js} +3 -3
  30. package/dist/chunks/{setup-common.QoaKiKGk.js → setup-common.BkQOiNcI.js} +2 -2
  31. package/dist/chunks/{source-map.Dx3YPjIe.js → source-map.BH0bbrs9.js} +1 -1
  32. package/dist/chunks/{spy.DPpyuUIA.js → spy.DQ0ZsPbi.js} +20 -4
  33. package/dist/chunks/{utils.CtqmNjXD.js → utils.CJ0JImL8.js} +1 -1
  34. package/dist/chunks/{vm.DhWYFrLG.js → vm.W4G5WMTl.js} +6 -6
  35. package/dist/cli.js +2 -2
  36. package/dist/config.d.ts +2 -2
  37. package/dist/index.js +6 -6
  38. package/dist/node.d.ts +2 -2
  39. package/dist/node.js +14 -14
  40. package/dist/runtime.js +4 -4
  41. package/dist/spy.js +1 -1
  42. package/dist/task-utils.js +1 -1
  43. package/dist/worker.js +13 -13
  44. package/dist/workers/forks.js +14 -14
  45. package/dist/workers/runVmTests.js +10 -10
  46. package/dist/workers/threads.js +14 -14
  47. package/dist/workers/vmForks.js +10 -10
  48. package/dist/workers/vmThreads.js +10 -10
  49. package/package.json +12 -12
@@ -4,4 +4,4 @@ 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, CDPSession, FsOptions } from 'vitest/internal/browser'
7
+ export { BrowserCommands, BrowserTraceEntryKind, CDPSession, FsOptions, MarkOptions } from 'vitest/internal/browser'
package/config.d.ts CHANGED
@@ -1,3 +1 @@
1
- // ensure `@vitest/expect` provides `chai` types
2
- import type {} from '@vitest/expect'
3
1
  export * from './dist/config.js'
package/dist/browser.d.ts CHANGED
@@ -59,6 +59,19 @@ interface BrowserCommands {
59
59
  removeFile: (path: string) => Promise<void>;
60
60
  }
61
61
  interface CDPSession {}
62
+ type BrowserTraceEntryKind = "action" | "expect" | "mark" | "lifecycle";
63
+ interface MarkOptions {
64
+ /**
65
+ * Optional stack string used to resolve marker location.
66
+ * Useful for wrapper libraries that need to forward the end-user callsite.
67
+ */
68
+ stack?: string;
69
+ /**
70
+ * Optional marker kind that's used to categorize the marker in the trace viewer.
71
+ * @default 'mark'
72
+ */
73
+ kind?: BrowserTraceEntryKind;
74
+ }
62
75
 
63
76
  export { FileSpecification, publicCollect as collectTests, getSafeTimers, getType, loadDiffConfig, loadSnapshotSerializers, processError, setSafeTimers, setupCommonEnv, setupEnv, startCoverageInsideWorker, startTests, stopCoverageInsideWorker, takeCoverageInsideWorker };
64
- export type { BrowserCommands, CDPSession, FsOptions };
77
+ export type { BrowserCommands, BrowserTraceEntryKind, CDPSession, FsOptions, MarkOptions };
package/dist/browser.js CHANGED
@@ -1,11 +1,11 @@
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.CQOUYP-x.js';
3
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as setupEnv } from './chunks/setup-common.QoaKiKGk.js';
4
- export { s as SpyModule } from './chunks/spy.DPpyuUIA.js';
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.BkQOiNcI.js';
4
+ export { s as SpyModule } from './chunks/spy.DQ0ZsPbi.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.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';
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
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
- import { s as spyModule } from './spy.DPpyuUIA.js';
3
- import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.DKvCqCMl.js';
4
- import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.DJ2lKyjE.js';
2
+ import { s as spyModule } from './spy.DQ0ZsPbi.js';
3
+ import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.DNv8WNGe.js';
4
+ import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.3UJvPvQg.js';
5
5
  import { Traces } from '../traces.js';
6
- import { V as VitestEvaluatedModules } from './rpc.DWKX1ZbI.js';
7
- import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.DQO7054M.js';
6
+ import { V as VitestEvaluatedModules } from './rpc.Bvs-iVxs.js';
7
+ import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.D4dXTzh9.js';
8
8
  import { performance as performance$1 } from 'node:perf_hooks';
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.CD2j-4_2.js';
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.m3L2HgmY.js';
11
11
  import { c as closeInspector } from './inspector.CvyFGlXm.js';
12
- import { s as startTests, p as publicCollect } from './run.CQOUYP-x.js';
12
+ import { s as startTests, p as publicCollect } from './run.C5UmxDPh.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.Clq7AXhv.js';
18
- import { s as setupCommonEnv, b as setupEnv } from './setup-common.QoaKiKGk.js';
17
+ import { K as KNOWN_ASSET_TYPES } from './pathe.M-eThtNZ.DwEga6ro.js';
18
+ import { s as setupCommonEnv, b as setupEnv } from './setup-common.BkQOiNcI.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.CHi0lDgQ.js');
60
+ const { createCustomConsole } = await import('./console.B09ye7y0.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.DBSXgC3F.js');
122
+ const { NativeModuleMocker } = await import('./nativeModuleMocker.B20FEd-E.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.BOvBCgI_.js').then(function (n) { return n.n; });
139
+ const { NativeModuleRunner } = await import('./nativeModuleRunner.J0QLzNtK.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.cLbCmZDO.js');
151
+ const { setupNodeLoaderHooks } = await import('./native.CF4uT5hY.js');
152
152
  await setupNodeLoaderHooks(context);
153
153
  }
154
154
  const startTime = performance.now();
@@ -1,4 +1,4 @@
1
- import { n as normalize, t as toArray } from './pathe.M-eThtNZ.Clq7AXhv.js';
1
+ import { n as normalize, t as toArray } from './pathe.M-eThtNZ.DwEga6ro.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.4";
623
+ var version = "5.0.1";
624
624
 
625
625
  const apiConfig = (port) => ({
626
626
  port: {
@@ -2366,11 +2366,11 @@ function normalizeCliOptions(cliFilters, argv) {
2366
2366
  }
2367
2367
  async function start(cliFilters, options) {
2368
2368
  try {
2369
- const { startVitest } = await import('./cli-api.rZIctZe8.js').then(function (n) { return n.a; });
2369
+ const { startVitest } = await import('./cli-api.DcLieX4F.js').then(function (n) { return n.a; });
2370
2370
  const ctx = await startVitest(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2371
2371
  if (!ctx.shouldKeepServer()) await ctx.exit();
2372
2372
  } catch (e) {
2373
- const { errorBanner } = await import('./utils.CtqmNjXD.js').then(function (n) { return n.u; });
2373
+ const { errorBanner } = await import('./utils.CJ0JImL8.js').then(function (n) { return n.u; });
2374
2374
  console.error(`\n${errorBanner("Startup Error")}`);
2375
2375
  console.error(e);
2376
2376
  console.error("\n\n");
@@ -2380,11 +2380,11 @@ async function start(cliFilters, options) {
2380
2380
  }
2381
2381
  async function doctorCommand(cliFilters, options) {
2382
2382
  try {
2383
- const { doctor } = await import('./doctor.heFfAozl.js');
2383
+ const { doctor } = await import('./doctor.DR3u0Z_G.js');
2384
2384
  await doctor(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2385
2385
  process.exit();
2386
2386
  } catch (e) {
2387
- const { errorBanner } = await import('./utils.CtqmNjXD.js').then(function (n) { return n.u; });
2387
+ const { errorBanner } = await import('./utils.CJ0JImL8.js').then(function (n) { return n.u; });
2388
2388
  console.error(`\n${errorBanner("Doctor Error")}`);
2389
2389
  console.error(e);
2390
2390
  console.error("\n\n");
@@ -2397,12 +2397,12 @@ async function init(project) {
2397
2397
  console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
2398
2398
  process.exit(1);
2399
2399
  }
2400
- const { create } = await import('./creator.BNqrBW1W.js');
2400
+ const { create } = await import('./creator.BEj8pIIH.js');
2401
2401
  await create();
2402
2402
  }
2403
2403
  async function collect(cliFilters, options) {
2404
2404
  try {
2405
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.rZIctZe8.js').then(function (n) { return n.a; });
2405
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.DcLieX4F.js').then(function (n) { return n.a; });
2406
2406
  const ctx = await prepareVitest({
2407
2407
  ...normalizeCliOptions(cliFilters, options),
2408
2408
  watch: false,
@@ -2424,7 +2424,7 @@ async function collect(cliFilters, options) {
2424
2424
  } else outputFileList(await ctx.getRelevantTestSpecifications(cliFilters.map(normalize)), options);
2425
2425
  await ctx.close();
2426
2426
  } catch (e) {
2427
- const { errorBanner } = await import('./utils.CtqmNjXD.js').then(function (n) { return n.u; });
2427
+ const { errorBanner } = await import('./utils.CJ0JImL8.js').then(function (n) { return n.u; });
2428
2428
  console.error(`\n${errorBanner("Collect Error")}`);
2429
2429
  console.error(e);
2430
2430
  console.error("\n\n");
@@ -1,11 +1,11 @@
1
1
  import { mkdirSync, writeFileSync } from 'node:fs';
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.Cd7SnpwO.js';
2
+ import { C as CoverageProviderMap } from './coverage.CX7NN5s7.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.DzobfTyw.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.Clq7AXhv.js';
8
+ import { e as createDefer, a as relative, r as resolve, d as dirname, i as isAbsolute } from './pathe.M-eThtNZ.DwEga6ro.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.Dx3YPjIe.js';
4
+ import { a as getSafeTimers } from './source-map.BH0bbrs9.js';
5
5
  import { y } from './tinyrainbow.Ht9iggcq.js';
6
6
  import { g as getWorkerState } from './utils.DYj33du9.js';
7
- import './pathe.M-eThtNZ.Clq7AXhv.js';
7
+ import './pathe.M-eThtNZ.DwEga6ro.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 resolveCoverageProviderModule } from './coverage.BcXK1DsQ.js';
1
+ import { r as resolveCoverageProviderModule } from './coverage.CX7NN5s7.js';
2
2
 
3
3
  async function startCoverageInsideWorker(options, loader, runtimeOptions) {
4
4
  const coverageModule = await resolveCoverageProviderModule(options, loader);
@@ -1,4 +1,4 @@
1
- import { r as resolve } from './pathe.M-eThtNZ.Clq7AXhv.js';
1
+ import { r as resolve } from './pathe.M-eThtNZ.DwEga6ro.js';
2
2
 
3
3
  function getCoverageFilesDirectory(reportsDirectory, shard) {
4
4
  return resolve(reportsDirectory, `.tmp${shard ? `-${shard.index}-${shard.count}` : ""}`);
@@ -2,14 +2,14 @@ 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 { y as prompt, z as findConfigFile } from './index.Cd7SnpwO.js';
5
+ import { y as prompt, z as findConfigFile } from './index.DzobfTyw.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.Clq7AXhv.js';
11
- import './source-map.Dx3YPjIe.js';
12
- import './cac.Bf8-pv1O.js';
10
+ import './pathe.M-eThtNZ.DwEga6ro.js';
11
+ import './source-map.BH0bbrs9.js';
12
+ import './cac.fSuRXrAx.js';
13
13
  import 'events';
14
14
  import './env.DzFJjrmK.js';
15
15
  import 'std-env';
@@ -31,17 +31,19 @@ import 'vite';
31
31
  import 'node:crypto';
32
32
  import '../path.js';
33
33
  import 'node:url';
34
- import './run.CQOUYP-x.js';
34
+ import './run.C5UmxDPh.js';
35
35
  import './index.M2dsQ_UQ.js';
36
36
  import './display.pkpxlVcY.js';
37
37
  import '../task-utils.js';
38
- import './nativeModuleRunner.BOvBCgI_.js';
38
+ import './nativeModuleRunner.J0QLzNtK.js';
39
39
  import 'node:module';
40
40
  import 'node:v8';
41
41
  import 'node:util';
42
42
  import 'vite/module-runner';
43
43
  import '../traces.js';
44
44
  import 'obug';
45
+ import './resolver.NpfwMKt9.js';
46
+ import 'es-module-lexer';
45
47
  import 'tinyglobby';
46
48
  import './defaults.D2ip7f-X.js';
47
49
  import 'magic-string';
@@ -49,12 +51,10 @@ import '@vitest/mocker/node';
49
51
  import 'node:console';
50
52
  import 'node:stream';
51
53
  import './offset.Dy-5Fdfn.js';
52
- import './utils.CtqmNjXD.js';
54
+ import './utils.CJ0JImL8.js';
53
55
  import '#module-evaluator';
54
56
  import 'picomatch';
55
- import './coverage.BcXK1DsQ.js';
56
- import './resolver.CBCHRZ7j.js';
57
- import 'es-module-lexer';
57
+ import './coverage.CX7NN5s7.js';
58
58
  import 'node:tty';
59
59
  import 'node:events';
60
60
  import './modules.BJuCwlRJ.js';
@@ -4,11 +4,12 @@ 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.Clq7AXhv.js';
7
+ import { t as toArray, r as resolve } from './pathe.M-eThtNZ.DwEga6ro.js';
8
8
  import { y } from './tinyrainbow.Ht9iggcq.js';
9
9
  import { distDir } from '../path.js';
10
10
 
11
- const DOM_ENVIRONMENTS = /* @__PURE__ */ new Set(["jsdom", "happy-dom"]);
11
+ // custom environments are measured too: the run fails if they lack setupVM
12
+ const ENVIRONMENTS_WITHOUT_VM_UPSIDE = /* @__PURE__ */ new Set(["node", "edge-runtime"]);
12
13
  /**
13
14
  * Builds the list of configurations worth measuring for this config. The
14
15
  * candidates are pruned by what the config already uses - there is no point
@@ -22,7 +23,7 @@ function resolveDoctorCandidates(projects, options = {}) {
22
23
  const testProjects = projects.filter((project) => !project.browser);
23
24
  const pools = new Set(testProjects.map((project) => project.pool));
24
25
  const usesVmPool = pools.has("vmThreads") || pools.has("vmForks");
25
- const runsDom = testProjects.some((project) => DOM_ENVIRONMENTS.has(project.environment));
26
+ const benefitsFromVm = testProjects.some((project) => !ENVIRONMENTS_WITHOUT_VM_UPSIDE.has(project.environment));
26
27
  const isolates = projects.some((project) => project.isolate && (project.browser || project.pool !== "vmThreads" && project.pool !== "vmForks"));
27
28
  if (pools.has("forks")) candidates.push({
28
29
  id: "threads",
@@ -31,7 +32,7 @@ function resolveDoctorCandidates(projects, options = {}) {
31
32
  configLines: [`pool: 'threads'`],
32
33
  preservesIsolation: true
33
34
  });
34
- if (runsDom && !pools.has("vmThreads")) candidates.push({
35
+ if (benefitsFromVm && !pools.has("vmThreads")) candidates.push({
35
36
  id: "vmThreads",
36
37
  title: `pool: 'vmThreads'`,
37
38
  overrides: { pool: "vmThreads" },
@@ -41,7 +42,7 @@ function resolveDoctorCandidates(projects, options = {}) {
41
42
  // vmForks trades vmThreads' worker threads for child processes: each child
42
43
  // gets its own heap and GC, which can beat vmThreads on GC-heavy suites, and
43
44
  // it is the vm option for suites that cannot run in worker threads
44
- if (runsDom && !pools.has("vmForks")) candidates.push({
45
+ if (benefitsFromVm && !pools.has("vmForks")) candidates.push({
45
46
  id: "vmForks",
46
47
  title: `pool: 'vmForks'`,
47
48
  overrides: { pool: "vmForks" },
@@ -99,7 +100,7 @@ function log(...args) {
99
100
  console.log(...args);
100
101
  }
101
102
  async function doctor(cliFilters, options) {
102
- const { prepareVitest } = await import('./cli-api.rZIctZe8.js').then(function (n) { return n.a; });
103
+ const { prepareVitest } = await import('./cli-api.DcLieX4F.js').then(function (n) { return n.a; });
103
104
  log();
104
105
  log(y.inverse(y.bold(y.blue(" DOCTOR "))), "resolving the current configuration...");
105
106
  const ctx = await prepareVitest({
@@ -1,18 +1,18 @@
1
1
  import { g as globalApis } from './constants.-juJ8b_4.js';
2
- import { i as index } from './index.CD2j-4_2.js';
3
- import './run.CQOUYP-x.js';
2
+ import { i as index } from './index.m3L2HgmY.js';
3
+ import './run.C5UmxDPh.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.Clq7AXhv.js';
8
- import './source-map.Dx3YPjIe.js';
7
+ import './pathe.M-eThtNZ.DwEga6ro.js';
8
+ import './source-map.BH0bbrs9.js';
9
9
  import '../task-utils.js';
10
10
  import './utils.DYj33du9.js';
11
- import './spy.DPpyuUIA.js';
11
+ import './spy.DQ0ZsPbi.js';
12
12
  import 'chai';
13
13
  import './plugins.Cigb0uSy.js';
14
14
  import './offset.Dy-5Fdfn.js';
15
- import './rpc.DWKX1ZbI.js';
15
+ import './rpc.Bvs-iVxs.js';
16
16
  import 'vite/module-runner';
17
17
  import './index.DmDMHCg8.js';
18
18
  import 'tinybench';
@@ -1,5 +1,5 @@
1
1
  import fs__default from 'node:fs';
2
- import { n as normalize, k as splitFileAndPostfix$1, j as join, l as isBareImport } from './pathe.M-eThtNZ.Clq7AXhv.js';
2
+ import { n as normalize, k as splitFileAndPostfix$1, j as join, l as isBareImport } from './pathe.M-eThtNZ.DwEga6ro.js';
3
3
  import { i as isBuiltin, a as isBrowserExternal, t as toBuiltin } from './modules.BJuCwlRJ.js';
4
4
  import { E as EnvironmentTeardownError, a as getSafeWorkerState } from './utils.DYj33du9.js';
5
5
  import { pathToFileURL, URL as URL$1 } from 'node:url';
@@ -103,17 +103,27 @@ class BareModuleMocker {
103
103
  }
104
104
  async resolveMocks() {
105
105
  if (!BareModuleMocker.pendingIds.length) return;
106
+ const pendingIds = BareModuleMocker.pendingIds;
107
+ BareModuleMocker.pendingIds = [];
106
108
  const resolveMock = async (mock) => {
107
- const { id, url, external } = await this.resolveId(mock.id, mock.importer);
108
- if (mock.action === "unmock") this.unmockPath(id);
109
- if (mock.action === "mock") this.mockPath(mock.id, id, url, external, mock.type, mock.factory);
109
+ return {
110
+ mock,
111
+ ...await this.resolveId(mock.id, mock.importer)
112
+ };
110
113
  };
111
114
  // group consecutive mocks of the same action type together,
112
115
  // resolve in parallel inside each group, but run groups sequentially
113
116
  // to preserve mock/unmock ordering
114
- const groups = groupByConsecutiveAction(BareModuleMocker.pendingIds);
115
- for (const group of groups) await Promise.all(group.map(resolveMock));
116
- BareModuleMocker.pendingIds = [];
117
+ const groups = groupByConsecutiveAction(pendingIds);
118
+ for (const group of groups) {
119
+ // apply in queue order: two mocks of the same path can resolve out of
120
+ // order, and the last queued one must win
121
+ const resolvedGroup = await Promise.all(group.map(resolveMock));
122
+ for (const { mock, id, url, external } of resolvedGroup) {
123
+ if (mock.action === "unmock") this.unmockPath(id);
124
+ if (mock.action === "mock") this.mockPath(mock.id, id, url, external, mock.type, mock.factory);
125
+ }
126
+ }
117
127
  }
118
128
  // public method to avoid circular dependency
119
129
  getMockContext() {
@@ -609,6 +619,11 @@ const bareVitestRegexp = /^@?vitest(?:\/|$)/;
609
619
  const normalizedDistDir = normalize(distDir);
610
620
  const relativeIds = {};
611
621
  const externalizeMap = /* @__PURE__ */ new Map();
622
+ function getRelativeDistDir(root) {
623
+ const normalizedRoot = normalize(root).replace(/\/+$/, "") || "/";
624
+ const rootPrefix = normalizedRoot === "/" ? normalizedRoot : `${normalizedRoot}/`;
625
+ return normalizedDistDir.startsWith(rootPrefix) ? normalizedDistDir.slice(normalizedRoot.length) : "";
626
+ }
612
627
  // all Vitest imports always need to be externalized
613
628
  function getCachedVitestImport(id, state) {
614
629
  if (id.startsWith("/@fs/") || id.startsWith("\\@fs\\")) id = id.slice(process.platform === "win32" ? 5 : 4);
@@ -619,7 +634,7 @@ function getCachedVitestImport(id, state) {
619
634
  // always externalize Vitest because we import from there before running tests
620
635
  // so we already have it cached by Node.js
621
636
  const root = state().config.root;
622
- const relativeRoot = relativeIds[root] ?? (relativeIds[root] = normalizedDistDir.slice(root.length));
637
+ const relativeRoot = relativeIds[root] ?? (relativeIds[root] = getRelativeDistDir(root));
623
638
  if (id.includes(distDir) || id.includes(normalizedDistDir)) {
624
639
  const { file, postfix } = splitFileAndPostfix$1(id);
625
640
  const externalize = id.startsWith("file://") ? id : `${pathToFileURL(file)}${postfix}`;
@@ -732,7 +747,7 @@ function startVitestModuleRunner(options) {
732
747
  const vitest = getCachedVitestImport(id, state);
733
748
  if (vitest) return vitest;
734
749
  // strip _vitest_original query added by importActual so that
735
- // the plugin pipeline sees the original import id (e.g. virtual modules's load hook)
750
+ // the plugin pipeline sees the original import id (e.g. virtual modules' load hook)
736
751
  const isImportActual = id.includes("_vitest_original");
737
752
  if (isImportActual) id = removeQuery(id, "_vitest_original");
738
753
  const rawId = unwrapId(id);
@@ -1,10 +1,10 @@
1
1
  import * as chai from 'chai';
2
2
  import { createHook } from 'node:async_hooks';
3
- import { t as takeCoverageInsideWorker } from './coverage.BtDxDqSU.js';
4
- import { r as rpc } from './rpc.DWKX1ZbI.js';
5
- import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.QoaKiKGk.js';
3
+ import { t as takeCoverageInsideWorker } from './coverage.AipniaqB.js';
4
+ import { r as rpc } from './rpc.Bvs-iVxs.js';
5
+ import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.BkQOiNcI.js';
6
6
  import { g as getWorkerState } from './utils.DYj33du9.js';
7
- import { T as TestRunner } from './index.CD2j-4_2.js';
7
+ import { T as TestRunner } from './index.m3L2HgmY.js';
8
8
 
9
9
  function setupChaiConfig(config) {
10
10
  Object.assign(chai.config, config);
@@ -12,7 +12,7 @@ function setupChaiConfig(config) {
12
12
 
13
13
  async function resolveSnapshotEnvironment(config, moduleRunner) {
14
14
  if (!config.snapshotEnvironment) {
15
- const { VitestNodeSnapshotEnvironment } = await import('./node.Es9ukMGX.js');
15
+ const { VitestNodeSnapshotEnvironment } = await import('./node.CfQ_OGWr.js');
16
16
  return new VitestNodeSnapshotEnvironment();
17
17
  }
18
18
  const mod = await moduleRunner.import(config.snapshotEnvironment);