@depup/vitest 5.0.2-depup.0 → 5.0.3-depup.0

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 (72) hide show
  1. package/LICENSE.md +28 -0
  2. package/README.md +6 -4
  3. package/browser/context.d.ts +7 -1
  4. package/browser/context.js +5 -5
  5. package/changes.json +11 -3
  6. package/dist/browser.d.ts +4 -4
  7. package/dist/browser.js +10 -10
  8. package/dist/chunks/{base.5tQXSzMP.js → base.DhkQeZwd.js} +14 -14
  9. package/dist/chunks/{browser.d.g5Thl309.d.ts → browser.d.3cffPS1V.d.ts} +3 -3
  10. package/dist/chunks/{cac.BLbEtnDd.js → cac.DfDGTQ9W.js} +9 -9
  11. package/dist/chunks/{cli-api.DL4Bd7Vh.js → cli-api.C4x4GGip.js} +5 -5
  12. package/dist/chunks/{config.d.CU_b-wJj.d.ts → config.d.BxjInJat.d.ts} +13 -15
  13. package/dist/chunks/{console.B09ye7y0.js → console.RBA5x-0t.js} +3 -2
  14. package/dist/chunks/{coverage.AipniaqB.js → coverage.S6Dao4g-.js} +1 -1
  15. package/dist/chunks/{coverage.CX7NN5s7.js → coverage._yXj5zeb.js} +1 -1
  16. package/dist/chunks/{creator.2VTnpYzN.js → creator.203NYCo3.js} +12 -12
  17. package/dist/chunks/{display.pkpxlVcY.js → display.CXBnkt9a.js} +1 -1
  18. package/dist/chunks/{doctor.BCXa6-1R.js → doctor.CpHPRoza.js} +2 -2
  19. package/dist/chunks/{environment.d.C6xYahWA.d.ts → environment.d.DAj1Vt__.d.ts} +1 -1
  20. package/dist/chunks/{globals.Brdv9iOs.js → globals.9QtHn8Sr.js} +9 -9
  21. package/dist/chunks/{index.DGdajAO2.js → index.C4tKZ0yW.js} +14 -11
  22. package/dist/chunks/{index.C-uw7tH9.js → index.DpLw24bj.js} +168 -78
  23. package/dist/chunks/{index.M2dsQ_UQ.js → index.cx-_w29y.js} +551 -179
  24. package/dist/chunks/{index.BgwtGYxD.js → index.ggMXe2IF.js} +5 -5
  25. package/dist/chunks/{index.hTNFpC24.js → index.k8L_ZRzq.js} +20 -5
  26. package/dist/chunks/{init-forks.CdGu3HUy.js → init-forks.hzLs7kMZ.js} +1 -1
  27. package/dist/chunks/{init-threads.2f_lsHNK.js → init-threads.COb0VD5D.js} +1 -1
  28. package/dist/chunks/{init.IsjtLXKe.js → init.D0qF-GGk.js} +4 -5
  29. package/dist/chunks/{native.CF4uT5hY.js → native.CBlba4VV.js} +2 -2
  30. package/dist/chunks/{nativeModuleMocker.DwRB4F9R.js → nativeModuleMocker.CXSh3m91.js} +2 -2
  31. package/dist/chunks/{nativeModuleRunner.J0QLzNtK.js → nativeModuleRunner.jwZPY3dg.js} +1 -1
  32. package/dist/chunks/{node.CfQ_OGWr.js → node.BzimPqT5.js} +1 -1
  33. package/dist/chunks/{pathe.M-eThtNZ.DwEga6ro.js → pathe.M-eThtNZ.CknpM8Or.js} +1 -1
  34. package/dist/chunks/{plugin.d.My_z-jmU.d.ts → plugin.d.BsjqSb4-.d.ts} +26 -20
  35. package/dist/chunks/{plugins.Cigb0uSy.js → plugins.D2ut1V9b.js} +1 -1
  36. package/dist/chunks/{resolver.NpfwMKt9.js → resolver.fbW9AUvG.js} +1 -1
  37. package/dist/chunks/{rpc.CJVl3hZH.js → rpc.BTmCtPly.js} +3 -2
  38. package/dist/chunks/{rpc.d.DA9Utv4e.d.ts → rpc.d.BPFHl-HE.d.ts} +1 -1
  39. package/dist/chunks/{run.C5UmxDPh.js → run.BTlFXlnv.js} +29 -19
  40. package/dist/chunks/{setup-common.Ct8rQvjH.js → setup-common.BglbuAHD.js} +3 -3
  41. package/dist/chunks/{source-map.BH0bbrs9.js → source-map.DUxvo12T.js} +4 -8
  42. package/dist/chunks/{source-map.d.YqWNcp4e.d.ts → source-map.d.BLHtC2OB.d.ts} +1 -1
  43. package/dist/chunks/{spy.KLHgXex_.js → spy.DgMTfhrK.js} +18 -16
  44. package/dist/chunks/{task-utils.d.BZm4GSQD.d.ts → task-utils.d.C-IeGxLU.d.ts} +1 -1
  45. package/dist/chunks/{utils.CJ0JImL8.js → utils.RcGwuOc_.js} +2 -2
  46. package/dist/chunks/{vm.KI2AYADz.js → vm.vTyZj_02.js} +8 -8
  47. package/dist/chunks/{worker.d.MLmnzOJE.d.ts → worker.d.Bt2A2mmi.d.ts} +3 -3
  48. package/dist/cli.js +2 -2
  49. package/dist/config.d.ts +9 -9
  50. package/dist/index.d.ts +10 -10
  51. package/dist/index.js +9 -9
  52. package/dist/module-evaluator.d.ts +3 -2
  53. package/dist/module-evaluator.js +8 -5
  54. package/dist/node.d.ts +9 -9
  55. package/dist/node.js +14 -14
  56. package/dist/runtime.d.ts +6 -6
  57. package/dist/runtime.js +4 -4
  58. package/dist/spy.js +1 -1
  59. package/dist/task-utils.js +2 -1
  60. package/dist/worker.d.ts +4 -4
  61. package/dist/worker.js +17 -17
  62. package/dist/workers/forks.js +18 -18
  63. package/dist/workers/runVmTests.js +14 -14
  64. package/dist/workers/threads.js +18 -18
  65. package/dist/workers/vmForks.js +12 -12
  66. package/dist/workers/vmThreads.js +12 -12
  67. package/globals.d.ts +19 -19
  68. package/index.cjs +3 -3
  69. package/optional-runtime-types.d.ts +1 -1
  70. package/optional-types.d.ts +1 -1
  71. package/package.json +33 -20
  72. 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.CJVl3hZH.js';
5
- import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.Ct8rQvjH.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.DGdajAO2.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);
@@ -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 {
@@ -726,6 +727,7 @@ function startVitestModuleRunner(options) {
726
727
  return state().config.injectCjsGlobals;
727
728
  },
728
729
  getCurrentTestFilepath: () => state().filepath,
730
+ getEnvironmentName: environment,
729
731
  getterTracker: state().getterTracker
730
732
  });
731
733
  const moduleRunner = new VitestModuleRunner({
@@ -1419,10 +1421,22 @@ function createJSDOMCompatURL(utils) {
1419
1421
  }
1420
1422
  return URL;
1421
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;
1422
1438
  function createCompatUtils(window) {
1423
- // this returns a hidden Symbol(impl)
1424
- // this is cursed, and jsdom should just implement fetch API itself
1425
- const implSymbol = Object.getOwnPropertySymbols(Object.getOwnPropertyDescriptors(new window.Blob()))[0];
1439
+ getBlobImpl ??= createBlobImplGetter(window);
1426
1440
  const utils = {
1427
1441
  window,
1428
1442
  makeCompatFormData(formData) {
@@ -1434,7 +1448,8 @@ function createCompatUtils(window) {
1434
1448
  return nodeFormData;
1435
1449
  },
1436
1450
  makeCompatBlob(blob) {
1437
- const impl = blob[implSymbol];
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.");
1438
1453
  // jsdom 28 renamed `_buffer` to `_bytes`
1439
1454
  return new NodeBlob_([impl._bytes ?? impl._buffer], { type: blob.type });
1440
1455
  }
@@ -1,4 +1,4 @@
1
- import { i as init } from './init.IsjtLXKe.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.IsjtLXKe.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.hTNFpC24.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.CJVl3hZH.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.hTNFpC24.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';
@@ -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
  */
@@ -3258,19 +3264,19 @@ declare const ReportersMap: {
3258
3264
  };
3259
3265
  type BuiltinReporters = keyof typeof ReportersMap;
3260
3266
  interface BuiltinReporterOptions {
3261
- "default": DefaultReporterOptions;
3262
- "minimal": DefaultReporterOptions;
3263
- "agent": DefaultReporterOptions;
3264
- "verbose": DefaultReporterOptions;
3265
- "dot": BaseOptions;
3266
- "tree": BaseOptions;
3267
- "json": JsonOptions;
3268
- "blob": BlobOptions;
3269
- "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;
3270
3276
  "tap-flat": never;
3271
- "junit": JUnitOptions;
3277
+ junit: JUnitOptions;
3272
3278
  "hanging-process": never;
3273
- "html": HTMLOptions;
3279
+ html: HTMLOptions;
3274
3280
  "github-actions": GithubActionsReporterOptions;
3275
3281
  }
3276
3282
 
@@ -4490,7 +4496,7 @@ interface UserWorkspaceConfig extends UserConfig$1 {
4490
4496
  }
4491
4497
  type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>;
4492
4498
  type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
4493
- type TestProjectInlineConfiguration = (UserWorkspaceConfig & {
4499
+ type TestProjectInlineConfiguration = UserWorkspaceConfig & {
4494
4500
  /**
4495
4501
  * Relative path to the extendable config. All other options will be merged with this config.
4496
4502
  * If `true`, the project will inherit all options from the root config.
@@ -4499,7 +4505,7 @@ type TestProjectInlineConfiguration = (UserWorkspaceConfig & {
4499
4505
  * @example '../vite.config.ts'
4500
4506
  */
4501
4507
  extends?: string | boolean;
4502
- });
4508
+ };
4503
4509
  type TestProjectConfiguration = string | TestProjectInlineConfiguration | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
4504
4510
 
4505
4511
  /**
@@ -4521,7 +4527,7 @@ interface VitestPluginContext {
4521
4527
  project: TestProject;
4522
4528
  injectTestProjects: (config: TestProjectConfiguration | TestProjectConfiguration[]) => Promise<TestProject[]>;
4523
4529
  /**
4524
- * 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.
4525
4531
  *
4526
4532
  * Use this to make sure Vitest generates correct hash. It is a good idea
4527
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;
@@ -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.Brdv9iOs.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<{
@@ -105,13 +105,13 @@ function createMockInstance(options = {}) {
105
105
  });
106
106
  };
107
107
  mock.mockThrow = function mockThrow(value) {
108
- // eslint-disable-next-line prefer-arrow-callback
108
+ // oxlint-disable-next-line prefer-arrow-callback
109
109
  return mock.mockImplementation(function() {
110
110
  throw value;
111
111
  });
112
112
  };
113
113
  mock.mockThrowOnce = function mockThrowOnce(value) {
114
- // eslint-disable-next-line prefer-arrow-callback
114
+ // oxlint-disable-next-line prefer-arrow-callback
115
115
  return mock.mockImplementationOnce(function() {
116
116
  throw value;
117
117
  });
@@ -268,7 +268,7 @@ function createMock({ state, config, name: mockName, prototypeState, prototypeCo
268
268
  const prototypeMock = prototypeState && MOCKS_BY_STATE.get(prototypeState);
269
269
  const namedObject = {
270
270
  // to keep the name of the function intact
271
- [name]: (function(...args) {
271
+ [name]: function(...args) {
272
272
  addDirtyMock(namedObject[name]);
273
273
  if (prototypeMock) addDirtyMock(prototypeMock);
274
274
  registerCalls(args, state, prototypeState);
@@ -295,9 +295,11 @@ function createMock({ state, config, name: mockName, prototypeState, prototypeCo
295
295
  // the prototype chain is already prepared when the implementation
296
296
  // is registered, but a consumed `mockImplementationOnce` can change
297
297
  // which implementation this construction uses
298
- if (prototypeMembers.length === 0)
299
- // eslint-disable-next-line ts/no-use-before-define
300
- reparentMockPrototype(mock, implementation === noopImplementation ? void 0 : implementation);
298
+ if (prototypeMembers.length === 0) reparentMockPrototype(
299
+ // oxlint-disable-next-line typescript/no-use-before-define
300
+ mock,
301
+ implementation === noopImplementation ? void 0 : implementation
302
+ );
301
303
  returnValue = Reflect.construct(implementation, args, new.target);
302
304
  // jest calls this before the implementation, but we have to resolve this _after_
303
305
  // because we cannot do it before the `Reflect.construct` called the custom implementation.
@@ -306,7 +308,7 @@ function createMock({ state, config, name: mockName, prototypeState, prototypeCo
306
308
  for (const prop of prototypeMembers) {
307
309
  const prototypeMock = returnValue[prop];
308
310
  // the method was overridden because of inheritance, ignore it
309
- // eslint-disable-next-line ts/no-use-before-define
311
+ // oxlint-disable-next-line typescript/no-use-before-define
310
312
  if (prototypeMock !== mock.prototype[prop]) continue;
311
313
  const isMock = isMockFunction(prototypeMock);
312
314
  const prototypeState = isMock ? prototypeMock.mock : void 0;
@@ -353,7 +355,7 @@ function createMock({ state, config, name: mockName, prototypeState, prototypeCo
353
355
  }
354
356
  }
355
357
  return returnValue;
356
- }) };
358
+ } };
357
359
  const mock = namedObject[name];
358
360
  const copyPropertiesFrom = original || pseudoOriginal;
359
361
  if (copyPropertiesFrom) copyOriginalStaticProperties(mock, copyPropertiesFrom);
@@ -465,14 +467,14 @@ function throwConstructorError(shorthand) {
465
467
  }
466
468
 
467
469
  var spyModule = /*#__PURE__*/Object.freeze({
468
- __proto__: null,
469
- clearAllMocks: clearAllMocks,
470
- createMockInstance: createMockInstance,
471
- fn: fn,
472
- isMockFunction: isMockFunction,
473
- resetAllMocks: resetAllMocks,
474
- restoreAllMocks: restoreAllMocks,
475
- spyOn: spyOn
470
+ __proto__: null,
471
+ clearAllMocks: clearAllMocks,
472
+ createMockInstance: createMockInstance,
473
+ fn: fn,
474
+ isMockFunction: isMockFunction,
475
+ resetAllMocks: resetAllMocks,
476
+ restoreAllMocks: restoreAllMocks,
477
+ spyOn: spyOn
476
478
  });
477
479
 
478
480
  export { spyOn as a, resetAllMocks as b, clearAllMocks as c, createMockInstance as d, fn as f, isMockFunction as i, restoreAllMocks as r, spyModule as s };
@@ -1,4 +1,4 @@
1
- import { bn as SnapshotState, m as Test, bo as PromisifyAssertion, bp as Tester, bq as Plugin, ad as BenchResult, a as File } from './config.d.CU_b-wJj.js';
1
+ import { bn as SnapshotState, m as Test, bo as PromisifyAssertion, bp as Tester, bq as Plugin, ad as BenchResult, a as File } from './config.d.BxjInJat.js';
2
2
 
3
3
  interface SnapshotMatcher<
4
4
  R extends void | Promise<void>,
@@ -1,6 +1,6 @@
1
1
  import { stripVTControlCharacters } from 'node:util';
2
- import { t as truncateString$1 } from './display.pkpxlVcY.js';
3
- import { i as isAbsolute, a as relative, d as dirname, b as basename, s as slash } from './pathe.M-eThtNZ.DwEga6ro.js';
2
+ import { t as truncateString$1 } from './display.CXBnkt9a.js';
3
+ import { i as isAbsolute, a as relative, d as dirname, b as basename, s as slash } from './pathe.M-eThtNZ.CknpM8Or.js';
4
4
  import { y } from './tinyrainbow.Ht9iggcq.js';
5
5
 
6
6
  const F_RIGHT = "→";
@@ -1,18 +1,18 @@
1
1
  import { fileURLToPath, pathToFileURL } from 'node:url';
2
2
  import v8 from 'node:v8';
3
3
  import vm, { isContext, runInContext } from 'node:vm';
4
- import { l as loadEnvironment, a as listenForErrors, e as emitModuleRunner } from './init.IsjtLXKe.js';
4
+ import { l as loadEnvironment, a as listenForErrors, e as emitModuleRunner } from './init.D0qF-GGk.js';
5
5
  import { distDir } from '../path.js';
6
- import { createCustomConsole } from './console.B09ye7y0.js';
6
+ import { createCustomConsole } from './console.RBA5x-0t.js';
7
7
  import fs__default from 'node:fs';
8
8
  import { createRequire, Module, isBuiltin } from 'node:module';
9
- import { d as dirname, f as extname, b as basename, C as CSS_LANGS_RE, h as KNOWN_ASSET_RE, t as toArray, k as splitFileAndPostfix, n as normalize, l as isBareImport, r as resolve } from './pathe.M-eThtNZ.DwEga6ro.js';
10
- import { l as lookupPackageScopeType } from './resolver.NpfwMKt9.js';
9
+ import { d as dirname, f as extname, b as basename, C as CSS_LANGS_RE, h as KNOWN_ASSET_RE, t as toArray, k as splitFileAndPostfix, n as normalize, l as isBareImport, r as resolve } from './pathe.M-eThtNZ.CknpM8Or.js';
10
+ import { l as lookupPackageScopeType } from './resolver.fbW9AUvG.js';
11
11
  import { initSync, parse } from 'es-module-lexer';
12
12
  import { dirname as dirname$1 } from 'node:path';
13
- import { V as VITEST_VM_CONTEXT_SYMBOL, s as startVitestModuleRunner, c as createNodeImportMeta } from './index.hTNFpC24.js';
13
+ import { V as VITEST_VM_CONTEXT_SYMBOL, s as startVitestModuleRunner, c as createNodeImportMeta } from './index.k8L_ZRzq.js';
14
14
  import { getDefaultRequestStubs } from '../module-evaluator.js';
15
- import { b as setupEnv } from './setup-common.Ct8rQvjH.js';
15
+ import { b as setupEnv } from './setup-common.BglbuAHD.js';
16
16
  import { p as provideWorkerState } from './utils.DYj33du9.js';
17
17
 
18
18
  /**
@@ -219,7 +219,7 @@ class CommonjsExecutor {
219
219
  this.shouldRequireAsEsm = options.shouldRequireAsEsm;
220
220
  this.requireEsm = options.requireEsm;
221
221
  const primitives = vm.runInContext("({ Object, Array, Error })", this.context);
222
- // eslint-disable-next-line ts/no-this-alias
222
+ // oxlint-disable-next-line typescript/no-this-alias
223
223
  const executor = this;
224
224
  this.Module = class Module$1 {
225
225
  exports;
@@ -434,7 +434,7 @@ class CommonjsExecutor {
434
434
  let currentExtension;
435
435
  let index;
436
436
  let startIndex = 0;
437
- // eslint-disable-next-line no-cond-assign
437
+ // oxlint-disable-next-line no-cond-assign
438
438
  while ((index = name.indexOf(".", startIndex)) !== -1) {
439
439
  startIndex = index + 1;
440
440
  if (index === 0) continue;