vitest 5.0.1 → 5.0.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 (70) hide show
  1. package/LICENSE.md +28 -0
  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 +10 -10
  6. package/dist/chunks/{base.Cc3oda2V.js → base.DhkQeZwd.js} +14 -14
  7. package/dist/chunks/{browser.d.g5Thl309.d.ts → browser.d.3cffPS1V.d.ts} +3 -3
  8. package/dist/chunks/{cac.fSuRXrAx.js → cac.DfDGTQ9W.js} +13 -13
  9. package/dist/chunks/{cli-api.DcLieX4F.js → cli-api.C4x4GGip.js} +5 -5
  10. package/dist/chunks/{config.d.CU_b-wJj.d.ts → config.d.BxjInJat.d.ts} +13 -15
  11. package/dist/chunks/{console.B09ye7y0.js → console.RBA5x-0t.js} +3 -2
  12. package/dist/chunks/{coverage.AipniaqB.js → coverage.S6Dao4g-.js} +1 -1
  13. package/dist/chunks/{coverage.CX7NN5s7.js → coverage._yXj5zeb.js} +1 -1
  14. package/dist/chunks/{creator.BEj8pIIH.js → creator.203NYCo3.js} +12 -12
  15. package/dist/chunks/{display.pkpxlVcY.js → display.CXBnkt9a.js} +1 -1
  16. package/dist/chunks/{doctor.DR3u0Z_G.js → doctor.CpHPRoza.js} +2 -2
  17. package/dist/chunks/{environment.d.C6xYahWA.d.ts → environment.d.DAj1Vt__.d.ts} +1 -1
  18. package/dist/chunks/{globals.D9ucJdZZ.js → globals.9QtHn8Sr.js} +9 -9
  19. package/dist/chunks/{index.m3L2HgmY.js → index.C4tKZ0yW.js} +29 -15
  20. package/dist/chunks/{index.DzobfTyw.js → index.DpLw24bj.js} +177 -85
  21. package/dist/chunks/{index.M2dsQ_UQ.js → index.cx-_w29y.js} +551 -179
  22. package/dist/chunks/{index.DNv8WNGe.js → index.ggMXe2IF.js} +17 -7
  23. package/dist/chunks/{index.D4dXTzh9.js → index.k8L_ZRzq.js} +24 -7
  24. package/dist/chunks/{init-forks.DgHqDQHC.js → init-forks.hzLs7kMZ.js} +1 -1
  25. package/dist/chunks/{init-threads.B-t1iYCi.js → init-threads.COb0VD5D.js} +1 -1
  26. package/dist/chunks/{init.3UJvPvQg.js → init.D0qF-GGk.js} +4 -5
  27. package/dist/chunks/{native.CF4uT5hY.js → native.CBlba4VV.js} +2 -2
  28. package/dist/chunks/{nativeModuleMocker.B20FEd-E.js → nativeModuleMocker.CXSh3m91.js} +2 -2
  29. package/dist/chunks/{nativeModuleRunner.J0QLzNtK.js → nativeModuleRunner.jwZPY3dg.js} +1 -1
  30. package/dist/chunks/{node.CfQ_OGWr.js → node.BzimPqT5.js} +1 -1
  31. package/dist/chunks/{pathe.M-eThtNZ.DwEga6ro.js → pathe.M-eThtNZ.CknpM8Or.js} +1 -1
  32. package/dist/chunks/{plugin.d.CN87HSxv.d.ts → plugin.d.BsjqSb4-.d.ts} +35 -27
  33. package/dist/chunks/{plugins.Cigb0uSy.js → plugins.D2ut1V9b.js} +1 -1
  34. package/dist/chunks/{resolver.NpfwMKt9.js → resolver.fbW9AUvG.js} +1 -1
  35. package/dist/chunks/{rpc.Bvs-iVxs.js → rpc.BTmCtPly.js} +8 -6
  36. package/dist/chunks/{rpc.d.DA9Utv4e.d.ts → rpc.d.BPFHl-HE.d.ts} +1 -1
  37. package/dist/chunks/{run.C5UmxDPh.js → run.BTlFXlnv.js} +29 -19
  38. package/dist/chunks/{setup-common.BkQOiNcI.js → setup-common.BglbuAHD.js} +3 -3
  39. package/dist/chunks/{source-map.BH0bbrs9.js → source-map.DUxvo12T.js} +4 -8
  40. package/dist/chunks/{source-map.d.YqWNcp4e.d.ts → source-map.d.BLHtC2OB.d.ts} +1 -1
  41. package/dist/chunks/{spy.DQ0ZsPbi.js → spy.DgMTfhrK.js} +21 -18
  42. package/dist/chunks/{task-utils.d.BZm4GSQD.d.ts → task-utils.d.C-IeGxLU.d.ts} +1 -1
  43. package/dist/chunks/{utils.CJ0JImL8.js → utils.RcGwuOc_.js} +2 -2
  44. package/dist/chunks/{vm.W4G5WMTl.js → vm.vTyZj_02.js} +8 -8
  45. package/dist/chunks/{worker.d.MLmnzOJE.d.ts → worker.d.Bt2A2mmi.d.ts} +3 -3
  46. package/dist/cli.js +2 -2
  47. package/dist/config.d.ts +9 -9
  48. package/dist/index.d.ts +10 -10
  49. package/dist/index.js +9 -9
  50. package/dist/module-evaluator.d.ts +3 -2
  51. package/dist/module-evaluator.js +8 -5
  52. package/dist/node.d.ts +9 -9
  53. package/dist/node.js +14 -14
  54. package/dist/runtime.d.ts +6 -6
  55. package/dist/runtime.js +4 -4
  56. package/dist/spy.js +1 -1
  57. package/dist/task-utils.js +2 -1
  58. package/dist/worker.d.ts +4 -4
  59. package/dist/worker.js +17 -17
  60. package/dist/workers/forks.js +18 -18
  61. package/dist/workers/runVmTests.js +14 -14
  62. package/dist/workers/threads.js +18 -18
  63. package/dist/workers/vmForks.js +12 -12
  64. package/dist/workers/vmThreads.js +12 -12
  65. package/globals.d.ts +19 -19
  66. package/index.cjs +3 -3
  67. package/optional-runtime-types.d.ts +1 -1
  68. package/optional-types.d.ts +1 -1
  69. package/package.json +22 -17
  70. package/suppress-warnings.cjs +1 -1
@@ -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.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';
3
+ import { t as takeCoverageInsideWorker } from './coverage.S6Dao4g-.js';
4
+ import { r as rpc } from './rpc.BTmCtPly.js';
5
+ import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.BglbuAHD.js';
6
6
  import { g as getWorkerState } from './utils.DYj33du9.js';
7
- import { T as TestRunner } from './index.m3L2HgmY.js';
7
+ import { T as TestRunner } from './index.C4tKZ0yW.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.CfQ_OGWr.js');
15
+ const { VitestNodeSnapshotEnvironment } = await import('./node.BzimPqT5.js');
16
16
  return new VitestNodeSnapshotEnvironment();
17
17
  }
18
18
  const mod = await moduleRunner.import(config.snapshotEnvironment);
@@ -32,6 +32,7 @@ const IGNORED_TYPES = /* @__PURE__ */ new Set([
32
32
  "TLSWRAP",
33
33
  "ZLIB"
34
34
  ]);
35
+ const STDIO_TYPES = /* @__PURE__ */ new Set(["PIPEWRAP", "TTYWRAP"]);
35
36
  function detectAsyncLeaks(testFile, projectName) {
36
37
  const resources = /* @__PURE__ */ new Map();
37
38
  const hook = createHook({
@@ -64,7 +65,8 @@ function detectAsyncLeaks(testFile, projectName) {
64
65
  stack,
65
66
  projectName,
66
67
  filename: testFile,
67
- isActive
68
+ isActive,
69
+ handle: STDIO_TYPES.has(type) ? new WeakRef(resource) : void 0
68
70
  });
69
71
  },
70
72
  destroy(asyncId) {
@@ -79,7 +81,7 @@ function detectAsyncLeaks(testFile, projectName) {
79
81
  await new Promise((resolve) => setImmediate(resolve));
80
82
  hook.disable();
81
83
  const leaks = [];
82
- for (const resource of resources.values()) if (resource.isActive()) leaks.push({
84
+ for (const resource of resources.values()) if (resource.isActive() && !isStdioHandle(resource.handle?.deref())) leaks.push({
83
85
  stack: resource.stack,
84
86
  type: resource.type,
85
87
  filename: resource.filename,
@@ -92,6 +94,14 @@ function detectAsyncLeaks(testFile, projectName) {
92
94
  function isActiveDefault() {
93
95
  return true;
94
96
  }
97
+ function isStdioHandle(handle) {
98
+ if (!handle) return false;
99
+ return [
100
+ process.stdin,
101
+ process.stdout,
102
+ process.stderr
103
+ ].some((stream) => stream._handle === handle);
104
+ }
95
105
 
96
106
  async function getTestRunnerConstructor(config, moduleRunner) {
97
107
  if (!config.runner) return TestRunner;
@@ -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.DwEga6ro.js';
2
+ import { n as normalize, k as splitFileAndPostfix$1, j as join, l as isBareImport } from './pathe.M-eThtNZ.CknpM8Or.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';
@@ -11,6 +11,7 @@ import { MockerRegistry, mockObject, RedirectedModule, AutomockedModule } from '
11
11
  import { findMockRedirect } from '@vitest/mocker/redirect';
12
12
  import * as viteModuleRunner from 'vite/module-runner';
13
13
  import { Traces } from '../traces.js';
14
+ import { createRequire } from 'node:module';
14
15
  import { Console } from 'node:console';
15
16
 
16
17
  class BareModuleMocker {
@@ -615,6 +616,7 @@ class VitestModuleRunner extends viteModuleRunner.ModuleRunner {
615
616
  }
616
617
  }
617
618
 
619
+ const platform = process.platform;
618
620
  const bareVitestRegexp = /^@?vitest(?:\/|$)/;
619
621
  const normalizedDistDir = normalize(distDir);
620
622
  const relativeIds = {};
@@ -626,7 +628,7 @@ function getRelativeDistDir(root) {
626
628
  }
627
629
  // all Vitest imports always need to be externalized
628
630
  function getCachedVitestImport(id, state) {
629
- if (id.startsWith("/@fs/") || id.startsWith("\\@fs\\")) id = id.slice(process.platform === "win32" ? 5 : 4);
631
+ if (id.startsWith("/@fs/") || id.startsWith("\\@fs\\")) id = id.slice(platform === "win32" ? 5 : 4);
630
632
  if (externalizeMap.has(id)) return {
631
633
  externalize: externalizeMap.get(id),
632
634
  type: "module"
@@ -725,6 +727,7 @@ function startVitestModuleRunner(options) {
725
727
  return state().config.injectCjsGlobals;
726
728
  },
727
729
  getCurrentTestFilepath: () => state().filepath,
730
+ getEnvironmentName: environment,
728
731
  getterTracker: state().getterTracker
729
732
  });
730
733
  const moduleRunner = new VitestModuleRunner({
@@ -1418,10 +1421,22 @@ function createJSDOMCompatURL(utils) {
1418
1421
  }
1419
1422
  return URL;
1420
1423
  }
1424
+ // jsdom keeps Blob bytes on an internal "impl" object and exposes no synchronous
1425
+ // public way to read them, so this reaches into its generated bindings
1426
+ function createBlobImplGetter(window) {
1427
+ const _require = createRequire(import.meta.url);
1428
+ // jsdom 28.1 moved the generated bindings; jsdom has no "exports" map, so both subpaths resolve
1429
+ for (const id of ["jsdom/lib/generated/idl/utils.js", "jsdom/lib/jsdom/living/generated/utils.js"]) try {
1430
+ const { implForWrapper } = _require(id);
1431
+ if (typeof implForWrapper === "function") return implForWrapper;
1432
+ } catch {}
1433
+ // jsdom < 30.1 also stores the impl under an own Symbol("impl")
1434
+ const implSymbol = Object.getOwnPropertySymbols(new window.Blob())[0];
1435
+ return (blob) => blob[implSymbol];
1436
+ }
1437
+ let getBlobImpl;
1421
1438
  function createCompatUtils(window) {
1422
- // this returns a hidden Symbol(impl)
1423
- // this is cursed, and jsdom should just implement fetch API itself
1424
- const implSymbol = Object.getOwnPropertySymbols(Object.getOwnPropertyDescriptors(new window.Blob()))[0];
1439
+ getBlobImpl ??= createBlobImplGetter(window);
1425
1440
  const utils = {
1426
1441
  window,
1427
1442
  makeCompatFormData(formData) {
@@ -1433,8 +1448,10 @@ function createCompatUtils(window) {
1433
1448
  return nodeFormData;
1434
1449
  },
1435
1450
  makeCompatBlob(blob) {
1436
- const buffer = blob[implSymbol]._buffer;
1437
- return new NodeBlob_([buffer], { type: blob.type });
1451
+ const impl = getBlobImpl(blob);
1452
+ if (!impl) throw new TypeError("Vitest cannot read the bytes of a jsdom Blob. This is a Vitest bug, please report it with your jsdom version.");
1453
+ // jsdom 28 renamed `_buffer` to `_bytes`
1454
+ return new NodeBlob_([impl._bytes ?? impl._buffer], { type: blob.type });
1438
1455
  }
1439
1456
  };
1440
1457
  return utils;
@@ -1,4 +1,4 @@
1
- import { i as init } from './init.3UJvPvQg.js';
1
+ import { i as init } from './init.D0qF-GGk.js';
2
2
 
3
3
  if (!process.send) throw new Error("Expected worker to be run in node:child_process");
4
4
  // Store globals in case tests overwrite them
@@ -1,5 +1,5 @@
1
1
  import { isMainThread, parentPort } from 'node:worker_threads';
2
- import { i as init } from './init.3UJvPvQg.js';
2
+ import { i as init } from './init.D0qF-GGk.js';
3
3
 
4
4
  if (isMainThread || !parentPort) throw new Error("Expected worker to be run in node:worker_threads");
5
5
  function workerInit(options) {
@@ -2,13 +2,12 @@ import { readFileSync } from 'node:fs';
2
2
  import module$1, { isBuiltin } from 'node:module';
3
3
  import { pathToFileURL } from 'node:url';
4
4
  import { EvaluatedModules, ModuleRunner } from 'vite/module-runner';
5
- import { e as environments, b as VitestTransport } from './index.D4dXTzh9.js';
6
- import { r as resolve } from './pathe.M-eThtNZ.DwEga6ro.js';
7
- import { b as serializeValue, c as createStackString, p as parseStacktrace } from './source-map.BH0bbrs9.js';
8
- import './index.M2dsQ_UQ.js';
5
+ import { e as environments, b as VitestTransport } from './index.k8L_ZRzq.js';
6
+ import { r as resolve } from './pathe.M-eThtNZ.CknpM8Or.js';
7
+ import { b as serializeValue, c as createStackString, p as parseStacktrace } from './source-map.DUxvo12T.js';
9
8
  import { m } from './tinyrainbow.Ht9iggcq.js';
10
9
  import { Traces } from '../traces.js';
11
- import { o as onCancel, V as VitestEvaluatedModules, a as rpcDone, c as createRuntimeRpc } from './rpc.Bvs-iVxs.js';
10
+ import { o as onCancel, V as VitestEvaluatedModules, a as rpcDone, c as createRuntimeRpc } from './rpc.BTmCtPly.js';
12
11
  import { s as setupInspect } from './inspector.CvyFGlXm.js';
13
12
  import { E as EnvironmentTeardownError } from './utils.DYj33du9.js';
14
13
 
@@ -2,7 +2,7 @@ import module$1, { isBuiltin } from 'node:module';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import { MessageChannel } from 'node:worker_threads';
4
4
  import { initSyntaxLexers, hoistMocks } from '@vitest/mocker/transforms';
5
- import { c as cleanUrl, r as resolve } from './pathe.M-eThtNZ.DwEga6ro.js';
5
+ import { c as cleanUrl, r as resolve } from './pathe.M-eThtNZ.CknpM8Or.js';
6
6
  import { p as parse } from './acorn.C1kjbUFw.js';
7
7
  import MagicString from 'magic-string';
8
8
  import { y } from './tinyrainbow.Ht9iggcq.js';
@@ -73,7 +73,7 @@ function replaceInSourceMarker(url, source, ms) {
73
73
  const re = /import\.meta\.vitest/g;
74
74
  let match;
75
75
  let overridden = false;
76
- // eslint-disable-next-line no-cond-assign
76
+ // oxlint-disable-next-line no-cond-assign
77
77
  while (match = re.exec(source)) {
78
78
  const { index, "0": code } = match;
79
79
  overridden = true;
@@ -1,10 +1,10 @@
1
1
  import module$1, { isBuiltin } from 'node:module';
2
2
  import { fileURLToPath, pathToFileURL } from 'node:url';
3
3
  import { automockModule, createManualModuleSource, collectModuleExports } from '@vitest/mocker/transforms';
4
- import { c as cleanUrl, e as createDefer, i as isAbsolute } from './pathe.M-eThtNZ.DwEga6ro.js';
4
+ import { c as cleanUrl, e as createDefer, i as isAbsolute } from './pathe.M-eThtNZ.CknpM8Or.js';
5
5
  import { p as parse } from './acorn.C1kjbUFw.js';
6
6
  import { t as toBuiltin } from './modules.BJuCwlRJ.js';
7
- import { B as BareModuleMocker, n as normalizeModuleId } from './index.D4dXTzh9.js';
7
+ import { B as BareModuleMocker, n as normalizeModuleId } from './index.k8L_ZRzq.js';
8
8
  import 'node:fs';
9
9
  import './utils.DYj33du9.js';
10
10
  import '../path.js';
@@ -7,7 +7,7 @@ import fs from 'node:fs/promises';
7
7
  import assert from 'node:assert';
8
8
  import v8 from 'node:v8';
9
9
  import { format, inspect } from 'node:util';
10
- import { i as isAbsolute, r as resolve } from './pathe.M-eThtNZ.DwEga6ro.js';
10
+ import { i as isAbsolute, r as resolve } from './pathe.M-eThtNZ.CknpM8Or.js';
11
11
  import { ModuleRunner } from 'vite/module-runner';
12
12
 
13
13
  const JOIN_LEADING_SLASH_RE = /^\.?\//;
@@ -1,6 +1,6 @@
1
1
  import { g as getWorkerState } from './utils.DYj33du9.js';
2
2
  import { promises, existsSync } from 'node:fs';
3
- import { i as isAbsolute, r as resolve, d as dirname, j as join, b as basename } from './pathe.M-eThtNZ.DwEga6ro.js';
3
+ import { i as isAbsolute, r as resolve, d as dirname, j as join, b as basename } from './pathe.M-eThtNZ.CknpM8Or.js';
4
4
 
5
5
  class NodeSnapshotEnvironment {
6
6
  options;
@@ -293,7 +293,7 @@ function unique(array) {
293
293
  return Array.from(new Set(array));
294
294
  }
295
295
  function sanitizeFilePath(s) {
296
- // eslint-disable-next-line no-control-regex
296
+ // oxlint-disable-next-line no-control-regex
297
297
  return s.replace(/[\x00-\x2C\x2E\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/g, "-");
298
298
  }
299
299
 
@@ -1,13 +1,13 @@
1
1
  import { DevEnvironment, IndexHtmlTransformContext, IndexHtmlTransformResult, ViteDevServer, UserConfig as UserConfig$1, Plugin, ResolvedConfig as ResolvedConfig$1, TransformResult as TransformResult$1, InlineConfig as InlineConfig$1, DepOptimizationConfig, ServerOptions, ConfigEnv, AliasOptions } from 'vite';
2
- import { aU as TaskMeta, U as UserConsoleLog, O as Suite, a as File, bi as SerializableRetry, T as TestError, g as TestAnnotation, h as TestArtifact, b0 as TestBenchmark, aJ as SerializedError, a0 as ImportDuration, m as Test, A as Awaitable, Y as CancelReason, P as ParsedStack, bj as BrowserTraceViewMode, a5 as BaselineData, o as ProvidedContext, b as SerializedConfig, bk as Arrayable, a2 as AfterSuiteRunMeta, aO as SnapshotStateOptions, aP as SnapshotSummary, aM as SnapshotResult, X as Task, bl as AsyncLeak, j as TaskResultPack, F as FileSpecification, l as SerializedRootConfig, L as LabelColor, c as SerializedDiffOptions, bg as SequenceSetupFiles, bf as SequenceHooks, bm as PrettyFormatOptions, C as Config, e as TestTagDefinition } from './config.d.CU_b-wJj.js';
2
+ import { aU as TaskMeta, U as UserConsoleLog, O as Suite, a as File, bi as SerializableRetry, T as TestError, g as TestAnnotation, h as TestArtifact, b0 as TestBenchmark, aJ as SerializedError, a0 as ImportDuration, m as Test, A as Awaitable, Y as CancelReason, P as ParsedStack, bj as BrowserTraceViewMode, a5 as BaselineData, o as ProvidedContext, b as SerializedConfig, bk as Arrayable, a2 as AfterSuiteRunMeta, aO as SnapshotStateOptions, aP as SnapshotSummary, aM as SnapshotResult, X as Task, bl as AsyncLeak, j as TaskResultPack, F as FileSpecification, l as SerializedRootConfig, L as LabelColor, c as SerializedDiffOptions, bg as SequenceSetupFiles, bf as SequenceHooks, bm as PrettyFormatOptions, C as Config, e as TestTagDefinition } from './config.d.BxjInJat.js';
3
3
  import { Writable } from 'node:stream';
4
- import { S as SerializedTestSpecification, B as BrowserTesterOptions, c as SourceModuleDiagnostic } from './browser.d.g5Thl309.js';
4
+ import { S as SerializedTestSpecification, B as BrowserTesterOptions, c as SourceModuleDiagnostic } from './browser.d.3cffPS1V.js';
5
5
  import * as chai from 'chai';
6
6
  import { happyDomTypes, jsdomTypes } from 'vitest/optional-types.js';
7
- import { a as ContextTestEnvironment, b as WorkerExecuteContext, c as WorkerTestEnvironment } from './worker.d.MLmnzOJE.js';
8
- import { O as OTELCarrier } from './rpc.d.DA9Utv4e.js';
7
+ import { a as ContextTestEnvironment, b as WorkerExecuteContext, c as WorkerTestEnvironment } from './worker.d.Bt2A2mmi.js';
8
+ import { O as OTELCarrier } from './rpc.d.BPFHl-HE.js';
9
9
  import { MockedModule } from '@vitest/mocker';
10
- import { S as StackTraceParserOptions, a as RuntimeCoverageProviderModule } from './source-map.d.YqWNcp4e.js';
10
+ import { S as StackTraceParserOptions, a as RuntimeCoverageProviderModule } from './source-map.d.BLHtC2OB.js';
11
11
  import { CDPSession, BrowserCommands, MarkOptions } from 'vitest/browser';
12
12
  import path from 'node:path';
13
13
  import { Console } from 'node:console';
@@ -645,7 +645,7 @@ interface BrowserConfigOptions {
645
645
  testIdAttribute?: string;
646
646
  /**
647
647
  * Should locators match the text exactly by default
648
- * @default false
648
+ * @default true
649
649
  */
650
650
  exact?: boolean;
651
651
  /**
@@ -829,7 +829,7 @@ interface BrowserServerContribution {
829
829
  config: ResolvedConfig;
830
830
  vitest: Vitest;
831
831
  }) => ParentProjectBrowser;
832
- /** Called by core after `server.listen()` to wire up the browser RPC. */
832
+ /** Called by core once the server exists to wire up the browser RPC (the port may be bound later). */
833
833
  setupRpc: (parent: ParentProjectBrowser) => void;
834
834
  /**
835
835
  * Mutable. Filled by core at server creation; the pushed `BrowserPlugin`
@@ -2580,6 +2580,12 @@ declare class Vitest {
2580
2580
  */
2581
2581
  close(): Promise<void>;
2582
2582
  /**
2583
+ * Removes the root temp directory with the tmp module copies,
2584
+ * mirroring `TestProject.clearTmpDir()`. The reference is cleared before
2585
+ * the removal so a repeated close is a no-op.
2586
+ */
2587
+ private _clearTmpDir;
2588
+ /**
2583
2589
  * Closes all projects and exit the process
2584
2590
  * @param force If true, the process will exit immediately after closing the projects.
2585
2591
  */
@@ -3201,13 +3207,14 @@ declare class DotReporter extends BaseReporter {
3201
3207
 
3202
3208
  declare class HangingProcessReporter implements Reporter {
3203
3209
  whyRunning: (() => void) | undefined;
3204
- onInit(): void;
3210
+ onInit(): Promise<void>;
3205
3211
  onProcessTimeout(): void;
3206
3212
  }
3207
3213
 
3208
3214
  declare class MinimalReporter extends DefaultReporter {
3209
3215
  renderSucceed: boolean;
3210
3216
  constructor(options?: DefaultReporterOptions);
3217
+ onInit(ctx: Vitest): void;
3211
3218
  onTestRunStart(specifications: ReadonlyArray<TestSpecification>): void;
3212
3219
  protected printTestModule(testModule: TestModule): void;
3213
3220
  protected printTestCase(moduleState: TestModuleState, test: TestCase): void;
@@ -3257,19 +3264,19 @@ declare const ReportersMap: {
3257
3264
  };
3258
3265
  type BuiltinReporters = keyof typeof ReportersMap;
3259
3266
  interface BuiltinReporterOptions {
3260
- "default": DefaultReporterOptions;
3261
- "minimal": DefaultReporterOptions;
3262
- "agent": DefaultReporterOptions;
3263
- "verbose": DefaultReporterOptions;
3264
- "dot": BaseOptions;
3265
- "tree": BaseOptions;
3266
- "json": JsonOptions;
3267
- "blob": BlobOptions;
3268
- "tap": never;
3267
+ default: DefaultReporterOptions;
3268
+ minimal: DefaultReporterOptions;
3269
+ agent: DefaultReporterOptions;
3270
+ verbose: DefaultReporterOptions;
3271
+ dot: BaseOptions;
3272
+ tree: BaseOptions;
3273
+ json: JsonOptions;
3274
+ blob: BlobOptions;
3275
+ tap: never;
3269
3276
  "tap-flat": never;
3270
- "junit": JUnitOptions;
3277
+ junit: JUnitOptions;
3271
3278
  "hanging-process": never;
3272
- "html": HTMLOptions;
3279
+ html: HTMLOptions;
3273
3280
  "github-actions": GithubActionsReporterOptions;
3274
3281
  }
3275
3282
 
@@ -3295,7 +3302,8 @@ interface BenchmarkUserOptions {
3295
3302
  include?: string[];
3296
3303
  /**
3297
3304
  * Exclude globs for benchmark test files
3298
- * @default []
3305
+ *
3306
+ * @default ['**\/node_modules/**', '**\/.git/**']
3299
3307
  */
3300
3308
  exclude?: string[];
3301
3309
  /**
@@ -3336,7 +3344,7 @@ type ApiConfig = Pick<ServerOptions, "port" | "strictPort" | "host" | "middlewar
3336
3344
  /**
3337
3345
  * Allow any write operations from the API server.
3338
3346
  *
3339
- * @default true if `api.host` is exposed to network, false otherwise
3347
+ * @default false if `api.host` is exposed to network, true otherwise
3340
3348
  */
3341
3349
  allowWrite?: boolean;
3342
3350
  /**
@@ -3344,7 +3352,7 @@ type ApiConfig = Pick<ServerOptions, "port" | "strictPort" | "host" | "middlewar
3344
3352
  * If `api.host` is exposed to network and `allowWrite` is true,
3345
3353
  * anyone connected to the API server can run arbitrary code on your machine.
3346
3354
  *
3347
- * @default true if `api.host` is exposed to network, false otherwise
3355
+ * @default false if `api.host` is exposed to network, true otherwise
3348
3356
  */
3349
3357
  allowExec?: boolean;
3350
3358
  };
@@ -3411,7 +3419,7 @@ interface SequenceOptions {
3411
3419
  * Defines how setup files should be ordered
3412
3420
  * - 'parallel' will run all setup files in parallel
3413
3421
  * - 'list' will run all setup files in the order they are defined in the config file
3414
- * @default 'parallel'
3422
+ * @default 'list'
3415
3423
  */
3416
3424
  setupFiles?: SequenceSetupFiles;
3417
3425
  /**
@@ -3665,7 +3673,7 @@ interface InlineConfig {
3665
3673
  /**
3666
3674
  * Watch mode
3667
3675
  *
3668
- * @default !process.env.CI
3676
+ * @default !process.env.CI && process.stdin.isTTY && !isAgent
3669
3677
  */
3670
3678
  watch?: boolean;
3671
3679
  /**
@@ -4488,7 +4496,7 @@ interface UserWorkspaceConfig extends UserConfig$1 {
4488
4496
  }
4489
4497
  type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>;
4490
4498
  type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
4491
- type TestProjectInlineConfiguration = (UserWorkspaceConfig & {
4499
+ type TestProjectInlineConfiguration = UserWorkspaceConfig & {
4492
4500
  /**
4493
4501
  * Relative path to the extendable config. All other options will be merged with this config.
4494
4502
  * If `true`, the project will inherit all options from the root config.
@@ -4497,7 +4505,7 @@ type TestProjectInlineConfiguration = (UserWorkspaceConfig & {
4497
4505
  * @example '../vite.config.ts'
4498
4506
  */
4499
4507
  extends?: string | boolean;
4500
- });
4508
+ };
4501
4509
  type TestProjectConfiguration = string | TestProjectInlineConfiguration | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
4502
4510
 
4503
4511
  /**
@@ -4519,7 +4527,7 @@ interface VitestPluginContext {
4519
4527
  project: TestProject;
4520
4528
  injectTestProjects: (config: TestProjectConfiguration | TestProjectConfiguration[]) => Promise<TestProject[]>;
4521
4529
  /**
4522
- * Define a generator that will be applied before hashing the cache key.
4530
+ * Define a generator that will be applied before hashing this project's cache key.
4523
4531
  *
4524
4532
  * Use this to make sure Vitest generates correct hash. It is a good idea
4525
4533
  * to define this function if your plugin can be registered with different options.
@@ -1,4 +1,4 @@
1
- import { p as plugins } from './index.M2dsQ_UQ.js';
1
+ import { p as plugins } from './index.cx-_w29y.js';
2
2
 
3
3
  const serialize = (val, config, indentation, depth, refs, printer) => {
4
4
  // Serialize a non-default name, even if config.printFunctionName is false.
@@ -1,5 +1,5 @@
1
1
  import fs__default from 'node:fs';
2
- import { b as basename, j as join, d as dirname } from './pathe.M-eThtNZ.DwEga6ro.js';
2
+ import { b as basename, j as join, d as dirname } from './pathe.M-eThtNZ.CknpM8Or.js';
3
3
 
4
4
  const packageScopeTypeCache = /* @__PURE__ */ new Map();
5
5
  // mirrors LOOKUP_PACKAGE_SCOPE from the ESM resolution algorithm:
@@ -1,12 +1,13 @@
1
1
  import { EvaluatedModules } from 'vite/module-runner';
2
- import { d as dirname, r as resolve } from './pathe.M-eThtNZ.DwEga6ro.js';
3
- import { a as getSafeTimers } from './source-map.BH0bbrs9.js';
2
+ import { d as dirname, r as resolve } from './pathe.M-eThtNZ.CknpM8Or.js';
3
+ import { a as getSafeTimers } from './source-map.DUxvo12T.js';
4
4
  import { c as createBirpc } from './index.DmDMHCg8.js';
5
5
  import { g as getWorkerState } from './utils.DYj33du9.js';
6
6
 
7
7
  // TODO: this is not needed in Vite 7.2+
8
8
  class VitestEvaluatedModules extends EvaluatedModules {
9
9
  getModuleSourceMapById(id) {
10
+ /** the return type is not exposed by Vite */
10
11
  const map = super.getModuleSourceMapById(id);
11
12
  if (map != null && !("_patched" in map)) {
12
13
  map._patched = true;
@@ -18,27 +19,28 @@ class VitestEvaluatedModules extends EvaluatedModules {
18
19
  }
19
20
 
20
21
  const { get } = Reflect;
22
+ const globalProcess = globalThis.process;
21
23
  function withSafeTimers(fn) {
22
24
  const { setTimeout, clearTimeout, nextTick, setImmediate, clearImmediate } = getSafeTimers();
23
25
  const currentSetTimeout = globalThis.setTimeout;
24
26
  const currentClearTimeout = globalThis.clearTimeout;
25
27
  const currentSetImmediate = globalThis.setImmediate;
26
28
  const currentClearImmediate = globalThis.clearImmediate;
27
- const currentNextTick = globalThis.process?.nextTick;
29
+ const currentNextTick = globalProcess?.nextTick;
28
30
  try {
29
31
  globalThis.setTimeout = setTimeout;
30
32
  globalThis.clearTimeout = clearTimeout;
31
33
  if (setImmediate) globalThis.setImmediate = setImmediate;
32
34
  if (clearImmediate) globalThis.clearImmediate = clearImmediate;
33
- if (globalThis.process && nextTick) globalThis.process.nextTick = nextTick;
35
+ if (globalProcess && nextTick) globalProcess.nextTick = nextTick;
34
36
  return fn();
35
37
  } finally {
36
38
  globalThis.setTimeout = currentSetTimeout;
37
39
  globalThis.clearTimeout = currentClearTimeout;
38
40
  globalThis.setImmediate = currentSetImmediate;
39
41
  globalThis.clearImmediate = currentClearImmediate;
40
- if (globalThis.process && nextTick) nextTick(() => {
41
- globalThis.process.nextTick = currentNextTick;
42
+ if (globalProcess && nextTick) nextTick(() => {
43
+ globalProcess.nextTick = currentNextTick;
42
44
  });
43
45
  }
44
46
  }
@@ -1,4 +1,4 @@
1
- import { bt as FetchCachedFileSystemResult, bu as ResolveFunctionResult, U as UserConsoleLog, bl as AsyncLeak, a as File, a2 as AfterSuiteRunMeta, b0 as TestBenchmark, h as TestArtifact, j as TaskResultPack, k as TaskEventPack, Y as CancelReason, aM as SnapshotResult, a5 as BaselineData } from './config.d.CU_b-wJj.js';
1
+ import { bt as FetchCachedFileSystemResult, bu as ResolveFunctionResult, U as UserConsoleLog, bl as AsyncLeak, a as File, a2 as AfterSuiteRunMeta, b0 as TestBenchmark, h as TestArtifact, j as TaskResultPack, k as TaskEventPack, Y as CancelReason, aM as SnapshotResult, a5 as BaselineData } from './config.d.BxjInJat.js';
2
2
  import { FetchFunctionOptions, FetchResult } from 'vite/module-runner';
3
3
 
4
4
  interface OTELCarrier {
@@ -1,8 +1,8 @@
1
- import { f as format, p as plugins } from './index.M2dsQ_UQ.js';
1
+ import { f as format, p as plugins } from './index.cx-_w29y.js';
2
2
  import { y } from './tinyrainbow.Ht9iggcq.js';
3
- import { s as stringify, f as format$1, a as formatRegExp, t as truncateString, i as inspect } from './display.pkpxlVcY.js';
4
- import { p as deepClone, q as getOwnProperties, g as getType$1, u as isObject, v as filterOutComments, w as ordinal, e as createDefer, x as assertTypes, t as toArray, y as isNegativeNaN, z as unique, A as objectAttr } from './pathe.M-eThtNZ.DwEga6ro.js';
5
- import { d as diffSequences, b as serializeValue, p as parseStacktrace, a as getSafeTimers } from './source-map.BH0bbrs9.js';
3
+ import { s as stringify, f as format$1, a as formatRegExp, t as truncateString, i as inspect } from './display.CXBnkt9a.js';
4
+ import { p as deepClone, q as getOwnProperties, g as getType$1, u as isObject, v as filterOutComments, w as ordinal, e as createDefer, x as assertTypes, t as toArray, y as isNegativeNaN, z as unique, A as objectAttr } from './pathe.M-eThtNZ.CknpM8Or.js';
5
+ import { d as diffSequences, b as serializeValue, p as parseStacktrace, a as getSafeTimers } from './source-map.DUxvo12T.js';
6
6
  import { createTaskName, createFileTask, calculateSuiteHash, interpretTaskModes, hasFailed } from '../task-utils.js';
7
7
 
8
8
  const RealDate = Date;
@@ -3110,12 +3110,14 @@ function encodeUint8Array(bytes) {
3110
3110
  let base64 = "";
3111
3111
  const len = bytes.byteLength;
3112
3112
  for (let i = 0; i < len; i += 3) if (len === i + 1) {
3113
+ // last 1 byte
3113
3114
  const a = (bytes[i] & 252) >> 2;
3114
3115
  const b = (bytes[i] & 3) << 4;
3115
3116
  base64 += table[a];
3116
3117
  base64 += table[b];
3117
3118
  base64 += "==";
3118
3119
  } else if (len === i + 2) {
3120
+ // last 2 bytes
3119
3121
  const a = (bytes[i] & 252) >> 2;
3120
3122
  const b = (bytes[i] & 3) << 4 | (bytes[i + 1] & 240) >> 4;
3121
3123
  const c = (bytes[i + 1] & 15) << 2;
@@ -3251,7 +3253,7 @@ async function runWithSuite(suite, fn) {
3251
3253
  function withTimeout(fn, timeout, isHook = false, stackTraceError, onTimeout) {
3252
3254
  if (timeout <= 0 || timeout === Number.POSITIVE_INFINITY) return fn;
3253
3255
  // this function name is used to filter error in test/e2e/test/fails.test.ts
3254
- return (function runWithTimeout(...args) {
3256
+ return function runWithTimeout(...args) {
3255
3257
  const runner = getRunner();
3256
3258
  const previousDeadline = runner._deadline;
3257
3259
  return new Promise((resolve_, reject_) => {
@@ -3307,10 +3309,10 @@ catch (error) {
3307
3309
  reject(error);
3308
3310
  }
3309
3311
  });
3310
- });
3312
+ };
3311
3313
  }
3312
3314
  function withCancel(fn, signal) {
3313
- return (function runWithCancel(...args) {
3315
+ return function runWithCancel(...args) {
3314
3316
  return new Promise((resolve, reject) => {
3315
3317
  const onAbort = () => reject(signal.reason);
3316
3318
  signal.addEventListener("abort", onAbort, { once: true });
@@ -3333,7 +3335,7 @@ function withCancel(fn, signal) {
3333
3335
  reject(error);
3334
3336
  }
3335
3337
  });
3336
- });
3338
+ };
3337
3339
  }
3338
3340
  const abortControllers = /* @__PURE__ */ new WeakMap();
3339
3341
  function abortIfTimeout([context], error) {
@@ -3853,9 +3855,13 @@ async function runTest(test, runner) {
3853
3855
  const suite = test.suite || test.file;
3854
3856
  const $ = runner.trace;
3855
3857
  const repeats = test.repeats ?? 0;
3858
+ let hasFailedRepeat = false;
3856
3859
  for (let repeatCount = 0; repeatCount <= repeats; repeatCount++) {
3860
+ // Force widening to TaskState because TypeScript cannot track mutations made by hooks and the test.
3861
+ test.result.state = "run";
3857
3862
  const retry = getRetryCount(test.retry);
3858
3863
  for (let retryCount = 0; retryCount <= retry; retryCount++) {
3864
+ const attemptErrorsStart = test.result.errors?.length ?? 0;
3859
3865
  let beforeEachCleanups = [];
3860
3866
  // fixtureCheckpoint is passed by callAroundEachHooks - it represents the count
3861
3867
  // of fixture cleanup functions AFTER all aroundEach fixtures have been resolved
@@ -3929,6 +3935,19 @@ async function runTest(test, runner) {
3929
3935
  cleanupRunningTest();
3930
3936
  return;
3931
3937
  }
3938
+ // if test is marked to be failed, flip the result unless `TestSyntaxError` is present
3939
+ if (test.fails) {
3940
+ if (test.result.state === "pass") {
3941
+ const error = processError(/* @__PURE__ */ new Error("Expect test to fail"));
3942
+ test.result.state = "fail";
3943
+ test.result.errors ??= [];
3944
+ test.result.errors.push(error);
3945
+ } else if (!test.result.errors?.slice(attemptErrorsStart).some((e) => e.__vitest_test_syntax_error__)) {
3946
+ test.result.state = "pass";
3947
+ test.result.errors?.splice(attemptErrorsStart);
3948
+ if (!test.result.errors?.length) test.result.errors = void 0;
3949
+ }
3950
+ }
3932
3951
  if (test.result.state === "pass") break;
3933
3952
  if (retryCount < retry) {
3934
3953
  if (!passesRetryCondition(test, test.result.errors)) break;
@@ -3940,18 +3959,9 @@ async function runTest(test, runner) {
3940
3959
  // update retry info
3941
3960
  updateTask("test-retried", test, runner);
3942
3961
  }
3962
+ if (test.result.state === "fail") hasFailedRepeat = true;
3943
3963
  }
3944
- // if test is marked to be failed, flip the result unless `TestSyntaxError` is present
3945
- if (test.fails) {
3946
- if (test.result.state === "pass") {
3947
- const error = processError(/* @__PURE__ */ new Error("Expect test to fail"));
3948
- test.result.state = "fail";
3949
- test.result.errors = [error];
3950
- } else if (!test.result.errors?.some((e) => e.__vitest_test_syntax_error__)) {
3951
- test.result.state = "pass";
3952
- test.result.errors = void 0;
3953
- }
3954
- }
3964
+ if (hasFailedRepeat) test.result.state = "fail";
3955
3965
  cleanupRunningTest();
3956
3966
  setCurrentTest(void 0);
3957
3967
  test.result.duration = now() - start;
@@ -1,5 +1,5 @@
1
- import { s as setSafeTimers } from './source-map.BH0bbrs9.js';
2
- import { a as addSerializer } from './plugins.Cigb0uSy.js';
1
+ import { s as setSafeTimers } from './source-map.DUxvo12T.js';
2
+ import { a as addSerializer } from './plugins.D2ut1V9b.js';
3
3
 
4
4
  let globalSetup = false;
5
5
  async function setupCommonEnv(config) {
@@ -7,7 +7,7 @@ async function setupCommonEnv(config) {
7
7
  if (globalSetup) return;
8
8
  globalSetup = true;
9
9
  setSafeTimers();
10
- if (config.globals) (await import('./globals.D9ucJdZZ.js')).registerApiGlobally();
10
+ if (config.globals) (await import('./globals.9QtHn8Sr.js')).registerApiGlobally();
11
11
  }
12
12
  function setupDefines(config) {
13
13
  for (const key in config.defines) globalThis[key] = config.defines[key];
@@ -1,9 +1,5 @@
1
- import { m as isPrimitive, o as notNullish, r as resolve$1 } from './pathe.M-eThtNZ.DwEga6ro.js';
2
-
3
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
4
- function getDefaultExportFromCjs(x) {
5
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
6
- }
1
+ import { g as getDefaultExportFromCjs } from './index.cx-_w29y.js';
2
+ import { m as isPrimitive, o as notNullish, r as resolve$1 } from './pathe.M-eThtNZ.CknpM8Or.js';
7
3
 
8
4
  var build = {};
9
5
 
@@ -851,7 +847,7 @@ function serializeValue(val, seen = /* @__PURE__ */ new WeakMap()) {
851
847
  if (typeof val.toJSON === "function") return serializeValue(val.toJSON(), seen);
852
848
  if (seen.has(val)) return seen.get(val);
853
849
  if (Array.isArray(val)) {
854
- // eslint-disable-next-line unicorn/no-new-array -- we need to keep sparse arrays ([1,,3])
850
+ // oxlint-disable-next-line unicorn/no-new-array -- we need to keep sparse arrays ([1,,3])
855
851
  const clone = new Array(val.length);
856
852
  seen.set(val, clone);
857
853
  val.forEach((e, i) => {
@@ -1774,4 +1770,4 @@ function getOriginalPosition(map, needle) {
1774
1770
  return result;
1775
1771
  }
1776
1772
 
1777
- export { DecodedMap as D, TraceMap as T, getSafeTimers as a, serializeValue as b, createStackString as c, diffSequences as d, getDefaultExportFromCjs as e, parseErrorStacktrace as f, getOriginalPosition as g, commonjsGlobal as h, parseSingleStack as i, delay as j, generatedPositionFor as k, eachMapping as l, stackIgnorePatterns as m, originalPositionFor as o, parseStacktrace as p, setSafeTimers as s };
1773
+ export { DecodedMap as D, TraceMap as T, getSafeTimers as a, serializeValue as b, createStackString as c, diffSequences as d, parseErrorStacktrace as e, parseSingleStack as f, getOriginalPosition as g, delay as h, generatedPositionFor as i, eachMapping as j, stackIgnorePatterns as k, originalPositionFor as o, parseStacktrace as p, setSafeTimers as s };
@@ -1,4 +1,4 @@
1
- import { T as TestError, P as ParsedStack } from './config.d.CU_b-wJj.js';
1
+ import { T as TestError, P as ParsedStack } from './config.d.BxjInJat.js';
2
2
 
3
3
  interface RuntimeCoverageModuleLoader {
4
4
  import: (id: string) => Promise<{