vitest 3.1.3 → 3.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
618
618
 
619
619
  const cac = (name = "") => new CAC(name);
620
620
 
621
- var version = "3.1.3";
621
+ var version = "3.1.4";
622
622
 
623
623
  const apiConfig = (port) => ({
624
624
  port: {
@@ -864,10 +864,7 @@ const cliOptionsConfig = {
864
864
  return { enabled: browser === "yes" };
865
865
  }
866
866
  if (typeof browser === "string") {
867
- return {
868
- enabled: true,
869
- name: browser
870
- };
867
+ return { name: browser };
871
868
  }
872
869
  return browser;
873
870
  },
@@ -1451,9 +1448,6 @@ function normalizeCliOptions(cliFilters, argv) {
1451
1448
  if (cliFilters.some((filter) => filter.includes(":"))) {
1452
1449
  argv.includeTaskLocation ??= true;
1453
1450
  }
1454
- if (typeof argv.browser === "object" && !("enabled" in argv.browser)) {
1455
- argv.browser.enabled = true;
1456
- }
1457
1451
  if (typeof argv.typecheck?.only === "boolean") {
1458
1452
  argv.typecheck.enabled ??= true;
1459
1453
  }
@@ -1464,7 +1458,7 @@ async function start(mode, cliFilters, options) {
1464
1458
  process.title = "node (vitest)";
1465
1459
  } catch {}
1466
1460
  try {
1467
- const { startVitest } = await import('./cli-api.Bti1vevt.js').then(function (n) { return n.f; });
1461
+ const { startVitest } = await import('./cli-api.BzebkJv7.js').then(function (n) { return n.f; });
1468
1462
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
1469
1463
  if (!ctx.shouldKeepServer()) {
1470
1464
  await ctx.exit();
@@ -1493,7 +1487,7 @@ async function collect(mode, cliFilters, options) {
1493
1487
  process.title = "node (vitest)";
1494
1488
  } catch {}
1495
1489
  try {
1496
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.Bti1vevt.js').then(function (n) { return n.f; });
1490
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.BzebkJv7.js').then(function (n) { return n.f; });
1497
1491
  const ctx = await prepareVitest(mode, {
1498
1492
  ...normalizeCliOptions(cliFilters, options),
1499
1493
  watch: false,
@@ -5,13 +5,13 @@ import p, { resolve as resolve$1 } from 'node:path';
5
5
  import { noop, isPrimitive, createDefer, highlight, toArray, deepMerge, nanoid, slash, deepClone, notNullish } from '@vitest/utils';
6
6
  import { f as findUp, p as prompt } from './index.DBIGubLC.js';
7
7
  import * as vite from 'vite';
8
- import { searchForWorkspaceRoot, version, mergeConfig, createServer } from 'vite';
8
+ import { searchForWorkspaceRoot, version, createServer, mergeConfig } from 'vite';
9
9
  import { A as API_PATH, c as configFiles, d as defaultBrowserPort, w as workspacesFiles, a as defaultPort } from './constants.BZZyIeIE.js';
10
10
  import { generateFileHash, createFileTask, limitConcurrency, hasFailed, getTasks, getTests } from '@vitest/runner/utils';
11
11
  import { SnapshotManager } from '@vitest/snapshot/manager';
12
12
  import { ViteNodeRunner } from 'vite-node/client';
13
13
  import { ViteNodeServer } from 'vite-node/server';
14
- import { v as version$1 } from './cac.BN2e7cE1.js';
14
+ import { v as version$1 } from './cac.KrMo52r1.js';
15
15
  import { c as createBirpc } from './index.CJ0plNrh.js';
16
16
  import { p as parse, s as stringify, g as printError, h as generateCodeFrame, b as BenchmarkReportsMap, R as ReportersMap, i as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.De2FqGmR.js';
17
17
  import require$$0$3 from 'events';
@@ -28,7 +28,7 @@ import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
28
28
  import { parseErrorStacktrace } from '@vitest/utils/source-map';
29
29
  import crypto from 'node:crypto';
30
30
  import { distDir, rootDir } from '../path.js';
31
- import { R as RandomSequencer, i as isPackageExists, h as hash, V as VitestCache, g as getFilePoolName, d as isBrowserEnabled, m as mm, r as resolveConfig, e as groupBy, f as getCoverageProvider, j as createPool, w as wildcardPatternToRegExp, a as resolveApiServerConfig, s as stdout } from './coverage.87S59-Sl.js';
31
+ import { R as RandomSequencer, i as isPackageExists, h as hash, V as VitestCache, g as getFilePoolName, d as isBrowserEnabled, m as mm, r as resolveConfig, e as groupBy, f as getCoverageProvider, j as createPool, w as wildcardPatternToRegExp, a as resolveApiServerConfig, s as stdout } from './coverage.D6LCUsnS.js';
32
32
  import { c as convertTasksToEvents } from './typechecker.DYQbn8uK.js';
33
33
  import { Console } from 'node:console';
34
34
  import c from 'tinyrainbow';
@@ -6728,21 +6728,20 @@ function WorkspaceVitestPlugin(project, options) {
6728
6728
  environments: { ssr: { resolve: resolveOptions } },
6729
6729
  test: { name }
6730
6730
  };
6731
- if (project.vitest._options.browser && viteConfig.test?.browser) {
6732
- viteConfig.test.browser = mergeConfig(viteConfig.test.browser, project.vitest._options.browser);
6733
- }
6734
6731
  config.test.defines = defines;
6732
+ const isUserBrowserEnabled = viteConfig.test?.browser?.enabled;
6733
+ const isBrowserEnabled = isUserBrowserEnabled ?? (viteConfig.test?.browser && project.vitest._cliOptions.browser?.enabled);
6735
6734
  const workspaceNames = [name];
6736
- if (viteConfig.test?.browser?.enabled) {
6737
- if (viteConfig.test.browser.name && !viteConfig.test.browser.instances?.length) {
6738
- const browser = viteConfig.test.browser.name;
6739
- workspaceNames.push(name ? `${name} (${browser})` : browser);
6740
- }
6741
- viteConfig.test.browser.instances?.forEach((instance) => {
6742
- instance.name ??= name ? `${name} (${instance.browser})` : instance.browser;
6743
- workspaceNames.push(instance.name);
6744
- });
6735
+ const browser = viteConfig.test.browser || {};
6736
+ if (isBrowserEnabled && browser.name && !browser.instances?.length) {
6737
+ workspaceNames.push(name ? `${name} (${browser.name})` : browser.name);
6745
6738
  }
6739
+ viteConfig.test?.browser?.instances?.forEach((instance) => {
6740
+ instance.name ??= name ? `${name} (${instance.browser})` : instance.browser;
6741
+ if (isBrowserEnabled) {
6742
+ workspaceNames.push(instance.name);
6743
+ }
6744
+ });
6746
6745
  const filters = project.vitest.config.project;
6747
6746
  if (filters.length) {
6748
6747
  const hasProject = workspaceNames.some((name) => {
@@ -8760,7 +8759,7 @@ class Vitest {
8760
8759
  resolvedProjects = [];
8761
8760
  /** @internal */ _browserLastPort = defaultBrowserPort;
8762
8761
  /** @internal */ _browserSessions = new BrowserSessions();
8763
- /** @internal */ _options = {};
8762
+ /** @internal */ _cliOptions = {};
8764
8763
  /** @internal */ reporters = [];
8765
8764
  /** @internal */ vitenode = undefined;
8766
8765
  /** @internal */ runner = undefined;
@@ -8776,8 +8775,9 @@ class Vitest {
8776
8775
  _cache;
8777
8776
  _snapshot;
8778
8777
  _workspaceConfigPath;
8779
- constructor(mode, options = {}) {
8778
+ constructor(mode, cliOptions, options = {}) {
8780
8779
  this.mode = mode;
8780
+ this._cliOptions = cliOptions;
8781
8781
  this.logger = new Logger(this, options.stdout, options.stderr);
8782
8782
  this.packageInstaller = options.packageInstaller || new VitestPackageInstaller();
8783
8783
  this.specifications = new VitestSpecifications(this);
@@ -8838,12 +8838,11 @@ class Vitest {
8838
8838
  return this._cache;
8839
8839
  }
8840
8840
  /** @deprecated internal */
8841
- setServer(options, server, cliOptions) {
8842
- return this._setServer(options, server, cliOptions);
8841
+ setServer(options, server) {
8842
+ return this._setServer(options, server);
8843
8843
  }
8844
8844
  /** @internal */
8845
- async _setServer(options, server, cliOptions) {
8846
- this._options = options;
8845
+ async _setServer(options, server) {
8847
8846
  this.watcher.unregisterWatcher();
8848
8847
  clearTimeout(this._rerunTimer);
8849
8848
  this.restartsCount += 1;
@@ -8904,7 +8903,7 @@ class Vitest {
8904
8903
  try {
8905
8904
  await this.cache.results.readFromCache();
8906
8905
  } catch {}
8907
- const projects = await this.resolveWorkspace(cliOptions);
8906
+ const projects = await this.resolveWorkspace(this._cliOptions);
8908
8907
  this.resolvedProjects = projects;
8909
8908
  this.projects = projects;
8910
8909
  await Promise.all(projects.flatMap((project) => {
@@ -8915,7 +8914,7 @@ class Vitest {
8915
8914
  injectTestProjects: this.injectTestProject
8916
8915
  }));
8917
8916
  }));
8918
- if (options.browser?.enabled) {
8917
+ if (this._cliOptions.browser?.enabled) {
8919
8918
  const browserProjects = this.projects.filter((p) => p.config.browser.enabled);
8920
8919
  if (!browserProjects.length) {
8921
8920
  throw new Error(`Vitest received --browser flag, but no project had a browser configuration.`);
@@ -8945,7 +8944,7 @@ class Vitest {
8945
8944
  */
8946
8945
  injectTestProject = async (config) => {
8947
8946
  const currentNames = new Set(this.projects.map((p) => p.name));
8948
- const workspace = await resolveWorkspace(this, this._options, undefined, Array.isArray(config) ? config : [config], currentNames);
8947
+ const workspace = await resolveWorkspace(this, this._cliOptions, undefined, Array.isArray(config) ? config : [config], currentNames);
8949
8948
  this.projects.push(...workspace);
8950
8949
  return workspace;
8951
8950
  };
@@ -9687,7 +9686,7 @@ class Vitest {
9687
9686
  * Check if the project with a given name should be included.
9688
9687
  */
9689
9688
  matchesProjectFilter(name) {
9690
- const projects = this._config?.project || this._options?.project;
9689
+ const projects = this._config?.project || this._cliOptions?.project;
9691
9690
  if (!projects || !projects.length) {
9692
9691
  return true;
9693
9692
  }
@@ -9703,11 +9702,11 @@ function assert(condition, property, name = property) {
9703
9702
  }
9704
9703
  }
9705
9704
 
9706
- async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
9705
+ async function VitestPlugin(options = {}, vitest = new Vitest("test", deepClone(options))) {
9707
9706
  const userConfig = deepMerge({}, options);
9708
9707
  async function UIPlugin() {
9709
- await ctx.packageInstaller.ensureInstalled("@vitest/ui", options.root || process.cwd(), ctx.version);
9710
- return (await import('@vitest/ui')).default(ctx);
9708
+ await vitest.packageInstaller.ensureInstalled("@vitest/ui", options.root || process.cwd(), vitest.version);
9709
+ return (await import('@vitest/ui')).default(vitest);
9711
9710
  }
9712
9711
  return [
9713
9712
  {
@@ -9763,10 +9762,10 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
9763
9762
  deps: testConfig.deps ?? viteConfig.test?.deps
9764
9763
  }
9765
9764
  };
9766
- if (ctx.configOverride.project) {
9767
- options.project = ctx.configOverride.project;
9765
+ if (vitest.configOverride.project) {
9766
+ options.project = vitest.configOverride.project;
9768
9767
  }
9769
- config.customLogger = createViteLogger(ctx.logger, viteConfig.logLevel || "warn", { allowClearScreen: false });
9768
+ config.customLogger = createViteLogger(vitest.logger, viteConfig.logLevel || "warn", { allowClearScreen: false });
9770
9769
  config.customLogger = silenceImportViteIgnoreWarning(config.customLogger);
9771
9770
  if (viteConfig.ssr?.noExternal !== true) {
9772
9771
  const inline = testConfig.server?.deps?.inline;
@@ -9792,7 +9791,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
9792
9791
  config.css.modules ??= {};
9793
9792
  if (config.css.modules) {
9794
9793
  config.css.modules.generateScopedName = (name, filename) => {
9795
- const root = ctx.config.root || options.root || process.cwd();
9794
+ const root = vitest.config.root || options.root || process.cwd();
9796
9795
  return generateScopedClassName(classNameStrategy, name, relative(root, filename));
9797
9796
  };
9798
9797
  }
@@ -9824,7 +9823,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
9824
9823
  configurable: true
9825
9824
  });
9826
9825
  const originalName = options.name;
9827
- if (options.browser?.enabled && options.browser?.instances) {
9826
+ if (options.browser?.instances) {
9828
9827
  options.browser.instances.forEach((instance) => {
9829
9828
  instance.name ??= originalName ? `${originalName} (${instance.browser})` : instance.browser;
9830
9829
  });
@@ -9838,9 +9837,9 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
9838
9837
  console.log("[debug] watcher is ready");
9839
9838
  });
9840
9839
  }
9841
- await ctx._setServer(options, server, userConfig);
9840
+ await vitest._setServer(options, server);
9842
9841
  if (options.api && options.watch) {
9843
- (await Promise.resolve().then(function () { return setup$1; })).setup(ctx);
9842
+ (await Promise.resolve().then(function () { return setup$1; })).setup(vitest);
9844
9843
  }
9845
9844
  if (!options.watch) {
9846
9845
  await server.watcher.close();
@@ -9849,9 +9848,9 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
9849
9848
  }
9850
9849
  },
9851
9850
  SsrReplacerPlugin(),
9852
- ...CSSEnablerPlugin(ctx),
9853
- CoverageTransform(ctx),
9854
- VitestCoreResolver(ctx),
9851
+ ...CSSEnablerPlugin(vitest),
9852
+ CoverageTransform(vitest),
9853
+ VitestCoreResolver(vitest),
9855
9854
  options.ui ? await UIPlugin() : null,
9856
9855
  ...MocksPlugins(),
9857
9856
  VitestOptimizer(),
@@ -9868,15 +9867,16 @@ function removeUndefinedValues(obj) {
9868
9867
  }
9869
9868
 
9870
9869
  async function createVitest(mode, options, viteOverrides = {}, vitestOptions = {}) {
9871
- const ctx = new Vitest(mode, vitestOptions);
9870
+ const ctx = new Vitest(mode, deepClone(options), vitestOptions);
9872
9871
  const root = slash(resolve$1(options.root || process.cwd()));
9873
9872
  const configPath = options.config === false ? false : options.config ? resolve$1(root, options.config) : await findUp(configFiles, { cwd: root });
9874
9873
  options.config = configPath;
9874
+ const { browser: _removeBrowser,...restOptions } = options;
9875
9875
  const config = {
9876
9876
  configFile: configPath,
9877
9877
  configLoader: options.configLoader,
9878
9878
  mode: options.mode || mode,
9879
- plugins: await VitestPlugin(options, ctx)
9879
+ plugins: await VitestPlugin(restOptions, ctx)
9880
9880
  };
9881
9881
  const server = await createViteServer(mergeConfig(config, mergeConfig(viteOverrides, { root: options.root })));
9882
9882
  if (ctx.config.api?.port) {
@@ -15,12 +15,12 @@ import { fileURLToPath as fileURLToPath$1, pathToFileURL as pathToFileURL$1, URL
15
15
  import assert from 'node:assert';
16
16
  import v8 from 'node:v8';
17
17
  import { format, inspect } from 'node:util';
18
+ import { version, mergeConfig } from 'vite';
18
19
  import { e as extraInlineDeps, d as defaultBrowserPort, b as defaultInspectPort, a as defaultPort } from './constants.BZZyIeIE.js';
19
20
  import { a as isWindows } from './env.Dq0hM4Xv.js';
20
21
  import * as nodeos from 'node:os';
21
22
  import nodeos__default from 'node:os';
22
23
  import { isatty } from 'node:tty';
23
- import { version } from 'vite';
24
24
  import EventEmitter from 'node:events';
25
25
  import { c as createBirpc } from './index.CJ0plNrh.js';
26
26
  import Tinypool$1, { Tinypool } from 'tinypool';
@@ -7913,7 +7913,6 @@ function resolveConfig$1(vitest, options, viteConfig) {
7913
7913
  if (resolved.minWorkers) {
7914
7914
  resolved.minWorkers = resolveInlineWorkerOption(resolved.minWorkers);
7915
7915
  }
7916
- resolved.browser ??= {};
7917
7916
  resolved.fileParallelism ??= mode !== "benchmark";
7918
7917
  if (!resolved.fileParallelism) {
7919
7918
  resolved.maxWorkers = 1;
@@ -7931,8 +7930,12 @@ function resolveConfig$1(vitest, options, viteConfig) {
7931
7930
  throw new Error(`You cannot use ${inspectOption} without "--no-file-parallelism", "poolOptions.threads.singleThread" or "poolOptions.forks.singleFork"`);
7932
7931
  }
7933
7932
  }
7933
+ if (vitest._cliOptions.browser && resolved.browser && (resolved.browser.enabled !== false || vitest._cliOptions.browser.enabled)) {
7934
+ resolved.browser = mergeConfig(resolved.browser, vitest._cliOptions.browser);
7935
+ }
7936
+ resolved.browser ??= {};
7934
7937
  const browser = resolved.browser;
7935
- if (browser.enabled && viteConfig.test?.browser) {
7938
+ if (browser.enabled) {
7936
7939
  if (!browser.name && !browser.instances) {
7937
7940
  throw new Error(`Vitest Browser Mode requires "browser.name" (deprecated) or "browser.instances" options, none were set.`);
7938
7941
  }
@@ -8276,7 +8279,6 @@ function resolveConfig$1(vitest, options, viteConfig) {
8276
8279
  if (resolved.typecheck.enabled) {
8277
8280
  logger.console.warn(c.yellow("Testing types with tsc and vue-tsc is an experimental feature.\nBreaking changes might not follow SemVer, please pin Vitest's version when using it."));
8278
8281
  }
8279
- resolved.browser ??= {};
8280
8282
  resolved.browser.enabled ??= false;
8281
8283
  resolved.browser.headless ??= isCI;
8282
8284
  resolved.browser.isolate ??= true;
@@ -2822,7 +2822,7 @@ declare class Vitest {
2822
2822
  private _cache?;
2823
2823
  private _snapshot?;
2824
2824
  private _workspaceConfigPath?;
2825
- constructor(mode: VitestRunMode, options?: VitestOptions);
2825
+ constructor(mode: VitestRunMode, cliOptions: UserConfig, options?: VitestOptions);
2826
2826
  private _onRestartListeners;
2827
2827
  private _onClose;
2828
2828
  private _onSetServer;
@@ -2857,7 +2857,7 @@ declare class Vitest {
2857
2857
  */
2858
2858
  get cache(): VitestCache;
2859
2859
  /** @deprecated internal */
2860
- setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
2860
+ setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
2861
2861
  /**
2862
2862
  * Inject new test projects into the workspace.
2863
2863
  * @param config Glob, config path or a custom config options.
@@ -1,5 +1,5 @@
1
1
  import { HookHandler } from 'vite';
2
- import { V as Vitest, T as TestProject, b as TestProjectConfiguration, I as InlineConfig } from './reporters.d.DG9VKi4m.js';
2
+ import { V as Vitest, T as TestProject, b as TestProjectConfiguration, I as InlineConfig } from './reporters.d.C-cu31ET.js';
3
3
 
4
4
  interface VitestPluginContext {
5
5
  vitest: Vitest;
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createCLI } from './chunks/cac.BN2e7cE1.js';
1
+ import { c as createCLI } from './chunks/cac.KrMo52r1.js';
2
2
  import '@vitest/utils';
3
3
  import 'events';
4
4
  import 'pathe';
package/dist/config.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
3
- import { c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport, b as TestProjectConfiguration } from './chunks/reporters.d.DG9VKi4m.js';
4
- export { f as TestProjectInlineConfiguration, W as WorkspaceProjectConfiguration } from './chunks/reporters.d.DG9VKi4m.js';
5
- import './chunks/vite.d.D3ndlJcw.js';
3
+ import { c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport, b as TestProjectConfiguration } from './chunks/reporters.d.C-cu31ET.js';
4
+ export { f as TestProjectInlineConfiguration, W as WorkspaceProjectConfiguration } from './chunks/reporters.d.C-cu31ET.js';
5
+ import './chunks/vite.d.iXCEVtFP.js';
6
6
  import { F as FakeTimerInstallOpts } from './chunks/config.d.UqE-KR0o.js';
7
7
  import '@vitest/runner';
8
8
  import './chunks/environment.d.Dmw5ulng.js';
@@ -1,4 +1,4 @@
1
- import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.d.DG9VKi4m.js';
1
+ import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.d.C-cu31ET.js';
2
2
  import { TransformResult } from 'vite';
3
3
  import { A as AfterSuiteRunMeta } from './chunks/environment.d.Dmw5ulng.js';
4
4
  import '@vitest/runner';
package/dist/coverage.js CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BaseCoverageProvider } from './chunks/coverage.87S59-Sl.js';
1
+ export { B as BaseCoverageProvider } from './chunks/coverage.D6LCUsnS.js';
2
2
  import 'node:fs';
3
3
  import './chunks/_commonjsHelpers.BFTU3MAI.js';
4
4
  import 'util';
@@ -19,9 +19,9 @@ import 'node:url';
19
19
  import 'node:assert';
20
20
  import 'node:v8';
21
21
  import 'node:util';
22
+ import 'vite';
22
23
  import './chunks/constants.BZZyIeIE.js';
23
24
  import 'node:tty';
24
- import 'vite';
25
25
  import 'node:events';
26
26
  import './chunks/index.CJ0plNrh.js';
27
27
  import 'tinypool';
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { File as File$1, TaskResultPack as TaskResultPack$1, TaskEventPack, TaskPopulated, Suite as Suite$1, Test as Test$1, Custom as Custom$1, Task as Task$1, TaskBase as TaskBase$1, TaskResult as TaskResult$1, DoneCallback as DoneCallback$1, RuntimeContext as RuntimeContext$1, SuiteHooks as SuiteHooks$1, SequenceHooks as SequenceHooks$1, SequenceSetupFiles as SequenceSetupFiles$1 } from '@vitest/runner';
2
2
  export { CancelReason, ExtendedContext, HookCleanupCallback, HookListener, OnTestFailedHandler, OnTestFinishedHandler, RunMode, Custom as RunnerCustomCase, Task as RunnerTask, TaskBase as RunnerTaskBase, TaskEventPack as RunnerTaskEventPack, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SuiteAPI, SuiteCollector, SuiteFactory, TaskContext, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
3
- import { S as SerializedTestSpecification, g as CoverageProvider$1, a as ReportContext$1, h as CoverageProviderModule$1, i as CoverageReporter$1, j as CoverageProviderName, k as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, l as CoverageIstanbulOptions$1, c as CoverageV8Options$1, m as CustomProviderOptions$1, n as Reporter$1, V as Vitest$1, o as BrowserScript$1, p as BrowserConfigOptions$1, q as BuiltinEnvironment$1, r as VitestEnvironment$1, P as Pool$1, s as PoolOptions$1, t as CSSModuleScopeStrategy$1, A as ApiConfig$1, u as VitestRunMode$1, D as DepsOptimizationOptions$1, v as TransformModePatterns$1, I as InlineConfig$1, w as TypecheckConfig$1, x as UserConfig$1, y as ResolvedConfig$1, z as ProjectConfig$1, U as UserWorkspaceConfig$1, E as BenchmarkUserOptions$1 } from './chunks/reporters.d.DG9VKi4m.js';
4
- export { F as BrowserTesterOptions } from './chunks/reporters.d.DG9VKi4m.js';
3
+ import { S as SerializedTestSpecification, g as CoverageProvider$1, a as ReportContext$1, h as CoverageProviderModule$1, i as CoverageReporter$1, j as CoverageProviderName, k as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, l as CoverageIstanbulOptions$1, c as CoverageV8Options$1, m as CustomProviderOptions$1, n as Reporter$1, V as Vitest$1, o as BrowserScript$1, p as BrowserConfigOptions$1, q as BuiltinEnvironment$1, r as VitestEnvironment$1, P as Pool$1, s as PoolOptions$1, t as CSSModuleScopeStrategy$1, A as ApiConfig$1, u as VitestRunMode$1, D as DepsOptimizationOptions$1, v as TransformModePatterns$1, I as InlineConfig$1, w as TypecheckConfig$1, x as UserConfig$1, y as ResolvedConfig$1, z as ProjectConfig$1, U as UserWorkspaceConfig$1, E as BenchmarkUserOptions$1 } from './chunks/reporters.d.C-cu31ET.js';
4
+ export { F as BrowserTesterOptions } from './chunks/reporters.d.C-cu31ET.js';
5
5
  import { W as WorkerContext$1 } from './chunks/worker.d.C-KN07Ls.js';
6
6
  import { R as RawErrsMap$1, T as TscErrorInfo$1, C as CollectLineNumbers$1, a as CollectLines$1, b as RootAndTarget$1, c as Context$1 } from './chunks/global.d.CXRAxnWc.js';
7
7
  import { b as Awaitable$1, U as UserConsoleLog, M as ModuleGraphData, P as ProvidedContext, N as Nullable$1, c as Arrayable$1, d as ArgumentsType$1, e as MutableArray$1, C as Constructable$1, a as EnvironmentReturn$1, V as VmEnvironmentReturn$1, E as Environment$1, R as ResolvedTestEnvironment$1, J as JSDOMOptions$1, H as HappyDOMOptions$1, f as EnvironmentOptions$1 } from './chunks/environment.d.Dmw5ulng.js';
8
8
  export { A as AfterSuiteRunMeta, g as ModuleCache } from './chunks/environment.d.Dmw5ulng.js';
9
9
  import { a as BirpcReturn, b as WorkerRPC$1 } from './chunks/worker.d.CHGSOG0s.js';
10
10
  export { C as ContextRPC, d as ContextTestEnvironment, e as ResolveIdFunction, c as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.CHGSOG0s.js';
11
- import './chunks/vite.d.D3ndlJcw.js';
11
+ import './chunks/vite.d.iXCEVtFP.js';
12
12
  import { a as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.UqE-KR0o.js';
13
13
  export { b as RuntimeConfig, S as SerializedCoverageConfig } from './chunks/config.d.UqE-KR0o.js';
14
14
  import { ExpectStatic } from '@vitest/expect';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { y as ResolvedConfig, x as UserConfig, u as VitestRunMode, G as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, H as TestSequencer, J as TestSpecification, L as Logger, K as TestModule, M as ModuleDiagnostic } from './chunks/reporters.d.DG9VKi4m.js';
2
- export { B as BaseCoverageOptions, E as BenchmarkUserOptions, af as BrowserBuiltinProvider, ag as BrowserCommand, ah as BrowserCommandContext, p as BrowserConfigOptions, ai as BrowserInstanceOption, aj as BrowserModuleMocker, ak as BrowserOrchestrator, al as BrowserProvider, am as BrowserProviderInitializationOptions, an as BrowserProviderModule, ao as BrowserProviderOptions, o as BrowserScript, ap as BrowserServerState, aq as BrowserServerStateSession, q as BuiltinEnvironment, ar as CDPSession, t as CSSModuleScopeStrategy, l as CoverageIstanbulOptions, k as CoverageOptions, g as CoverageProvider, h as CoverageProviderModule, i as CoverageReporter, c as CoverageV8Options, m as CustomProviderOptions, D as DepsOptimizationOptions, $ as HTMLOptions, I as InlineConfig, a1 as JUnitOptions, a0 as JsonOptions, O as OnServerRestartHandler, N as OnTestsRerunHandler, as as ParentProjectBrowser, P as Pool, s as PoolOptions, X as ProcessPool, at as ProjectBrowser, z as ProjectConfig, a as ReportContext, az as ReportedHookContext, n as Reporter, aw as ResolveSnapshotPathHandler, ax as ResolveSnapshotPathHandlerContext, au as ResolvedBrowserOptions, R as ResolvedCoverageOptions, av as ResolvedProjectConfig, _ as SerializedTestProject, a2 as TaskOptions, a3 as TestCase, a4 as TestCollection, a5 as TestDiagnostic, a6 as TestModuleState, a7 as TestResult, a8 as TestResultFailed, a9 as TestResultPassed, aa as TestResultSkipped, aA as TestRunEndReason, ay as TestRunResult, ae as TestSequencerConstructor, ab as TestState, ac as TestSuite, ad as TestSuiteState, v as TransformModePatterns, w as TypecheckConfig, U as UserWorkspaceConfig, r as VitestEnvironment, Q as VitestPackageInstaller, Y as WorkspaceSpec, Z as getFilePoolName } from './chunks/reporters.d.DG9VKi4m.js';
1
+ import { y as ResolvedConfig, x as UserConfig, u as VitestRunMode, G as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, H as TestSequencer, J as TestSpecification, L as Logger, K as TestModule, M as ModuleDiagnostic } from './chunks/reporters.d.C-cu31ET.js';
2
+ export { B as BaseCoverageOptions, E as BenchmarkUserOptions, af as BrowserBuiltinProvider, ag as BrowserCommand, ah as BrowserCommandContext, p as BrowserConfigOptions, ai as BrowserInstanceOption, aj as BrowserModuleMocker, ak as BrowserOrchestrator, al as BrowserProvider, am as BrowserProviderInitializationOptions, an as BrowserProviderModule, ao as BrowserProviderOptions, o as BrowserScript, ap as BrowserServerState, aq as BrowserServerStateSession, q as BuiltinEnvironment, ar as CDPSession, t as CSSModuleScopeStrategy, l as CoverageIstanbulOptions, k as CoverageOptions, g as CoverageProvider, h as CoverageProviderModule, i as CoverageReporter, c as CoverageV8Options, m as CustomProviderOptions, D as DepsOptimizationOptions, $ as HTMLOptions, I as InlineConfig, a1 as JUnitOptions, a0 as JsonOptions, O as OnServerRestartHandler, N as OnTestsRerunHandler, as as ParentProjectBrowser, P as Pool, s as PoolOptions, X as ProcessPool, at as ProjectBrowser, z as ProjectConfig, a as ReportContext, az as ReportedHookContext, n as Reporter, aw as ResolveSnapshotPathHandler, ax as ResolveSnapshotPathHandlerContext, au as ResolvedBrowserOptions, R as ResolvedCoverageOptions, av as ResolvedProjectConfig, _ as SerializedTestProject, a2 as TaskOptions, a3 as TestCase, a4 as TestCollection, a5 as TestDiagnostic, a6 as TestModuleState, a7 as TestResult, a8 as TestResultFailed, a9 as TestResultPassed, aa as TestResultSkipped, aA as TestRunEndReason, ay as TestRunResult, ae as TestSequencerConstructor, ab as TestState, ac as TestSuite, ad as TestSuiteState, v as TransformModePatterns, w as TypecheckConfig, U as UserWorkspaceConfig, r as VitestEnvironment, Q as VitestPackageInstaller, Y as WorkspaceSpec, Z as getFilePoolName } from './chunks/reporters.d.C-cu31ET.js';
3
3
  import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as ResolvedConfig$1, LogLevel, LoggerOptions, Logger as Logger$1, createServer as createServer$1 } from 'vite';
4
4
  import * as vite from 'vite';
5
5
  export { vite as Vite };
@@ -8,7 +8,7 @@ import { IncomingMessage } from 'node:http';
8
8
  import { R as RuntimeRPC } from './chunks/worker.d.CHGSOG0s.js';
9
9
  export { T as TestExecutionType } from './chunks/worker.d.CHGSOG0s.js';
10
10
  import { Writable } from 'node:stream';
11
- export { V as VitestPluginContext } from './chunks/vite.d.D3ndlJcw.js';
11
+ export { V as VitestPluginContext } from './chunks/vite.d.iXCEVtFP.js';
12
12
  export { W as WorkerContext } from './chunks/worker.d.C-KN07Ls.js';
13
13
  export { C as TypeCheckCollectLineNumbers, a as TypeCheckCollectLines, c as TypeCheckContext, T as TypeCheckErrorInfo, R as TypeCheckRawErrorsMap, b as TypeCheckRootAndTarget } from './chunks/global.d.CXRAxnWc.js';
14
14
  import { Debugger } from 'debug';
@@ -96,7 +96,7 @@ declare class GitNotFoundError extends Error {
96
96
  /** @deprecated use `TestProject` instead */
97
97
  type GlobalSetupContext = TestProject;
98
98
 
99
- declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugin[]>;
99
+ declare function VitestPlugin(options?: UserConfig, vitest?: Vitest): Promise<Plugin[]>;
100
100
 
101
101
  declare function resolveConfig(options?: UserConfig, viteOverrides?: UserConfig$1): Promise<{
102
102
  vitestConfig: ResolvedConfig
package/dist/node.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { resolveConfig as resolveConfig$1, mergeConfig, createServer as createServer$1 } from 'vite';
2
2
  export { esbuildVersion, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
3
- import { V as Vitest, a as VitestPlugin, T as TestModule } from './chunks/cli-api.Bti1vevt.js';
4
- export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, e as createViteLogger, c as createVitest, i as isValidApiRequest, d as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.Bti1vevt.js';
5
- export { p as parseCLI } from './chunks/cac.BN2e7cE1.js';
6
- import { r as resolveConfig$2 } from './chunks/coverage.87S59-Sl.js';
7
- export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.87S59-Sl.js';
8
- import { slash } from '@vitest/utils';
3
+ import { V as Vitest, a as VitestPlugin, T as TestModule } from './chunks/cli-api.BzebkJv7.js';
4
+ export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, e as createViteLogger, c as createVitest, i as isValidApiRequest, d as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.BzebkJv7.js';
5
+ export { p as parseCLI } from './chunks/cac.KrMo52r1.js';
6
+ import { r as resolveConfig$2 } from './chunks/coverage.D6LCUsnS.js';
7
+ export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.D6LCUsnS.js';
8
+ import { slash, deepClone } from '@vitest/utils';
9
9
  import { f as findUp } from './chunks/index.DBIGubLC.js';
10
10
  import { resolve } from 'pathe';
11
11
  import { c as configFiles } from './chunks/constants.BZZyIeIE.js';
@@ -70,7 +70,7 @@ async function resolveConfig(options = {}, viteOverrides = {}) {
70
70
  const root = slash(resolve(options.root || process.cwd()));
71
71
  const configPath = options.config === false ? false : options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
72
72
  options.config = configPath;
73
- const vitest = new Vitest("test");
73
+ const vitest = new Vitest("test", deepClone(options));
74
74
  const config = await resolveConfig$1(mergeConfig({
75
75
  configFile: configPath,
76
76
  mode: options.mode || "test",
@@ -1,4 +1,4 @@
1
- export { aP as BaseReporter, aB as BasicReporter, aQ as BenchmarkBuiltinReporters, aC as BenchmarkReporter, aD as BenchmarkReportsMap, aR as BuiltinReporterOptions, aS as BuiltinReporters, aE as DefaultReporter, aF as DotReporter, aG as GithubActionsReporter, aH as HangingProcessReporter, aJ as JUnitReporter, aT as JsonAssertionResult, aI as JsonReporter, aU as JsonTestResult, aV as JsonTestResults, az as ReportedHookContext, n as Reporter, aK as ReportersMap, aL as TapFlatReporter, aM as TapReporter, aA as TestRunEndReason, aN as VerboseBenchmarkReporter, aO as VerboseReporter } from './chunks/reporters.d.DG9VKi4m.js';
1
+ export { aP as BaseReporter, aB as BasicReporter, aQ as BenchmarkBuiltinReporters, aC as BenchmarkReporter, aD as BenchmarkReportsMap, aR as BuiltinReporterOptions, aS as BuiltinReporters, aE as DefaultReporter, aF as DotReporter, aG as GithubActionsReporter, aH as HangingProcessReporter, aJ as JUnitReporter, aT as JsonAssertionResult, aI as JsonReporter, aU as JsonTestResult, aV as JsonTestResults, az as ReportedHookContext, n as Reporter, aK as ReportersMap, aL as TapFlatReporter, aM as TapReporter, aA as TestRunEndReason, aN as VerboseBenchmarkReporter, aO as VerboseReporter } from './chunks/reporters.d.C-cu31ET.js';
2
2
  import '@vitest/runner';
3
3
  import './chunks/environment.d.Dmw5ulng.js';
4
4
  import 'vitest/optional-types.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "3.1.3",
4
+ "version": "3.1.4",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -123,8 +123,8 @@
123
123
  "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
124
124
  "happy-dom": "*",
125
125
  "jsdom": "*",
126
- "@vitest/browser": "3.1.3",
127
- "@vitest/ui": "3.1.3"
126
+ "@vitest/browser": "3.1.4",
127
+ "@vitest/ui": "3.1.4"
128
128
  },
129
129
  "peerDependenciesMeta": {
130
130
  "@edge-runtime/vm": {
@@ -163,14 +163,14 @@
163
163
  "tinyrainbow": "^2.0.0",
164
164
  "vite": "^5.0.0 || ^6.0.0",
165
165
  "why-is-node-running": "^2.3.0",
166
- "@vitest/expect": "3.1.3",
167
- "@vitest/pretty-format": "^3.1.3",
168
- "@vitest/snapshot": "3.1.3",
169
- "@vitest/runner": "3.1.3",
170
- "@vitest/spy": "3.1.3",
171
- "@vitest/mocker": "3.1.3",
172
- "vite-node": "3.1.3",
173
- "@vitest/utils": "3.1.3"
166
+ "@vitest/expect": "3.1.4",
167
+ "@vitest/pretty-format": "^3.1.4",
168
+ "@vitest/runner": "3.1.4",
169
+ "@vitest/utils": "3.1.4",
170
+ "@vitest/snapshot": "3.1.4",
171
+ "@vitest/spy": "3.1.4",
172
+ "vite-node": "3.1.4",
173
+ "@vitest/mocker": "3.1.4"
174
174
  },
175
175
  "devDependencies": {
176
176
  "@ampproject/remapping": "^2.3.0",