vitest 5.0.4 → 5.0.5

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 (30) hide show
  1. package/dist/browser.js +2 -2
  2. package/dist/chunks/{base.CYbb9pQW.js → base.CzXt2BO_.js} +8 -7
  3. package/dist/chunks/{cac.DTXWs6Ni.js → cac.CLrZKo1g.js} +5 -5
  4. package/dist/chunks/{cli-api.Bx28WXzL.js → cli-api.De07GUeT.js} +24 -9
  5. package/dist/chunks/{creator.CLL8QFMS.js → creator.C5g4egeG.js} +3 -3
  6. package/dist/chunks/{doctor.Bqc8NDDb.js → doctor.BK86Cncq.js} +1 -1
  7. package/dist/chunks/{globals.CTWMSIPL.js → globals.CXEE6_2C.js} +2 -2
  8. package/dist/chunks/{index.B8VfM7Mf.js → index.1TqnEahn.js} +108 -81
  9. package/dist/chunks/{index.CPNMO3h-.js → index.CK-t0WMg.js} +6 -7
  10. package/dist/chunks/{index.GYMZ12wH.js → index.CoUIxZd4.js} +4 -2
  11. package/dist/chunks/{index.uwTEEBsB.js → index.aTZaPVhf.js} +1 -1
  12. package/dist/chunks/{init-forks.CbYYa5xq.js → init-forks.CRxIPOJR.js} +1 -1
  13. package/dist/chunks/{init-threads.DtjdvxPl.js → init-threads.Dv3kwST_.js} +1 -1
  14. package/dist/chunks/{init.DrHtV5zd.js → init.PvxYpuCm.js} +1 -1
  15. package/dist/chunks/{nativeModuleMocker.D8f4cW4A.js → nativeModuleMocker.BxrHJNAF.js} +25 -4
  16. package/dist/chunks/{run.Cm2sd7-x.js → run.BPv-BBRv.js} +37 -28
  17. package/dist/chunks/{setup-common.BABL3z3m.js → setup-common.HGAqWOnX.js} +1 -1
  18. package/dist/chunks/{vm.Uo_C9Uld.js → vm.FGl2rw_t.js} +3 -3
  19. package/dist/cli.js +1 -1
  20. package/dist/index.js +2 -2
  21. package/dist/module-evaluator.js +16 -12
  22. package/dist/node.js +5 -5
  23. package/dist/runtime.js +2 -2
  24. package/dist/worker.js +7 -7
  25. package/dist/workers/forks.js +8 -8
  26. package/dist/workers/runVmTests.js +5 -4
  27. package/dist/workers/threads.js +8 -8
  28. package/dist/workers/vmForks.js +5 -5
  29. package/dist/workers/vmThreads.js +5 -5
  30. package/package.json +12 -12
@@ -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.CPNMO3h-.js';
5
+ import { e as environments, b as VitestTransport } from './index.CK-t0WMg.js';
6
6
  import { r as resolve } from './pathe.M-eThtNZ.Ba-7h1rE.js';
7
7
  import { b as serializeValue, c as createStackString, p as parseStacktrace } from './source-map.DdKI5IHB.js';
8
8
  import { w } from './tinyrainbow.Do8I1XRG.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.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.CPNMO3h-.js';
7
+ import { B as BareModuleMocker, n as normalizeModuleId } from './index.CK-t0WMg.js';
8
8
  import 'node:fs';
9
9
  import './utils.DYj33du9.js';
10
10
  import '../path.js';
@@ -19,12 +19,15 @@ import 'node:console';
19
19
 
20
20
  class NativeModuleMocker extends BareModuleMocker {
21
21
  wrapDynamicImport(moduleFactory) {
22
- if (typeof moduleFactory === "function") return new Promise((resolve, reject) => {
22
+ if (typeof moduleFactory !== "function") return moduleFactory;
23
+ // Node.js can evaluate the module outside of the importer's async chain,
24
+ // so the stack of an import error would not point at the import
25
+ const importer = /* @__PURE__ */ new Error("import location");
26
+ return new Promise((resolve, reject) => {
23
27
  this.resolveMocks().finally(() => {
24
- moduleFactory().then(resolve, reject);
28
+ moduleFactory().then(resolve, (error) => reject(addImporterFrame(error, importer)));
25
29
  });
26
30
  });
27
- return moduleFactory;
28
31
  }
29
32
  resolveMockedModule(url, parentURL) {
30
33
  // don't mock modules inside of packages because there is
@@ -209,5 +212,23 @@ function transformCode(code, format, filename) {
209
212
  }
210
213
  return code;
211
214
  }
215
+ function addImporterFrame(error, importer) {
216
+ const lines = importer.stack?.split("\n") || [];
217
+ const index = lines.findIndex((line) => line.includes("wrapDynamicImport"));
218
+ const frame = index === -1 ? void 0 : lines[index + 1];
219
+ const file = frame?.match(/\(?([^()\s]+):\d+:\d+\)?$/)?.[1];
220
+ if (!frame || !file || frame.includes("node:")) return error;
221
+ const asyncFrame = frame.replace(/^(\s*)at /, "$1at async ");
222
+ const seen = /* @__PURE__ */ new Set();
223
+ let current = error;
224
+ while (current instanceof Error && !seen.has(current)) {
225
+ seen.add(current);
226
+ const stack = current.stack;
227
+ // older Node.js versions keep the async frame of the import themselves
228
+ if (typeof stack === "string" && !stack.split("\n").some((line) => line.includes("at async ") && line.includes(file))) current.stack = `${stack}\n${asyncFrame}`;
229
+ current = current.cause;
230
+ }
231
+ return error;
232
+ }
212
233
 
213
234
  export { NativeModuleMocker };
@@ -1849,11 +1849,11 @@ function setCurrentTest(test) {
1849
1849
  function getCurrentTest() {
1850
1850
  return _test;
1851
1851
  }
1852
- const tests = [];
1852
+ const tests = /* @__PURE__ */ new Set();
1853
1853
  function addRunningTest(test) {
1854
- tests.push(test);
1854
+ tests.add(test);
1855
1855
  return () => {
1856
- tests.splice(tests.indexOf(test));
1856
+ tests.delete(test);
1857
1857
  };
1858
1858
  }
1859
1859
  function getRunningTests() {
@@ -1873,6 +1873,10 @@ function createChainable(keys, fn, context) {
1873
1873
  Object.defineProperty(chain, kChainableContext, {
1874
1874
  value: {
1875
1875
  withContext: () => chain.bind(context),
1876
+ extendContext: (ctx) => create({
1877
+ ...context,
1878
+ ...ctx
1879
+ }),
1876
1880
  getFixtures: () => context.fixtures,
1877
1881
  setContext: (key, value) => {
1878
1882
  context[key] = value;
@@ -2595,6 +2599,10 @@ function createSuiteHooks() {
2595
2599
  };
2596
2600
  }
2597
2601
  const POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
2602
+ function assignDefined(target, source) {
2603
+ for (const key in source) if (source[key] !== void 0) target[key] = source[key];
2604
+ return target;
2605
+ }
2598
2606
  function parseArguments(optionsOrFn, timeoutOrTest) {
2599
2607
  if (timeoutOrTest != null && typeof timeoutOrTest === "object") throw new TypeError(`Signature "test(name, fn, { ... })" was deprecated in Vitest 3 and removed in Vitest 4. Please, provide options as a second argument instead.`);
2600
2608
  let options = {};
@@ -2626,16 +2634,16 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
2626
2634
  return tagDefinition;
2627
2635
  }).filter((r) => r != null).sort((tag1, tag2) => (tag2.priority ?? POSITIVE_INFINITY) - (tag1.priority ?? POSITIVE_INFINITY)).reduce((acc, tag) => {
2628
2636
  const { name, description, priority, meta, ...options } = tag;
2629
- Object.assign(acc, options);
2637
+ assignDefined(acc, options);
2630
2638
  if (meta) acc.meta = Object.assign(acc.meta ?? Object.create(null), meta);
2631
2639
  return acc;
2632
2640
  }, {});
2633
2641
  const testOwnMeta = options.meta;
2634
- options = {
2635
- ...collectorContext.currentSuite?.options,
2636
- ...tagsOptions,
2637
- ...options
2638
- };
2642
+ const parentOptions = collectorContext.currentSuite?.options;
2643
+ options = assignDefined({
2644
+ ...parentOptions,
2645
+ ...tagsOptions
2646
+ }, options);
2639
2647
  const timeout = options.timeout ?? runner.config.testTimeout;
2640
2648
  // TODO: should this be `parentTask.meta`?
2641
2649
  // currently we don't inherit
@@ -2707,8 +2715,7 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
2707
2715
  const concurrent = this.concurrent ?? options?.concurrent;
2708
2716
  if (concurrent != null) options.concurrent = concurrent;
2709
2717
  const test = task(formatName(name), {
2710
- ...this,
2711
- ...options,
2718
+ ...assignDefined({ ...this }, options),
2712
2719
  handler
2713
2720
  });
2714
2721
  test.type = "test";
@@ -2807,10 +2814,7 @@ function createSuite() {
2807
2814
  let { options, handler: factory } = parseArguments(factoryOrOptions, optionsOrFactory);
2808
2815
  const { meta: parentMeta, ...parentOptions } = currentSuite?.options || {};
2809
2816
  // inherit options from current suite
2810
- options = {
2811
- ...parentOptions,
2812
- ...options
2813
- };
2817
+ options = assignDefined({ ...parentOptions }, options);
2814
2818
  const shuffle = this.shuffle ?? options.shuffle ?? currentSuite?.options?.shuffle ?? runner?.config.sequence.shuffle;
2815
2819
  if (shuffle != null) options.shuffle = shuffle;
2816
2820
  let mode = this.only ?? options.only ? "only" : this.skip ?? options.skip ? "skip" : this.todo ?? options.todo ? "todo" : "run";
@@ -2904,10 +2908,10 @@ function createTaskCollector(fn) {
2904
2908
  };
2905
2909
  };
2906
2910
  taskFn.skipIf = function(condition) {
2907
- return condition ? this.skip : this;
2911
+ return getChainableContext(this).extendContext({ skip: !!condition });
2908
2912
  };
2909
2913
  taskFn.runIf = function(condition) {
2910
- return condition ? this : this.skip;
2914
+ return getChainableContext(this).extendContext({ skip: !condition });
2911
2915
  };
2912
2916
  /**
2913
2917
  * Parse builder pattern arguments into a fixtures object.
@@ -3586,12 +3590,11 @@ async function callTestHooks(runner, test, hooks, sequence) {
3586
3590
  context.onTestFailed = onTestFailed;
3587
3591
  context.onTestFinished = onTestFinished;
3588
3592
  }
3589
- async function callSuiteHook(suite, currentTask, name, runner, args) {
3593
+ async function callSuiteHook(suite, currentTask, name, runner, args, cleanups = []) {
3590
3594
  const sequence = runner.config.sequence.hooks;
3591
- const callbacks = [];
3592
3595
  // stop at file level
3593
3596
  const parentSuite = "filepath" in suite ? null : suite.suite || suite.file;
3594
- if (name === "beforeEach" && parentSuite) callbacks.push(...await callSuiteHook(parentSuite, currentTask, name, runner, args));
3597
+ if (name === "beforeEach" && parentSuite) await callSuiteHook(parentSuite, currentTask, name, runner, args, cleanups);
3595
3598
  const hooks = getSuiteHooks(suite, name, sequence);
3596
3599
  if (hooks.length > 0) updateSuiteHookState(currentTask, name, "run", runner);
3597
3600
  async function runHook(hook) {
@@ -3599,11 +3602,17 @@ async function callSuiteHook(suite, currentTask, name, runner, args) {
3599
3602
  return getBeforeHookCleanupCallback(hook, await hook(...args), name === "beforeEach" ? args[0] : void 0);
3600
3603
  });
3601
3604
  }
3602
- if (sequence === "parallel") callbacks.push(...await Promise.all(hooks.map((hook) => runHook(hook))));
3603
- else for (const hook of hooks) callbacks.push(await runHook(hook));
3605
+ if (sequence === "parallel") {
3606
+ const results = await Promise.allSettled(hooks.map((hook) => runHook(hook)));
3607
+ // hooks can reject with the same `signal.reason`
3608
+ const errors = /* @__PURE__ */ new Set();
3609
+ for (const result of results) if (result.status === "fulfilled") cleanups.push(result.value);
3610
+ else errors.add(result.reason);
3611
+ if (errors.size === 1) throw [...errors][0];
3612
+ if (errors.size > 1) throw new AggregateError([...errors], `Multiple "${name}" hooks failed.`);
3613
+ } else for (const hook of hooks) cleanups.push(await runHook(hook));
3604
3614
  if (hooks.length > 0) updateSuiteHookState(currentTask, name, "pass", runner);
3605
- if (name === "afterEach" && parentSuite) callbacks.push(...await callSuiteHook(parentSuite, currentTask, name, runner, args));
3606
- return callbacks;
3615
+ if (name === "afterEach" && parentSuite) await callSuiteHook(parentSuite, currentTask, name, runner, args);
3607
3616
  }
3608
3617
  function getAroundEachHooks(suite) {
3609
3618
  const hooks = [];
@@ -3875,7 +3884,7 @@ async function runTest(test, runner) {
3875
3884
  const retry = getRetryCount(test.retry);
3876
3885
  for (let retryCount = 0; retryCount <= retry; retryCount++) {
3877
3886
  const attemptErrorsStart = test.result.errors?.length ?? 0;
3878
- let beforeEachCleanups = [];
3887
+ const beforeEachCleanups = [];
3879
3888
  // fixtureCheckpoint is passed by callAroundEachHooks - it represents the count
3880
3889
  // of fixture cleanup functions AFTER all aroundEach fixtures have been resolved
3881
3890
  // but BEFORE the test runs. This allows us to clean up only fixtures created
@@ -3887,7 +3896,7 @@ async function runTest(test, runner) {
3887
3896
  repeats: repeatCount
3888
3897
  });
3889
3898
  test.result.repeatCount = repeatCount;
3890
- beforeEachCleanups = await $("test.beforeEach", () => callSuiteHook(suite, test, "beforeEach", runner, [test.context, suite]));
3899
+ await $("test.beforeEach", () => callSuiteHook(suite, test, "beforeEach", runner, [test.context, suite], beforeEachCleanups));
3891
3900
  if (runner.runTask) await $("test.callback", () => limitMaxConcurrency(() => runner.runTask(test)));
3892
3901
  else {
3893
3902
  const fn = getFn(test);
@@ -4042,7 +4051,7 @@ async function runSuite(suite, runner) {
4042
4051
  };
4043
4052
  const $ = runner.trace;
4044
4053
  updateTask("suite-prepare", suite, runner);
4045
- let beforeAllCleanups = [];
4054
+ const beforeAllCleanups = [];
4046
4055
  if (suite.mode === "skip") {
4047
4056
  suite.result.state = "skip";
4048
4057
  updateTask("suite-finished", suite, runner);
@@ -4057,7 +4066,7 @@ async function runSuite(suite, runner) {
4057
4066
  try {
4058
4067
  // beforeAll
4059
4068
  try {
4060
- beforeAllCleanups = await $("suite.beforeAll", () => callSuiteHook(suite, suite, "beforeAll", runner, [suite]));
4069
+ await $("suite.beforeAll", () => callSuiteHook(suite, suite, "beforeAll", runner, [suite], beforeAllCleanups));
4061
4070
  } catch (e) {
4062
4071
  failTask(suite.result, e, runner.config._diffOptions);
4063
4072
  markTasksAsSkipped(suite, runner);
@@ -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.CTWMSIPL.js')).registerApiGlobally();
10
+ if (config.globals) (await import('./globals.CXEE6_2C.js')).registerApiGlobally();
11
11
  }
12
12
  function setupDefines(config) {
13
13
  for (const key in config.defines) globalThis[key] = config.defines[key];
@@ -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.DrHtV5zd.js';
4
+ import { l as loadEnvironment, a as listenForErrors, e as emitModuleRunner } from './init.PvxYpuCm.js';
5
5
  import { distDir } from '../path.js';
6
6
  import { createCustomConsole } from './console.DtI4yxfN.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.CtCcxIy1.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.CPNMO3h-.js';
13
+ import { V as VITEST_VM_CONTEXT_SYMBOL, s as startVitestModuleRunner, c as createNodeImportMeta } from './index.CK-t0WMg.js';
14
14
  import { getDefaultRequestStubs } from '../module-evaluator.js';
15
- import { b as setupEnv } from './setup-common.BABL3z3m.js';
15
+ import { b as setupEnv } from './setup-common.HGAqWOnX.js';
16
16
  import { p as provideWorkerState } from './utils.DYj33du9.js';
17
17
 
18
18
  /**
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createCLI } from './chunks/cac.DTXWs6Ni.js';
1
+ import { c as createCLI } from './chunks/cac.CLrZKo1g.js';
2
2
  import './chunks/pathe.M-eThtNZ.Ba-7h1rE.js';
3
3
  import 'events';
4
4
  import './chunks/tinyrainbow.Do8I1XRG.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
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.uwTEEBsB.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.aTZaPVhf.js';
2
2
  export { V as EvaluatedModules } from './chunks/rpc.DpkUyY1N.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.Cm2sd7-x.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.BPv-BBRv.js';
4
4
  export { expectTypeOf } from 'expect-type';
5
5
  import * as chai from 'chai';
6
6
  export { chai };
@@ -325,19 +325,23 @@ function removeStyle(id) {
325
325
  const sheet = document.querySelector(`[data-vite-dev-id="${id}"]`);
326
326
  if (sheet) document.head.removeChild(sheet);
327
327
  }
328
+ function createHotContext() {
329
+ return {
330
+ data: {},
331
+ accept: () => {},
332
+ acceptExports: () => {},
333
+ prune: () => {},
334
+ dispose: () => {},
335
+ decline: () => {},
336
+ invalidate: () => {},
337
+ on: () => {},
338
+ off: () => {},
339
+ send: () => {}
340
+ };
341
+ }
328
342
  const defaultClientStub = {
329
343
  injectQuery: (id) => id,
330
- createHotContext: () => {
331
- return {
332
- accept: () => {},
333
- prune: () => {},
334
- dispose: () => {},
335
- decline: () => {},
336
- invalidate: () => {},
337
- on: () => {},
338
- send: () => {}
339
- };
340
- },
344
+ createHotContext,
341
345
  updateStyle: () => {},
342
346
  removeStyle: () => {}
343
347
  };
@@ -347,7 +351,7 @@ function getDefaultRequestStubs(context) {
347
351
  updateStyle,
348
352
  removeStyle
349
353
  } };
350
- return { "/@vite/client": vm.runInContext(`(defaultClient) => ({ ...defaultClient, updateStyle: ${updateStyle.toString()}, removeStyle: ${removeStyle.toString()} })`, context)(defaultClientStub) };
354
+ return { "/@vite/client": vm.runInContext(`(defaultClient) => ({ ...defaultClient, createHotContext: ${createHotContext.toString()}, updateStyle: ${updateStyle.toString()}, removeStyle: ${removeStyle.toString()} })`, context)(defaultClientStub) };
351
355
  }
352
356
  function exportAll(exports, sourceModule) {
353
357
  // #1120 when a module exports itself it causes
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/cli-api.Bx28WXzL.js';
4
- export { M as AgentReporter, B as BaseCoverageProvider, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, J as JUnitReporter, b as JsonReporter, M as MinimalReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, d as VerboseReporter, e as createVitest, f as experimental_getRunnerTask, i as isValidApiRequest, r as registerConsoleShortcuts, s as startVitest } from './chunks/cli-api.Bx28WXzL.js';
5
- export { B as BaseSequencer, a as BrowserConnectionError, F as ForksPoolWorker, G as GitNotFoundError, L as Logger, P as PluginHarness, b as TestsNotFoundError, T as ThreadsPoolWorker, c as TypecheckPoolWorker, V as VitestPackageInstaller, d as VmForksPoolWorker, e as VmThreadsPoolWorker, f as createDebugger, g as createMethodsRPC, h as createViteLogger, i as escapeTestName, j as getFilePoolName, k as isFileServingAllowed, r as resolveApiServerConfig, l as resolveConfig, m as resolveFsAllow } from './chunks/index.B8VfM7Mf.js';
6
- export { c as createCLI, p as parseCLI } from './chunks/cac.DTXWs6Ni.js';
3
+ import { V as Vitest } from './chunks/cli-api.De07GUeT.js';
4
+ export { M as AgentReporter, B as BaseCoverageProvider, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, J as JUnitReporter, b as JsonReporter, M as MinimalReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, d as VerboseReporter, e as createVitest, f as experimental_getRunnerTask, i as isValidApiRequest, r as registerConsoleShortcuts, s as startVitest } from './chunks/cli-api.De07GUeT.js';
5
+ export { B as BaseSequencer, a as BrowserConnectionError, F as ForksPoolWorker, G as GitNotFoundError, L as Logger, P as PluginHarness, b as TestsNotFoundError, T as ThreadsPoolWorker, c as TypecheckPoolWorker, V as VitestPackageInstaller, d as VmForksPoolWorker, e as VmThreadsPoolWorker, f as createDebugger, g as createMethodsRPC, h as createViteLogger, i as escapeTestName, j as getFilePoolName, k as isFileServingAllowed, r as resolveApiServerConfig, l as resolveConfig, m as resolveFsAllow } from './chunks/index.1TqnEahn.js';
6
+ export { c as createCLI, p as parseCLI } from './chunks/cac.CLrZKo1g.js';
7
7
  export { distDir, rootDir } from './path.js';
8
8
  export { generateFileHash } from './task-utils.js';
9
9
  export { w as disableDefaultColors } from './chunks/tinyrainbow.Do8I1XRG.js';
@@ -31,7 +31,7 @@ import './chunks/constants.-juJ8b_4.js';
31
31
  import './chunks/modules.BJuCwlRJ.js';
32
32
  import 'node:module';
33
33
  import 'node:crypto';
34
- import './chunks/run.Cm2sd7-x.js';
34
+ import './chunks/run.BPv-BBRv.js';
35
35
  import './chunks/display.BlTmubjj.js';
36
36
  import './chunks/nativeModuleRunner.xi64Afb2.js';
37
37
  import 'node:url';
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.CPNMO3h-.js';
3
- export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.CPNMO3h-.js';
2
+ import { V as VITEST_VM_CONTEXT_SYMBOL, s as startVitestModuleRunner, a as VitestModuleRunner } from './chunks/index.CK-t0WMg.js';
3
+ export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.CK-t0WMg.js';
4
4
  import { g as getWorkerState } from './chunks/utils.DYj33du9.js';
5
5
  export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/node.uQulW0ei.js';
6
6
  import 'node:module';
package/dist/worker.js CHANGED
@@ -1,8 +1,8 @@
1
- export { r as runBaseTests, s as setupEnvironment } from './chunks/base.CYbb9pQW.js';
2
- export { i as init } from './chunks/init.DrHtV5zd.js';
1
+ export { r as runBaseTests, s as setupEnvironment } from './chunks/base.CzXt2BO_.js';
2
+ export { i as init } from './chunks/init.PvxYpuCm.js';
3
3
  import 'node:vm';
4
4
  import './chunks/spy.DDMXghXv.js';
5
- import './chunks/index.GYMZ12wH.js';
5
+ import './chunks/index.CoUIxZd4.js';
6
6
  import 'chai';
7
7
  import 'node:async_hooks';
8
8
  import './chunks/coverage.-bm5IxnW.js';
@@ -15,10 +15,10 @@ import './chunks/index.D0heQG4v.js';
15
15
  import './chunks/tinyrainbow.Do8I1XRG.js';
16
16
  import './chunks/index.DmDMHCg8.js';
17
17
  import './chunks/utils.DYj33du9.js';
18
- import './chunks/setup-common.BABL3z3m.js';
18
+ import './chunks/setup-common.HGAqWOnX.js';
19
19
  import './chunks/plugins.DPQHVT0p.js';
20
- import './chunks/index.uwTEEBsB.js';
21
- import './chunks/run.Cm2sd7-x.js';
20
+ import './chunks/index.aTZaPVhf.js';
21
+ import './chunks/run.BPv-BBRv.js';
22
22
  import './chunks/display.BlTmubjj.js';
23
23
  import './task-utils.js';
24
24
  import './chunks/offset.Dy-5Fdfn.js';
@@ -30,7 +30,7 @@ import 'node:url';
30
30
  import './path.js';
31
31
  import 'node:path';
32
32
  import './traces.js';
33
- import './chunks/index.CPNMO3h-.js';
33
+ import './chunks/index.CK-t0WMg.js';
34
34
  import 'node:fs';
35
35
  import './chunks/modules.BJuCwlRJ.js';
36
36
  import './module-evaluator.js';
@@ -1,8 +1,8 @@
1
- import { r as runBaseTests, s as setupBaseEnvironment } from '../chunks/base.CYbb9pQW.js';
2
- import { w as workerInit } from '../chunks/init-forks.CbYYa5xq.js';
1
+ import { r as runBaseTests, s as setupBaseEnvironment } from '../chunks/base.CzXt2BO_.js';
2
+ import { w as workerInit } from '../chunks/init-forks.CRxIPOJR.js';
3
3
  import 'node:vm';
4
4
  import '../chunks/spy.DDMXghXv.js';
5
- import '../chunks/index.GYMZ12wH.js';
5
+ import '../chunks/index.CoUIxZd4.js';
6
6
  import 'chai';
7
7
  import 'node:async_hooks';
8
8
  import '../chunks/coverage.-bm5IxnW.js';
@@ -15,20 +15,20 @@ import '../chunks/index.D0heQG4v.js';
15
15
  import '../chunks/tinyrainbow.Do8I1XRG.js';
16
16
  import '../chunks/index.DmDMHCg8.js';
17
17
  import '../chunks/utils.DYj33du9.js';
18
- import '../chunks/setup-common.BABL3z3m.js';
18
+ import '../chunks/setup-common.HGAqWOnX.js';
19
19
  import '../chunks/plugins.DPQHVT0p.js';
20
- import '../chunks/index.uwTEEBsB.js';
21
- import '../chunks/run.Cm2sd7-x.js';
20
+ import '../chunks/index.aTZaPVhf.js';
21
+ import '../chunks/run.BPv-BBRv.js';
22
22
  import '../chunks/display.BlTmubjj.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.DrHtV5zd.js';
27
+ import '../chunks/init.PvxYpuCm.js';
28
28
  import 'node:fs';
29
29
  import 'node:module';
30
30
  import 'node:url';
31
- import '../chunks/index.CPNMO3h-.js';
31
+ import '../chunks/index.CK-t0WMg.js';
32
32
  import '../chunks/modules.BJuCwlRJ.js';
33
33
  import '../path.js';
34
34
  import 'node:path';
@@ -4,13 +4,13 @@ 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.Ba-7h1rE.js';
7
- import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks } from '../chunks/index.GYMZ12wH.js';
7
+ import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks } from '../chunks/index.CoUIxZd4.js';
8
8
  import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from '../chunks/coverage.-bm5IxnW.js';
9
- import { i as index, g as globalExpect } from '../chunks/index.uwTEEBsB.js';
9
+ import { i as index, g as globalExpect } from '../chunks/index.aTZaPVhf.js';
10
10
  import { g as getEvaluatedImports, c as collectDependencies } from '../chunks/module-dependencies.CwNPkcV4.js';
11
11
  import { c as closeInspector } from '../chunks/inspector.CvyFGlXm.js';
12
- import { s as startTests, p as publicCollect } from '../chunks/run.Cm2sd7-x.js';
13
- import { s as setupCommonEnv } from '../chunks/setup-common.BABL3z3m.js';
12
+ import { s as startTests, p as publicCollect } from '../chunks/run.BPv-BBRv.js';
13
+ import { s as setupCommonEnv } from '../chunks/setup-common.HGAqWOnX.js';
14
14
  import { g as getWorkerState } from '../chunks/utils.DYj33du9.js';
15
15
  import 'chai';
16
16
  import 'node:async_hooks';
@@ -98,6 +98,7 @@ async function run(method, files, config, moduleRunner, traces) {
98
98
  vi.resetConfig();
99
99
  // mocks should not affect different files
100
100
  vi.restoreAllMocks();
101
+ moduleRunner.mocker?.reset();
101
102
  }
102
103
  });
103
104
  } finally {
@@ -1,8 +1,8 @@
1
- import { s as setupBaseEnvironment, r as runBaseTests } from '../chunks/base.CYbb9pQW.js';
2
- import { w as workerInit } from '../chunks/init-threads.DtjdvxPl.js';
1
+ import { s as setupBaseEnvironment, r as runBaseTests } from '../chunks/base.CzXt2BO_.js';
2
+ import { w as workerInit } from '../chunks/init-threads.Dv3kwST_.js';
3
3
  import 'node:vm';
4
4
  import '../chunks/spy.DDMXghXv.js';
5
- import '../chunks/index.GYMZ12wH.js';
5
+ import '../chunks/index.CoUIxZd4.js';
6
6
  import 'chai';
7
7
  import 'node:async_hooks';
8
8
  import '../chunks/coverage.-bm5IxnW.js';
@@ -15,20 +15,20 @@ import '../chunks/index.D0heQG4v.js';
15
15
  import '../chunks/tinyrainbow.Do8I1XRG.js';
16
16
  import '../chunks/index.DmDMHCg8.js';
17
17
  import '../chunks/utils.DYj33du9.js';
18
- import '../chunks/setup-common.BABL3z3m.js';
18
+ import '../chunks/setup-common.HGAqWOnX.js';
19
19
  import '../chunks/plugins.DPQHVT0p.js';
20
- import '../chunks/index.uwTEEBsB.js';
21
- import '../chunks/run.Cm2sd7-x.js';
20
+ import '../chunks/index.aTZaPVhf.js';
21
+ import '../chunks/run.BPv-BBRv.js';
22
22
  import '../chunks/display.BlTmubjj.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.DrHtV5zd.js';
27
+ import '../chunks/init.PvxYpuCm.js';
28
28
  import 'node:fs';
29
29
  import 'node:module';
30
30
  import 'node:url';
31
- import '../chunks/index.CPNMO3h-.js';
31
+ import '../chunks/index.CK-t0WMg.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.CbYYa5xq.js';
2
- import { r as runVmTests, s as setupVmWorker } from '../chunks/vm.Uo_C9Uld.js';
3
- import '../chunks/init.DrHtV5zd.js';
1
+ import { w as workerInit } from '../chunks/init-forks.CRxIPOJR.js';
2
+ import { r as runVmTests, s as setupVmWorker } from '../chunks/vm.FGl2rw_t.js';
3
+ import '../chunks/init.PvxYpuCm.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.CPNMO3h-.js';
8
+ import '../chunks/index.CK-t0WMg.js';
9
9
  import '../chunks/pathe.M-eThtNZ.Ba-7h1rE.js';
10
10
  import '../chunks/modules.BJuCwlRJ.js';
11
11
  import '../chunks/utils.DYj33du9.js';
@@ -28,7 +28,7 @@ import '../chunks/console.DtI4yxfN.js';
28
28
  import 'node:stream';
29
29
  import '../chunks/resolver.CtCcxIy1.js';
30
30
  import 'es-module-lexer';
31
- import '../chunks/setup-common.BABL3z3m.js';
31
+ import '../chunks/setup-common.HGAqWOnX.js';
32
32
  import '../chunks/plugins.DPQHVT0p.js';
33
33
 
34
34
  workerInit({
@@ -1,12 +1,12 @@
1
- import { w as workerInit } from '../chunks/init-threads.DtjdvxPl.js';
2
- import { s as setupVmWorker, r as runVmTests } from '../chunks/vm.Uo_C9Uld.js';
1
+ import { w as workerInit } from '../chunks/init-threads.Dv3kwST_.js';
2
+ import { s as setupVmWorker, r as runVmTests } from '../chunks/vm.FGl2rw_t.js';
3
3
  import 'node:worker_threads';
4
- import '../chunks/init.DrHtV5zd.js';
4
+ import '../chunks/init.PvxYpuCm.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.CPNMO3h-.js';
9
+ import '../chunks/index.CK-t0WMg.js';
10
10
  import '../chunks/pathe.M-eThtNZ.Ba-7h1rE.js';
11
11
  import '../chunks/modules.BJuCwlRJ.js';
12
12
  import '../chunks/utils.DYj33du9.js';
@@ -29,7 +29,7 @@ import '../chunks/console.DtI4yxfN.js';
29
29
  import 'node:stream';
30
30
  import '../chunks/resolver.CtCcxIy1.js';
31
31
  import 'es-module-lexer';
32
- import '../chunks/setup-common.BABL3z3m.js';
32
+ import '../chunks/setup-common.HGAqWOnX.js';
33
33
  import '../chunks/plugins.DPQHVT0p.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.4",
4
+ "version": "5.0.5",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -118,12 +118,12 @@
118
118
  "@edge-runtime/vm": "*",
119
119
  "@opentelemetry/api": "^1.9.0",
120
120
  "@types/node": "^22.0.0 || >=24.0.0",
121
- "@vitest/browser-playwright": "5.0.4",
122
- "@vitest/browser-preview": "5.0.4",
121
+ "@vitest/browser-playwright": "5.0.5",
122
+ "@vitest/browser-preview": "5.0.5",
123
123
  "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
124
- "@vitest/coverage-istanbul": "5.0.4",
125
- "@vitest/coverage-v8": "5.0.4",
126
- "@vitest/ui": "5.0.4",
124
+ "@vitest/coverage-istanbul": "5.0.5",
125
+ "@vitest/coverage-v8": "5.0.5",
126
+ "@vitest/ui": "5.0.5",
127
127
  "happy-dom": "*",
128
128
  "jsdom": "*",
129
129
  "vite": "^6.4.0 || ^7.0.0 || ^8.0.0"
@@ -168,7 +168,7 @@
168
168
  },
169
169
  "dependencies": {
170
170
  "@types/chai": "^5.2.2",
171
- "@vitest/mocker": "5.0.4",
171
+ "@vitest/mocker": "5.0.5",
172
172
  "chai": "^6.3.0",
173
173
  "es-module-lexer": "^2.3.2",
174
174
  "expect-type": "^1.4.0",
@@ -193,13 +193,13 @@
193
193
  "@types/picomatch": "^4.0.3",
194
194
  "@types/prompts": "^2.4.9",
195
195
  "@types/ws": "^8.18.2",
196
- "@vitest/expect": "5.0.4",
196
+ "@vitest/expect": "5.0.5",
197
197
  "@vitest/istanbul-lib-coverage": "^1.0.2",
198
198
  "@vitest/istanbul-lib-report": "^1.0.2",
199
- "@vitest/pretty-format": "5.0.4",
200
- "@vitest/snapshot": "5.0.4",
201
- "@vitest/spy": "5.0.4",
202
- "@vitest/utils": "5.0.4",
199
+ "@vitest/pretty-format": "5.0.5",
200
+ "@vitest/snapshot": "5.0.5",
201
+ "@vitest/spy": "5.0.5",
202
+ "@vitest/utils": "5.0.5",
203
203
  "acorn": "8.11.3",
204
204
  "acorn-walk": "^8.3.5",
205
205
  "birpc": "^4.2.0",