vitest 5.0.2 → 5.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/LICENSE.md +29 -1
  2. package/browser/context.d.ts +7 -1
  3. package/browser/context.js +5 -5
  4. package/dist/browser.d.ts +4 -4
  5. package/dist/browser.js +11 -11
  6. package/dist/chunks/{base.5tQXSzMP.js → base.CYbb9pQW.js} +39 -15
  7. package/dist/chunks/{browser.d.g5Thl309.d.ts → browser.d.FGQ9_rK6.d.ts} +3 -3
  8. package/dist/chunks/{cac.BLbEtnDd.js → cac.DTXWs6Ni.js} +21 -23
  9. package/dist/chunks/cli-api.Bx28WXzL.js +13879 -0
  10. package/dist/chunks/{config.d.CU_b-wJj.d.ts → config.d.QBNYCgFU.d.ts} +33 -24
  11. package/dist/chunks/{console.B09ye7y0.js → console.DtI4yxfN.js} +5 -4
  12. package/dist/chunks/{coverage.AipniaqB.js → coverage.-bm5IxnW.js} +1 -1
  13. package/dist/chunks/{coverage.CX7NN5s7.js → coverage.cTDc4uSS.js} +1 -1
  14. package/dist/chunks/{creator.2VTnpYzN.js → creator.CLL8QFMS.js} +44 -54
  15. package/dist/chunks/{defaults.D2ip7f-X.js → defaults.B1FCaFfh.js} +2 -2
  16. package/dist/chunks/{display.pkpxlVcY.js → display.BlTmubjj.js} +1 -1
  17. package/dist/chunks/{doctor.BCXa6-1R.js → doctor.Bqc8NDDb.js} +40 -41
  18. package/dist/chunks/{env.DzFJjrmK.js → env.BKKtU2WC.js} +1 -1
  19. package/dist/chunks/{environment.d.C6xYahWA.d.ts → environment.d.BY56MoGs.d.ts} +1 -1
  20. package/dist/chunks/{globals.Brdv9iOs.js → globals.CTWMSIPL.js} +10 -10
  21. package/dist/chunks/{index.C-uw7tH9.js → index.B8VfM7Mf.js} +8606 -20822
  22. package/dist/chunks/{index.DXQx-kDM.js → index.BoyTG_B7.js} +9 -4
  23. package/dist/chunks/{index.hTNFpC24.js → index.CPNMO3h-.js} +73 -50
  24. package/dist/chunks/{index.M2dsQ_UQ.js → index.D0heQG4v.js} +557 -183
  25. package/dist/chunks/{index.BgwtGYxD.js → index.GYMZ12wH.js} +5 -5
  26. package/dist/chunks/{index.DGdajAO2.js → index.uwTEEBsB.js} +94 -71
  27. package/dist/chunks/{init-forks.CdGu3HUy.js → init-forks.CbYYa5xq.js} +1 -1
  28. package/dist/chunks/{init-threads.2f_lsHNK.js → init-threads.DtjdvxPl.js} +1 -1
  29. package/dist/chunks/{init.IsjtLXKe.js → init.DrHtV5zd.js} +7 -7
  30. package/dist/chunks/module-dependencies.CwNPkcV4.js +71 -0
  31. package/dist/chunks/{native.CF4uT5hY.js → native.cdzHIdmv.js} +48 -34
  32. package/dist/chunks/{nativeModuleMocker.DwRB4F9R.js → nativeModuleMocker.D8f4cW4A.js} +2 -2
  33. package/dist/chunks/{nativeModuleRunner.J0QLzNtK.js → nativeModuleRunner.xi64Afb2.js} +1 -1
  34. package/dist/chunks/{node.CfQ_OGWr.js → node.uQulW0ei.js} +1 -1
  35. package/dist/chunks/{pathe.M-eThtNZ.DwEga6ro.js → pathe.M-eThtNZ.Ba-7h1rE.js} +9 -7
  36. package/dist/chunks/{plugin.d.My_z-jmU.d.ts → plugin.d.C8mmycim.d.ts} +109 -68
  37. package/dist/chunks/{plugins.Cigb0uSy.js → plugins.DPQHVT0p.js} +1 -1
  38. package/dist/chunks/{resolver.NpfwMKt9.js → resolver.CtCcxIy1.js} +1 -1
  39. package/dist/chunks/{rpc.CJVl3hZH.js → rpc.DpkUyY1N.js} +3 -2
  40. package/dist/chunks/{rpc.d.DA9Utv4e.d.ts → rpc.d.Cft1biqy.d.ts} +2 -1
  41. package/dist/chunks/{run.C5UmxDPh.js → run.Cm2sd7-x.js} +122 -97
  42. package/dist/chunks/{setup-common.Ct8rQvjH.js → setup-common.BABL3z3m.js} +3 -3
  43. package/dist/chunks/{source-map.BH0bbrs9.js → source-map.DdKI5IHB.js} +15 -10
  44. package/dist/chunks/{source-map.d.YqWNcp4e.d.ts → source-map.d.kzFtk_dj.d.ts} +1 -1
  45. package/dist/chunks/{spy.KLHgXex_.js → spy.DDMXghXv.js} +63 -32
  46. package/dist/chunks/{task-utils.d.BZm4GSQD.d.ts → task-utils.d.PFh2BV6Q.d.ts} +1 -1
  47. package/dist/chunks/tinyrainbow.Do8I1XRG.js +88 -0
  48. package/dist/chunks/{utils.CJ0JImL8.js → utils.DSfl_w8V.js} +44 -42
  49. package/dist/chunks/{vm.KI2AYADz.js → vm.Uo_C9Uld.js} +16 -13
  50. package/dist/chunks/{worker.d.MLmnzOJE.d.ts → worker.d.BH-r1bPu.d.ts} +8 -3
  51. package/dist/cli.js +4 -4
  52. package/dist/config.cjs +1 -1
  53. package/dist/config.d.ts +9 -10
  54. package/dist/config.js +2 -2
  55. package/dist/index.d.ts +10 -10
  56. package/dist/index.js +10 -10
  57. package/dist/module-evaluator.d.ts +3 -2
  58. package/dist/module-evaluator.js +8 -5
  59. package/dist/node.d.ts +9 -10
  60. package/dist/node.js +27 -26
  61. package/dist/runtime.d.ts +6 -6
  62. package/dist/runtime.js +4 -4
  63. package/dist/spy.js +1 -1
  64. package/dist/task-utils.js +7 -4
  65. package/dist/worker.d.ts +4 -4
  66. package/dist/worker.js +21 -20
  67. package/dist/workers/forks.js +19 -18
  68. package/dist/workers/runVmTests.js +23 -14
  69. package/dist/workers/threads.js +19 -18
  70. package/dist/workers/vmForks.js +13 -13
  71. package/dist/workers/vmThreads.js +13 -13
  72. package/globals.d.ts +19 -19
  73. package/index.cjs +3 -3
  74. package/optional-runtime-types.d.ts +1 -1
  75. package/optional-types.d.ts +1 -1
  76. package/package.json +35 -29
  77. package/suppress-warnings.cjs +1 -1
  78. package/dist/chunks/cli-api.DL4Bd7Vh.js +0 -528
  79. package/dist/chunks/tinyrainbow.Ht9iggcq.js +0 -95
@@ -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.Ba-7h1rE.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.CPNMO3h-.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.Ba-7h1rE.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.Ba-7h1rE.js';
4
4
 
5
5
  class NodeSnapshotEnvironment {
6
6
  options;
@@ -113,11 +113,13 @@ function filterOutComments(s) {
113
113
  if (s[i] === "\n") commentState = "none";
114
114
  } else if (commentState === "multiline") {
115
115
  if (s[i - 1] === "*" && s[i] === "/") commentState = "none";
116
- } else if (commentState === "none") if (s[i] === "/" && s[i + 1] === "/") commentState = "singleline";
117
- else if (s[i] === "/" && s[i + 1] === "*") {
118
- commentState = "multiline";
119
- i += 2;
120
- } else result.push(s[i]);
116
+ } else if (commentState === "none") {
117
+ if (s[i] === "/" && s[i + 1] === "/") commentState = "singleline";
118
+ else if (s[i] === "/" && s[i + 1] === "*") {
119
+ commentState = "multiline";
120
+ i += 2;
121
+ } else result.push(s[i]);
122
+ }
121
123
  return result.join("");
122
124
  }
123
125
  const bareImportRE = /^(?![a-z]:)[\w@](?!.*:\/\/)/i;
@@ -293,7 +295,7 @@ function unique(array) {
293
295
  return Array.from(new Set(array));
294
296
  }
295
297
  function sanitizeFilePath(s) {
296
- // eslint-disable-next-line no-control-regex
298
+ // oxlint-disable-next-line no-control-regex
297
299
  return s.replace(/[\x00-\x2C\x2E\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/g, "-");
298
300
  }
299
301
 
@@ -487,4 +489,4 @@ const basename = function(p, extension) {
487
489
  return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
488
490
  };
489
491
 
490
- export { objectAttr as A, getCallLastIndex as B, CSS_LANGS_RE as C, noop as D, createSimpleStackTrace as E, withTrailingSlash as F, wrapId as G, isExternalUrl as H, unwrapId as I, deepMerge as J, KNOWN_ASSET_TYPES as K, sanitizeFilePath as L, relative as a, basename as b, cleanUrl as c, dirname as d, createDefer as e, extname as f, getType as g, KNOWN_ASSET_RE as h, isAbsolute as i, join as j, splitFileAndPostfix as k, isBareImport as l, isPrimitive as m, normalize as n, notNullish as o, deepClone as p, getOwnProperties as q, resolve as r, slash as s, toArray as t, isObject as u, filterOutComments as v, ordinal as w, assertTypes as x, isNegativeNaN as y, unique as z };
492
+ export { objectAttr as A, getCallLastIndex as B, CSS_LANGS_RE as C, noop as D, createSimpleStackTrace as E, sanitizeFilePath as F, deepMerge as G, withTrailingSlash as H, wrapId as I, isExternalUrl as J, KNOWN_ASSET_TYPES as K, unwrapId as L, relative as a, basename as b, cleanUrl as c, dirname as d, createDefer as e, extname as f, getType as g, KNOWN_ASSET_RE as h, isAbsolute as i, join as j, splitFileAndPostfix as k, isBareImport as l, isPrimitive as m, normalize as n, notNullish as o, deepClone as p, getOwnProperties as q, resolve as r, slash as s, toArray as t, isObject as u, filterOutComments as v, ordinal as w, assertTypes as x, isNegativeNaN as y, unique as z };
@@ -1,18 +1,17 @@
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.QBNYCgFU.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.FGQ9_rK6.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.BH-r1bPu.js';
8
+ import { O as OTELCarrier } from './rpc.d.Cft1biqy.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.kzFtk_dj.js';
11
11
  import { CDPSession, BrowserCommands, MarkOptions } from 'vitest/browser';
12
12
  import path from 'node:path';
13
13
  import { Console } from 'node:console';
14
14
  import { writeFile } from 'node:fs/promises';
15
- import { Stats } from 'node:fs';
16
15
 
17
16
  type ChaiConfig = Omit<Partial<typeof chai.config>, "useProxy" | "proxyExcludedKeys" | "deepEqual">;
18
17
 
@@ -530,7 +529,16 @@ interface BrowserProvider {
530
529
  parallel: boolean;
531
530
  }) => Promise<void>;
532
531
  getCDPSession?: (sessionId: string) => Promise<CDPSession>;
533
- close: () => Awaitable<void>;
532
+ close: (options?: BrowserProviderCloseOptions) => Awaitable<void>;
533
+ }
534
+ interface BrowserProviderCloseOptions {
535
+ /**
536
+ * The instance is closed to free a slot for another project and can be
537
+ * opened again later, so the provider may keep the browser process alive
538
+ * for the next instance instead of launching a new one.
539
+ * @default false
540
+ */
541
+ keepWarm?: boolean;
534
542
  }
535
543
  type BrowserBuiltinProvider = "webdriverio" | "playwright" | "preview";
536
544
  interface _BrowserNames {}
@@ -829,7 +837,7 @@ interface BrowserServerContribution {
829
837
  config: ResolvedConfig;
830
838
  vitest: Vitest;
831
839
  }) => ParentProjectBrowser;
832
- /** Called by core after `server.listen()` to wire up the browser RPC. */
840
+ /** Called by core once the server exists to wire up the browser RPC (the port may be bound later). */
833
841
  setupRpc: (parent: ParentProjectBrowser) => void;
834
842
  /**
835
843
  * Mutable. Filled by core at server creation; the pushed `BrowserPlugin`
@@ -840,9 +848,14 @@ interface BrowserServerContribution {
840
848
  interface ProjectBrowser {
841
849
  vite: ViteDevServer;
842
850
  state: BrowserServerState;
843
- provider: BrowserProvider;
851
+ /**
852
+ * The provider of the open browser instance. It is `undefined` until the instance
853
+ * starts running tests and after the instance is closed to free a worker slot.
854
+ */
855
+ provider: BrowserProvider | undefined;
844
856
  close: () => Promise<void>;
845
857
  initBrowserProvider: (project: TestProject) => Promise<void>;
858
+ closeBrowserProvider: (options?: BrowserProviderCloseOptions) => Promise<void>;
846
859
  parseStacktrace: (stack: string) => ParsedStack[];
847
860
  parseErrorStacktrace: (error: TestError, options?: StackTraceParserOptions) => ParsedStack[];
848
861
  registerCommand: <K extends keyof BrowserCommands>(name: K, cb: BrowserCommand<Parameters<BrowserCommands[K]>, ReturnType<BrowserCommands[K]>>) => void;
@@ -1909,7 +1922,7 @@ interface CoverageOptions {
1909
1922
  excludeAfterRemap?: boolean;
1910
1923
  /**
1911
1924
  * Concurrency limit used when processing the coverage results.
1912
- * Defaults to `Math.min(20, os.availableParallelism?.() ?? os.cpus().length)`
1925
+ * Defaults to `Math.min(20, os.availableParallelism())`
1913
1926
  */
1914
1927
  processingConcurrency?: number;
1915
1928
  /**
@@ -2060,46 +2073,42 @@ declare class SnapshotManager {
2060
2073
  resolveRawPath(testPath: string, rawPath: string): string;
2061
2074
  }
2062
2075
 
2063
- interface SuiteResultCache {
2076
+ interface CachedTestFileResult {
2077
+ /**
2078
+ * The file has a known failure. Only a complete run of the file clears it.
2079
+ */
2064
2080
  failed: boolean;
2081
+ /**
2082
+ * Duration of the last complete run in milliseconds.
2083
+ * A file that never ran completely keeps the duration of its first recorded run.
2084
+ */
2065
2085
  duration: number;
2066
- }
2067
- declare class ResultsCache {
2068
- private logger;
2069
- private cache;
2070
- private workspacesKeyMap;
2071
- private cachePath;
2072
- private version;
2073
- private root;
2074
- constructor(logger: Logger);
2075
- getCachePath(): string | null;
2076
- setConfig(root: string, config: ResolvedConfig["cache"]): void;
2077
- getResults(key: string): SuiteResultCache | undefined;
2078
- clearCache(): Promise<void>;
2079
- readFromCache(): Promise<void>;
2080
- updateResults(files: File[]): void;
2081
- removeFromCache(filepath: string): void;
2082
- writeToCache(): Promise<void>;
2083
- }
2084
-
2085
- type FileStatsCache = Pick<Stats, "size">;
2086
- declare class FilesStatsCache {
2087
- cache: Map<string, FileStatsCache>;
2088
- getStats(key: string): FileStatsCache | undefined;
2089
- populateStats(root: string, specs: TestSpecification[]): Promise<void>;
2090
- updateStats(fsPath: string, key: string): Promise<void>;
2091
- removeStats(fsPath: string): void;
2086
+ /**
2087
+ * Unix timestamp in milliseconds of the start of the last complete run.
2088
+ * It is not set if the file never ran completely.
2089
+ */
2090
+ lastRun?: number;
2092
2091
  }
2093
2092
 
2094
2093
  declare class VitestCache {
2095
- results: ResultsCache;
2096
- stats: FilesStatsCache;
2097
- constructor(logger: Logger);
2098
- getFileTestResults(key: string): SuiteResultCache | undefined;
2094
+ private fileStats;
2095
+ private warnedMethods;
2096
+ /**
2097
+ * Returns the result of the test file from the previous test runs.
2098
+ */
2099
+ getTestSpecificationResult(specification: TestSpecification): CachedTestFileResult | undefined;
2100
+ /**
2101
+ * @deprecated Use `getTestSpecificationResult(specification)` instead.
2102
+ */
2103
+ getFileTestResults(key: string): CachedTestFileResult | undefined;
2104
+ /**
2105
+ * @deprecated Vitest does not cache file sizes anymore. Read the size from the file system instead.
2106
+ */
2099
2107
  getFileStats(key: string): {
2100
2108
  size: number;
2101
2109
  } | undefined;
2102
- static resolveCacheDir(root: string, dir?: string, projectName?: string): string;
2110
+ private readFileStats;
2111
+ private deprecate;
2103
2112
  }
2104
2113
 
2105
2114
  type TestRunEndReason = "passed" | "interrupted" | "failed";
@@ -2280,7 +2289,7 @@ declare class VitestWatcher {
2280
2289
  onFileChange: (id: string) => void;
2281
2290
  onFileDelete: (id: string) => void;
2282
2291
  onFileCreate: (id: string) => void;
2283
- private handleSetupFile;
2292
+ private handleProjectFile;
2284
2293
  /**
2285
2294
  * @returns A value indicating whether rerun is needed (changedTests was mutated)
2286
2295
  */
@@ -2365,7 +2374,7 @@ declare class Vitest {
2365
2374
  */
2366
2375
  snapshot: SnapshotManager;
2367
2376
  /**
2368
- * Test results and test file stats cache. Primarily used by the sequencer to sort tests.
2377
+ * The cache of the previous test runs. Primarily used by the sequencer to sort tests.
2369
2378
  */
2370
2379
  cache: VitestCache;
2371
2380
  private _warnedExperimentalCacheKeyGenerator;
@@ -2580,6 +2589,12 @@ declare class Vitest {
2580
2589
  */
2581
2590
  close(): Promise<void>;
2582
2591
  /**
2592
+ * Removes the root temp directory with the tmp module copies,
2593
+ * mirroring `TestProject.clearTmpDir()`. The reference is cleared before
2594
+ * the removal so a repeated close is a no-op.
2595
+ */
2596
+ private _clearTmpDir;
2597
+ /**
2583
2598
  * Closes all projects and exit the process
2584
2599
  * @param force If true, the process will exit immediately after closing the projects.
2585
2600
  */
@@ -2817,8 +2832,8 @@ declare abstract class BaseReporter implements Reporter {
2817
2832
  shouldLog(log: UserConsoleLog, taskState?: TestResult["state"]): boolean;
2818
2833
  onServerRestart(reason?: string): void;
2819
2834
  reportSummary(files: File[], errors: unknown[]): void;
2835
+ private printSourceFilterSummary;
2820
2836
  reportTestSummary(files: File[], errors: unknown[], leakCount: number): void;
2821
- private getEffectiveMaxWorkers;
2822
2837
  /**
2823
2838
  * Surfaces the cost of re-creating a DOM environment for every test file:
2824
2839
  * with an isolating pool, `jsdom`/`happy-dom` are imported and set up once
@@ -3258,19 +3273,19 @@ declare const ReportersMap: {
3258
3273
  };
3259
3274
  type BuiltinReporters = keyof typeof ReportersMap;
3260
3275
  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;
3276
+ default: DefaultReporterOptions;
3277
+ minimal: DefaultReporterOptions;
3278
+ agent: DefaultReporterOptions;
3279
+ verbose: DefaultReporterOptions;
3280
+ dot: BaseOptions;
3281
+ tree: BaseOptions;
3282
+ json: JsonOptions;
3283
+ blob: BlobOptions;
3284
+ tap: never;
3270
3285
  "tap-flat": never;
3271
- "junit": JUnitOptions;
3286
+ junit: JUnitOptions;
3272
3287
  "hanging-process": never;
3273
- "html": HTMLOptions;
3288
+ html: HTMLOptions;
3274
3289
  "github-actions": GithubActionsReporterOptions;
3275
3290
  }
3276
3291
 
@@ -3354,6 +3369,21 @@ type ResolvedApiConfig = ApiConfig & {
3354
3369
  token: string;
3355
3370
  tokenCreated: boolean;
3356
3371
  };
3372
+ interface UIOptions {
3373
+ /**
3374
+ * Enable Vitest UI
3375
+ *
3376
+ * @default false
3377
+ */
3378
+ enabled?: boolean;
3379
+ /**
3380
+ * Color theme of Vitest UI and the browser mode UI. `auto` follows the system preference
3381
+ * and remembers the theme toggled in the UI. `dark` and `light` are applied on every page load.
3382
+ *
3383
+ * @default 'auto'
3384
+ */
3385
+ theme?: "dark" | "light" | "auto";
3386
+ }
3357
3387
  interface EnvironmentOptions {
3358
3388
  /**
3359
3389
  * jsdom options.
@@ -3787,7 +3817,7 @@ interface InlineConfig {
3787
3817
  *
3788
3818
  * @default false
3789
3819
  */
3790
- ui?: boolean;
3820
+ ui?: boolean | UIOptions;
3791
3821
  /**
3792
3822
  * options for test in a browser environment
3793
3823
  *
@@ -3893,12 +3923,13 @@ interface InlineConfig {
3893
3923
  */
3894
3924
  maxConcurrency?: number;
3895
3925
  /**
3896
- * Options for configuring cache policy.
3897
- * @default { dir: 'node_modules/.vite/vitest/{project-hash}' }
3926
+ * Store the results of test runs on the file system to run failed
3927
+ * and longer test files first. The cache is stored in Vite's "cacheDir".
3928
+ * @default true
3898
3929
  */
3899
- cache?: false | {
3930
+ cache?: boolean | {
3900
3931
  /**
3901
- * @deprecated Use Vite's "cacheDir" instead if you want to change the cache director. Note caches will be written to "cacheDir\/vitest".
3932
+ * @deprecated This option has no effect. Use Vite's "cacheDir" instead if you want to change the cache directory.
3902
3933
  */
3903
3934
  dir: string;
3904
3935
  };
@@ -3906,7 +3937,7 @@ interface InlineConfig {
3906
3937
  * Cache transformed modules on the file system and reuse them between reruns
3907
3938
  * and separate Vitest processes, which can significantly speed up cold starts.
3908
3939
  *
3909
- * @default false
3940
+ * @default true
3910
3941
  */
3911
3942
  fsModuleCache?: boolean;
3912
3943
  /**
@@ -4181,6 +4212,14 @@ interface InlineConfig {
4181
4212
  */
4182
4213
  vcsProvider?: VCSProvider | string;
4183
4214
  /**
4215
+ * Record the modules that every test file loads in the cache and use the records
4216
+ * with `--changed` and `--related` instead of walking the module graph statically.
4217
+ *
4218
+ * A test file without a record always runs.
4219
+ * @default false
4220
+ */
4221
+ recordDependencies?: boolean;
4222
+ /**
4184
4223
  * Parse test specifications before running them.
4185
4224
  * This will apply `.only` flag and test name pattern across all files without running them.
4186
4225
  */
@@ -4354,7 +4393,7 @@ interface UserConfig extends InlineConfig {
4354
4393
  type OnUnhandledErrorCallback = (error: (TestError | Error) & {
4355
4394
  type: string;
4356
4395
  }) => boolean | void;
4357
- interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config" | "filters" | "browser" | "coverage" | "testNamePattern" | "related" | "api" | "reporters" | "resolveSnapshotPath" | "benchmark" | "shard" | "cache" | "sequence" | "typecheck" | "runner" | "pool" | "cliExclude" | "diff" | "setupFiles" | "snapshotEnvironment" | "bail" | "name" | "vmMemoryLimit" | "fileParallelism" | "tagsFilter" | "reporter"> {
4396
+ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config" | "filters" | "browser" | "coverage" | "testNamePattern" | "related" | "api" | "reporters" | "resolveSnapshotPath" | "benchmark" | "shard" | "cache" | "sequence" | "typecheck" | "runner" | "pool" | "cliExclude" | "diff" | "setupFiles" | "snapshotEnvironment" | "bail" | "name" | "vmMemoryLimit" | "fileParallelism" | "tagsFilter" | "reporter" | "ui"> {
4358
4397
  name: ProjectName["label"];
4359
4398
  color?: ProjectName["color"];
4360
4399
  base?: string;
@@ -4374,6 +4413,8 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config"
4374
4413
  reporters: (InlineReporter | ReporterWithOptions)[];
4375
4414
  defines: Record<string, any>;
4376
4415
  api: ResolvedApiConfig;
4416
+ ui: boolean;
4417
+ uiOptions: Required<Omit<UIOptions, "enabled">>;
4377
4418
  cliExclude?: string[];
4378
4419
  project: string[];
4379
4420
  benchmark: ResolvedBenchmarkOptions;
@@ -4490,7 +4531,7 @@ interface UserWorkspaceConfig extends UserConfig$1 {
4490
4531
  }
4491
4532
  type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>;
4492
4533
  type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
4493
- type TestProjectInlineConfiguration = (UserWorkspaceConfig & {
4534
+ type TestProjectInlineConfiguration = UserWorkspaceConfig & {
4494
4535
  /**
4495
4536
  * Relative path to the extendable config. All other options will be merged with this config.
4496
4537
  * If `true`, the project will inherit all options from the root config.
@@ -4499,7 +4540,7 @@ type TestProjectInlineConfiguration = (UserWorkspaceConfig & {
4499
4540
  * @example '../vite.config.ts'
4500
4541
  */
4501
4542
  extends?: string | boolean;
4502
- });
4543
+ };
4503
4544
  type TestProjectConfiguration = string | TestProjectInlineConfiguration | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
4504
4545
 
4505
4546
  /**
@@ -4521,7 +4562,7 @@ interface VitestPluginContext {
4521
4562
  project: TestProject;
4522
4563
  injectTestProjects: (config: TestProjectConfiguration | TestProjectConfiguration[]) => Promise<TestProject[]>;
4523
4564
  /**
4524
- * Define a generator that will be applied before hashing the cache key.
4565
+ * Define a generator that will be applied before hashing this project's cache key.
4525
4566
  *
4526
4567
  * Use this to make sure Vitest generates correct hash. It is a good idea
4527
4568
  * to define this function if your plugin can be registered with different options.
@@ -4535,5 +4576,5 @@ interface VitestPluginContext {
4535
4576
  experimental_defineCacheKeyGenerator: (callback: CacheKeyIdGenerator) => void;
4536
4577
  }
4537
4578
 
4538
- export { Logger as L, MinimalReporter as M, PluginHarness as P, VerboseReporter as a$, DefaultReporter as a6, DotReporter as a8, TapFlatReporter as aE, TapReporter as aF, TestCase as aH, TestCollection as aI, TestModule as aK, TestSuite as aW, GithubActionsReporter as aa, HangingProcessReporter as ac, JUnitReporter as af, JsonReporter as ai, ReportersMap as ax, VitestPackageInstaller as b1, experimental_getRunnerTask as b4, startVitest as b5, Vitest as f, CoverageMap as h, TestProject as j, TestSpecification as m, BaseReporter as r };
4539
- export type { CoverageInstrumenter as $, ApiConfig as A, BaseCoverageOptions as B, CoverageOptions as C, BrowserProvider as D, BrowserProviderOption as E, FieldsWithDefaultValues as F, BrowserScript as G, BrowserServerContribution as H, InlineConfig as I, BrowserServerFactory as J, BrowserServerState as K, BrowserServerStateSession as N, BrowserTraceViewOptions as O, BuiltinEnvironment as Q, ResolvedConfig as R, BuiltinReporterOptions as S, TestProjectConfiguration as T, UserWorkspaceConfig as U, VitestPluginContext as V, WatcherTriggerPattern as W, BuiltinReporters as X, CSSModuleScopeStrategy as Y, CacheKeyIdGenerator as Z, CacheKeyIdGeneratorContext as _, UserProjectConfigFn as a, CoverageIstanbulOptions as a0, CoverageProvider as a1, CoverageProviderModule as a2, CoverageReporter as a3, CoverageV8Options as a4, CustomProviderOptions as a5, DepsOptimizationOptions as a7, EnvironmentOptions as a9, ResolvedBrowserOptions as aA, ResolvedProjectConfig as aB, SerializedTestProject as aC, SuiteNameTemplateVariables as aD, TaskOptions as aG, TestDiagnostic as aJ, TestModuleState as aL, TestResult as aM, TestResultFailed as aN, TestResultPassed as aO, TestResultPending as aP, TestResultSkipped as aQ, TestRunEndReason as aR, TestRunResult as aS, TestSequencerConstructor as aT, TestSpecificationOptions as aU, TestState as aV, TestSuiteState as aX, ToMatchScreenshotComparators as aY, ToMatchScreenshotOptions as aZ, TypecheckConfig as a_, HTMLOptions as ab, InstrumenterOptions as ad, JUnitOptions as ae, JsonAssertionResult as ag, JsonOptions as ah, JsonTestResult as aj, JsonTestResults as ak, ModuleDiagnostic as al, OnServerRestartHandler as am, OnTestsRerunHandler as an, ParentProjectBrowser as ao, Pool as ap, PoolRunnerInitializer as aq, PoolTask as ar, ProjectBrowser as as, ProjectConfig as at, Report as au, ReportedHookContext as av, Reporter as aw, ResolveSnapshotPathHandler as ay, ResolveSnapshotPathHandlerContext as az, UserProjectConfigExport as b, VitestEnvironment as b0, WorkerResponse as b2, _BrowserNames as b3, TestProjectInlineConfiguration as c, UserConfig as d, CliOptions as e, ResolvedCoverageOptions as g, ReportContext as i, VitestOptions as k, VitestRunMode as l, PoolWorker as n, PoolOptions as o, WorkerRequest as p, TestSequencer as q, BenchmarkUserOptions as s, BrowserBuiltinProvider as t, BrowserCommand as u, BrowserCommandContext as v, BrowserConfigOptions as w, BrowserInstanceOption as x, BrowserModuleMocker as y, BrowserOrchestrator as z };
4579
+ export { Logger as L, MinimalReporter as M, PluginHarness as P, DefaultReporter as a8, TapFlatReporter as aG, TapReporter as aH, TestCase as aJ, TestCollection as aK, TestModule as aM, TestSuite as aY, DotReporter as aa, GithubActionsReporter as ac, HangingProcessReporter as ae, JUnitReporter as ah, JsonReporter as ak, ReportersMap as az, VerboseReporter as b2, VitestPackageInstaller as b4, experimental_getRunnerTask as b7, startVitest as b8, Vitest as f, CoverageMap as h, TestProject as j, TestSpecification as m, BaseReporter as r };
4580
+ export type { CacheKeyIdGeneratorContext as $, ApiConfig as A, BaseCoverageOptions as B, CoverageOptions as C, BrowserProvider as D, BrowserProviderCloseOptions as E, FieldsWithDefaultValues as F, BrowserProviderOption as G, BrowserScript as H, InlineConfig as I, BrowserServerContribution as J, BrowserServerFactory as K, BrowserServerState as N, BrowserServerStateSession as O, BrowserTraceViewOptions as Q, ResolvedConfig as R, BuiltinEnvironment as S, TestProjectConfiguration as T, UserWorkspaceConfig as U, VitestPluginContext as V, WatcherTriggerPattern as W, BuiltinReporterOptions as X, BuiltinReporters as Y, CSSModuleScopeStrategy as Z, CacheKeyIdGenerator as _, UserProjectConfigFn as a, ToMatchScreenshotOptions as a$, CachedTestFileResult as a0, CoverageInstrumenter as a1, CoverageIstanbulOptions as a2, CoverageProvider as a3, CoverageProviderModule as a4, CoverageReporter as a5, CoverageV8Options as a6, CustomProviderOptions as a7, DepsOptimizationOptions as a9, ResolveSnapshotPathHandler as aA, ResolveSnapshotPathHandlerContext as aB, ResolvedBrowserOptions as aC, ResolvedProjectConfig as aD, SerializedTestProject as aE, SuiteNameTemplateVariables as aF, TaskOptions as aI, TestDiagnostic as aL, TestModuleState as aN, TestResult as aO, TestResultFailed as aP, TestResultPassed as aQ, TestResultPending as aR, TestResultSkipped as aS, TestRunEndReason as aT, TestRunResult as aU, TestSequencerConstructor as aV, TestSpecificationOptions as aW, TestState as aX, TestSuiteState as aZ, ToMatchScreenshotComparators as a_, EnvironmentOptions as ab, HTMLOptions as ad, InstrumenterOptions as af, JUnitOptions as ag, JsonAssertionResult as ai, JsonOptions as aj, JsonTestResult as al, JsonTestResults as am, ModuleDiagnostic as an, OnServerRestartHandler as ao, OnTestsRerunHandler as ap, ParentProjectBrowser as aq, Pool as ar, PoolRunnerInitializer as as, PoolTask as at, ProjectBrowser as au, ProjectConfig as av, Report as aw, ReportedHookContext as ax, Reporter as ay, UserProjectConfigExport as b, TypecheckConfig as b0, UIOptions as b1, VitestEnvironment as b3, WorkerResponse as b5, _BrowserNames as b6, TestProjectInlineConfiguration as c, UserConfig as d, CliOptions as e, ResolvedCoverageOptions as g, ReportContext as i, VitestOptions as k, VitestRunMode as l, PoolWorker as n, PoolOptions as o, WorkerRequest as p, TestSequencer as q, BenchmarkUserOptions as s, BrowserBuiltinProvider as t, BrowserCommand as u, BrowserCommandContext as v, BrowserConfigOptions as w, BrowserInstanceOption as x, BrowserModuleMocker as y, BrowserOrchestrator as z };
@@ -1,4 +1,4 @@
1
- import { p as plugins } from './index.M2dsQ_UQ.js';
1
+ import { p as plugins } from './index.D0heQG4v.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.Ba-7h1rE.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.Ba-7h1rE.js';
3
+ import { a as getSafeTimers } from './source-map.DdKI5IHB.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.QBNYCgFU.js';
2
2
  import { FetchFunctionOptions, FetchResult } from 'vite/module-runner';
3
3
 
4
4
  interface OTELCarrier {
@@ -52,6 +52,7 @@ interface RuntimeRPC {
52
52
  onUserConsoleLog: (log: UserConsoleLog) => void;
53
53
  onUnhandledError: (err: unknown, type: string) => void;
54
54
  onAsyncLeaks: (leak: AsyncLeak[]) => void;
55
+ onTestModuleDependencies: (filepath: string, dependencies: string[]) => void;
55
56
  onQueued: (file: File) => void;
56
57
  onCollected: (files: File[]) => Promise<void>;
57
58
  onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;