vitest 5.0.0-rc.3 → 5.0.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 (34) hide show
  1. package/dist/browser.js +3 -3
  2. package/dist/chunks/{base.CZYgpg5z.js → base.BTS5G301.js} +8 -8
  3. package/dist/chunks/{cac.AVSgLgX0.js → cac.D805sv8h.js} +9 -6
  4. package/dist/chunks/{cli-api.BsG_KUyt.js → cli-api.LUtK11-x.js} +2 -2
  5. package/dist/chunks/{creator.CYvpourF.js → creator.BHJ7K266.js} +3 -3
  6. package/dist/chunks/{doctor.CzJ1dA-i.js → doctor.CrUoUtdU.js} +1 -1
  7. package/dist/chunks/{globals.B4gJ9mZH.js → globals.DQ4rmEUL.js} +3 -3
  8. package/dist/chunks/{index.DQO7054M.js → index.1_nbEjJY.js} +16 -6
  9. package/dist/chunks/{index.okypXZ97.js → index.5J3Pr46F.js} +2 -2
  10. package/dist/chunks/{index.CVFiuVPx.js → index.B89dZ0-N.js} +49 -21
  11. package/dist/chunks/{index.CSoBZWW_.js → index.OVGXnVRj.js} +26 -19
  12. package/dist/chunks/{init-forks.BqnYxpzU.js → init-forks.CiCtIMPj.js} +1 -1
  13. package/dist/chunks/{init-threads.CL4Y0HC6.js → init-threads.DbGO6vUd.js} +1 -1
  14. package/dist/chunks/{init.DJ2lKyjE.js → init.BS957yFf.js} +1 -1
  15. package/dist/chunks/{nativeModuleMocker.DBSXgC3F.js → nativeModuleMocker.E7jPi2fl.js} +1 -1
  16. package/dist/chunks/{plugin.d.DAuMAWfb.d.ts → plugin.d.BbcoZhuj.d.ts} +7 -4
  17. package/dist/chunks/{run.DyRH7m0-.js → run.CQOUYP-x.js} +92 -20
  18. package/dist/chunks/{setup-common.p8NqUXPi.js → setup-common.D5-2VgqG.js} +1 -1
  19. package/dist/chunks/{spy.DPpyuUIA.js → spy.DPLvp2J7.js} +19 -3
  20. package/dist/chunks/{vm.gGBei5ET.js → vm.BQTVRi0W.js} +21 -5
  21. package/dist/cli.js +1 -1
  22. package/dist/config.d.ts +2 -2
  23. package/dist/index.js +3 -3
  24. package/dist/node.d.ts +2 -2
  25. package/dist/node.js +5 -5
  26. package/dist/runtime.js +2 -2
  27. package/dist/spy.js +1 -1
  28. package/dist/worker.js +8 -8
  29. package/dist/workers/forks.js +9 -9
  30. package/dist/workers/runVmTests.js +5 -5
  31. package/dist/workers/threads.js +9 -9
  32. package/dist/workers/vmForks.js +5 -5
  33. package/dist/workers/vmThreads.js +5 -5
  34. package/package.json +15 -15
package/dist/browser.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.BtDxDqSU.js';
2
- export { p as collectTests, a as processError, s as startTests } from './chunks/run.DyRH7m0-.js';
3
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as setupEnv } from './chunks/setup-common.p8NqUXPi.js';
4
- export { s as SpyModule } from './chunks/spy.DPpyuUIA.js';
2
+ export { p as collectTests, a as processError, s as startTests } from './chunks/run.CQOUYP-x.js';
3
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as setupEnv } from './chunks/setup-common.D5-2VgqG.js';
4
+ export { s as SpyModule } from './chunks/spy.DPLvp2J7.js';
5
5
  export { f as format, i as inspect, s as stringify } from './chunks/display.pkpxlVcY.js';
6
6
  export { g as getType } from './chunks/pathe.M-eThtNZ.Clq7AXhv.js';
7
7
  export { D as DecodedMap, g as getOriginalPosition, a as getSafeTimers, s as setSafeTimers } from './chunks/source-map.Dx3YPjIe.js';
@@ -1,21 +1,21 @@
1
1
  import { runInThisContext } from 'node:vm';
2
- import { s as spyModule } from './spy.DPpyuUIA.js';
3
- import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.okypXZ97.js';
4
- import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.DJ2lKyjE.js';
2
+ import { s as spyModule } from './spy.DPLvp2J7.js';
3
+ import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.5J3Pr46F.js';
4
+ import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.BS957yFf.js';
5
5
  import { Traces } from '../traces.js';
6
6
  import { V as VitestEvaluatedModules } from './rpc.DWKX1ZbI.js';
7
- import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.DQO7054M.js';
7
+ import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.1_nbEjJY.js';
8
8
  import { performance as performance$1 } from 'node:perf_hooks';
9
9
  import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.BtDxDqSU.js';
10
- import { i as index, g as globalExpect, v as vi } from './index.CSoBZWW_.js';
10
+ import { i as index, g as globalExpect, v as vi } from './index.OVGXnVRj.js';
11
11
  import { c as closeInspector } from './inspector.CvyFGlXm.js';
12
- import { s as startTests, p as publicCollect } from './run.DyRH7m0-.js';
12
+ import { s as startTests, p as publicCollect } from './run.CQOUYP-x.js';
13
13
  import { createRequire } from 'node:module';
14
14
  import timers from 'node:timers';
15
15
  import timersPromises from 'node:timers/promises';
16
16
  import util from 'node:util';
17
17
  import { K as KNOWN_ASSET_TYPES } from './pathe.M-eThtNZ.Clq7AXhv.js';
18
- import { s as setupCommonEnv, b as setupEnv } from './setup-common.p8NqUXPi.js';
18
+ import { s as setupCommonEnv, b as setupEnv } from './setup-common.D5-2VgqG.js';
19
19
  import { g as getWorkerState, r as resetModules, p as provideWorkerState, a as getSafeWorkerState } from './utils.DYj33du9.js';
20
20
 
21
21
  // this should only be used in Node
@@ -119,7 +119,7 @@ async function startModuleRunner(options) {
119
119
  let mocker;
120
120
  if (options.state.config.experimental.nodeLoader !== false) {
121
121
  // this additionally imports acorn/magic-string
122
- const { NativeModuleMocker } = await import('./nativeModuleMocker.DBSXgC3F.js');
122
+ const { NativeModuleMocker } = await import('./nativeModuleMocker.E7jPi2fl.js');
123
123
  mocker = new NativeModuleMocker({
124
124
  async resolveId(id, importer) {
125
125
  // TODO: use import.meta.resolve instead
@@ -620,7 +620,7 @@ class CAC extends EventEmitter {
620
620
 
621
621
  const cac = (name = "") => new CAC(name);
622
622
 
623
- var version = "5.0.0-rc.3";
623
+ var version = "5.0.0";
624
624
 
625
625
  const apiConfig = (port) => ({
626
626
  port: {
@@ -1337,7 +1337,10 @@ const collectCliOptionsConfig = {
1337
1337
  argument: "[true/path]"
1338
1338
  },
1339
1339
  filesOnly: { description: "Print only test files with out the test cases" },
1340
- staticParse: { description: "Parse files statically instead of running them to collect tests (default: false)" },
1340
+ staticParse: {
1341
+ description: "Parse files statically instead of running them to collect tests (default: true)",
1342
+ default: true
1343
+ },
1341
1344
  staticParseConcurrency: {
1342
1345
  description: "How many tests to process at the same time (default: os.availableParallelism())",
1343
1346
  argument: "<limit>"
@@ -2363,7 +2366,7 @@ function normalizeCliOptions(cliFilters, argv) {
2363
2366
  }
2364
2367
  async function start(cliFilters, options) {
2365
2368
  try {
2366
- const { startVitest } = await import('./cli-api.BsG_KUyt.js').then(function (n) { return n.a; });
2369
+ const { startVitest } = await import('./cli-api.LUtK11-x.js').then(function (n) { return n.a; });
2367
2370
  const ctx = await startVitest(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2368
2371
  if (!ctx.shouldKeepServer()) await ctx.exit();
2369
2372
  } catch (e) {
@@ -2377,7 +2380,7 @@ async function start(cliFilters, options) {
2377
2380
  }
2378
2381
  async function doctorCommand(cliFilters, options) {
2379
2382
  try {
2380
- const { doctor } = await import('./doctor.CzJ1dA-i.js');
2383
+ const { doctor } = await import('./doctor.CrUoUtdU.js');
2381
2384
  await doctor(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2382
2385
  process.exit();
2383
2386
  } catch (e) {
@@ -2394,12 +2397,12 @@ async function init(project) {
2394
2397
  console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
2395
2398
  process.exit(1);
2396
2399
  }
2397
- const { create } = await import('./creator.CYvpourF.js');
2400
+ const { create } = await import('./creator.BHJ7K266.js');
2398
2401
  await create();
2399
2402
  }
2400
2403
  async function collect(cliFilters, options) {
2401
2404
  try {
2402
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.BsG_KUyt.js').then(function (n) { return n.a; });
2405
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.LUtK11-x.js').then(function (n) { return n.a; });
2403
2406
  const ctx = await prepareVitest({
2404
2407
  ...normalizeCliOptions(cliFilters, options),
2405
2408
  watch: false,
@@ -1,6 +1,6 @@
1
1
  import { mkdirSync, writeFileSync } from 'node:fs';
2
2
  import { C as CoverageProviderMap } from './coverage.BcXK1DsQ.js';
3
- import { L as Logger, k as VitestPackageInstaller, P as PluginHarness, w as resolveConfig, V as Vitest, A as stdout, y as prompt, g as FilesNotFoundError, G as GitNotFoundError, I as IncludeTaskLocationDisabledError, C as RangeLocationFilterProvidedError, E as LocationFilterFileNotFoundError } from './index.CVFiuVPx.js';
3
+ import { L as Logger, k as VitestPackageInstaller, P as PluginHarness, w as resolveConfig, V as Vitest, A as stdout, y as prompt, g as FilesNotFoundError, G as GitNotFoundError, I as IncludeTaskLocationDisabledError, C as RangeLocationFilterProvidedError, E as LocationFilterFileNotFoundError } from './index.B89dZ0-N.js';
4
4
  import readline from 'node:readline';
5
5
  import { y } from './tinyrainbow.Ht9iggcq.js';
6
6
  import { i as isWindows } from './env.DzFJjrmK.js';
@@ -363,7 +363,7 @@ async function startVitest(modeOrCliFilters, cliFiltersOrOptions, optionsOrViteO
363
363
  });
364
364
  try {
365
365
  if (ctx.config.listTags) await ctx.listTags();
366
- else if (ctx.config.clearCache) await ctx.experimental_clearCache();
366
+ else if (ctx.config.clearCache) await ctx.clearCache();
367
367
  else if (ctx.config.mergeReports) await ctx.mergeReports();
368
368
  else if (ctx.config.standalone) await ctx.standalone();
369
369
  else await ctx.start(cliFilters);
@@ -2,14 +2,14 @@ import { existsSync, writeFileSync, readFileSync } from 'node:fs';
2
2
  import { mkdir, writeFile } from 'node:fs/promises';
3
3
  import { resolve, dirname, relative } from 'node:path';
4
4
  import { detectPackageManager, installPackage } from './index.DXQx-kDM.js';
5
- import { y as prompt, z as findConfigFile } from './index.CVFiuVPx.js';
5
+ import { y as prompt, z as findConfigFile } from './index.B89dZ0-N.js';
6
6
  import { x } from 'tinyexec';
7
7
  import { y } from './tinyrainbow.Ht9iggcq.js';
8
8
  import 'node:process';
9
9
  import 'node:os';
10
10
  import './pathe.M-eThtNZ.Clq7AXhv.js';
11
11
  import './source-map.Dx3YPjIe.js';
12
- import './cac.AVSgLgX0.js';
12
+ import './cac.D805sv8h.js';
13
13
  import 'events';
14
14
  import './env.DzFJjrmK.js';
15
15
  import 'std-env';
@@ -31,7 +31,7 @@ import 'vite';
31
31
  import 'node:crypto';
32
32
  import '../path.js';
33
33
  import 'node:url';
34
- import './run.DyRH7m0-.js';
34
+ import './run.CQOUYP-x.js';
35
35
  import './index.M2dsQ_UQ.js';
36
36
  import './display.pkpxlVcY.js';
37
37
  import '../task-utils.js';
@@ -99,7 +99,7 @@ function log(...args) {
99
99
  console.log(...args);
100
100
  }
101
101
  async function doctor(cliFilters, options) {
102
- const { prepareVitest } = await import('./cli-api.BsG_KUyt.js').then(function (n) { return n.a; });
102
+ const { prepareVitest } = await import('./cli-api.LUtK11-x.js').then(function (n) { return n.a; });
103
103
  log();
104
104
  log(y.inverse(y.bold(y.blue(" DOCTOR "))), "resolving the current configuration...");
105
105
  const ctx = await prepareVitest({
@@ -1,6 +1,6 @@
1
1
  import { g as globalApis } from './constants.-juJ8b_4.js';
2
- import { i as index } from './index.CSoBZWW_.js';
3
- import './run.DyRH7m0-.js';
2
+ import { i as index } from './index.OVGXnVRj.js';
3
+ import './run.CQOUYP-x.js';
4
4
  import './index.M2dsQ_UQ.js';
5
5
  import './tinyrainbow.Ht9iggcq.js';
6
6
  import './display.pkpxlVcY.js';
@@ -8,7 +8,7 @@ import './pathe.M-eThtNZ.Clq7AXhv.js';
8
8
  import './source-map.Dx3YPjIe.js';
9
9
  import '../task-utils.js';
10
10
  import './utils.DYj33du9.js';
11
- import './spy.DPpyuUIA.js';
11
+ import './spy.DPLvp2J7.js';
12
12
  import 'chai';
13
13
  import './plugins.Cigb0uSy.js';
14
14
  import './offset.Dy-5Fdfn.js';
@@ -103,17 +103,27 @@ class BareModuleMocker {
103
103
  }
104
104
  async resolveMocks() {
105
105
  if (!BareModuleMocker.pendingIds.length) return;
106
+ const pendingIds = BareModuleMocker.pendingIds;
107
+ BareModuleMocker.pendingIds = [];
106
108
  const resolveMock = async (mock) => {
107
- const { id, url, external } = await this.resolveId(mock.id, mock.importer);
108
- if (mock.action === "unmock") this.unmockPath(id);
109
- if (mock.action === "mock") this.mockPath(mock.id, id, url, external, mock.type, mock.factory);
109
+ return {
110
+ mock,
111
+ ...await this.resolveId(mock.id, mock.importer)
112
+ };
110
113
  };
111
114
  // group consecutive mocks of the same action type together,
112
115
  // resolve in parallel inside each group, but run groups sequentially
113
116
  // to preserve mock/unmock ordering
114
- const groups = groupByConsecutiveAction(BareModuleMocker.pendingIds);
115
- for (const group of groups) await Promise.all(group.map(resolveMock));
116
- BareModuleMocker.pendingIds = [];
117
+ const groups = groupByConsecutiveAction(pendingIds);
118
+ for (const group of groups) {
119
+ // apply in queue order: two mocks of the same path can resolve out of
120
+ // order, and the last queued one must win
121
+ const resolvedGroup = await Promise.all(group.map(resolveMock));
122
+ for (const { mock, id, url, external } of resolvedGroup) {
123
+ if (mock.action === "unmock") this.unmockPath(id);
124
+ if (mock.action === "mock") this.mockPath(mock.id, id, url, external, mock.type, mock.factory);
125
+ }
126
+ }
117
127
  }
118
128
  // public method to avoid circular dependency
119
129
  getMockContext() {
@@ -2,9 +2,9 @@ import * as chai from 'chai';
2
2
  import { createHook } from 'node:async_hooks';
3
3
  import { t as takeCoverageInsideWorker } from './coverage.BtDxDqSU.js';
4
4
  import { r as rpc } from './rpc.DWKX1ZbI.js';
5
- import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.p8NqUXPi.js';
5
+ import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.D5-2VgqG.js';
6
6
  import { g as getWorkerState } from './utils.DYj33du9.js';
7
- import { T as TestRunner } from './index.CSoBZWW_.js';
7
+ import { T as TestRunner } from './index.OVGXnVRj.js';
8
8
 
9
9
  function setupChaiConfig(config) {
10
10
  Object.assign(chai.config, config);
@@ -2,7 +2,7 @@ import * as os from 'node:os';
2
2
  import os__default, { homedir, tmpdir, availableParallelism, hostname } from 'node:os';
3
3
  import { j as join, b as basename, d as dirname, i as isAbsolute, r as resolve, c as cleanUrl, D as noop$1, a as relative, z as unique, e as createDefer, s as slash, t as toArray, m as isPrimitive, n as normalize, F as withTrailingSlash, G as wrapId, H as deepMerge, f as extname, h as KNOWN_ASSET_RE, I as isExternalUrl, J as unwrapId, p as deepClone, L as sanitizeFilePath } from './pathe.M-eThtNZ.Clq7AXhv.js';
4
4
  import { e as getDefaultExportFromCjs, T as TraceMap, o as originalPositionFor, k as generatedPositionFor, l as eachMapping, m as stackIgnorePatterns, f as parseErrorStacktrace, p as parseStacktrace, b as serializeValue } from './source-map.Dx3YPjIe.js';
5
- import { v as version$1 } from './cac.AVSgLgX0.js';
5
+ import { v as version$1 } from './cac.D805sv8h.js';
6
6
  import * as fs from 'node:fs';
7
7
  import fs__default, { promises, existsSync, mkdirSync, readFileSync, writeFileSync, chmodSync, statfsSync, realpathSync, statSync, readdirSync } from 'node:fs';
8
8
  import { performance as performance$1 } from 'node:perf_hooks';
@@ -23,7 +23,7 @@ import * as vite from 'vite';
23
23
  import { createServer, isFileLoadingAllowed, normalizePath, parseAst, searchForWorkspaceRoot, version, isRunnableDevEnvironment, mergeConfig, fetchModule, resolveConfig as resolveConfig$2 } from 'vite';
24
24
  import crypto, { createHash } from 'node:crypto';
25
25
  import { rootDir, distDir } from '../path.js';
26
- import { z as validateTags, A as limitConcurrency, B as shuffle, C as createTagsFilter } from './run.DyRH7m0-.js';
26
+ import { z as validateTags, A as limitConcurrency, B as shuffle, C as createTagsFilter } from './run.CQOUYP-x.js';
27
27
  import { N as NativeModuleRunner, i as isPackageExists, r as resolveModule } from './nativeModuleRunner.BOvBCgI_.js';
28
28
  import { createFileTask as createFileTask$1, createTaskName, calculateSuiteHash, convertTasksToEvents, hasFailed, generateFileHash, getTestName, hasFailedSnapshot, getTests, getSuites, getTasks, getFullName, interpretTaskModes } from '../task-utils.js';
29
29
  import { Traces } from '../traces.js';
@@ -43,7 +43,7 @@ import { stripVTControlCharacters } from 'node:util';
43
43
  import { i as inspect } from './display.pkpxlVcY.js';
44
44
  import { x } from 'tinyexec';
45
45
  import { p as positionToOffset, l as lineSplitRE } from './offset.Dy-5Fdfn.js';
46
- import { e as errorBanner, F as F_POINTER, d as divider, t as truncateString, f as formatProjectName, w as withLabel, a as formatTimeString, b as taskFail, s as separator, c as F_CHECK, g as F_DOWN_RIGHT, h as getStateSymbol, r as renderSnapshotSummary, p as padSummaryTitle, i as getStateString$1, j as formatTime, k as countTestErrors, l as F_TREE_NODE_END, m as F_TREE_NODE_MIDDLE, n as noun, o as F_RIGHT } from './utils.CtqmNjXD.js';
46
+ import { e as errorBanner, F as F_POINTER, d as divider, t as truncateString, w as withLabel, f as formatProjectName, a as formatTimeString, b as taskFail, s as separator, c as F_CHECK, g as F_DOWN_RIGHT, h as getStateSymbol, r as renderSnapshotSummary, p as padSummaryTitle, i as getStateString$1, j as formatTime, k as countTestErrors, l as F_TREE_NODE_END, m as F_TREE_NODE_MIDDLE, n as noun, o as F_RIGHT } from './utils.CtqmNjXD.js';
47
47
  import { ModuleRunner, ssrImportKey, ssrModuleExportsKey, ssrExportAllKey, ssrImportMetaKey } from 'vite/module-runner';
48
48
  import { VitestModuleEvaluator } from '#module-evaluator';
49
49
  import path, { resolve as resolve$1 } from 'node:path';
@@ -6169,7 +6169,7 @@ function astParseFile(filepath, code) {
6169
6169
  start,
6170
6170
  end,
6171
6171
  name: message,
6172
- type: isTestFunctionName(name) ? "test" : "suite",
6172
+ type: properties.includes("describe") || properties.includes("suite") || !isTestFunctionName(name) ? "suite" : "test",
6173
6173
  mode,
6174
6174
  task: null,
6175
6175
  dynamic: isDynamicEach,
@@ -7404,20 +7404,19 @@ function ViteConfigPlugin(harness) {
7404
7404
  resolve: resolveOptions
7405
7405
  }
7406
7406
  };
7407
- if ("rolldownVersion" in vite)
7408
- // eslint-disable-next-line ts/ban-ts-comment
7409
- // @ts-ignore rolldown-vite only
7410
- config.oxc = viteConfig.oxc === false ? false : {
7411
- // eslint-disable-next-line ts/ban-ts-comment
7412
- // @ts-ignore rolldown-vite only
7413
- target: viteConfig.oxc?.target || "node18" };
7414
- else config.esbuild = viteConfig.esbuild === false ? false : {
7415
- // Lowest target Vitest supports is Node18
7416
- target: viteConfig.esbuild?.target || "node18",
7417
- sourcemap: "external",
7407
+ if (viteConfig.oxc !== false) {
7408
+ viteConfig.oxc ??= {};
7409
+ // Lowest target Vitest supports is Node22
7410
+ viteConfig.oxc.target ??= "node22";
7411
+ }
7412
+ if (!("rolldownVersion" in vite) && viteConfig.esbuild !== false) {
7413
+ viteConfig.esbuild ??= {};
7414
+ // Lowest target Vitest supports is Node22
7415
+ viteConfig.esbuild.target ??= "node22";
7416
+ viteConfig.esbuild.sourcemap = "external";
7418
7417
  // Enables using ignore hint for coverage providers with @preserve keyword
7419
- legalComments: "inline"
7420
- };
7418
+ viteConfig.esbuild.legalComments = "inline";
7419
+ }
7421
7420
  const classNameStrategy = typeof testConfig.css !== "boolean" && testConfig.css?.modules?.classNameStrategy || "stable";
7422
7421
  if (!browserEnabled && classNameStrategy !== "scoped") {
7423
7422
  config.css ??= {};
@@ -12386,6 +12385,7 @@ const PROJECT_CLI_OVERRIDES = [
12386
12385
  "inspect",
12387
12386
  "inspectBrk",
12388
12387
  "fileParallelism",
12388
+ "maxWorkers",
12389
12389
  "tagsFilter",
12390
12390
  "browser",
12391
12391
  "experimental",
@@ -12717,6 +12717,27 @@ function getOwnServerReason(context, options) {
12717
12717
  function hasNoPlugins(plugins) {
12718
12718
  return Array.isArray(plugins) && plugins.every((plugin) => !plugin || Array.isArray(plugin) && hasNoPlugins(plugin));
12719
12719
  }
12720
+ function countPluginNames(plugins) {
12721
+ const counts = /* @__PURE__ */ new Map();
12722
+ for (const plugin of plugins) if (plugin.name) counts.set(plugin.name, (counts.get(plugin.name) || 0) + 1);
12723
+ return counts;
12724
+ }
12725
+ function warnDuplicateInheritedPlugins(logger, projectConfig, projectViteConfig, parentViteConfig, configFile, root) {
12726
+ const parentCounts = countPluginNames(parentViteConfig.plugins);
12727
+ const duplicates = [];
12728
+ for (const [name, count] of countPluginNames(projectViteConfig.plugins)) {
12729
+ // a duplicate already present in the declaring config is not caused by `extends`
12730
+ const parentCount = parentCounts.get(name) || 0;
12731
+ if (count > 1 && parentCount > 0 && count > parentCount) duplicates.push(name);
12732
+ }
12733
+ if (!duplicates.length) return;
12734
+ logger.warn(withLabel("yellow", "Vitest", [
12735
+ `The "${projectConfig.name}" project applies the same plugin multiple times: ${duplicates.map((name) => `"${name}"`).join(", ")}. `,
12736
+ `Since Vitest 5, an inline project extends the config file that declares it by default, so the plugins from "${relative(root, configFile)}" already apply to this project and don't need to be listed again.\n`,
12737
+ `Remove the duplicated plugins from the project, or set \`extends: false\` to not inherit the declaring config. `,
12738
+ `Setting the \`extends\` option explicitly hides this warning.`
12739
+ ].join("")));
12740
+ }
12720
12741
  // `deleteDefineConfig` always drops these
12721
12742
  const DROPPED_DEFINE_KEYS = [
12722
12743
  "process.env",
@@ -12847,6 +12868,7 @@ async function resolveSingleProjectEntry(context, options, workspacePath) {
12847
12868
  mergedOptions.name = resolveProjectName(mergedOptions.name, workspacePath, context.ancestors.at(-1));
12848
12869
  const projectConfig = resolveTestConfig(harness.logger, mergedOptions, projectViteConfig, parentConfig);
12849
12870
  projectViteConfig.test = projectConfig;
12871
+ if (inheritsParentConfig && options.extends === void 0 && configFile) warnDuplicateInheritedPlugins(harness.logger, projectConfig, projectViteConfig, parentViteConfig, configFile, rootConfig.root);
12850
12872
  // The browser provider's contribution (captured during this resolution by the
12851
12873
  // `vitest:browser:loader` plugin) is carried on the resolved config + entry so
12852
12874
  // server creation can build the single shared Vite server.
@@ -20748,10 +20770,16 @@ class Vitest {
20748
20770
  return this._coverageProvider;
20749
20771
  }
20750
20772
  /**
20773
+ * @deprecated Use `clearCache` instead.
20774
+ */
20775
+ experimental_clearCache() {
20776
+ this.logger.deprecate(`The "experimental_clearCache" method is deprecated. Use "clearCache" instead.`);
20777
+ return this.clearCache();
20778
+ }
20779
+ /**
20751
20780
  * Deletes all Vitest caches, including the `fsModuleCache`.
20752
- * @experimental
20753
20781
  */
20754
- async experimental_clearCache() {
20782
+ async clearCache() {
20755
20783
  await this.cache.results.clearCache();
20756
20784
  await this._fsCache.clearCache();
20757
20785
  }
@@ -20816,7 +20844,7 @@ class Vitest {
20816
20844
  this.state.catchError(serializeValue(error), "Unhandled Reporter Error");
20817
20845
  });
20818
20846
  }
20819
- async collect(filters, options) {
20847
+ async collect(filters, options = {}) {
20820
20848
  return this._traces.$("vitest.collect", async (collectSpan) => {
20821
20849
  const filenamePattern = filters && filters?.length > 0 ? filters : [];
20822
20850
  collectSpan.setAttribute("vitest.collect.filters", filenamePattern);
@@ -20834,7 +20862,7 @@ class Vitest {
20834
20862
  testModules: [],
20835
20863
  unhandledErrors: []
20836
20864
  };
20837
- if (options?.staticParse) return {
20865
+ if (options.staticParse !== false) return {
20838
20866
  testModules: await this.parseSpecifications(files, { concurrency: options.staticParseConcurrency }),
20839
20867
  unhandledErrors: []
20840
20868
  };
@@ -1,7 +1,7 @@
1
- import { b as printDiffOrStringify, d as diff, a as processError, T as TestSyntaxError, g as getCurrentTest, c as createTaskCollector, e as getCurrentSuite, f as createChainable, h as getHooks, i as getFn, m as matchesTags, j as afterAll, k as afterEach, l as aroundAll, n as aroundEach, o as beforeAll, q as beforeEach, r as describe, t as it, u as onTestFailed, v as onTestFinished, w as recordArtifact, x as suite, y as test } from './run.DyRH7m0-.js';
1
+ import { b as printDiffOrStringify, d as diff, a as processError, T as TestSyntaxError, g as getCurrentTest, c as createTaskCollector, e as getCurrentSuite, f as createChainable, h as getHooks, i as getFn, m as matchesTags, j as afterAll, k as afterEach, l as aroundAll, n as aroundEach, o as beforeAll, q as beforeEach, r as describe, t as it, u as onTestFailed, v as onTestFinished, w as recordArtifact, x as suite, y as test } from './run.CQOUYP-x.js';
2
2
  import { i as isChildProcess, r as resetModules, g as getWorkerState } from './utils.DYj33du9.js';
3
3
  import { e as getDefaultExportFromCjs, f as parseErrorStacktrace, h as commonjsGlobal, a as getSafeTimers, i as parseSingleStack, j as delay } from './source-map.Dx3YPjIe.js';
4
- import { i as isMockFunction, f as fn, a as spyOn, r as restoreAllMocks, b as resetAllMocks, c as clearAllMocks } from './spy.DPpyuUIA.js';
4
+ import { i as isMockFunction, f as fn, a as spyOn, r as restoreAllMocks, b as resetAllMocks, c as clearAllMocks } from './spy.DPLvp2J7.js';
5
5
  import { u as isObject, B as getCallLastIndex, g as getType, D as noop, x as assertTypes, w as ordinal, E as createSimpleStackTrace, i as isAbsolute, a as relative, n as normalize } from './pathe.M-eThtNZ.Clq7AXhv.js';
6
6
  import { s as stringify, i as inspect } from './display.pkpxlVcY.js';
7
7
  import { y } from './tinyrainbow.Ht9iggcq.js';
@@ -2213,13 +2213,15 @@ const JestChaiExpect = (chai, utils) => {
2213
2213
  const spyName = spy.getMockName();
2214
2214
  const pass = spy.mock.calls.some((callArg) => equalsArgumentArray(callArg, args));
2215
2215
  const isNot = utils.flag(this, "negate");
2216
- const msg = utils.getMessage(this, [
2217
- pass,
2218
- `expected "${spyName}" to be called with arguments: #{exp}`,
2219
- `expected "${spyName}" to not be called with arguments: #{exp}`,
2220
- args
2221
- ]);
2222
- if (pass && isNot || !pass && !isNot) throw new AssertionError(formatCalls(spy, msg, args));
2216
+ if (pass && isNot || !pass && !isNot) {
2217
+ const msg = utils.getMessage(this, [
2218
+ pass,
2219
+ `expected "${spyName}" to be called with arguments: #{exp}`,
2220
+ `expected "${spyName}" to not be called with arguments: #{exp}`,
2221
+ args
2222
+ ]);
2223
+ throw new AssertionError(formatCalls(spy, msg, args));
2224
+ }
2223
2225
  });
2224
2226
  def("toHaveBeenCalledExactlyOnceWith", function(...args) {
2225
2227
  const spy = getSpy(this);
@@ -2227,13 +2229,15 @@ const JestChaiExpect = (chai, utils) => {
2227
2229
  const callCount = spy.mock.calls.length;
2228
2230
  const pass = spy.mock.calls.some((callArg) => equalsArgumentArray(callArg, args)) && callCount === 1;
2229
2231
  const isNot = utils.flag(this, "negate");
2230
- const msg = utils.getMessage(this, [
2231
- pass,
2232
- `expected "${spyName}" to be called once with arguments: #{exp}`,
2233
- `expected "${spyName}" to not be called once with arguments: #{exp}`,
2234
- args
2235
- ]);
2236
- if (pass && isNot || !pass && !isNot) throw new AssertionError(formatCalls(spy, msg, args));
2232
+ if (pass && isNot || !pass && !isNot) {
2233
+ const msg = utils.getMessage(this, [
2234
+ pass,
2235
+ `expected "${spyName}" to be called once with arguments: #{exp}`,
2236
+ `expected "${spyName}" to not be called once with arguments: #{exp}`,
2237
+ args
2238
+ ]);
2239
+ throw new AssertionError(formatCalls(spy, msg, args));
2240
+ }
2237
2241
  });
2238
2242
  def("toHaveBeenNthCalledWith", function(times, ...args) {
2239
2243
  const spy = getSpy(this);
@@ -7615,20 +7619,23 @@ function createExpectPoll(expect) {
7615
7619
  }
7616
7620
  });
7617
7621
  let resultPromise;
7622
+ // lets `expect.element` register the poll with the task deadline
7623
+ const wrap = chai.util.flag(assertion, "_poll.wrap");
7624
+ const start = () => resultPromise ||= wrap ? wrap(promise(), STACK_TRACE_ERROR) : promise();
7618
7625
  // only .then is enough to check awaited, but we type this as `Promise<void>` in global types
7619
7626
  // so let's follow it
7620
7627
  return {
7621
7628
  then(onFulfilled, onRejected) {
7622
7629
  awaited = true;
7623
- return (resultPromise ||= promise()).then(onFulfilled, onRejected);
7630
+ return start().then(onFulfilled, onRejected);
7624
7631
  },
7625
7632
  catch(onRejected) {
7626
7633
  awaited = true;
7627
- return (resultPromise ||= promise()).catch(onRejected);
7634
+ return start().catch(onRejected);
7628
7635
  },
7629
7636
  finally(onFinally) {
7630
7637
  awaited = true;
7631
- return (resultPromise ||= promise()).finally(onFinally);
7638
+ return start().finally(onFinally);
7632
7639
  },
7633
7640
  [Symbol.toStringTag]: "Promise"
7634
7641
  };
@@ -1,4 +1,4 @@
1
- import { i as init } from './init.DJ2lKyjE.js';
1
+ import { i as init } from './init.BS957yFf.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.DJ2lKyjE.js';
2
+ import { i as init } from './init.BS957yFf.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,7 +2,7 @@ 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.DQO7054M.js';
5
+ import { e as environments, b as VitestTransport } from './index.1_nbEjJY.js';
6
6
  import { r as resolve } from './pathe.M-eThtNZ.Clq7AXhv.js';
7
7
  import { b as serializeValue, c as createStackString, p as parseStacktrace } from './source-map.Dx3YPjIe.js';
8
8
  import './index.M2dsQ_UQ.js';
@@ -4,7 +4,7 @@ import { automockModule, createManualModuleSource, collectModuleExports } from '
4
4
  import { c as cleanUrl, e as createDefer, i as isAbsolute } from './pathe.M-eThtNZ.Clq7AXhv.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.DQO7054M.js';
7
+ import { B as BareModuleMocker, n as normalizeModuleId } from './index.1_nbEjJY.js';
8
8
  import 'node:fs';
9
9
  import './utils.DYj33du9.js';
10
10
  import '../path.js';
@@ -2430,11 +2430,14 @@ declare class Vitest {
2430
2430
  globTestSpecifications(filters?: string[]): Promise<TestSpecification[]>;
2431
2431
  private initCoverageProvider;
2432
2432
  /**
2433
- * Deletes all Vitest caches, including the `fsModuleCache`.
2434
- * @experimental
2433
+ * @deprecated Use `clearCache` instead.
2435
2434
  */
2436
2435
  experimental_clearCache(): Promise<void>;
2437
2436
  /**
2437
+ * Deletes all Vitest caches, including the `fsModuleCache`.
2438
+ */
2439
+ clearCache(): Promise<void>;
2440
+ /**
2438
2441
  * Merge reports from multiple runs located in the specified directory (value from `--merge-reports` if not specified).
2439
2442
  */
2440
2443
  mergeReports(directory?: string): Promise<TestRunResult>;
@@ -2640,12 +2643,12 @@ interface CliOptions extends UserConfig {
2640
2643
  filesOnly?: boolean;
2641
2644
  /**
2642
2645
  * Parse files statically instead of running them to collect tests
2643
- * @experimental
2646
+ * @default true
2644
2647
  */
2645
2648
  staticParse?: boolean;
2646
2649
  /**
2647
2650
  * How many tests to process at the same time
2648
- * @experimental
2651
+ * @default os.availableParallelism()
2649
2652
  */
2650
2653
  staticParseConcurrency?: number;
2651
2654
  /**
@@ -3173,6 +3173,68 @@ function manageArtifactAttachment(attachment) {
3173
3173
  }
3174
3174
 
3175
3175
  const now$2 = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
3176
+ // makes an operation deadline derived from the task fire before the task timer
3177
+ const DERIVED_BUFFER = 100;
3178
+ // how long the task timer waits for a tracked operation past that operation's own deadline
3179
+ const SETTLE_GRACE = 500;
3180
+ class TaskDeadline {
3181
+ startTime = now$2();
3182
+ endTime;
3183
+ timer;
3184
+ operations = /* @__PURE__ */ new Set();
3185
+ constructor(timeout, onTimeout) {
3186
+ this.endTime = this.startTime + timeout;
3187
+ const { setTimeout } = getSafeTimers();
3188
+ this.timer = setTimeout(onTimeout, timeout);
3189
+ // `unref` might not exist in browser
3190
+ this.timer.unref?.();
3191
+ }
3192
+ remaining() {
3193
+ return this.endTime - now$2();
3194
+ }
3195
+ exceeded() {
3196
+ return now$2() >= this.endTime;
3197
+ }
3198
+ clear() {
3199
+ const { clearTimeout } = getSafeTimers();
3200
+ clearTimeout(this.timer);
3201
+ }
3202
+ /** timeout for an operation that must fail before the task does */
3203
+ derive() {
3204
+ return Math.max(Math.floor(this.remaining()) - DERIVED_BUFFER, 1);
3205
+ }
3206
+ /** Registers an operation with its own timeout; see `settle`. */
3207
+ track(name, promise, timeout, source) {
3208
+ const operation = {
3209
+ name,
3210
+ source,
3211
+ promise,
3212
+ endTime: now$2() + timeout
3213
+ };
3214
+ this.operations.add(operation);
3215
+ promise.finally(() => this.operations.delete(operation)).catch(() => {});
3216
+ return promise;
3217
+ }
3218
+ /**
3219
+ * Waits for the operations that were due before the task, if possible.
3220
+ */
3221
+ settle() {
3222
+ if (!this.operations.size) return;
3223
+ const operations = [...this.operations];
3224
+ const pending = () => operations.filter((operation) => this.operations.has(operation));
3225
+ const due = operations.filter((operation) => operation.endTime <= this.endTime);
3226
+ if (!due.length)
3227
+ // return operations whose timeout is larger than task for a better stack trace
3228
+ return Promise.resolve(operations);
3229
+ const { setTimeout } = getSafeTimers();
3230
+ const waitUntil = Math.max(...due.map((operation) => operation.endTime)) + SETTLE_GRACE;
3231
+ return Promise.race([Promise.all(due.map((operation) => operation.promise)).then(pending), new Promise((resolve) => setTimeout(() => {
3232
+ resolve(pending());
3233
+ // the grace may already be in the past
3234
+ }, Math.max(waitUntil - now$2(), 0)))]);
3235
+ }
3236
+ }
3237
+
3176
3238
  const collectorContext = {
3177
3239
  tasks: [],
3178
3240
  currentSuite: null
@@ -3188,42 +3250,48 @@ async function runWithSuite(suite, fn) {
3188
3250
  }
3189
3251
  function withTimeout(fn, timeout, isHook = false, stackTraceError, onTimeout) {
3190
3252
  if (timeout <= 0 || timeout === Number.POSITIVE_INFINITY) return fn;
3191
- const { setTimeout, clearTimeout } = getSafeTimers();
3192
3253
  // this function name is used to filter error in test/e2e/test/fails.test.ts
3193
3254
  return (function runWithTimeout(...args) {
3194
- const startTime = now$2();
3195
3255
  const runner = getRunner();
3196
- runner._currentTaskStartTime = startTime;
3197
- runner._currentTaskTimeout = timeout;
3256
+ const previousDeadline = runner._deadline;
3198
3257
  return new Promise((resolve_, reject_) => {
3199
- const timer = setTimeout(() => {
3200
- clearTimeout(timer);
3258
+ let settled = false;
3259
+ const deadline = new TaskDeadline(timeout, () => {
3260
+ // an operation derived a shorter deadline from this one,
3261
+ // so its error describes the failure better than a generic timeout
3262
+ const pending = deadline.settle();
3263
+ if (pending) {
3264
+ pending.then(rejectTimeoutError, reject);
3265
+ return;
3266
+ }
3201
3267
  rejectTimeoutError();
3202
- }, timeout);
3203
- // `unref` might not exist in browser
3204
- timer.unref?.();
3205
- function rejectTimeoutError() {
3206
- const error = makeTimeoutError(isHook, timeout, stackTraceError);
3268
+ });
3269
+ runner._deadline = deadline;
3270
+ function rejectTimeoutError(pending) {
3271
+ if (settled) return;
3272
+ settled = true;
3273
+ const error = makeTimeoutError(isHook, timeout, stackTraceError, pending);
3207
3274
  onTimeout?.(args, error);
3208
3275
  reject_(error);
3209
3276
  }
3210
3277
  function resolve(result) {
3211
- runner._currentTaskStartTime = void 0;
3212
- runner._currentTaskTimeout = void 0;
3213
- clearTimeout(timer);
3278
+ runner._deadline = previousDeadline;
3279
+ deadline.clear();
3214
3280
  // if test/hook took too long in microtask, setTimeout won't be triggered,
3215
3281
  // but we still need to fail the test, see
3216
3282
  // https://github.com/vitest-dev/vitest/issues/2920
3217
- if (now$2() - startTime >= timeout) {
3283
+ if (deadline.exceeded()) {
3218
3284
  rejectTimeoutError();
3219
3285
  return;
3220
3286
  }
3287
+ settled = true;
3221
3288
  resolve_(result);
3222
3289
  }
3223
3290
  function reject(error) {
3224
- runner._currentTaskStartTime = void 0;
3225
- runner._currentTaskTimeout = void 0;
3226
- clearTimeout(timer);
3291
+ if (settled) return;
3292
+ settled = true;
3293
+ runner._deadline = previousDeadline;
3294
+ deadline.clear();
3227
3295
  reject_(error);
3228
3296
  }
3229
3297
  // sync test/hook will be caught by try/catch
@@ -3325,8 +3393,12 @@ function createTestContext(test, runner) {
3325
3393
  };
3326
3394
  return runner.extendTaskContext?.(context) || context;
3327
3395
  }
3328
- function makeTimeoutError(isHook, timeout, stackTraceError) {
3329
- const message = `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.\nIf this is a long-running ${isHook ? "hook" : "test"}, pass a timeout value as the last argument or configure it globally with "${isHook ? "hookTimeout" : "testTimeout"}".`;
3396
+ function makeTimeoutError(isHook, timeout, stackTraceError, pending) {
3397
+ const waiting = pending?.length ? ` while waiting for ${pending.map((operation) => operation.name).join(", ")}` : "";
3398
+ // point at the action the task is stuck on rather than at the task itself
3399
+ const lastOperationSource = pending?.at(-1)?.source;
3400
+ if (lastOperationSource) stackTraceError = lastOperationSource;
3401
+ const message = `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms${waiting}.\nIf this is a long-running ${isHook ? "hook" : "test"}, pass a timeout value as the last argument or configure it globally with "${isHook ? "hookTimeout" : "testTimeout"}".`;
3330
3402
  const error = new Error(message);
3331
3403
  if (stackTraceError?.stack) error.stack = stackTraceError.stack.replace(stackTraceError.message, error.message);
3332
3404
  return error;
@@ -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.B4gJ9mZH.js')).registerApiGlobally();
10
+ if (config.globals) (await import('./globals.DQ4rmEUL.js')).registerApiGlobally();
11
11
  }
12
12
  function setupDefines(config) {
13
13
  for (const key in config.defines) globalThis[key] = config.defines[key];
@@ -5,8 +5,13 @@ const MOCK_RESTORE = /* @__PURE__ */ new Set();
5
5
  // Jest keeps the state in a separate WeakMap which is good for memory,
6
6
  // but it makes the state slower to access and return different values
7
7
  // if you stored it before calling `mockClear` where it will be recreated
8
+ const DIRTY_MOCK_STATES = /* @__PURE__ */ new Set();
8
9
  const REGISTERED_MOCKS = /* @__PURE__ */ new Set();
10
+ const MOCK_FINALIZER = new FinalizationRegistry((ref) => {
11
+ REGISTERED_MOCKS.delete(ref);
12
+ });
9
13
  const MOCK_CONFIGS = /* @__PURE__ */ new WeakMap();
14
+ const MOCKS_BY_STATE = /* @__PURE__ */ new WeakMap();
10
15
  function createMockInstance(options = {}) {
11
16
  const { originalImplementation, restore, mockImplementation, resetToMockImplementation, resetToMockName } = options;
12
17
  if (restore) MOCK_RESTORE.add(restore);
@@ -29,7 +34,10 @@ function createMockInstance(options = {}) {
29
34
  // when `vi.fn()` is called, we just use the default string
30
35
  if (resetToMockName) config.mockName = mock.name || "vi.fn()";
31
36
  MOCK_CONFIGS.set(mock, config);
32
- REGISTERED_MOCKS.add(mock);
37
+ MOCKS_BY_STATE.set(state, mock);
38
+ const ref = new WeakRef(mock);
39
+ REGISTERED_MOCKS.add(ref);
40
+ MOCK_FINALIZER.register(mock, ref);
33
41
  mock._isMockFunction = true;
34
42
  mock.getMockImplementation = () => {
35
43
  // Jest only returns `config.mockImplementation` here,
@@ -138,6 +146,7 @@ function createMockInstance(options = {}) {
138
146
  state.invocationCallOrder = [];
139
147
  state.results = [];
140
148
  state.settledResults = [];
149
+ DIRTY_MOCK_STATES.delete(mock);
141
150
  return mock;
142
151
  };
143
152
  mock.mockReset = function mockReset() {
@@ -255,9 +264,12 @@ function createMock({ state, config, name: mockName, prototypeState, prototypeCo
255
264
  const pseudoOriginal = mockImplementation;
256
265
  const name = mockName || original?.name || "Mock";
257
266
  const noopImplementation = function() {};
267
+ const prototypeMock = prototypeState && MOCKS_BY_STATE.get(prototypeState);
258
268
  const namedObject = {
259
269
  // to keep the name of the function intact
260
270
  [name]: (function(...args) {
271
+ DIRTY_MOCK_STATES.add(namedObject[name]);
272
+ if (prototypeMock) DIRTY_MOCK_STATES.add(prototypeMock);
261
273
  registerCalls(args, state, prototypeState);
262
274
  registerInvocationOrder(invocationCallCounter++, state, prototypeState);
263
275
  const result = {
@@ -438,10 +450,14 @@ function restoreAllMocks() {
438
450
  MOCK_RESTORE.clear();
439
451
  }
440
452
  function clearAllMocks() {
441
- REGISTERED_MOCKS.forEach((mock) => mock.mockClear());
453
+ for (const mock of DIRTY_MOCK_STATES) mock.mockClear();
442
454
  }
443
455
  function resetAllMocks() {
444
- REGISTERED_MOCKS.forEach((mock) => mock.mockReset());
456
+ for (const ref of REGISTERED_MOCKS) {
457
+ const mock = ref.deref();
458
+ if (mock) mock.mockReset();
459
+ else REGISTERED_MOCKS.delete(ref);
460
+ }
445
461
  }
446
462
  function throwConstructorError(shorthand) {
447
463
  throw new TypeError(`Cannot use \`${shorthand}\` when called with \`new\`. Use \`mockImplementation\` with a \`class\` keyword instead. See https://vitest.dev/api/mock#class-support for more information.`);
@@ -1,7 +1,7 @@
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.DJ2lKyjE.js';
4
+ import { l as loadEnvironment, a as listenForErrors, e as emitModuleRunner } from './init.BS957yFf.js';
5
5
  import { distDir } from '../path.js';
6
6
  import { createCustomConsole } from './console.CHi0lDgQ.js';
7
7
  import fs__default from 'node:fs';
@@ -10,9 +10,9 @@ import { d as dirname, f as extname, b as basename, C as CSS_LANGS_RE, h as KNOW
10
10
  import { l as lookupPackageScopeType } from './resolver.CBCHRZ7j.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.DQO7054M.js';
13
+ import { V as VITEST_VM_CONTEXT_SYMBOL, s as startVitestModuleRunner, c as createNodeImportMeta } from './index.1_nbEjJY.js';
14
14
  import { getDefaultRequestStubs } from '../module-evaluator.js';
15
- import { b as setupEnv } from './setup-common.p8NqUXPi.js';
15
+ import { b as setupEnv } from './setup-common.D5-2VgqG.js';
16
16
  import { p as provideWorkerState } from './utils.DYj33du9.js';
17
17
 
18
18
  /**
@@ -618,6 +618,7 @@ class EsmExecutor {
618
618
  executor;
619
619
  moduleCache = /* @__PURE__ */ new Map();
620
620
  esmLinkMap = /* @__PURE__ */ new WeakMap();
621
+ linkQueue = Promise.resolve();
621
622
  context;
622
623
  #httpIp = IPnumber("127.0.0.0");
623
624
  constructor(executor, options) {
@@ -628,11 +629,26 @@ class EsmExecutor {
628
629
  // a module that failed to evaluate keeps living in the cache — rethrow
629
630
  // its error instead of silently returning an unusable namespace
630
631
  if (m.status === "errored") throw m.error;
631
- if (m.status === "unlinked") this.esmLinkMap.set(m, m.link((identifier, referencer) => this.executor.resolveModule(identifier, referencer.identifier)));
632
- await this.esmLinkMap.get(m);
632
+ await this.linkModule(m);
633
633
  if (m.status === "linked") await m.evaluate();
634
634
  return m;
635
635
  }
636
+ // Roots are linked one at a time: Node's link() does not wait for a
637
+ // dependency that another root is still linking, and instantiate() then
638
+ // fails on it. Sharing the queue with all roots keeps cycle handling to
639
+ // Node's own single-root linker, which never has to wait.
640
+ linkModule(m) {
641
+ const pending = this.esmLinkMap.get(m);
642
+ if (pending) return pending;
643
+ if (m.status !== "unlinked" && m.status !== "linking") return Promise.resolve();
644
+ const linking = this.linkQueue.then(() => {
645
+ if (m.status === "unlinked") return m.link(this.linker);
646
+ });
647
+ this.esmLinkMap.set(m, linking);
648
+ this.linkQueue = linking.catch(() => {});
649
+ return linking;
650
+ }
651
+ linker = (identifier, referencer) => this.executor.resolveModule(identifier, referencer.identifier);
636
652
  async createEsModule(fileURL, getCode) {
637
653
  const cached = this.moduleCache.get(fileURL);
638
654
  if (cached) return cached;
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createCLI } from './chunks/cac.AVSgLgX0.js';
1
+ import { c as createCLI } from './chunks/cac.D805sv8h.js';
2
2
  import './chunks/pathe.M-eThtNZ.Clq7AXhv.js';
3
3
  import 'events';
4
4
  import './chunks/tinyrainbow.Ht9iggcq.js';
package/dist/config.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { HookHandler, UserConfig, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
3
- import { F as FieldsWithDefaultValues, U as UserWorkspaceConfig, a as UserProjectConfigFn, b as UserProjectConfigExport } from './chunks/plugin.d.DAuMAWfb.js';
3
+ import { F as FieldsWithDefaultValues, U as UserWorkspaceConfig, a as UserProjectConfigFn, b as UserProjectConfigExport } from './chunks/plugin.d.BbcoZhuj.js';
4
4
  import { InlineConfig, ResolvedConfig, VitestPluginContext, CoverageOptions } from './node.js';
5
- export { T as TestProjectConfiguration, c as TestProjectInlineConfiguration, d as TestUserConfig, W as WatcherTriggerPattern } from './chunks/plugin.d.DAuMAWfb.js';
5
+ export { T as TestProjectConfiguration, c as TestProjectInlineConfiguration, d as TestUserConfig, W as WatcherTriggerPattern } from './chunks/plugin.d.BbcoZhuj.js';
6
6
  import { C as Config } from './chunks/config.d.CU_b-wJj.js';
7
7
  export { e as TestTagDefinition } from './chunks/config.d.CU_b-wJj.js';
8
8
  import 'node:stream';
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- export { S as Snapshots, T as TestRunner, a as assert, b as assertType, c as createExpect, g as expect, d as inject, s as should, v as vi, e as vitest } from './chunks/index.CSoBZWW_.js';
1
+ export { S as Snapshots, T as TestRunner, a as assert, b as assertType, c as createExpect, g as expect, d as inject, s as should, v as vi, e as vitest } from './chunks/index.OVGXnVRj.js';
2
2
  export { V as EvaluatedModules } from './chunks/rpc.DWKX1ZbI.js';
3
- export { j as afterAll, k as afterEach, l as aroundAll, n as aroundEach, o as beforeAll, q as beforeEach, r as describe, t as it, u as onTestFailed, v as onTestFinished, w as recordArtifact, x as suite, y as test } from './chunks/run.DyRH7m0-.js';
3
+ export { j as afterAll, k as afterEach, l as aroundAll, n as aroundEach, o as beforeAll, q as beforeEach, r as describe, t as it, u as onTestFailed, v as onTestFinished, w as recordArtifact, x as suite, y as test } from './chunks/run.CQOUYP-x.js';
4
4
  export { expectTypeOf } from 'expect-type';
5
5
  import * as chai from 'chai';
6
6
  export { chai };
7
7
  import './chunks/utils.DYj33du9.js';
8
8
  import './chunks/source-map.Dx3YPjIe.js';
9
9
  import './chunks/pathe.M-eThtNZ.Clq7AXhv.js';
10
- import './chunks/spy.DPpyuUIA.js';
10
+ import './chunks/spy.DPLvp2J7.js';
11
11
  import './chunks/display.pkpxlVcY.js';
12
12
  import './chunks/index.M2dsQ_UQ.js';
13
13
  import './chunks/tinyrainbow.Ht9iggcq.js';
package/dist/node.d.ts CHANGED
@@ -3,8 +3,8 @@ import { UserConfig as UserConfig$1, ResolvedConfig as ResolvedConfig$1, Transfo
3
3
  export { vite as Vite };
4
4
  export { esbuildVersion, isCSSRequest, isFileLoadingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
5
5
  import { IncomingMessage } from 'node:http';
6
- import { R as ResolvedConfig, e as CliOptions, d as UserConfig, L as Logger, A as ApiConfig, P as PluginHarness, f as Vitest, g as ResolvedCoverageOptions, h as CoverageMap, i as ReportContext, j as TestProject, k as VitestOptions, l as VitestRunMode, m as TestSpecification, n as PoolWorker, o as PoolOptions, p as WorkerRequest, q as TestSequencer } from './chunks/plugin.d.DAuMAWfb.js';
7
- export { M as AgentReporter, B as BaseCoverageOptions, r as BaseReporter, s as BenchmarkUserOptions, t as BrowserBuiltinProvider, u as BrowserCommand, v as BrowserCommandContext, w as BrowserConfigOptions, x as BrowserInstanceOption, y as BrowserModuleMocker, z as BrowserOrchestrator, D as BrowserProvider, E as BrowserProviderOption, G as BrowserScript, H as BrowserServerContribution, J as BrowserServerFactory, K as BrowserServerState, N as BrowserServerStateSession, O as BrowserTraceViewOptions, Q as BuiltinEnvironment, S as BuiltinReporterOptions, X as BuiltinReporters, Y as CSSModuleScopeStrategy, Z as CacheKeyIdGenerator, _ as CacheKeyIdGeneratorContext, $ as CoverageInstrumenter, a0 as CoverageIstanbulOptions, C as CoverageOptions, a1 as CoverageProvider, a2 as CoverageProviderModule, a3 as CoverageReporter, a4 as CoverageV8Options, a5 as CustomProviderOptions, a6 as DefaultReporter, a7 as DepsOptimizationOptions, a8 as DotReporter, a9 as EnvironmentOptions, aa as GithubActionsReporter, ab as HTMLOptions, ac as HangingProcessReporter, I as InlineConfig, ad as InstrumenterOptions, ae as JUnitOptions, af as JUnitReporter, ag as JsonAssertionResult, ah as JsonOptions, ai as JsonReporter, aj as JsonTestResult, ak as JsonTestResults, M as MinimalReporter, al as ModuleDiagnostic, am as OnServerRestartHandler, an as OnTestsRerunHandler, ao as ParentProjectBrowser, ap as Pool, aq as PoolRunnerInitializer, ar as PoolTask, as as ProjectBrowser, at as ProjectConfig, au as Report, av as ReportedHookContext, aw as Reporter, ax as ReportersMap, ay as ResolveSnapshotPathHandler, az as ResolveSnapshotPathHandlerContext, aA as ResolvedBrowserOptions, aB as ResolvedProjectConfig, aC as SerializedTestProject, aD as SuiteNameTemplateVariables, aE as TapFlatReporter, aF as TapReporter, aG as TaskOptions, aH as TestCase, aI as TestCollection, aJ as TestDiagnostic, aK as TestModule, aL as TestModuleState, aM as TestResult, aN as TestResultFailed, aO as TestResultPassed, aP as TestResultPending, aQ as TestResultSkipped, aR as TestRunEndReason, aS as TestRunResult, aT as TestSequencerConstructor, aU as TestSpecificationOptions, aV as TestState, aW as TestSuite, aX as TestSuiteState, aY as ToMatchScreenshotComparators, aZ as ToMatchScreenshotOptions, a_ as TypecheckConfig, U as UserWorkspaceConfig, a$ as VerboseReporter, b0 as VitestEnvironment, b1 as VitestPackageInstaller, V as VitestPluginContext, W as WatcherTriggerPattern, b2 as WorkerResponse, b3 as _BrowserNames, b4 as experimental_getRunnerTask, b5 as startVitest } from './chunks/plugin.d.DAuMAWfb.js';
6
+ import { R as ResolvedConfig, e as CliOptions, d as UserConfig, L as Logger, A as ApiConfig, P as PluginHarness, f as Vitest, g as ResolvedCoverageOptions, h as CoverageMap, i as ReportContext, j as TestProject, k as VitestOptions, l as VitestRunMode, m as TestSpecification, n as PoolWorker, o as PoolOptions, p as WorkerRequest, q as TestSequencer } from './chunks/plugin.d.BbcoZhuj.js';
7
+ export { M as AgentReporter, B as BaseCoverageOptions, r as BaseReporter, s as BenchmarkUserOptions, t as BrowserBuiltinProvider, u as BrowserCommand, v as BrowserCommandContext, w as BrowserConfigOptions, x as BrowserInstanceOption, y as BrowserModuleMocker, z as BrowserOrchestrator, D as BrowserProvider, E as BrowserProviderOption, G as BrowserScript, H as BrowserServerContribution, J as BrowserServerFactory, K as BrowserServerState, N as BrowserServerStateSession, O as BrowserTraceViewOptions, Q as BuiltinEnvironment, S as BuiltinReporterOptions, X as BuiltinReporters, Y as CSSModuleScopeStrategy, Z as CacheKeyIdGenerator, _ as CacheKeyIdGeneratorContext, $ as CoverageInstrumenter, a0 as CoverageIstanbulOptions, C as CoverageOptions, a1 as CoverageProvider, a2 as CoverageProviderModule, a3 as CoverageReporter, a4 as CoverageV8Options, a5 as CustomProviderOptions, a6 as DefaultReporter, a7 as DepsOptimizationOptions, a8 as DotReporter, a9 as EnvironmentOptions, aa as GithubActionsReporter, ab as HTMLOptions, ac as HangingProcessReporter, I as InlineConfig, ad as InstrumenterOptions, ae as JUnitOptions, af as JUnitReporter, ag as JsonAssertionResult, ah as JsonOptions, ai as JsonReporter, aj as JsonTestResult, ak as JsonTestResults, M as MinimalReporter, al as ModuleDiagnostic, am as OnServerRestartHandler, an as OnTestsRerunHandler, ao as ParentProjectBrowser, ap as Pool, aq as PoolRunnerInitializer, ar as PoolTask, as as ProjectBrowser, at as ProjectConfig, au as Report, av as ReportedHookContext, aw as Reporter, ax as ReportersMap, ay as ResolveSnapshotPathHandler, az as ResolveSnapshotPathHandlerContext, aA as ResolvedBrowserOptions, aB as ResolvedProjectConfig, aC as SerializedTestProject, aD as SuiteNameTemplateVariables, aE as TapFlatReporter, aF as TapReporter, aG as TaskOptions, aH as TestCase, aI as TestCollection, aJ as TestDiagnostic, aK as TestModule, aL as TestModuleState, aM as TestResult, aN as TestResultFailed, aO as TestResultPassed, aP as TestResultPending, aQ as TestResultSkipped, aR as TestRunEndReason, aS as TestRunResult, aT as TestSequencerConstructor, aU as TestSpecificationOptions, aV as TestState, aW as TestSuite, aX as TestSuiteState, aY as ToMatchScreenshotComparators, aZ as ToMatchScreenshotOptions, a_ as TypecheckConfig, U as UserWorkspaceConfig, a$ as VerboseReporter, b0 as VitestEnvironment, b1 as VitestPackageInstaller, V as VitestPluginContext, W as WatcherTriggerPattern, b2 as WorkerResponse, b3 as _BrowserNames, b4 as experimental_getRunnerTask, b5 as startVitest } from './chunks/plugin.d.BbcoZhuj.js';
8
8
  import { EventEmitter } from 'events';
9
9
  import { A as Awaitable } from './chunks/config.d.CU_b-wJj.js';
10
10
  import { AfterSuiteRunMeta } from './index.js';
package/dist/node.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as vite from 'vite';
2
2
  export { esbuildVersion, isCSSRequest, isFileLoadingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
3
- import { V as Vitest } from './chunks/index.CVFiuVPx.js';
4
- export { M as AgentReporter, B as BaseCoverageProvider, a as BaseSequencer, b as BrowserConnectionError, D as DefaultReporter, c as DotReporter, F as ForksPoolWorker, G as GitNotFoundError, d as GithubActionsReporter, H as HangingProcessReporter, J as JUnitReporter, e as JsonReporter, L as Logger, M as MinimalReporter, P as PluginHarness, R as ReportersMap, T as TapFlatReporter, f as TapReporter, g as TestsNotFoundError, h as ThreadsPoolWorker, i as TypecheckPoolWorker, j as VerboseReporter, k as VitestPackageInstaller, l as VmForksPoolWorker, m as VmThreadsPoolWorker, n as createDebugger, o as createMethodsRPC, p as createViteLogger, q as escapeTestName, r as experimental_getRunnerTask, s as getFilePoolName, t as isFileServingAllowed, u as isValidApiRequest, v as resolveApiServerConfig, w as resolveConfig, x as resolveFsAllow } from './chunks/index.CVFiuVPx.js';
5
- export { c as createCLI, p as parseCLI } from './chunks/cac.AVSgLgX0.js';
6
- export { c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './chunks/cli-api.BsG_KUyt.js';
3
+ import { V as Vitest } from './chunks/index.B89dZ0-N.js';
4
+ export { M as AgentReporter, B as BaseCoverageProvider, a as BaseSequencer, b as BrowserConnectionError, D as DefaultReporter, c as DotReporter, F as ForksPoolWorker, G as GitNotFoundError, d as GithubActionsReporter, H as HangingProcessReporter, J as JUnitReporter, e as JsonReporter, L as Logger, M as MinimalReporter, P as PluginHarness, R as ReportersMap, T as TapFlatReporter, f as TapReporter, g as TestsNotFoundError, h as ThreadsPoolWorker, i as TypecheckPoolWorker, j as VerboseReporter, k as VitestPackageInstaller, l as VmForksPoolWorker, m as VmThreadsPoolWorker, n as createDebugger, o as createMethodsRPC, p as createViteLogger, q as escapeTestName, r as experimental_getRunnerTask, s as getFilePoolName, t as isFileServingAllowed, u as isValidApiRequest, v as resolveApiServerConfig, w as resolveConfig, x as resolveFsAllow } from './chunks/index.B89dZ0-N.js';
5
+ export { c as createCLI, p as parseCLI } from './chunks/cac.D805sv8h.js';
6
+ export { c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './chunks/cli-api.LUtK11-x.js';
7
7
  export { distDir, rootDir } from './path.js';
8
8
  export { generateFileHash } from './task-utils.js';
9
9
  export { m as disableDefaultColors } from './chunks/tinyrainbow.Ht9iggcq.js';
@@ -26,7 +26,7 @@ import 'buffer';
26
26
  import 'util';
27
27
  import './chunks/constants.-juJ8b_4.js';
28
28
  import 'node:crypto';
29
- import './chunks/run.DyRH7m0-.js';
29
+ import './chunks/run.CQOUYP-x.js';
30
30
  import './chunks/index.M2dsQ_UQ.js';
31
31
  import './chunks/display.pkpxlVcY.js';
32
32
  import './chunks/nativeModuleRunner.BOvBCgI_.js';
package/dist/runtime.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VitestModuleEvaluator } from './module-evaluator.js';
2
- import { V as VITEST_VM_CONTEXT_SYMBOL, s as startVitestModuleRunner, a as VitestModuleRunner } from './chunks/index.DQO7054M.js';
3
- export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.DQO7054M.js';
2
+ import { V as VITEST_VM_CONTEXT_SYMBOL, s as startVitestModuleRunner, a as VitestModuleRunner } from './chunks/index.1_nbEjJY.js';
3
+ export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.1_nbEjJY.js';
4
4
  import { g as getWorkerState } from './chunks/utils.DYj33du9.js';
5
5
  export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/node.Es9ukMGX.js';
6
6
  import 'node:module';
package/dist/spy.js CHANGED
@@ -1 +1 @@
1
- export { c as clearAllMocks, d as createMockInstance, f as fn, i as isMockFunction, b as resetAllMocks, r as restoreAllMocks, a as spyOn } from './chunks/spy.DPpyuUIA.js';
1
+ export { c as clearAllMocks, d as createMockInstance, f as fn, i as isMockFunction, b as resetAllMocks, r as restoreAllMocks, a as spyOn } from './chunks/spy.DPLvp2J7.js';
package/dist/worker.js CHANGED
@@ -1,8 +1,8 @@
1
- export { r as runBaseTests, s as setupEnvironment } from './chunks/base.CZYgpg5z.js';
2
- export { i as init } from './chunks/init.DJ2lKyjE.js';
1
+ export { r as runBaseTests, s as setupEnvironment } from './chunks/base.BTS5G301.js';
2
+ export { i as init } from './chunks/init.BS957yFf.js';
3
3
  import 'node:vm';
4
- import './chunks/spy.DPpyuUIA.js';
5
- import './chunks/index.okypXZ97.js';
4
+ import './chunks/spy.DPLvp2J7.js';
5
+ import './chunks/index.5J3Pr46F.js';
6
6
  import 'chai';
7
7
  import 'node:async_hooks';
8
8
  import './chunks/coverage.BtDxDqSU.js';
@@ -13,19 +13,19 @@ import 'vite/module-runner';
13
13
  import './chunks/source-map.Dx3YPjIe.js';
14
14
  import './chunks/index.DmDMHCg8.js';
15
15
  import './chunks/utils.DYj33du9.js';
16
- import './chunks/setup-common.p8NqUXPi.js';
16
+ import './chunks/setup-common.D5-2VgqG.js';
17
17
  import './chunks/plugins.Cigb0uSy.js';
18
18
  import './chunks/index.M2dsQ_UQ.js';
19
19
  import './chunks/tinyrainbow.Ht9iggcq.js';
20
- import './chunks/index.CSoBZWW_.js';
21
- import './chunks/run.DyRH7m0-.js';
20
+ import './chunks/index.OVGXnVRj.js';
21
+ import './chunks/run.CQOUYP-x.js';
22
22
  import './chunks/display.pkpxlVcY.js';
23
23
  import './task-utils.js';
24
24
  import './chunks/offset.Dy-5Fdfn.js';
25
25
  import 'tinybench';
26
26
  import 'expect-type';
27
27
  import './traces.js';
28
- import './chunks/index.DQO7054M.js';
28
+ import './chunks/index.1_nbEjJY.js';
29
29
  import 'node:fs';
30
30
  import './chunks/modules.BJuCwlRJ.js';
31
31
  import 'node:module';
@@ -1,8 +1,8 @@
1
- import { r as runBaseTests, s as setupBaseEnvironment } from '../chunks/base.CZYgpg5z.js';
2
- import { w as workerInit } from '../chunks/init-forks.BqnYxpzU.js';
1
+ import { r as runBaseTests, s as setupBaseEnvironment } from '../chunks/base.BTS5G301.js';
2
+ import { w as workerInit } from '../chunks/init-forks.CiCtIMPj.js';
3
3
  import 'node:vm';
4
- import '../chunks/spy.DPpyuUIA.js';
5
- import '../chunks/index.okypXZ97.js';
4
+ import '../chunks/spy.DPLvp2J7.js';
5
+ import '../chunks/index.5J3Pr46F.js';
6
6
  import 'chai';
7
7
  import 'node:async_hooks';
8
8
  import '../chunks/coverage.BtDxDqSU.js';
@@ -13,22 +13,22 @@ import 'vite/module-runner';
13
13
  import '../chunks/source-map.Dx3YPjIe.js';
14
14
  import '../chunks/index.DmDMHCg8.js';
15
15
  import '../chunks/utils.DYj33du9.js';
16
- import '../chunks/setup-common.p8NqUXPi.js';
16
+ import '../chunks/setup-common.D5-2VgqG.js';
17
17
  import '../chunks/plugins.Cigb0uSy.js';
18
18
  import '../chunks/index.M2dsQ_UQ.js';
19
19
  import '../chunks/tinyrainbow.Ht9iggcq.js';
20
- import '../chunks/index.CSoBZWW_.js';
21
- import '../chunks/run.DyRH7m0-.js';
20
+ import '../chunks/index.OVGXnVRj.js';
21
+ import '../chunks/run.CQOUYP-x.js';
22
22
  import '../chunks/display.pkpxlVcY.js';
23
23
  import '../task-utils.js';
24
24
  import '../chunks/offset.Dy-5Fdfn.js';
25
25
  import 'tinybench';
26
26
  import 'expect-type';
27
- import '../chunks/init.DJ2lKyjE.js';
27
+ import '../chunks/init.BS957yFf.js';
28
28
  import 'node:fs';
29
29
  import 'node:module';
30
30
  import 'node:url';
31
- import '../chunks/index.DQO7054M.js';
31
+ import '../chunks/index.1_nbEjJY.js';
32
32
  import '../chunks/modules.BJuCwlRJ.js';
33
33
  import '../path.js';
34
34
  import 'node:path';
@@ -4,12 +4,12 @@ import timers from 'node:timers';
4
4
  import timersPromises from 'node:timers/promises';
5
5
  import util from 'node:util';
6
6
  import { K as KNOWN_ASSET_TYPES } from '../chunks/pathe.M-eThtNZ.Clq7AXhv.js';
7
- import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks } from '../chunks/index.okypXZ97.js';
7
+ import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks } from '../chunks/index.5J3Pr46F.js';
8
8
  import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from '../chunks/coverage.BtDxDqSU.js';
9
- import { i as index, g as globalExpect } from '../chunks/index.CSoBZWW_.js';
9
+ import { i as index, g as globalExpect } from '../chunks/index.OVGXnVRj.js';
10
10
  import { c as closeInspector } from '../chunks/inspector.CvyFGlXm.js';
11
- import { s as startTests, p as publicCollect } from '../chunks/run.DyRH7m0-.js';
12
- import { s as setupCommonEnv } from '../chunks/setup-common.p8NqUXPi.js';
11
+ import { s as startTests, p as publicCollect } from '../chunks/run.CQOUYP-x.js';
12
+ import { s as setupCommonEnv } from '../chunks/setup-common.D5-2VgqG.js';
13
13
  import { g as getWorkerState } from '../chunks/utils.DYj33du9.js';
14
14
  import 'chai';
15
15
  import 'node:async_hooks';
@@ -18,7 +18,7 @@ import 'vite/module-runner';
18
18
  import '../chunks/source-map.Dx3YPjIe.js';
19
19
  import '../chunks/index.DmDMHCg8.js';
20
20
  import '../chunks/coverage.BcXK1DsQ.js';
21
- import '../chunks/spy.DPpyuUIA.js';
21
+ import '../chunks/spy.DPLvp2J7.js';
22
22
  import '../chunks/display.pkpxlVcY.js';
23
23
  import '../chunks/index.M2dsQ_UQ.js';
24
24
  import '../chunks/tinyrainbow.Ht9iggcq.js';
@@ -1,8 +1,8 @@
1
- import { s as setupBaseEnvironment, r as runBaseTests } from '../chunks/base.CZYgpg5z.js';
2
- import { w as workerInit } from '../chunks/init-threads.CL4Y0HC6.js';
1
+ import { s as setupBaseEnvironment, r as runBaseTests } from '../chunks/base.BTS5G301.js';
2
+ import { w as workerInit } from '../chunks/init-threads.DbGO6vUd.js';
3
3
  import 'node:vm';
4
- import '../chunks/spy.DPpyuUIA.js';
5
- import '../chunks/index.okypXZ97.js';
4
+ import '../chunks/spy.DPLvp2J7.js';
5
+ import '../chunks/index.5J3Pr46F.js';
6
6
  import 'chai';
7
7
  import 'node:async_hooks';
8
8
  import '../chunks/coverage.BtDxDqSU.js';
@@ -13,22 +13,22 @@ import 'vite/module-runner';
13
13
  import '../chunks/source-map.Dx3YPjIe.js';
14
14
  import '../chunks/index.DmDMHCg8.js';
15
15
  import '../chunks/utils.DYj33du9.js';
16
- import '../chunks/setup-common.p8NqUXPi.js';
16
+ import '../chunks/setup-common.D5-2VgqG.js';
17
17
  import '../chunks/plugins.Cigb0uSy.js';
18
18
  import '../chunks/index.M2dsQ_UQ.js';
19
19
  import '../chunks/tinyrainbow.Ht9iggcq.js';
20
- import '../chunks/index.CSoBZWW_.js';
21
- import '../chunks/run.DyRH7m0-.js';
20
+ import '../chunks/index.OVGXnVRj.js';
21
+ import '../chunks/run.CQOUYP-x.js';
22
22
  import '../chunks/display.pkpxlVcY.js';
23
23
  import '../task-utils.js';
24
24
  import '../chunks/offset.Dy-5Fdfn.js';
25
25
  import 'tinybench';
26
26
  import 'expect-type';
27
- import '../chunks/init.DJ2lKyjE.js';
27
+ import '../chunks/init.BS957yFf.js';
28
28
  import 'node:fs';
29
29
  import 'node:module';
30
30
  import 'node:url';
31
- import '../chunks/index.DQO7054M.js';
31
+ import '../chunks/index.1_nbEjJY.js';
32
32
  import '../chunks/modules.BJuCwlRJ.js';
33
33
  import '../path.js';
34
34
  import 'node:path';
@@ -1,11 +1,11 @@
1
- import { w as workerInit } from '../chunks/init-forks.BqnYxpzU.js';
2
- import { r as runVmTests, s as setupVmWorker } from '../chunks/vm.gGBei5ET.js';
3
- import '../chunks/init.DJ2lKyjE.js';
1
+ import { w as workerInit } from '../chunks/init-forks.CiCtIMPj.js';
2
+ import { r as runVmTests, s as setupVmWorker } from '../chunks/vm.BQTVRi0W.js';
3
+ import '../chunks/init.BS957yFf.js';
4
4
  import 'node:fs';
5
5
  import 'node:module';
6
6
  import 'node:url';
7
7
  import 'vite/module-runner';
8
- import '../chunks/index.DQO7054M.js';
8
+ import '../chunks/index.1_nbEjJY.js';
9
9
  import '../chunks/pathe.M-eThtNZ.Clq7AXhv.js';
10
10
  import '../chunks/modules.BJuCwlRJ.js';
11
11
  import '../chunks/utils.DYj33du9.js';
@@ -28,7 +28,7 @@ import '../chunks/console.CHi0lDgQ.js';
28
28
  import 'node:stream';
29
29
  import '../chunks/resolver.CBCHRZ7j.js';
30
30
  import 'es-module-lexer';
31
- import '../chunks/setup-common.p8NqUXPi.js';
31
+ import '../chunks/setup-common.D5-2VgqG.js';
32
32
  import '../chunks/plugins.Cigb0uSy.js';
33
33
 
34
34
  workerInit({
@@ -1,12 +1,12 @@
1
- import { w as workerInit } from '../chunks/init-threads.CL4Y0HC6.js';
2
- import { s as setupVmWorker, r as runVmTests } from '../chunks/vm.gGBei5ET.js';
1
+ import { w as workerInit } from '../chunks/init-threads.DbGO6vUd.js';
2
+ import { s as setupVmWorker, r as runVmTests } from '../chunks/vm.BQTVRi0W.js';
3
3
  import 'node:worker_threads';
4
- import '../chunks/init.DJ2lKyjE.js';
4
+ import '../chunks/init.BS957yFf.js';
5
5
  import 'node:fs';
6
6
  import 'node:module';
7
7
  import 'node:url';
8
8
  import 'vite/module-runner';
9
- import '../chunks/index.DQO7054M.js';
9
+ import '../chunks/index.1_nbEjJY.js';
10
10
  import '../chunks/pathe.M-eThtNZ.Clq7AXhv.js';
11
11
  import '../chunks/modules.BJuCwlRJ.js';
12
12
  import '../chunks/utils.DYj33du9.js';
@@ -29,7 +29,7 @@ import '../chunks/console.CHi0lDgQ.js';
29
29
  import 'node:stream';
30
30
  import '../chunks/resolver.CBCHRZ7j.js';
31
31
  import 'es-module-lexer';
32
- import '../chunks/setup-common.p8NqUXPi.js';
32
+ import '../chunks/setup-common.D5-2VgqG.js';
33
33
  import '../chunks/plugins.Cigb0uSy.js';
34
34
 
35
35
  workerInit({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "5.0.0-rc.3",
4
+ "version": "5.0.0",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -113,12 +113,12 @@
113
113
  "@edge-runtime/vm": "*",
114
114
  "@opentelemetry/api": "^1.9.0",
115
115
  "@types/node": "^22.0.0 || >=24.0.0",
116
- "@vitest/browser-playwright": "5.0.0-rc.3",
117
- "@vitest/browser-preview": "5.0.0-rc.3",
116
+ "@vitest/browser-playwright": "5.0.0",
117
+ "@vitest/browser-preview": "5.0.0",
118
118
  "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
119
- "@vitest/coverage-istanbul": "5.0.0-rc.3",
120
- "@vitest/coverage-v8": "5.0.0-rc.3",
121
- "@vitest/ui": "5.0.0-rc.3",
119
+ "@vitest/coverage-istanbul": "5.0.0",
120
+ "@vitest/coverage-v8": "5.0.0",
121
+ "@vitest/ui": "5.0.0",
122
122
  "happy-dom": "*",
123
123
  "jsdom": "*",
124
124
  "vite": "^6.4.0 || ^7.0.0 || ^8.0.0"
@@ -163,15 +163,15 @@
163
163
  },
164
164
  "dependencies": {
165
165
  "@types/chai": "^5.2.2",
166
- "@vitest/mocker": "5.0.0-rc.3",
166
+ "@vitest/mocker": "5.0.0",
167
167
  "chai": "^6.2.2",
168
168
  "es-module-lexer": "^2.3.2",
169
169
  "expect-type": "^1.4.0",
170
- "magic-string": "^1.2.2",
170
+ "magic-string": "^1.2.3",
171
171
  "obug": "^2.1.4",
172
172
  "picomatch": "^4.0.7",
173
173
  "std-env": "^4.2.0",
174
- "tinybench": "6.1.3",
174
+ "tinybench": "6.1.4",
175
175
  "tinyexec": "1.3.0",
176
176
  "tinyglobby": "^0.2.17",
177
177
  "why-is-node-running": "^2.3.0"
@@ -187,19 +187,19 @@
187
187
  "@types/node": "^24.13.3",
188
188
  "@types/picomatch": "^4.0.3",
189
189
  "@types/prompts": "^2.4.9",
190
- "@vitest/expect": "5.0.0-rc.3",
190
+ "@vitest/expect": "5.0.0",
191
191
  "@vitest/istanbul-lib-coverage": "^1.0.0",
192
192
  "@vitest/istanbul-lib-report": "^1.0.0",
193
- "@vitest/pretty-format": "5.0.0-rc.3",
194
- "@vitest/snapshot": "5.0.0-rc.3",
195
- "@vitest/spy": "5.0.0-rc.3",
196
- "@vitest/utils": "5.0.0-rc.3",
193
+ "@vitest/pretty-format": "5.0.0",
194
+ "@vitest/snapshot": "5.0.0",
195
+ "@vitest/spy": "5.0.0",
196
+ "@vitest/utils": "5.0.0",
197
197
  "acorn": "8.11.3",
198
198
  "acorn-walk": "^8.3.5",
199
199
  "birpc": "^4.2.0",
200
200
  "cac": "^6.7.14",
201
201
  "flatted": "^3.4.4",
202
- "happy-dom": "^20.11.6",
202
+ "happy-dom": "^20.12.0",
203
203
  "jsdom": "^29.1.1",
204
204
  "local-pkg": "^1.2.1",
205
205
  "mime": "^4.1.0",