vitest 4.0.0-beta.1 → 4.0.0-beta.2

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.
package/dist/browser.d.ts CHANGED
@@ -11,7 +11,7 @@ import '@vitest/pretty-format';
11
11
  import '@vitest/snapshot';
12
12
  import 'vite-node/client';
13
13
  import 'vite-node';
14
- import './chunks/worker.d.DoNjFAiv.js';
14
+ import './chunks/worker.d.COAQvn4k.js';
15
15
  import './chunks/environment.d.CUq4cUgQ.js';
16
16
  import 'node:vm';
17
17
  import '@vitest/mocker';
@@ -1,4 +1,4 @@
1
- import { T as TestExecutionMethod } from './worker.d.DoNjFAiv.js';
1
+ import { T as TestExecutionMethod } from './worker.d.COAQvn4k.js';
2
2
 
3
3
  type SerializedTestSpecification = [project: {
4
4
  name: string | undefined
@@ -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.CZI_8rVt.js';
6
+ import { R as ReportersMap } from './index.a-yuRg2G.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 = "4.0.0-beta.1";
622
+ var version = "4.0.0-beta.2";
623
623
 
624
624
  const apiConfig = (port) => ({
625
625
  port: {
@@ -1201,7 +1201,6 @@ const cliOptionsConfig = {
1201
1201
  includeSource: null,
1202
1202
  alias: null,
1203
1203
  env: null,
1204
- environmentMatchGlobs: null,
1205
1204
  environmentOptions: null,
1206
1205
  unstubEnvs: null,
1207
1206
  related: null,
@@ -1218,7 +1217,6 @@ const cliOptionsConfig = {
1218
1217
  chaiConfig: null,
1219
1218
  clearMocks: null,
1220
1219
  css: null,
1221
- poolMatchGlobs: null,
1222
1220
  deps: null,
1223
1221
  name: null,
1224
1222
  snapshotEnvironment: null,
@@ -1399,11 +1397,11 @@ async function start(mode, cliFilters, options) {
1399
1397
  process.title = "node (vitest)";
1400
1398
  } catch {}
1401
1399
  try {
1402
- const { startVitest } = await import('./cli-api.Dn5gKePv.js').then(function (n) { return n.f; });
1400
+ const { startVitest } = await import('./cli-api.BUkNuHvl.js').then(function (n) { return n.f; });
1403
1401
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
1404
1402
  if (!ctx.shouldKeepServer()) await ctx.exit();
1405
1403
  } catch (e) {
1406
- const { errorBanner } = await import('./index.CZI_8rVt.js').then(function (n) { return n.u; });
1404
+ const { errorBanner } = await import('./index.a-yuRg2G.js').then(function (n) { return n.u; });
1407
1405
  console.error(`\n${errorBanner("Startup Error")}`);
1408
1406
  console.error(e);
1409
1407
  console.error("\n\n");
@@ -1424,7 +1422,7 @@ async function collect(mode, cliFilters, options) {
1424
1422
  process.title = "node (vitest)";
1425
1423
  } catch {}
1426
1424
  try {
1427
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.Dn5gKePv.js').then(function (n) { return n.f; });
1425
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.BUkNuHvl.js').then(function (n) { return n.f; });
1428
1426
  const ctx = await prepareVitest(mode, {
1429
1427
  ...normalizeCliOptions(cliFilters, options),
1430
1428
  watch: false,
@@ -1446,7 +1444,7 @@ async function collect(mode, cliFilters, options) {
1446
1444
  }
1447
1445
  await ctx.close();
1448
1446
  } catch (e) {
1449
- const { errorBanner } = await import('./index.CZI_8rVt.js').then(function (n) { return n.u; });
1447
+ const { errorBanner } = await import('./index.a-yuRg2G.js').then(function (n) { return n.u; });
1450
1448
  console.error(`\n${errorBanner("Collect Error")}`);
1451
1449
  console.error(e);
1452
1450
  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.D3EzDDZd.js';
14
+ import { v as version$1 } from './cac.CVVvMokL.js';
15
15
  import { c as createBirpc } from './index.B521nVV-.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, B as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.CZI_8rVt.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, B as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.a-yuRg2G.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.Cwa-XhJt.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.BjMqihzx.js';
32
32
  import { c as convertTasksToEvents } from './typechecker.CVytUJuF.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.CXFFjsi8.js';
45
45
  import MagicString from 'magic-string';
46
- import { a as BenchmarkReportsMap } from './index.TfbsX-3I.js';
46
+ import { a as BenchmarkReportsMap } from './index.CJvUWPky.js';
47
47
  import assert$1 from 'node:assert';
48
48
  import { serializeError } from '@vitest/utils/error';
49
49
  import readline from 'node:readline';
@@ -5120,9 +5120,6 @@ function setup(ctx, _server) {
5120
5120
  getConfig() {
5121
5121
  return ctx.getRootProject().serializedConfig;
5122
5122
  },
5123
- getResolvedProjectNames() {
5124
- return ctx.projects.map((p) => p.name);
5125
- },
5126
5123
  getResolvedProjectLabels() {
5127
5124
  return ctx.projects.map((p) => ({
5128
5125
  name: p.name,
@@ -6991,7 +6988,7 @@ class TestProject {
6991
6988
  * @param moduleId The file path
6992
6989
  */
6993
6990
  createSpecification(moduleId, locations, pool) {
6994
- return new TestSpecification(this, moduleId, pool || getFilePoolName(this, moduleId), locations);
6991
+ return new TestSpecification(this, moduleId, pool || getFilePoolName(this), locations);
6995
6992
  }
6996
6993
  toJSON() {
6997
6994
  return {
@@ -8244,25 +8241,29 @@ class StateManager {
8244
8241
  processTimeoutCauses = /* @__PURE__ */ new Set();
8245
8242
  reportedTasksMap = /* @__PURE__ */ new WeakMap();
8246
8243
  blobs;
8247
- catchError(err, type) {
8248
- if (isAggregateError(err)) return err.errors.forEach((error) => this.catchError(error, type));
8249
- if (err === Object(err)) err.type = type;
8250
- else err = {
8244
+ onUnhandledError;
8245
+ constructor(options) {
8246
+ this.onUnhandledError = options.onUnhandledError;
8247
+ }
8248
+ catchError(error, type) {
8249
+ if (isAggregateError(error)) return error.errors.forEach((error) => this.catchError(error, type));
8250
+ if (typeof error === "object" && error !== null) error.type = type;
8251
+ else error = {
8251
8252
  type,
8252
- message: err
8253
+ message: error
8253
8254
  };
8254
- const _err = err;
8255
- if (_err && typeof _err === "object" && _err.code === "VITEST_PENDING") {
8256
- const task = this.idMap.get(_err.taskId);
8255
+ const _error = error;
8256
+ if (_error && typeof _error === "object" && _error.code === "VITEST_PENDING") {
8257
+ const task = this.idMap.get(_error.taskId);
8257
8258
  if (task) {
8258
8259
  task.mode = "skip";
8259
8260
  task.result ??= { state: "skip" };
8260
8261
  task.result.state = "skip";
8261
- task.result.note = _err.note;
8262
+ task.result.note = _error.note;
8262
8263
  }
8263
8264
  return;
8264
8265
  }
8265
- this.errorsSet.add(err);
8266
+ if (!this.onUnhandledError || this.onUnhandledError(error) !== false) this.errorsSet.add(error);
8266
8267
  }
8267
8268
  clearErrors() {
8268
8269
  this.errorsSet.clear();
@@ -9274,7 +9275,7 @@ class Vitest {
9274
9275
  this._vite = server;
9275
9276
  const resolved = resolveConfig(this, options, server.config);
9276
9277
  this._config = resolved;
9277
- this._state = new StateManager();
9278
+ this._state = new StateManager({ onUnhandledError: resolved.onUnhandledError });
9278
9279
  this._cache = new VitestCache(this.version);
9279
9280
  this._snapshot = new SnapshotManager({ ...resolved.snapshotOptions });
9280
9281
  this._testRun = new TestRun(this);
@@ -2406,14 +2406,7 @@ async function groupFilesByEnv(files) {
2406
2406
  const code = await promises$1.readFile(filepath, "utf-8");
2407
2407
  // 1. Check for control comments in the file
2408
2408
  let env = code.match(/@(?:vitest|jest)-environment\s+([\w-]+)\b/)?.[1];
2409
- // 2. Check for globals
2410
- if (!env) {
2411
- for (const [glob, target] of project.config.environmentMatchGlobs || []) if (pm.isMatch(filepath, glob, { cwd: project.config.root })) {
2412
- env = target;
2413
- break;
2414
- }
2415
- }
2416
- // 3. Fallback to global env
2409
+ // 2. Fallback to global env
2417
2410
  env ||= project.config.environment || "node";
2418
2411
  const transformMode = getTransformMode(project.config.testTransformMode, filepath);
2419
2412
  let envOptionsJson = code.match(/@(?:vitest|jest)-environment-options\s+(.+)/)?.[1];
@@ -3292,11 +3285,7 @@ function getDefaultPoolName(project) {
3292
3285
  if (project.config.browser.enabled) return "browser";
3293
3286
  return project.config.pool;
3294
3287
  }
3295
- function getFilePoolName(project, file) {
3296
- for (const [glob, pool] of project.config.poolMatchGlobs) {
3297
- if (pool === "browser") throw new Error("Since Vitest 0.31.0 \"browser\" pool is not supported in `poolMatchGlobs`. You can create a project to run some of your tests in browser in parallel. Read more: https://vitest.dev/guide/projects");
3298
- if (pm.isMatch(file, glob, { cwd: project.config.root })) return pool;
3299
- }
3288
+ function getFilePoolName(project) {
3300
3289
  return getDefaultPoolName(project);
3301
3290
  }
3302
3291
  function createPool(ctx) {
@@ -3770,11 +3759,6 @@ function resolveConfig$1(vitest, options, viteConfig) {
3770
3759
  // if passed down from the CLI and it's relative, resolve relative to CWD
3771
3760
  resolved.workspace = typeof options.workspace === "string" && options.workspace[0] === "." ? resolve$1(process.cwd(), options.workspace) : resolvePath(resolved.workspace, resolved.root);
3772
3761
  if (!builtinPools.includes(resolved.pool)) resolved.pool = resolvePath(resolved.pool, resolved.root);
3773
- if (resolved.poolMatchGlobs) logger.deprecate("`poolMatchGlobs` is deprecated. Use `test.projects` to define different configurations instead.");
3774
- resolved.poolMatchGlobs = (resolved.poolMatchGlobs || []).map(([glob, pool]) => {
3775
- if (!builtinPools.includes(pool)) pool = resolvePath(pool, resolved.root);
3776
- return [glob, pool];
3777
- });
3778
3762
  if (mode === "benchmark") {
3779
3763
  resolved.benchmark = {
3780
3764
  ...benchmarkConfigDefaults,
@@ -3872,8 +3856,6 @@ function resolveConfig$1(vitest, options, viteConfig) {
3872
3856
  ...configDefaults.typecheck,
3873
3857
  ...resolved.typecheck
3874
3858
  };
3875
- if (resolved.environmentMatchGlobs) logger.deprecate("\"environmentMatchGlobs\" is deprecated. Use `test.projects` to define different configurations instead.");
3876
- resolved.environmentMatchGlobs = (resolved.environmentMatchGlobs || []).map((i) => [resolve$1(resolved.root, i[0]), i[1]]);
3877
3859
  resolved.typecheck ??= {};
3878
3860
  resolved.typecheck.enabled ??= false;
3879
3861
  if (resolved.typecheck.enabled) 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."));
@@ -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.CZI_8rVt.js';
5
+ import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName } from './index.a-yuRg2G.js';
6
6
  import { stripVTControlCharacters } from 'node:util';
7
7
  import { notNullish } from '@vitest/utils';
8
8
 
@@ -1883,7 +1883,6 @@ class JUnitReporter {
1883
1883
  };
1884
1884
  if (typeof this.options.classnameTemplate === "function") classname = this.options.classnameTemplate(templateVars);
1885
1885
  else if (typeof this.options.classnameTemplate === "string") classname = this.options.classnameTemplate.replace(/\{filename\}/g, templateVars.filename).replace(/\{filepath\}/g, templateVars.filepath);
1886
- else if (typeof this.options.classname === "string") classname = this.options.classname;
1887
1886
  await this.writeElement("testcase", {
1888
1887
  classname,
1889
1888
  file: this.options.addFileAttribute ? filename : void 0,
@@ -1,4 +1,4 @@
1
- import { V as Vitest, T as TestProject, a as TestProjectConfiguration } from './reporters.d.DxZg19fy.js';
1
+ import { V as Vitest, T as TestProject, a as TestProjectConfiguration } from './reporters.d.BbsDWlO9.js';
2
2
 
3
3
  interface VitestPluginContext {
4
4
  vitest: Vitest;
@@ -4,7 +4,7 @@ import { ParsedStack, Awaitable, TestError, SerializedError, Arrayable } from '@
4
4
  import { Writable } from 'node:stream';
5
5
  import { ViteDevServer, ModuleNode, TransformResult as TransformResult$1, UserConfig as UserConfig$1, DepOptimizationConfig, ServerOptions, ConfigEnv, AliasOptions } from 'vite';
6
6
  import { Console } from 'node:console';
7
- import { B as BrowserTesterOptions, S as SerializedTestSpecification } from './browser.d.q8Z0P0q1.js';
7
+ import { B as BrowserTesterOptions, S as SerializedTestSpecification } from './browser.d.DP0ACFkh.js';
8
8
  import { MockedModule } from '@vitest/mocker';
9
9
  import { StackTraceParserOptions } from '@vitest/utils/source-map';
10
10
  import { a as SerializedConfig, F as FakeTimerInstallOpts } from './config.d.HJdfX-8k.js';
@@ -152,7 +152,7 @@ interface BrowserProviderModule {
152
152
  }
153
153
  interface BrowserProviderOptions {}
154
154
  type BrowserBuiltinProvider = "webdriverio" | "playwright" | "preview";
155
- type UnsupportedProperties = "browser" | "typecheck" | "alias" | "sequence" | "root" | "pool" | "poolOptions" | "runner" | "api" | "deps" | "testTransformMode" | "poolMatchGlobs" | "environmentMatchGlobs" | "environment" | "environmentOptions" | "server" | "benchmark" | "name";
155
+ type UnsupportedProperties = "browser" | "typecheck" | "alias" | "sequence" | "root" | "pool" | "poolOptions" | "runner" | "api" | "deps" | "testTransformMode" | "environment" | "environmentOptions" | "server" | "benchmark" | "name";
156
156
  interface BrowserInstanceOption extends BrowserProviderOptions, Omit<ProjectConfig, UnsupportedProperties>, Pick<BrowserConfigOptions, "headless" | "locators" | "viewport" | "testerHtmlPath" | "screenshotDirectory" | "screenshotFailures"> {
157
157
  /**
158
158
  * Name of the browser
@@ -291,8 +291,6 @@ interface BrowserCommandContext {
291
291
  testPath: string | undefined;
292
292
  provider: BrowserProvider;
293
293
  project: TestProject;
294
- /** @deprecated use `sessionId` instead */
295
- contextId: string;
296
294
  sessionId: string;
297
295
  }
298
296
  interface BrowserServerStateSession {
@@ -1020,7 +1018,7 @@ interface ProcessPool {
1020
1018
  collectTests: RunWithFiles;
1021
1019
  close?: () => Awaitable<void>;
1022
1020
  }
1023
- declare function getFilePoolName(project: TestProject, file: string): Pool;
1021
+ declare function getFilePoolName(project: TestProject): Pool;
1024
1022
 
1025
1023
  interface TestRunResult {
1026
1024
  testModules: TestModule[];
@@ -1101,7 +1099,11 @@ declare class StateManager {
1101
1099
  processTimeoutCauses: Set<string>;
1102
1100
  reportedTasksMap: WeakMap<Task, TestModule | TestCase | TestSuite>;
1103
1101
  blobs?: MergedBlobs;
1104
- catchError(err: unknown, type: string): void;
1102
+ onUnhandledError?: OnUnhandledErrorCallback;
1103
+ constructor(options: {
1104
+ onUnhandledError?: OnUnhandledErrorCallback
1105
+ });
1106
+ catchError(error: unknown, type: string): void;
1105
1107
  clearErrors(): void;
1106
1108
  getUnhandledErrors(): unknown[];
1107
1109
  addProcessTimeoutCause(cause: string): void;
@@ -1742,8 +1744,6 @@ interface ClassnameTemplateVariables {
1742
1744
  }
1743
1745
  interface JUnitOptions {
1744
1746
  outputFile?: string;
1745
- /** @deprecated Use `classnameTemplate` instead. */
1746
- classname?: string;
1747
1747
  /**
1748
1748
  * Template for the classname attribute. Can be either a string or a function. The string can contain placeholders {filename} and {filepath}.
1749
1749
  */
@@ -2492,23 +2492,6 @@ interface InlineConfig {
2492
2492
  */
2493
2493
  environmentOptions?: EnvironmentOptions;
2494
2494
  /**
2495
- * Automatically assign environment based on globs. The first match will be used.
2496
- * This has effect only when running tests inside Node.js.
2497
- *
2498
- * Format: [glob, environment-name]
2499
- *
2500
- * @deprecated use [`projects`](https://vitest.dev/config/#projects) instead
2501
- * @default []
2502
- * @example [
2503
- * // all tests in tests/dom will run in jsdom
2504
- * ['tests/dom/**', 'jsdom'],
2505
- * // all tests in tests/ with .edge.test.ts will run in edge-runtime
2506
- * ['**\/*.edge.test.ts', 'edge-runtime'],
2507
- * // ...
2508
- * ]
2509
- */
2510
- environmentMatchGlobs?: [string, VitestEnvironment][];
2511
- /**
2512
2495
  * Run tests in an isolated environment. This option has no effect on vmThreads pool.
2513
2496
  *
2514
2497
  * Disabling this option might improve performance if your code doesn't rely on side effects.
@@ -2544,21 +2527,6 @@ interface InlineConfig {
2544
2527
  */
2545
2528
  fileParallelism?: boolean;
2546
2529
  /**
2547
- * Automatically assign pool based on globs. The first match will be used.
2548
- *
2549
- * Format: [glob, pool-name]
2550
- *
2551
- * @deprecated use [`projects`](https://vitest.dev/config/#projects) instead
2552
- * @default []
2553
- * @example [
2554
- * // all tests in "forks" directory will run using "poolOptions.forks" API
2555
- * ['tests/forks/**', 'forks'],
2556
- * // all other tests will run based on "poolOptions.threads" option, if you didn't specify other globs
2557
- * // ...
2558
- * ]
2559
- */
2560
- poolMatchGlobs?: [string, Exclude<Pool, "browser">][];
2561
- /**
2562
2530
  * Options for projects
2563
2531
  */
2564
2532
  projects?: TestProjectConfiguration[];
@@ -2776,6 +2744,10 @@ interface InlineConfig {
2776
2744
  */
2777
2745
  onStackTrace?: (error: TestError, frame: ParsedStack) => boolean | void;
2778
2746
  /**
2747
+ * A callback that can return `false` to ignore an unhandled error
2748
+ */
2749
+ onUnhandledError?: OnUnhandledErrorCallback;
2750
+ /**
2779
2751
  * Indicates if CSS files should be processed.
2780
2752
  *
2781
2753
  * When excluded, the CSS files will be replaced with empty strings to bypass the subsequent processing.
@@ -3076,6 +3048,9 @@ interface UserConfig extends InlineConfig {
3076
3048
  */
3077
3049
  mergeReports?: string;
3078
3050
  }
3051
+ type OnUnhandledErrorCallback = (error: (TestError | Error) & {
3052
+ type: string
3053
+ }) => boolean | void;
3079
3054
  interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config" | "filters" | "browser" | "coverage" | "testNamePattern" | "related" | "api" | "reporters" | "resolveSnapshotPath" | "benchmark" | "shard" | "cache" | "sequence" | "typecheck" | "runner" | "poolOptions" | "pool" | "cliExclude" | "diff" | "setupFiles" | "snapshotEnvironment" | "bail" | "name"> {
3080
3055
  mode: VitestRunMode;
3081
3056
  name: ProjectName["label"];
@@ -105,12 +105,6 @@ interface RuntimeRPC {
105
105
  resolveId: (id: string, importer: string | undefined, transformMode: TransformMode) => Promise<{
106
106
  external?: boolean | "absolute" | "relative"
107
107
  id: string
108
- /** @deprecated */
109
- meta?: Record<string, any> | null
110
- /** @deprecated */
111
- moduleSideEffects?: boolean | "no-treeshake" | null
112
- /** @deprecated */
113
- syntheticNamedExports?: boolean | string | null
114
108
  } | null>;
115
109
  onUserConsoleLog: (log: UserConsoleLog) => void;
116
110
  onUnhandledError: (err: unknown, type: string) => void;
@@ -1,5 +1,5 @@
1
1
  import { MessagePort } from 'node:worker_threads';
2
- import { C as ContextRPC } from './worker.d.DoNjFAiv.js';
2
+ import { C as ContextRPC } from './worker.d.COAQvn4k.js';
3
3
 
4
4
  interface WorkerContext extends ContextRPC {
5
5
  port: MessagePort;
package/dist/cli.js CHANGED
@@ -1,10 +1,10 @@
1
- import { c as createCLI } from './chunks/cac.D3EzDDZd.js';
1
+ import { c as createCLI } from './chunks/cac.CVVvMokL.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.CZI_8rVt.js';
7
+ import './chunks/index.a-yuRg2G.js';
8
8
  import 'node:fs';
9
9
  import 'node:fs/promises';
10
10
  import './chunks/typechecker.CVytUJuF.js';
package/dist/config.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  import { HookHandler, ConfigEnv, UserConfig } from 'vite';
2
2
  export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
3
- import { I as InlineConfig, c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.DxZg19fy.js';
4
- export { a as TestProjectConfiguration, g as TestProjectInlineConfiguration, f as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.DxZg19fy.js';
5
- import { V as VitestPluginContext } from './chunks/plugin.d.C2EcJUjo.js';
3
+ import { I as InlineConfig, c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.BbsDWlO9.js';
4
+ export { a as TestProjectConfiguration, g as TestProjectInlineConfiguration, f as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.BbsDWlO9.js';
5
+ import { V as VitestPluginContext } from './chunks/plugin.d.NmsBIHuT.js';
6
6
  import { F as FakeTimerInstallOpts } from './chunks/config.d.HJdfX-8k.js';
7
7
  import '@vitest/runner';
8
8
  import './chunks/environment.d.CUq4cUgQ.js';
9
9
  import '@vitest/utils';
10
10
  import 'node:stream';
11
11
  import 'node:console';
12
- import './chunks/browser.d.q8Z0P0q1.js';
13
- import './chunks/worker.d.DoNjFAiv.js';
12
+ import './chunks/browser.d.DP0ACFkh.js';
13
+ import './chunks/worker.d.COAQvn4k.js';
14
14
  import '@vitest/snapshot';
15
15
  import '@vitest/mocker';
16
16
  import '@vitest/utils/source-map';
@@ -1,12 +1,12 @@
1
- import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, b as ReportContext } from './chunks/reporters.d.DxZg19fy.js';
1
+ import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, b as ReportContext } from './chunks/reporters.d.BbsDWlO9.js';
2
2
  import { TransformResult } from 'vite';
3
3
  import { A as AfterSuiteRunMeta } from './chunks/environment.d.CUq4cUgQ.js';
4
4
  import '@vitest/runner';
5
5
  import '@vitest/utils';
6
6
  import 'node:stream';
7
7
  import 'node:console';
8
- import './chunks/browser.d.q8Z0P0q1.js';
9
- import './chunks/worker.d.DoNjFAiv.js';
8
+ import './chunks/browser.d.DP0ACFkh.js';
9
+ import './chunks/worker.d.COAQvn4k.js';
10
10
  import './chunks/config.d.HJdfX-8k.js';
11
11
  import '@vitest/pretty-format';
12
12
  import '@vitest/snapshot';
package/dist/coverage.js CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BaseCoverageProvider } from './chunks/coverage.Cwa-XhJt.js';
1
+ export { B as BaseCoverageProvider } from './chunks/coverage.BjMqihzx.js';
2
2
  import 'node:fs';
3
3
  import 'node:path';
4
4
  import 'pathe';
package/dist/execute.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ViteNodeRunnerOptions } from 'vite-node';
2
2
  import { ViteNodeRunner, ModuleExecutionInfo } from 'vite-node/client';
3
- import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.d.DoNjFAiv.js';
3
+ import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.d.COAQvn4k.js';
4
4
  import vm from 'node:vm';
5
5
  import { MockedModule, MockedModuleType } from '@vitest/mocker';
6
6
  import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './chunks/mocker.d.BE_2ls6u.js';
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { S as SerializedTestSpecification } from './chunks/browser.d.q8Z0P0q1.js';
2
- export { B as BrowserTesterOptions } from './chunks/browser.d.q8Z0P0q1.js';
1
+ import { S as SerializedTestSpecification } from './chunks/browser.d.DP0ACFkh.js';
2
+ export { B as BrowserTesterOptions } from './chunks/browser.d.DP0ACFkh.js';
3
3
  import './chunks/global.d.CVbXEflG.js';
4
4
  import { File, TestAnnotation, TaskResultPack, TaskEventPack, TaskPopulated } from '@vitest/runner';
5
- 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';
6
- import { a as BirpcReturn } from './chunks/worker.d.DoNjFAiv.js';
7
- export { C as ContextRPC, c as ContextTestEnvironment, b as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.DoNjFAiv.js';
5
+ export { CancelReason, HookCleanupCallback, HookListener, ImportDuration, OnTestFailedHandler, OnTestFinishedHandler, RunMode, 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, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestAnnotation, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
6
+ import { a as BirpcReturn } from './chunks/worker.d.COAQvn4k.js';
7
+ export { C as ContextRPC, c as ContextTestEnvironment, b as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.COAQvn4k.js';
8
8
  import { a as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.HJdfX-8k.js';
9
9
  export { b as RuntimeConfig, S as SerializedCoverageConfig } from './chunks/config.d.HJdfX-8k.js';
10
10
  import { b as Awaitable, U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, P as ProvidedContext } from './chunks/environment.d.CUq4cUgQ.js';
@@ -54,9 +54,6 @@ interface WebSocketHandlers {
54
54
  getTestFiles: () => Promise<SerializedTestSpecification[]>;
55
55
  getPaths: () => string[];
56
56
  getConfig: () => SerializedConfig;
57
- // TODO: Remove in v4
58
- /** @deprecated -- Use `getResolvedProjectLabels` instead */
59
- getResolvedProjectNames: () => string[];
60
57
  getResolvedProjectLabels: () => {
61
58
  name: string
62
59
  color?: LabelColor
package/dist/node.d.ts CHANGED
@@ -3,13 +3,13 @@ import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as Res
3
3
  export { vite as Vite };
4
4
  export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
5
5
  import { IncomingMessage } from 'node:http';
6
- import { h as ResolvedConfig, f as UserConfig, i as VitestRunMode, j as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, k as TestSequencer, l as TestSpecification, L as Logger } from './chunks/reporters.d.DxZg19fy.js';
7
- export { ao as BaseCoverageOptions, K as BenchmarkUserOptions, N as BrowserBuiltinProvider, Q as BrowserCommand, X as BrowserCommandContext, Y as BrowserConfigOptions, Z as BrowserInstanceOption, _ as BrowserModuleMocker, $ as BrowserOrchestrator, a0 as BrowserProvider, a1 as BrowserProviderInitializationOptions, a2 as BrowserProviderModule, a3 as BrowserProviderOptions, a4 as BrowserScript, a5 as BrowserServerState, a6 as BrowserServerStateSession, ab as BuiltinEnvironment, a7 as CDPSession, ac as CSSModuleScopeStrategy, ap as CoverageIstanbulOptions, aq as CoverageOptions, ar as CoverageProvider, as as CoverageProviderModule, at as CoverageReporter, c as CoverageV8Options, au as CustomProviderOptions, ad as DepsOptimizationOptions, ae as EnvironmentOptions, H as HTMLOptions, I as InlineConfig, q as JUnitOptions, J as JsonOptions, M as ModuleDiagnostic, O as OnServerRestartHandler, m as OnTestsRerunHandler, a8 as ParentProjectBrowser, af as Pool, ag as PoolOptions, P as ProcessPool, a9 as ProjectBrowser, ah as ProjectConfig, b as ReportContext, aw as ReportedHookContext, ax as Reporter, aj as ResolveSnapshotPathHandler, ak as ResolveSnapshotPathHandlerContext, aa as ResolvedBrowserOptions, R as ResolvedCoverageOptions, ai as ResolvedProjectConfig, S as SerializedTestProject, r as TaskOptions, s as TestCase, t as TestCollection, u as TestDiagnostic, v as TestModule, w as TestModuleState, x as TestResult, y as TestResultFailed, z as TestResultPassed, B as TestResultSkipped, ay as TestRunEndReason, av as TestRunResult, G as TestSequencerConstructor, D as TestState, E as TestSuite, F as TestSuiteState, al as TransformModePatterns, am as TypecheckConfig, U as UserWorkspaceConfig, an as VitestEnvironment, n as VitestPackageInstaller, W as WatcherTriggerPattern, o as WorkspaceSpec, p as getFilePoolName } from './chunks/reporters.d.DxZg19fy.js';
8
- import { R as RuntimeRPC } from './chunks/worker.d.DoNjFAiv.js';
9
- export { T as TestExecutionType } from './chunks/worker.d.DoNjFAiv.js';
6
+ import { h as ResolvedConfig, f as UserConfig, i as VitestRunMode, j as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, k as TestSequencer, l as TestSpecification, L as Logger } from './chunks/reporters.d.BbsDWlO9.js';
7
+ export { ao as BaseCoverageOptions, K as BenchmarkUserOptions, N as BrowserBuiltinProvider, Q as BrowserCommand, X as BrowserCommandContext, Y as BrowserConfigOptions, Z as BrowserInstanceOption, _ as BrowserModuleMocker, $ as BrowserOrchestrator, a0 as BrowserProvider, a1 as BrowserProviderInitializationOptions, a2 as BrowserProviderModule, a3 as BrowserProviderOptions, a4 as BrowserScript, a5 as BrowserServerState, a6 as BrowserServerStateSession, ab as BuiltinEnvironment, a7 as CDPSession, ac as CSSModuleScopeStrategy, ap as CoverageIstanbulOptions, aq as CoverageOptions, ar as CoverageProvider, as as CoverageProviderModule, at as CoverageReporter, c as CoverageV8Options, au as CustomProviderOptions, ad as DepsOptimizationOptions, ae as EnvironmentOptions, H as HTMLOptions, I as InlineConfig, q as JUnitOptions, J as JsonOptions, M as ModuleDiagnostic, O as OnServerRestartHandler, m as OnTestsRerunHandler, a8 as ParentProjectBrowser, af as Pool, ag as PoolOptions, P as ProcessPool, a9 as ProjectBrowser, ah as ProjectConfig, b as ReportContext, aw as ReportedHookContext, ax as Reporter, aj as ResolveSnapshotPathHandler, ak as ResolveSnapshotPathHandlerContext, aa as ResolvedBrowserOptions, R as ResolvedCoverageOptions, ai as ResolvedProjectConfig, S as SerializedTestProject, r as TaskOptions, s as TestCase, t as TestCollection, u as TestDiagnostic, v as TestModule, w as TestModuleState, x as TestResult, y as TestResultFailed, z as TestResultPassed, B as TestResultSkipped, ay as TestRunEndReason, av as TestRunResult, G as TestSequencerConstructor, D as TestState, E as TestSuite, F as TestSuiteState, al as TransformModePatterns, am as TypecheckConfig, U as UserWorkspaceConfig, an as VitestEnvironment, n as VitestPackageInstaller, W as WatcherTriggerPattern, o as WorkspaceSpec, p as getFilePoolName } from './chunks/reporters.d.BbsDWlO9.js';
8
+ import { R as RuntimeRPC } from './chunks/worker.d.COAQvn4k.js';
9
+ export { T as TestExecutionType } from './chunks/worker.d.COAQvn4k.js';
10
10
  import { Writable } from 'node:stream';
11
- export { V as VitestPluginContext } from './chunks/plugin.d.C2EcJUjo.js';
12
- export { W as WorkerContext } from './chunks/worker.d.CmvJfRGs.js';
11
+ export { V as VitestPluginContext } from './chunks/plugin.d.NmsBIHuT.js';
12
+ export { W as WorkerContext } from './chunks/worker.d.CVn8WGlF.js';
13
13
  import { Debugger } from 'debug';
14
14
  import './chunks/global.d.CVbXEflG.js';
15
15
  export { Task as RunnerTask, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
@@ -18,7 +18,7 @@ export { SerializedError } from '@vitest/utils';
18
18
  export { generateFileHash } from '@vitest/runner/utils';
19
19
  import './chunks/environment.d.CUq4cUgQ.js';
20
20
  import 'node:console';
21
- import './chunks/browser.d.q8Z0P0q1.js';
21
+ import './chunks/browser.d.DP0ACFkh.js';
22
22
  import '@vitest/mocker';
23
23
  import '@vitest/utils/source-map';
24
24
  import '@vitest/pretty-format';
@@ -117,9 +117,6 @@ declare class GitNotFoundError extends Error {
117
117
  constructor();
118
118
  }
119
119
 
120
- /** @deprecated use `TestProject` instead */
121
- type GlobalSetupContext = TestProject;
122
-
123
120
  declare function VitestPlugin(options?: UserConfig, vitest?: Vitest): Promise<Plugin[]>;
124
121
 
125
122
  // this is only exported as a public function and not used inside vitest
@@ -167,4 +164,4 @@ declare const createViteServer: typeof vite.createServer;
167
164
  declare const rolldownVersion: string | undefined;
168
165
 
169
166
  export { ApiConfig, BaseSequencer, GitNotFoundError, ResolvedConfig, TestProject, TestSequencer, TestSpecification, UserConfig as TestUserConfig, FilesNotFoundError as TestsNotFoundError, Vitest, VitestOptions, VitestPlugin, VitestRunMode, TestProject as WorkspaceProject, createDebugger, createMethodsRPC, createViteLogger, createViteServer, createVitest, distDir, isValidApiRequest, parseCLI, registerConsoleShortcuts, resolveApiServerConfig, resolveConfig, resolveFsAllow, rolldownVersion, rootDir, startVitest, version };
170
- export type { CliParseOptions, GlobalSetupContext, CollectLineNumbers as TypeCheckCollectLineNumbers, CollectLines as TypeCheckCollectLines, Context as TypeCheckContext, TscErrorInfo as TypeCheckErrorInfo, RawErrsMap as TypeCheckRawErrorsMap, RootAndTarget as TypeCheckRootAndTarget };
167
+ export type { CliParseOptions, CollectLineNumbers as TypeCheckCollectLineNumbers, CollectLines as TypeCheckCollectLines, Context as TypeCheckContext, TscErrorInfo as TypeCheckErrorInfo, RawErrsMap as TypeCheckRawErrorsMap, RootAndTarget as TypeCheckRootAndTarget };
package/dist/node.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as vite from 'vite';
2
2
  import { resolveConfig as resolveConfig$1, mergeConfig } from 'vite';
3
3
  export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
4
- import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.Dn5gKePv.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.Dn5gKePv.js';
6
- export { p as parseCLI } from './chunks/cac.D3EzDDZd.js';
7
- import { r as resolveConfig$2 } from './chunks/coverage.Cwa-XhJt.js';
8
- export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.Cwa-XhJt.js';
4
+ import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.BUkNuHvl.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.BUkNuHvl.js';
6
+ export { p as parseCLI } from './chunks/cac.CVVvMokL.js';
7
+ import { r as resolveConfig$2 } from './chunks/coverage.BjMqihzx.js';
8
+ export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.BjMqihzx.js';
9
9
  import { slash, deepClone } from '@vitest/utils';
10
10
  import { f as findUp } from './chunks/index.X0nbfr6-.js';
11
11
  import { resolve } from 'pathe';
@@ -20,7 +20,7 @@ import '@vitest/snapshot/manager';
20
20
  import 'vite-node/client';
21
21
  import 'vite-node/server';
22
22
  import './chunks/index.B521nVV-.js';
23
- import './chunks/index.CZI_8rVt.js';
23
+ import './chunks/index.a-yuRg2G.js';
24
24
  import 'node:fs/promises';
25
25
  import './chunks/typechecker.CVytUJuF.js';
26
26
  import 'node:os';
@@ -53,7 +53,7 @@ import 'vite-node/utils';
53
53
  import '@vitest/mocker/node';
54
54
  import './chunks/defaults.CXFFjsi8.js';
55
55
  import 'magic-string';
56
- import './chunks/index.TfbsX-3I.js';
56
+ import './chunks/index.CJvUWPky.js';
57
57
  import 'node:assert';
58
58
  import '@vitest/utils/error';
59
59
  import 'node:readline';
@@ -1,12 +1,12 @@
1
- export { aM as BaseReporter, aN as BenchmarkBuiltinReporters, az as BenchmarkReporter, aA as BenchmarkReportsMap, aO as BuiltinReporterOptions, aP as BuiltinReporters, aB as DefaultReporter, aC as DotReporter, aD as GithubActionsReporter, aE as HangingProcessReporter, aG as JUnitReporter, aQ as JsonAssertionResult, aF as JsonReporter, aR as JsonTestResult, aS as JsonTestResults, aw as ReportedHookContext, ax as Reporter, aH as ReportersMap, aI as TapFlatReporter, aJ as TapReporter, ay as TestRunEndReason, aK as VerboseBenchmarkReporter, aL as VerboseReporter } from './chunks/reporters.d.DxZg19fy.js';
1
+ export { aM as BaseReporter, aN as BenchmarkBuiltinReporters, az as BenchmarkReporter, aA as BenchmarkReportsMap, aO as BuiltinReporterOptions, aP as BuiltinReporters, aB as DefaultReporter, aC as DotReporter, aD as GithubActionsReporter, aE as HangingProcessReporter, aG as JUnitReporter, aQ as JsonAssertionResult, aF as JsonReporter, aR as JsonTestResult, aS as JsonTestResults, aw as ReportedHookContext, ax as Reporter, aH as ReportersMap, aI as TapFlatReporter, aJ as TapReporter, ay as TestRunEndReason, aK as VerboseBenchmarkReporter, aL as VerboseReporter } from './chunks/reporters.d.BbsDWlO9.js';
2
2
  import '@vitest/runner';
3
3
  import './chunks/environment.d.CUq4cUgQ.js';
4
4
  import '@vitest/utils';
5
5
  import 'node:stream';
6
6
  import 'vite';
7
7
  import 'node:console';
8
- import './chunks/browser.d.q8Z0P0q1.js';
9
- import './chunks/worker.d.DoNjFAiv.js';
8
+ import './chunks/browser.d.DP0ACFkh.js';
9
+ import './chunks/worker.d.COAQvn4k.js';
10
10
  import './chunks/config.d.HJdfX-8k.js';
11
11
  import '@vitest/pretty-format';
12
12
  import '@vitest/snapshot';
package/dist/reporters.js CHANGED
@@ -1,5 +1,5 @@
1
- export { 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.CZI_8rVt.js';
2
- export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.TfbsX-3I.js';
1
+ export { 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.a-yuRg2G.js';
2
+ export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.CJvUWPky.js';
3
3
  import 'node:fs';
4
4
  import 'node:fs/promises';
5
5
  import 'pathe';
package/dist/runners.js CHANGED
@@ -4,13 +4,13 @@ import { a as getBenchOptions, g as getBenchFn } from './chunks/benchmark.CYdenm
4
4
  import { g as getWorkerState } from './chunks/utils.XdZDrNZV.js';
5
5
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
6
6
  import { getTests, getNames, getTestName } from '@vitest/runner/utils';
7
+ import { processError } from '@vitest/utils/error';
7
8
  import { normalize } from 'pathe';
8
9
  import { g as getSnapshotClient, i as inject, c as createExpect, v as vi } from './chunks/vi.bdSIJ99Y.js';
9
10
  import { r as rpc } from './chunks/rpc.CsFtxqeq.js';
10
11
  import 'chai';
11
12
  import './chunks/_commonjsHelpers.BFTU3MAI.js';
12
13
  import '@vitest/snapshot';
13
- import '@vitest/utils/error';
14
14
  import '@vitest/spy';
15
15
  import '@vitest/utils/source-map';
16
16
  import './chunks/date.Bq6ZW5rf.js';
@@ -156,6 +156,13 @@ class VitestTestRunner {
156
156
  this.snapshotClient.skipTest(suite.file.filepath, name);
157
157
  }
158
158
  const result = await this.snapshotClient.finish(suite.file.filepath);
159
+ if (this.workerState.config.snapshotOptions.updateSnapshot === "none" && result.unchecked) {
160
+ let message = `Obsolete snapshots found when no snapshot update is expected.\n`;
161
+ for (const key of result.uncheckedKeys) message += `· ${key}\n`;
162
+ suite.result.errors ??= [];
163
+ suite.result.errors.push(processError(new Error(message)));
164
+ suite.result.state = "fail";
165
+ }
159
166
  await rpc().snapshotSaved(result);
160
167
  }
161
168
  this.workerState.current = suite.suite || suite.file;
package/dist/workers.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { W as WorkerGlobalState, C as ContextRPC, B as BirpcOptions, R as RuntimeRPC } from './chunks/worker.d.DoNjFAiv.js';
1
+ import { W as WorkerGlobalState, C as ContextRPC, B as BirpcOptions, R as RuntimeRPC } from './chunks/worker.d.COAQvn4k.js';
2
2
  import { Awaitable } from '@vitest/utils';
3
3
  import * as v8 from 'v8';
4
4
  import { a as SerializedConfig } from './chunks/config.d.HJdfX-8k.js';
5
- import { W as WorkerContext } from './chunks/worker.d.CmvJfRGs.js';
5
+ import { W as WorkerContext } from './chunks/worker.d.CVn8WGlF.js';
6
6
  import '@vitest/runner';
7
7
  import './chunks/environment.d.CUq4cUgQ.js';
8
8
  import '@vitest/snapshot';
package/globals.d.ts CHANGED
@@ -1,20 +1,20 @@
1
1
  declare global {
2
- const suite: typeof import('vitest')['suite']
3
- const test: typeof import('vitest')['test']
4
- const chai: typeof import("vitest")["chai"]
5
- const describe: typeof import('vitest')['describe']
6
- const it: typeof import('vitest')['it']
7
- const expectTypeOf: typeof import('vitest')['expectTypeOf']
8
- const assertType: typeof import('vitest')['assertType']
9
- const expect: typeof import('vitest')['expect']
10
- const assert: typeof import('vitest')['assert']
11
- const vitest: typeof import('vitest')['vitest']
12
- const vi: typeof import('vitest')['vitest']
13
- const beforeAll: typeof import('vitest')['beforeAll']
14
- const afterAll: typeof import('vitest')['afterAll']
15
- const beforeEach: typeof import('vitest')['beforeEach']
16
- const afterEach: typeof import('vitest')['afterEach']
17
- const onTestFailed: typeof import('vitest')['onTestFailed']
18
- const onTestFinished: typeof import('vitest')['onTestFinished']
2
+ let suite: typeof import('vitest')['suite']
3
+ let test: typeof import('vitest')['test']
4
+ let chai: typeof import("vitest")["chai"]
5
+ let describe: typeof import('vitest')['describe']
6
+ let it: typeof import('vitest')['it']
7
+ let expectTypeOf: typeof import('vitest')['expectTypeOf']
8
+ let assertType: typeof import('vitest')['assertType']
9
+ let expect: typeof import('vitest')['expect']
10
+ let assert: typeof import('vitest')['assert']
11
+ let vitest: typeof import('vitest')['vitest']
12
+ let vi: typeof import('vitest')['vitest']
13
+ let beforeAll: typeof import('vitest')['beforeAll']
14
+ let afterAll: typeof import('vitest')['afterAll']
15
+ let beforeEach: typeof import('vitest')['beforeEach']
16
+ let afterEach: typeof import('vitest')['afterEach']
17
+ let onTestFailed: typeof import('vitest')['onTestFailed']
18
+ let onTestFinished: typeof import('vitest')['onTestFinished']
19
19
  }
20
20
  export {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "4.0.0-beta.1",
4
+ "version": "4.0.0-beta.2",
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": "4.0.0-beta.1",
123
- "@vitest/ui": "4.0.0-beta.1"
122
+ "@vitest/ui": "4.0.0-beta.2",
123
+ "@vitest/browser": "4.0.0-beta.2"
124
124
  },
125
125
  "peerDependenciesMeta": {
126
126
  "@edge-runtime/vm": {
@@ -159,16 +159,16 @@
159
159
  "tinyglobby": "^0.2.14",
160
160
  "tinypool": "^1.1.1",
161
161
  "tinyrainbow": "^2.0.0",
162
- "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0",
162
+ "vite": "^6.0.0 || ^7.0.0-0",
163
163
  "why-is-node-running": "^2.3.0",
164
- "@vitest/expect": "4.0.0-beta.1",
165
- "@vitest/mocker": "4.0.0-beta.1",
166
- "@vitest/runner": "4.0.0-beta.1",
167
- "@vitest/snapshot": "4.0.0-beta.1",
168
- "@vitest/spy": "4.0.0-beta.1",
169
- "@vitest/pretty-format": "^4.0.0-beta.1",
170
- "@vitest/utils": "4.0.0-beta.1",
171
- "vite-node": "4.0.0-beta.1"
164
+ "@vitest/expect": "4.0.0-beta.2",
165
+ "@vitest/snapshot": "4.0.0-beta.2",
166
+ "@vitest/mocker": "4.0.0-beta.2",
167
+ "@vitest/pretty-format": "^4.0.0-beta.2",
168
+ "@vitest/runner": "4.0.0-beta.2",
169
+ "@vitest/utils": "4.0.0-beta.2",
170
+ "@vitest/spy": "4.0.0-beta.2",
171
+ "vite-node": "4.0.0-beta.2"
172
172
  },
173
173
  "devDependencies": {
174
174
  "@ampproject/remapping": "^2.3.0",