vitest 3.2.1 → 3.2.3

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.
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
3
3
  import { normalize } from 'pathe';
4
4
  import c from 'tinyrainbow';
5
5
  import { a as defaultPort, d as defaultBrowserPort } from './constants.DnKduX2e.js';
6
- import { R as ReportersMap } from './index.BZ0g1JD2.js';
6
+ import { R as ReportersMap } from './index.CX5aIIXH.js';
7
7
 
8
8
  function toArr(any) {
9
9
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -619,7 +619,7 @@ class CAC extends EventEmitter {
619
619
 
620
620
  const cac = (name = "") => new CAC(name);
621
621
 
622
- var version = "3.2.1";
622
+ var version = "3.2.3";
623
623
 
624
624
  const apiConfig = (port) => ({
625
625
  port: {
@@ -1407,11 +1407,11 @@ async function start(mode, cliFilters, options) {
1407
1407
  process.title = "node (vitest)";
1408
1408
  } catch {}
1409
1409
  try {
1410
- const { startVitest } = await import('./cli-api.DmupRhea.js').then(function (n) { return n.f; });
1410
+ const { startVitest } = await import('./cli-api.C37Ou0i1.js').then(function (n) { return n.f; });
1411
1411
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
1412
1412
  if (!ctx.shouldKeepServer()) await ctx.exit();
1413
1413
  } catch (e) {
1414
- const { errorBanner } = await import('./index.BZ0g1JD2.js').then(function (n) { return n.u; });
1414
+ const { errorBanner } = await import('./index.CX5aIIXH.js').then(function (n) { return n.u; });
1415
1415
  console.error(`\n${errorBanner("Startup Error")}`);
1416
1416
  console.error(e);
1417
1417
  console.error("\n\n");
@@ -1432,7 +1432,7 @@ async function collect(mode, cliFilters, options) {
1432
1432
  process.title = "node (vitest)";
1433
1433
  } catch {}
1434
1434
  try {
1435
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.DmupRhea.js').then(function (n) { return n.f; });
1435
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.C37Ou0i1.js').then(function (n) { return n.f; });
1436
1436
  const ctx = await prepareVitest(mode, {
1437
1437
  ...normalizeCliOptions(cliFilters, options),
1438
1438
  watch: false,
@@ -1454,7 +1454,7 @@ async function collect(mode, cliFilters, options) {
1454
1454
  }
1455
1455
  await ctx.close();
1456
1456
  } catch (e) {
1457
- const { errorBanner } = await import('./index.BZ0g1JD2.js').then(function (n) { return n.u; });
1457
+ const { errorBanner } = await import('./index.CX5aIIXH.js').then(function (n) { return n.u; });
1458
1458
  console.error(`\n${errorBanner("Collect Error")}`);
1459
1459
  console.error(e);
1460
1460
  console.error("\n\n");
@@ -11,9 +11,9 @@ import { generateFileHash, limitConcurrency, createFileTask, hasFailed, getTasks
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.C8BzMmTW.js';
14
+ import { v as version$1 } from './cac.Cs_fZ7zn.js';
15
15
  import { c as createBirpc } from './index.CJ0plNrh.js';
16
- import { p as parse, s as stringify, d as printError, f as formatProjectName, w as withLabel, e as errorBanner, h as divider, i as generateCodeFrame, R as ReportersMap, j as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.BZ0g1JD2.js';
16
+ import { p as parse, s as stringify, d as printError, f as formatProjectName, w as withLabel, e as errorBanner, h as divider, i as generateCodeFrame, R as ReportersMap, j as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.CX5aIIXH.js';
17
17
  import require$$0$3 from 'events';
18
18
  import require$$1$1 from 'https';
19
19
  import require$$2 from 'http';
@@ -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, { createHash } from 'node:crypto';
30
30
  import { distDir, rootDir } from '../path.js';
31
- import { h as hash, R as RandomSequencer, i as isPackageExists, g as getFilePoolName, d as isBrowserEnabled, r as resolveConfig, e as groupBy, f as getCoverageProvider, j as createPool, w as wildcardPatternToRegExp, a as resolveApiServerConfig, s as stdout } from './coverage.EIiagJJP.js';
31
+ import { h as hash, R as RandomSequencer, i as isPackageExists, g as getFilePoolName, d as isBrowserEnabled, r as resolveConfig, e as groupBy, f as getCoverageProvider, j as createPool, w as wildcardPatternToRegExp, a as resolveApiServerConfig, s as stdout } from './coverage.D1a3dTnj.js';
32
32
  import { c as convertTasksToEvents } from './typechecker.DRKU1-1g.js';
33
33
  import { Console } from 'node:console';
34
34
  import c from 'tinyrainbow';
@@ -43,7 +43,7 @@ import { normalizeRequestId, cleanUrl } from 'vite-node/utils';
43
43
  import { hoistMocksPlugin, automockPlugin } from '@vitest/mocker/node';
44
44
  import { c as configDefaults } from './defaults.B7q_naMc.js';
45
45
  import MagicString from 'magic-string';
46
- import { a as BenchmarkReportsMap } from './index.CIyJn3t1.js';
46
+ import { a as BenchmarkReportsMap } from './index.CSxmp_dI.js';
47
47
  import assert$1 from 'node:assert';
48
48
  import { serializeError } from '@vitest/utils/error';
49
49
  import readline from 'node:readline';
@@ -5572,7 +5572,7 @@ class Logger {
5572
5572
  const output = project.isRootProject() ? "" : formatProjectName(project);
5573
5573
  const provider = project.browser.provider.name;
5574
5574
  const providerString = provider === "preview" ? "" : ` by ${c.reset(c.bold(provider))}`;
5575
- this.log(c.dim(`${output}Browser runner started${providerString} ${c.dim("at")} ${c.blue(new URL("/", origin))}\n`));
5575
+ this.log(c.dim(`${output}Browser runner started${providerString} ${c.dim("at")} ${c.blue(new URL("/__vitest_test__/", origin))}\n`));
5576
5576
  }
5577
5577
  printUnhandledErrors(errors) {
5578
5578
  const errorMessage = c.red(c.bold(`\nVitest caught ${errors.length} unhandled error${errors.length > 1 ? "s" : ""} during the test run.
@@ -6709,15 +6709,10 @@ function VitestCoreResolver(ctx) {
6709
6709
  function WorkspaceVitestPlugin(project, options) {
6710
6710
  return [
6711
6711
  {
6712
- name: "vitest:project",
6712
+ name: "vitest:project:name",
6713
6713
  enforce: "post",
6714
- options() {
6715
- this.meta.watchMode = false;
6716
- },
6717
6714
  config(viteConfig) {
6718
- const defines = deleteDefineConfig(viteConfig);
6719
6715
  const testConfig = viteConfig.test || {};
6720
- const root = testConfig.root || viteConfig.root || options.root;
6721
6716
  let { label: name, color } = typeof testConfig.name === "string" ? { label: testConfig.name } : {
6722
6717
  label: "",
6723
6718
  ...testConfig.name
@@ -6729,6 +6724,45 @@ function WorkspaceVitestPlugin(project, options) {
6729
6724
  if (existsSync(pkgJsonPath)) name = JSON.parse(readFileSync(pkgJsonPath, "utf-8")).name;
6730
6725
  if (typeof name !== "string" || !name) name = basename(dir);
6731
6726
  } else name = options.workspacePath.toString();
6727
+ const isUserBrowserEnabled = viteConfig.test?.browser?.enabled;
6728
+ const isBrowserEnabled = isUserBrowserEnabled ?? (viteConfig.test?.browser && project.vitest._cliOptions.browser?.enabled);
6729
+ // keep project names to potentially filter it out
6730
+ const workspaceNames = [name];
6731
+ const browser = viteConfig.test.browser || {};
6732
+ if (isBrowserEnabled && browser.name && !browser.instances?.length)
6733
+ // vitest injects `instances` in this case later on
6734
+ workspaceNames.push(name ? `${name} (${browser.name})` : browser.name);
6735
+ viteConfig.test?.browser?.instances?.forEach((instance) => {
6736
+ // every instance is a potential project
6737
+ instance.name ??= name ? `${name} (${instance.browser})` : instance.browser;
6738
+ if (isBrowserEnabled) workspaceNames.push(instance.name);
6739
+ });
6740
+ const filters = project.vitest.config.project;
6741
+ // if there is `--project=...` filter, check if any of the potential projects match
6742
+ // if projects don't match, we ignore the test project altogether
6743
+ // if some of them match, they will later be filtered again by `resolveWorkspace`
6744
+ if (filters.length) {
6745
+ const hasProject = workspaceNames.some((name) => {
6746
+ return project.vitest.matchesProjectFilter(name);
6747
+ });
6748
+ if (!hasProject) throw new VitestFilteredOutProjectError();
6749
+ }
6750
+ return { test: { name: {
6751
+ label: name,
6752
+ color
6753
+ } } };
6754
+ }
6755
+ },
6756
+ {
6757
+ name: "vitest:project",
6758
+ enforce: "pre",
6759
+ options() {
6760
+ this.meta.watchMode = false;
6761
+ },
6762
+ config(viteConfig) {
6763
+ const defines = deleteDefineConfig(viteConfig);
6764
+ const testConfig = viteConfig.test || {};
6765
+ const root = testConfig.root || viteConfig.root || options.root;
6732
6766
  const resolveOptions = getDefaultResolveOptions();
6733
6767
  const config = {
6734
6768
  root,
@@ -6752,35 +6786,9 @@ function WorkspaceVitestPlugin(project, options) {
6752
6786
  fs: { allow: resolveFsAllow(project.vitest.config.root, project.vitest.vite.config.configFile) }
6753
6787
  },
6754
6788
  environments: { ssr: { resolve: resolveOptions } },
6755
- test: { name: {
6756
- label: name,
6757
- color
6758
- } }
6789
+ test: {}
6759
6790
  };
6760
6791
  config.test.defines = defines;
6761
- const isUserBrowserEnabled = viteConfig.test?.browser?.enabled;
6762
- const isBrowserEnabled = isUserBrowserEnabled ?? (viteConfig.test?.browser && project.vitest._cliOptions.browser?.enabled);
6763
- // keep project names to potentially filter it out
6764
- const workspaceNames = [name];
6765
- const browser = viteConfig.test.browser || {};
6766
- if (isBrowserEnabled && browser.name && !browser.instances?.length)
6767
- // vitest injects `instances` in this case later on
6768
- workspaceNames.push(name ? `${name} (${browser.name})` : browser.name);
6769
- viteConfig.test?.browser?.instances?.forEach((instance) => {
6770
- // every instance is a potential project
6771
- instance.name ??= name ? `${name} (${instance.browser})` : instance.browser;
6772
- if (isBrowserEnabled) workspaceNames.push(instance.name);
6773
- });
6774
- const filters = project.vitest.config.project;
6775
- // if there is `--project=...` filter, check if any of the potential projects match
6776
- // if projects don't match, we ignore the test project altogether
6777
- // if some of them match, they will later be filtered again by `resolveWorkspace`
6778
- if (filters.length) {
6779
- const hasProject = workspaceNames.some((name) => {
6780
- return project.vitest.matchesProjectFilter(name);
6781
- });
6782
- if (!hasProject) throw new VitestFilteredOutProjectError();
6783
- }
6784
6792
  const classNameStrategy = typeof testConfig.css !== "boolean" && testConfig.css?.modules?.classNameStrategy || "stable";
6785
6793
  if (classNameStrategy !== "scoped") {
6786
6794
  config.css ??= {};
@@ -6793,7 +6801,11 @@ function WorkspaceVitestPlugin(project, options) {
6793
6801
  config.customLogger = createViteLogger(project.vitest.logger, viteConfig.logLevel || "warn", { allowClearScreen: false });
6794
6802
  config.customLogger = silenceImportViteIgnoreWarning(config.customLogger);
6795
6803
  return config;
6796
- },
6804
+ }
6805
+ },
6806
+ {
6807
+ name: "vitest:project:server",
6808
+ enforce: "post",
6797
6809
  async configureServer(server) {
6798
6810
  const options = deepMerge({}, configDefaults, server.config.test || {});
6799
6811
  await project._configureServer(options, server);
@@ -9053,6 +9065,21 @@ class VitestWatcher {
9053
9065
  if (needsRerun) this.scheduleRerun(id);
9054
9066
  }
9055
9067
  };
9068
+ handleSetupFile(filepath) {
9069
+ let isSetupFile = false;
9070
+ this.vitest.projects.forEach((project) => {
9071
+ if (!project.config.setupFiles.includes(filepath)) return;
9072
+ this.vitest.state.filesMap.forEach((files) => {
9073
+ files.forEach((file) => {
9074
+ if (file.projectName === project.name) {
9075
+ isSetupFile = true;
9076
+ this.changedTests.add(file.filepath);
9077
+ }
9078
+ });
9079
+ });
9080
+ });
9081
+ return isSetupFile;
9082
+ }
9056
9083
  /**
9057
9084
  * @returns A value indicating whether rerun is needed (changedTests was mutated)
9058
9085
  */
@@ -9062,6 +9089,7 @@ class VitestWatcher {
9062
9089
  this.vitest.state.getFilepaths().forEach((file) => this.changedTests.add(file));
9063
9090
  return true;
9064
9091
  }
9092
+ if (this.handleSetupFile(filepath)) return true;
9065
9093
  const projects = this.vitest.projects.filter((project) => {
9066
9094
  const moduleGraph = project.browser?.vite.moduleGraph || project.vite.moduleGraph;
9067
9095
  return moduleGraph.getModulesByFile(filepath)?.size;
@@ -2178,47 +2178,52 @@ function unwrapYield(value, isAsync) {
2178
2178
  throw new QuansyncError();
2179
2179
  return value;
2180
2180
  }
2181
- function iterateSync(generator) {
2181
+ const DEFAULT_ON_YIELD = (value) => value;
2182
+ function iterateSync(generator, onYield = DEFAULT_ON_YIELD) {
2182
2183
  let current = generator.next();
2183
2184
  while (!current.done) {
2184
2185
  try {
2185
- current = generator.next(unwrapYield(current.value));
2186
+ current = generator.next(unwrapYield(onYield(current.value, false)));
2186
2187
  } catch (err) {
2187
2188
  current = generator.throw(err);
2188
2189
  }
2189
2190
  }
2190
2191
  return unwrapYield(current.value);
2191
2192
  }
2192
- async function iterateAsync(generator) {
2193
+ async function iterateAsync(generator, onYield = DEFAULT_ON_YIELD) {
2193
2194
  let current = generator.next();
2194
2195
  while (!current.done) {
2195
2196
  try {
2196
- current = generator.next(await unwrapYield(current.value, true));
2197
+ current = generator.next(await unwrapYield(onYield(current.value, true), true));
2197
2198
  } catch (err) {
2198
2199
  current = generator.throw(err);
2199
2200
  }
2200
2201
  }
2201
2202
  return current.value;
2202
2203
  }
2203
- function fromGeneratorFn(generatorFn) {
2204
+ function fromGeneratorFn(generatorFn, options) {
2204
2205
  return fromObject({
2205
2206
  name: generatorFn.name,
2206
2207
  async(...args) {
2207
- return iterateAsync(generatorFn.apply(this, args));
2208
+ return iterateAsync(generatorFn.apply(this, args), options?.onYield);
2208
2209
  },
2209
2210
  sync(...args) {
2210
- return iterateSync(generatorFn.apply(this, args));
2211
+ return iterateSync(generatorFn.apply(this, args), options?.onYield);
2211
2212
  }
2212
2213
  });
2213
2214
  }
2214
- function quansync$1(options) {
2215
- if (isThenable(options))
2216
- return fromPromise(options);
2217
- if (typeof options === "function")
2218
- return fromGeneratorFn(options);
2215
+ function quansync$1(input, options) {
2216
+ if (isThenable(input))
2217
+ return fromPromise(input);
2218
+ if (typeof input === "function")
2219
+ return fromGeneratorFn(input, options);
2219
2220
  else
2220
- return fromObject(options);
2221
+ return fromObject(input);
2221
2222
  }
2223
+ quansync$1({
2224
+ async: () => Promise.resolve(true),
2225
+ sync: () => false
2226
+ });
2222
2227
 
2223
2228
  const quansync = quansync$1;
2224
2229
 
@@ -2576,7 +2581,17 @@ function createChildProcessChannel$1(project, collect = false) {
2576
2581
  }), {
2577
2582
  eventNames: ["onCancel"],
2578
2583
  serialize: v8.serialize,
2579
- deserialize: (v) => v8.deserialize(Buffer.from(v)),
2584
+ deserialize: (v) => {
2585
+ try {
2586
+ return v8.deserialize(Buffer.from(v));
2587
+ } catch (error) {
2588
+ let stringified = "";
2589
+ try {
2590
+ stringified = `\nReceived value: ${JSON.stringify(v)}`;
2591
+ } catch {}
2592
+ throw new Error(`[vitest-pool]: Unexpected call to process.send(). Make sure your test cases are not interfering with process's channel.${stringified}`, { cause: error });
2593
+ }
2594
+ },
2580
2595
  post(v) {
2581
2596
  emitter.emit(events.message, v);
2582
2597
  },
@@ -3027,7 +3042,17 @@ function createChildProcessChannel(project, collect) {
3027
3042
  }), {
3028
3043
  eventNames: ["onCancel"],
3029
3044
  serialize: v8.serialize,
3030
- deserialize: (v) => v8.deserialize(Buffer.from(v)),
3045
+ deserialize: (v) => {
3046
+ try {
3047
+ return v8.deserialize(Buffer.from(v));
3048
+ } catch (error) {
3049
+ let stringified = "";
3050
+ try {
3051
+ stringified = `\nReceived value: ${JSON.stringify(v)}`;
3052
+ } catch {}
3053
+ throw new Error(`[vitest-pool]: Unexpected call to process.send(). Make sure your test cases are not interfering with process's channel.${stringified}`, { cause: error });
3054
+ }
3055
+ },
3031
3056
  post(v) {
3032
3057
  emitter.emit(events.message, v);
3033
3058
  },
@@ -2,7 +2,7 @@ import fs from 'node:fs';
2
2
  import { getTasks, getFullName, getTests } from '@vitest/runner/utils';
3
3
  import * as pathe from 'pathe';
4
4
  import c from 'tinyrainbow';
5
- import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName } from './index.BZ0g1JD2.js';
5
+ import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName } from './index.CX5aIIXH.js';
6
6
  import { stripVTControlCharacters } from 'node:util';
7
7
  import { notNullish } from '@vitest/utils';
8
8
 
@@ -1195,9 +1195,8 @@ class DotReporter extends BaseReporter {
1195
1195
  this.ctx.onClose(() => this.renderer?.stop());
1196
1196
  }
1197
1197
  }
1198
- printTestModule(testModule) {
1199
- if (!this.isTTY) super.printTestModule(testModule);
1200
- }
1198
+ // Ignore default logging of base reporter
1199
+ printTestModule() {}
1201
1200
  onWatcherRerun(files, trigger) {
1202
1201
  this.tests.clear();
1203
1202
  this.renderer?.start();
@@ -1207,7 +1206,7 @@ class DotReporter extends BaseReporter {
1207
1206
  if (this.isTTY) {
1208
1207
  const finalLog = formatTests(Array.from(this.tests.values()));
1209
1208
  this.ctx.logger.log(finalLog);
1210
- }
1209
+ } else this.ctx.logger.log();
1211
1210
  this.tests.clear();
1212
1211
  this.renderer?.finish();
1213
1212
  super.onFinished(files, errors);
@@ -1223,9 +1222,12 @@ class DotReporter extends BaseReporter {
1223
1222
  this.renderer?.schedule();
1224
1223
  }
1225
1224
  onTestCaseResult(test) {
1225
+ const result = test.result().state;
1226
+ // On non-TTY the finished tests are printed immediately
1227
+ if (!this.isTTY && result !== "pending") this.ctx.logger.outputStream.write(formatTests([result]));
1226
1228
  super.onTestCaseResult(test);
1227
1229
  this.finishedTests.add(test.id);
1228
- this.tests.set(test.id, test.result().state || "skipped");
1230
+ this.tests.set(test.id, result || "skipped");
1229
1231
  this.renderer?.schedule();
1230
1232
  }
1231
1233
  onTestModuleEnd(testModule) {
@@ -951,7 +951,8 @@ declare class DotReporter extends BaseReporter {
951
951
  private tests;
952
952
  private finishedTests;
953
953
  onInit(ctx: Vitest): void;
954
- printTestModule(testModule: TestModule): void;
954
+ // Ignore default logging of base reporter
955
+ printTestModule(): void;
955
956
  onWatcherRerun(files: string[], trigger?: string): void;
956
957
  onFinished(files?: File[], errors?: unknown[]): void;
957
958
  onTestModuleCollected(module: TestModule): void;
@@ -1071,6 +1072,7 @@ interface BrowserTesterOptions {
1071
1072
  method: TestExecutionMethod;
1072
1073
  files: string[];
1073
1074
  providedContext: string;
1075
+ startTime: number;
1074
1076
  }
1075
1077
 
1076
1078
  type ChaiConfig = Omit<Partial<typeof chai.config>, "useProxy" | "proxyExcludedKeys">;
@@ -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.C1ogPriE.js';
2
+ import { V as Vitest, T as TestProject, b as TestProjectConfiguration, I as InlineConfig } from './reporters.d.DL9pg5DB.js';
3
3
 
4
4
  interface VitestPluginContext {
5
5
  vitest: Vitest;
package/dist/cli.js CHANGED
@@ -1,10 +1,10 @@
1
- import { c as createCLI } from './chunks/cac.C8BzMmTW.js';
1
+ import { c as createCLI } from './chunks/cac.Cs_fZ7zn.js';
2
2
  import '@vitest/utils';
3
3
  import 'events';
4
4
  import 'pathe';
5
5
  import 'tinyrainbow';
6
6
  import './chunks/constants.DnKduX2e.js';
7
- import './chunks/index.BZ0g1JD2.js';
7
+ import './chunks/index.CX5aIIXH.js';
8
8
  import 'node:perf_hooks';
9
9
  import '@vitest/runner/utils';
10
10
  import '@vitest/utils/source-map';
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.C1ogPriE.js';
4
- export { f as TestProjectInlineConfiguration, g as WatcherTriggerPattern, W as WorkspaceProjectConfiguration } from './chunks/reporters.d.C1ogPriE.js';
5
- import './chunks/vite.d.DqE4-hhK.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.DL9pg5DB.js';
4
+ export { f as TestProjectInlineConfiguration, g as WatcherTriggerPattern, W as WorkspaceProjectConfiguration } from './chunks/reporters.d.DL9pg5DB.js';
5
+ import './chunks/vite.d.CtvOcEqC.js';
6
6
  import { F as FakeTimerInstallOpts } from './chunks/config.d.D2ROskhv.js';
7
7
  import '@vitest/runner';
8
8
  import './chunks/environment.d.cL3nLXbE.js';
@@ -1,4 +1,4 @@
1
- import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.d.C1ogPriE.js';
1
+ import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.d.DL9pg5DB.js';
2
2
  import { TransformResult } from 'vite';
3
3
  import { A as AfterSuiteRunMeta } from './chunks/environment.d.cL3nLXbE.js';
4
4
  import '@vitest/runner';
package/dist/coverage.js CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BaseCoverageProvider } from './chunks/coverage.EIiagJJP.js';
1
+ export { B as BaseCoverageProvider } from './chunks/coverage.D1a3dTnj.js';
2
2
  import 'node:fs';
3
3
  import 'pathe';
4
4
  import 'picomatch';
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { File as File$1, TestAnnotation, 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, ImportDuration, 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, TestAnnotation, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
3
- import { S as SerializedTestSpecification, h as CoverageProvider$1, a as ReportContext$1, i as CoverageProviderModule$1, j as CoverageReporter$1, k as CoverageProviderName, l as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, m as CoverageIstanbulOptions$1, c as CoverageV8Options$1, n as CustomProviderOptions$1, o as Reporter$1, V as Vitest$1, p as BrowserScript$1, q as BrowserConfigOptions$1, r as BuiltinEnvironment$1, s as VitestEnvironment$1, P as Pool$1, t as PoolOptions$1, u as CSSModuleScopeStrategy$1, A as ApiConfig$1, v as VitestRunMode$1, D as DepsOptimizationOptions$1, w as TransformModePatterns$1, I as InlineConfig$1, x as TypecheckConfig$1, y as UserConfig$1, z as ResolvedConfig$1, E as ProjectConfig$1, U as UserWorkspaceConfig$1, F as BenchmarkUserOptions$1 } from './chunks/reporters.d.C1ogPriE.js';
4
- export { G as BrowserTesterOptions } from './chunks/reporters.d.C1ogPriE.js';
3
+ import { S as SerializedTestSpecification, h as CoverageProvider$1, a as ReportContext$1, i as CoverageProviderModule$1, j as CoverageReporter$1, k as CoverageProviderName, l as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, m as CoverageIstanbulOptions$1, c as CoverageV8Options$1, n as CustomProviderOptions$1, o as Reporter$1, V as Vitest$1, p as BrowserScript$1, q as BrowserConfigOptions$1, r as BuiltinEnvironment$1, s as VitestEnvironment$1, P as Pool$1, t as PoolOptions$1, u as CSSModuleScopeStrategy$1, A as ApiConfig$1, v as VitestRunMode$1, D as DepsOptimizationOptions$1, w as TransformModePatterns$1, I as InlineConfig$1, x as TypecheckConfig$1, y as UserConfig$1, z as ResolvedConfig$1, E as ProjectConfig$1, U as UserWorkspaceConfig$1, F as BenchmarkUserOptions$1 } from './chunks/reporters.d.DL9pg5DB.js';
4
+ export { G as BrowserTesterOptions } from './chunks/reporters.d.DL9pg5DB.js';
5
5
  import { W as WorkerContext$1 } from './chunks/worker.d.DvqK5Vmu.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.MAmajcmJ.js';
7
7
  import { b as Awaitable$1, U as UserConsoleLog, L as LabelColor, 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.cL3nLXbE.js';
8
8
  export { A as AfterSuiteRunMeta, g as ModuleCache } from './chunks/environment.d.cL3nLXbE.js';
9
9
  import { a as BirpcReturn, b as WorkerRPC$1 } from './chunks/worker.d.tQu2eJQy.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.tQu2eJQy.js';
11
- import './chunks/vite.d.DqE4-hhK.js';
11
+ import './chunks/vite.d.CtvOcEqC.js';
12
12
  import { a as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.D2ROskhv.js';
13
13
  export { b as RuntimeConfig, S as SerializedCoverageConfig } from './chunks/config.d.D2ROskhv.js';
14
14
  import { ExpectStatic } from '@vitest/expect';
package/dist/node.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { z as ResolvedConfig, y as UserConfig, v as VitestRunMode, H as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, J as TestSequencer, K as TestSpecification, L as Logger, M as TestModule, N as ModuleDiagnostic } from './chunks/reporters.d.C1ogPriE.js';
2
- export { B as BaseCoverageOptions, F as BenchmarkUserOptions, ag as BrowserBuiltinProvider, ah as BrowserCommand, ai as BrowserCommandContext, q as BrowserConfigOptions, aj as BrowserInstanceOption, ak as BrowserModuleMocker, al as BrowserOrchestrator, am as BrowserProvider, an as BrowserProviderInitializationOptions, ao as BrowserProviderModule, ap as BrowserProviderOptions, p as BrowserScript, aq as BrowserServerState, ar as BrowserServerStateSession, r as BuiltinEnvironment, as as CDPSession, u as CSSModuleScopeStrategy, m as CoverageIstanbulOptions, l as CoverageOptions, h as CoverageProvider, i as CoverageProviderModule, j as CoverageReporter, c as CoverageV8Options, n as CustomProviderOptions, D as DepsOptimizationOptions, a0 as HTMLOptions, I as InlineConfig, a2 as JUnitOptions, a1 as JsonOptions, O as OnServerRestartHandler, Q as OnTestsRerunHandler, at as ParentProjectBrowser, P as Pool, t as PoolOptions, Y as ProcessPool, au as ProjectBrowser, E as ProjectConfig, a as ReportContext, aA as ReportedHookContext, o as Reporter, ax as ResolveSnapshotPathHandler, ay as ResolveSnapshotPathHandlerContext, av as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aw as ResolvedProjectConfig, $ as SerializedTestProject, a3 as TaskOptions, a4 as TestCase, a5 as TestCollection, a6 as TestDiagnostic, a7 as TestModuleState, a8 as TestResult, a9 as TestResultFailed, aa as TestResultPassed, ab as TestResultSkipped, aB as TestRunEndReason, az as TestRunResult, af as TestSequencerConstructor, ac as TestState, ad as TestSuite, ae as TestSuiteState, w as TransformModePatterns, x as TypecheckConfig, U as UserWorkspaceConfig, s as VitestEnvironment, X as VitestPackageInstaller, g as WatcherTriggerPattern, Z as WorkspaceSpec, _ as getFilePoolName } from './chunks/reporters.d.C1ogPriE.js';
3
- import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as ResolvedConfig$1, LogLevel, LoggerOptions, Logger as Logger$1, createServer as createServer$1 } from 'vite';
1
+ import { z as ResolvedConfig, y as UserConfig, v as VitestRunMode, H as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, J as TestSequencer, K as TestSpecification, L as Logger, M as TestModule, N as ModuleDiagnostic } from './chunks/reporters.d.DL9pg5DB.js';
2
+ export { B as BaseCoverageOptions, F as BenchmarkUserOptions, ag as BrowserBuiltinProvider, ah as BrowserCommand, ai as BrowserCommandContext, q as BrowserConfigOptions, aj as BrowserInstanceOption, ak as BrowserModuleMocker, al as BrowserOrchestrator, am as BrowserProvider, an as BrowserProviderInitializationOptions, ao as BrowserProviderModule, ap as BrowserProviderOptions, p as BrowserScript, aq as BrowserServerState, ar as BrowserServerStateSession, r as BuiltinEnvironment, as as CDPSession, u as CSSModuleScopeStrategy, m as CoverageIstanbulOptions, l as CoverageOptions, h as CoverageProvider, i as CoverageProviderModule, j as CoverageReporter, c as CoverageV8Options, n as CustomProviderOptions, D as DepsOptimizationOptions, a0 as HTMLOptions, I as InlineConfig, a2 as JUnitOptions, a1 as JsonOptions, O as OnServerRestartHandler, Q as OnTestsRerunHandler, at as ParentProjectBrowser, P as Pool, t as PoolOptions, Y as ProcessPool, au as ProjectBrowser, E as ProjectConfig, a as ReportContext, aA as ReportedHookContext, o as Reporter, ax as ResolveSnapshotPathHandler, ay as ResolveSnapshotPathHandlerContext, av as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aw as ResolvedProjectConfig, $ as SerializedTestProject, a3 as TaskOptions, a4 as TestCase, a5 as TestCollection, a6 as TestDiagnostic, a7 as TestModuleState, a8 as TestResult, a9 as TestResultFailed, aa as TestResultPassed, ab as TestResultSkipped, aB as TestRunEndReason, az as TestRunResult, af as TestSequencerConstructor, ac as TestState, ad as TestSuite, ae as TestSuiteState, w as TransformModePatterns, x as TypecheckConfig, U as UserWorkspaceConfig, s as VitestEnvironment, X as VitestPackageInstaller, g as WatcherTriggerPattern, Z as WorkspaceSpec, _ as getFilePoolName } from './chunks/reporters.d.DL9pg5DB.js';
4
3
  import * as vite from 'vite';
4
+ import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as ResolvedConfig$1, LogLevel, LoggerOptions, Logger as Logger$1 } from 'vite';
5
5
  export { vite as Vite };
6
6
  export { esbuildVersion, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
7
7
  import { IncomingMessage } from 'node:http';
8
8
  import { R as RuntimeRPC } from './chunks/worker.d.tQu2eJQy.js';
9
9
  export { T as TestExecutionType } from './chunks/worker.d.tQu2eJQy.js';
10
10
  import { Writable } from 'node:stream';
11
- export { V as VitestPluginContext } from './chunks/vite.d.DqE4-hhK.js';
11
+ export { V as VitestPluginContext } from './chunks/vite.d.CtvOcEqC.js';
12
12
  export { W as WorkerContext } from './chunks/worker.d.DvqK5Vmu.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.MAmajcmJ.js';
14
14
  import { Debugger } from 'debug';
@@ -138,8 +138,8 @@ declare function createDebugger(namespace: `vitest:${string}`): Debugger | undef
138
138
  declare const version: string;
139
139
 
140
140
  /** @deprecated use `createViteServer` instead */
141
- declare const createServer: typeof createServer$1;
142
- declare const createViteServer: typeof createServer$1;
141
+ declare const createServer: typeof vite.createServer;
142
+ declare const createViteServer: typeof vite.createServer;
143
143
 
144
144
  /**
145
145
  * @deprecated Use `TestModule` instead
@@ -151,5 +151,8 @@ declare const TestFile: typeof TestModule;
151
151
  */
152
152
  type FileDiagnostic = ModuleDiagnostic;
153
153
 
154
- export { ApiConfig, BaseSequencer, GitNotFoundError, ModuleDiagnostic, ResolvedConfig, TestFile, TestModule, TestProject, TestSequencer, TestSpecification, FilesNotFoundError as TestsNotFoundError, UserConfig, Vitest, VitestOptions, VitestPlugin, VitestRunMode, TestProject as WorkspaceProject, createDebugger, createMethodsRPC, createServer, createViteLogger, createViteServer, createVitest, distDir, isValidApiRequest, parseCLI, registerConsoleShortcuts, resolveApiServerConfig, resolveConfig, resolveFsAllow, rootDir, startVitest, version };
154
+ // rolldownVersion is exported only by rolldown-vite
155
+ declare const rolldownVersion: string | undefined;
156
+
157
+ export { ApiConfig, BaseSequencer, GitNotFoundError, ModuleDiagnostic, ResolvedConfig, TestFile, TestModule, TestProject, TestSequencer, TestSpecification, FilesNotFoundError as TestsNotFoundError, UserConfig, Vitest, VitestOptions, VitestPlugin, VitestRunMode, TestProject as WorkspaceProject, createDebugger, createMethodsRPC, createServer, createViteLogger, createViteServer, createVitest, distDir, isValidApiRequest, parseCLI, registerConsoleShortcuts, resolveApiServerConfig, resolveConfig, resolveFsAllow, rolldownVersion, rootDir, startVitest, version };
155
158
  export type { CliParseOptions, FileDiagnostic, GlobalSetupContext };
package/dist/node.js CHANGED
@@ -1,10 +1,11 @@
1
- import { resolveConfig as resolveConfig$1, mergeConfig, createServer as createServer$1 } from 'vite';
1
+ import * as vite from 'vite';
2
+ import { resolveConfig as resolveConfig$1, mergeConfig } from 'vite';
2
3
  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.DmupRhea.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.DmupRhea.js';
5
- export { p as parseCLI } from './chunks/cac.C8BzMmTW.js';
6
- import { r as resolveConfig$2 } from './chunks/coverage.EIiagJJP.js';
7
- export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.EIiagJJP.js';
4
+ import { V as Vitest, a as VitestPlugin, T as TestModule } from './chunks/cli-api.C37Ou0i1.js';
5
+ 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.C37Ou0i1.js';
6
+ export { p as parseCLI } from './chunks/cac.Cs_fZ7zn.js';
7
+ import { r as resolveConfig$2 } from './chunks/coverage.D1a3dTnj.js';
8
+ export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.D1a3dTnj.js';
8
9
  import { slash, deepClone } from '@vitest/utils';
9
10
  import { f as findUp } from './chunks/index.X0nbfr6-.js';
10
11
  import { resolve } from 'pathe';
@@ -19,7 +20,7 @@ import '@vitest/snapshot/manager';
19
20
  import 'vite-node/client';
20
21
  import 'vite-node/server';
21
22
  import './chunks/index.CJ0plNrh.js';
22
- import './chunks/index.BZ0g1JD2.js';
23
+ import './chunks/index.CX5aIIXH.js';
23
24
  import 'node:perf_hooks';
24
25
  import '@vitest/utils/source-map';
25
26
  import 'tinyrainbow';
@@ -52,7 +53,7 @@ import 'vite-node/utils';
52
53
  import '@vitest/mocker/node';
53
54
  import './chunks/defaults.B7q_naMc.js';
54
55
  import 'magic-string';
55
- import './chunks/index.CIyJn3t1.js';
56
+ import './chunks/index.CSxmp_dI.js';
56
57
  import 'node:assert';
57
58
  import '@vitest/utils/error';
58
59
  import 'node:readline';
@@ -92,11 +93,13 @@ function createDebugger(namespace) {
92
93
 
93
94
  const version = Vitest.version;
94
95
  /** @deprecated use `createViteServer` instead */
95
- const createServer = createServer$1;
96
- const createViteServer = createServer$1;
96
+ const createServer = vite.createServer;
97
+ const createViteServer = vite.createServer;
97
98
  /**
98
99
  * @deprecated Use `TestModule` instead
99
100
  */
100
101
  const TestFile = TestModule;
102
+ // rolldownVersion is exported only by rolldown-vite
103
+ const rolldownVersion = vite.rolldownVersion;
101
104
 
102
- export { TestFile, VitestPlugin, createDebugger, createServer, createViteServer, resolveConfig, version };
105
+ export { TestFile, VitestPlugin, createDebugger, createServer, createViteServer, resolveConfig, rolldownVersion, version };
@@ -1,4 +1,4 @@
1
- export { aQ as BaseReporter, aC as BasicReporter, aR as BenchmarkBuiltinReporters, aD as BenchmarkReporter, aE as BenchmarkReportsMap, aS as BuiltinReporterOptions, aT as BuiltinReporters, aF as DefaultReporter, aG as DotReporter, aH as GithubActionsReporter, aI as HangingProcessReporter, aK as JUnitReporter, aU as JsonAssertionResult, aJ as JsonReporter, aV as JsonTestResult, aW as JsonTestResults, aA as ReportedHookContext, o as Reporter, aL as ReportersMap, aM as TapFlatReporter, aN as TapReporter, aB as TestRunEndReason, aO as VerboseBenchmarkReporter, aP as VerboseReporter } from './chunks/reporters.d.C1ogPriE.js';
1
+ export { aQ as BaseReporter, aC as BasicReporter, aR as BenchmarkBuiltinReporters, aD as BenchmarkReporter, aE as BenchmarkReportsMap, aS as BuiltinReporterOptions, aT as BuiltinReporters, aF as DefaultReporter, aG as DotReporter, aH as GithubActionsReporter, aI as HangingProcessReporter, aK as JUnitReporter, aU as JsonAssertionResult, aJ as JsonReporter, aV as JsonTestResult, aW as JsonTestResults, aA as ReportedHookContext, o as Reporter, aL as ReportersMap, aM as TapFlatReporter, aN as TapReporter, aB as TestRunEndReason, aO as VerboseBenchmarkReporter, aP as VerboseReporter } from './chunks/reporters.d.DL9pg5DB.js';
2
2
  import '@vitest/runner';
3
3
  import './chunks/environment.d.cL3nLXbE.js';
4
4
  import 'vitest/optional-types.js';
package/dist/reporters.js CHANGED
@@ -1,5 +1,5 @@
1
- export { B as BasicReporter, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.BZ0g1JD2.js';
2
- export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.CIyJn3t1.js';
1
+ export { B as BasicReporter, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.CX5aIIXH.js';
2
+ export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.CSxmp_dI.js';
3
3
  import 'node:perf_hooks';
4
4
  import '@vitest/runner/utils';
5
5
  import '@vitest/utils';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "3.2.1",
4
+ "version": "3.2.3",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -119,8 +119,8 @@
119
119
  "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
120
120
  "happy-dom": "*",
121
121
  "jsdom": "*",
122
- "@vitest/browser": "3.2.1",
123
- "@vitest/ui": "3.2.1"
122
+ "@vitest/browser": "3.2.3",
123
+ "@vitest/ui": "3.2.3"
124
124
  },
125
125
  "peerDependenciesMeta": {
126
126
  "@edge-runtime/vm": {
@@ -161,14 +161,14 @@
161
161
  "tinyrainbow": "^2.0.0",
162
162
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0",
163
163
  "why-is-node-running": "^2.3.0",
164
- "@vitest/mocker": "3.2.1",
165
- "@vitest/pretty-format": "^3.2.1",
166
- "@vitest/runner": "3.2.1",
167
- "@vitest/snapshot": "3.2.1",
168
- "@vitest/expect": "3.2.1",
169
- "@vitest/spy": "3.2.1",
170
- "vite-node": "3.2.1",
171
- "@vitest/utils": "3.2.1"
164
+ "@vitest/expect": "3.2.3",
165
+ "@vitest/pretty-format": "^3.2.3",
166
+ "@vitest/runner": "3.2.3",
167
+ "@vitest/spy": "3.2.3",
168
+ "@vitest/snapshot": "3.2.3",
169
+ "@vitest/mocker": "3.2.3",
170
+ "@vitest/utils": "3.2.3",
171
+ "vite-node": "3.2.3"
172
172
  },
173
173
  "devDependencies": {
174
174
  "@ampproject/remapping": "^2.3.0",