vitest 4.0.0-beta.1 → 4.0.0-beta.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.
Files changed (59) hide show
  1. package/dist/browser.d.ts +6 -6
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{base.Bj3pWTr1.js → base.D5_IXzht.js} +2 -2
  4. package/dist/chunks/{benchmark.d.BwvBVTda.d.ts → benchmark.d.DAaHLpsq.d.ts} +4 -4
  5. package/dist/chunks/{browser.d.q8Z0P0q1.d.ts → browser.d.BSPEQIuf.d.ts} +5 -5
  6. package/dist/chunks/{cac.D3EzDDZd.js → cac.C30xmylc.js} +11 -18
  7. package/dist/chunks/{cli-api.Dn5gKePv.js → cli-api.DE98RCgs.js} +53 -80
  8. package/dist/chunks/{config.d.HJdfX-8k.d.ts → config.d.DZo8c7fw.d.ts} +58 -58
  9. package/dist/chunks/{console.CtFJOzRO.js → console.DoJHFxmj.js} +3 -3
  10. package/dist/chunks/{constants.DnKduX2e.js → constants.CXzqaLmq.js} +1 -4
  11. package/dist/chunks/{coverage.Cwa-XhJt.js → coverage.OOpN1tMC.js} +54 -46
  12. package/dist/chunks/{coverage.d.S9RMNXIe.d.ts → coverage.d.CNYjU4GF.d.ts} +4 -4
  13. package/dist/chunks/{creator.GK6I-cL4.js → creator.CJNzQTzZ.js} +5 -5
  14. package/dist/chunks/{environment.d.CUq4cUgQ.d.ts → environment.d.Bhm9oc0v.d.ts} +1 -1
  15. package/dist/chunks/{execute.B7h3T_Hc.js → execute.Dt-pCVcL.js} +1 -1
  16. package/dist/chunks/{global.d.CVbXEflG.d.ts → global.d.DAhT2emn.d.ts} +2 -2
  17. package/dist/chunks/{globals.Cxal6MLI.js → globals.Dgo-vS5G.js} +3 -3
  18. package/dist/chunks/{index.CZI_8rVt.js → index.Bz6b0Ib7.js} +5 -5
  19. package/dist/chunks/{index.BWf_gE5n.js → index.D1_MsKEt.js} +1 -1
  20. package/dist/chunks/{index.TfbsX-3I.js → index.D3SKT3tv.js} +1 -1
  21. package/dist/chunks/{index.D-VkfKhf.js → index.Dppt57hu.js} +1 -1
  22. package/dist/chunks/{plugin.d.C2EcJUjo.d.ts → plugin.d.CKCmge5g.d.ts} +1 -1
  23. package/dist/chunks/{reporters.d.DxZg19fy.d.ts → reporters.d.BBuiUFDc.d.ts} +115 -145
  24. package/dist/chunks/{runBaseTests.BC7ZIH5L.js → runBaseTests.Bbi_gTJQ.js} +5 -5
  25. package/dist/chunks/{setup-common.D7ZqXFx-.js → setup-common.Ebx5x0eP.js} +1 -1
  26. package/dist/chunks/{suite.d.FvehnV49.d.ts → suite.d.BJWk38HB.d.ts} +1 -1
  27. package/dist/chunks/{typechecker.CVytUJuF.js → typechecker.CMNPqJOo.js} +3 -3
  28. package/dist/chunks/{utils.CAioKnHs.js → utils.CcGm2cd1.js} +1 -1
  29. package/dist/chunks/{vi.bdSIJ99Y.js → vi.CA0EPI9Y.js} +11 -11
  30. package/dist/chunks/{vm.BThCzidc.js → vm.BUnLJt_P.js} +11 -3
  31. package/dist/chunks/{worker.d.CmvJfRGs.d.ts → worker.d.DyXSTmRq.d.ts} +1 -1
  32. package/dist/chunks/{worker.d.DoNjFAiv.d.ts → worker.d.xTcinSQw.d.ts} +9 -15
  33. package/dist/cli.js +4 -4
  34. package/dist/config.d.ts +44 -44
  35. package/dist/config.js +1 -1
  36. package/dist/coverage.d.ts +20 -18
  37. package/dist/coverage.js +3 -3
  38. package/dist/environments.d.ts +9 -9
  39. package/dist/execute.d.ts +7 -7
  40. package/dist/execute.js +1 -1
  41. package/dist/index.d.ts +29 -27
  42. package/dist/index.js +2 -2
  43. package/dist/node.d.ts +23 -24
  44. package/dist/node.js +9 -9
  45. package/dist/reporters.d.ts +7 -7
  46. package/dist/reporters.js +3 -3
  47. package/dist/runners.d.ts +1 -1
  48. package/dist/runners.js +10 -3
  49. package/dist/suite.d.ts +2 -2
  50. package/dist/worker.js +1 -1
  51. package/dist/workers/forks.js +3 -3
  52. package/dist/workers/runVmTests.js +4 -4
  53. package/dist/workers/threads.js +3 -3
  54. package/dist/workers/vmForks.js +4 -4
  55. package/dist/workers/vmThreads.js +4 -4
  56. package/dist/workers.d.ts +4 -4
  57. package/dist/workers.js +5 -5
  58. package/globals.d.ts +17 -17
  59. package/package.json +17 -17
@@ -1,21 +1,21 @@
1
1
  import { Task, CancelReason, TaskMeta, Suite, File, TestAnnotation, ImportDuration, TaskResultPack, TaskEventPack, SequenceSetupFiles, SequenceHooks } from '@vitest/runner';
2
- import { P as ProvidedContext, U as UserConsoleLog, b as Awaitable$1, c as Arrayable$1, A as AfterSuiteRunMeta, L as LabelColor } from './environment.d.CUq4cUgQ.js';
2
+ import { P as ProvidedContext, U as UserConsoleLog, b as Awaitable$1, c as Arrayable$1, A as AfterSuiteRunMeta, L as LabelColor } from './environment.d.Bhm9oc0v.js';
3
3
  import { ParsedStack, Awaitable, TestError, SerializedError, Arrayable } from '@vitest/utils';
4
4
  import { Writable } from 'node:stream';
5
- import { ViteDevServer, ModuleNode, TransformResult as TransformResult$1, UserConfig as UserConfig$1, DepOptimizationConfig, ServerOptions, ConfigEnv, AliasOptions } from 'vite';
5
+ import { ViteDevServer, ModuleNode, TransformResult as TransformResult$1, DepOptimizationConfig, ServerOptions, UserConfig as UserConfig$1, 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.BSPEQIuf.js';
8
8
  import { MockedModule } from '@vitest/mocker';
9
9
  import { StackTraceParserOptions } from '@vitest/utils/source-map';
10
- import { a as SerializedConfig, F as FakeTimerInstallOpts } from './config.d.HJdfX-8k.js';
10
+ import { a as SerializedConfig, F as FakeTimerInstallOpts } from './config.d.DZo8c7fw.js';
11
11
  import { PrettyFormatOptions } from '@vitest/pretty-format';
12
12
  import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
13
13
  import { SerializedDiffOptions } from '@vitest/utils/diff';
14
14
  import { ViteNodeServerOptions } from 'vite-node';
15
15
  import * as chai from 'chai';
16
16
  import { happyDomTypes, jsdomTypes } from 'vitest/optional-types.js';
17
- import { B as BenchmarkResult } from './benchmark.d.BwvBVTda.js';
18
- import { a as RuntimeCoverageProviderModule } from './coverage.d.S9RMNXIe.js';
17
+ import { B as BenchmarkResult } from './benchmark.d.DAaHLpsq.js';
18
+ import { a as RuntimeCoverageProviderModule } from './coverage.d.CNYjU4GF.js';
19
19
  import { SnapshotManager } from '@vitest/snapshot/manager';
20
20
  import { Stats } from 'node:fs';
21
21
 
@@ -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
@@ -233,12 +233,12 @@ interface BrowserConfigOptions {
233
233
  * Width of the viewport
234
234
  * @default 414
235
235
  */
236
- width: number
236
+ width: number;
237
237
  /**
238
238
  * Height of the viewport
239
239
  * @default 896
240
240
  */
241
- height: number
241
+ height: number;
242
242
  };
243
243
  /**
244
244
  * Locator options
@@ -248,7 +248,7 @@ interface BrowserConfigOptions {
248
248
  * Attribute used to locate elements by test id
249
249
  * @default 'data-testid'
250
250
  */
251
- testIdAttribute?: string
251
+ testIdAttribute?: string;
252
252
  };
253
253
  /**
254
254
  * Directory where screenshots will be saved when page.screenshot() is called
@@ -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 {
@@ -362,12 +360,12 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
362
360
  api: ApiConfig;
363
361
  ui: boolean;
364
362
  viewport: {
365
- width: number
366
- height: number
363
+ width: number;
364
+ height: number;
367
365
  };
368
366
  screenshotFailures: boolean;
369
367
  locators: {
370
- testIdAttribute: string
368
+ testIdAttribute: string;
371
369
  };
372
370
  }
373
371
 
@@ -386,8 +384,8 @@ declare class ReportedTaskImplementation {
386
384
  * Location in the module where the test or suite is defined.
387
385
  */
388
386
  readonly location: {
389
- line: number
390
- column: number
387
+ line: number;
388
+ column: number;
391
389
  } | undefined;
392
390
  /**
393
391
  * Checks if the test did not fail the suite.
@@ -475,11 +473,11 @@ declare class TestCollection {
475
473
  }
476
474
 
477
475
  type ReportedHookContext = {
478
- readonly name: "beforeAll" | "afterAll"
479
- readonly entity: TestSuite | TestModule
476
+ readonly name: "beforeAll" | "afterAll";
477
+ readonly entity: TestSuite | TestModule;
480
478
  } | {
481
- readonly name: "beforeEach" | "afterEach"
482
- readonly entity: TestCase
479
+ readonly name: "beforeEach" | "afterEach";
480
+ readonly entity: TestCase;
483
481
  };
484
482
  declare abstract class SuiteImplementation extends ReportedTaskImplementation {
485
483
  /**
@@ -815,7 +813,7 @@ declare class TestSpecification {
815
813
  * @deprecated use `pool` instead
816
814
  */
817
815
  readonly 2: {
818
- pool: Pool
816
+ pool: Pool;
819
817
  };
820
818
  /**
821
819
  * The task ID associated with the test module.
@@ -854,7 +852,7 @@ declare class TestSpecification {
854
852
  declare class TestProject {
855
853
  /** @deprecated */
856
854
  path: string | number;
857
- options?: InitializeProjectOptions | undefined;
855
+ options?: Vitest;
858
856
  /**
859
857
  * The global Vitest instance.
860
858
  * @experimental The public Vitest API is experimental and does not follow semver.
@@ -957,11 +955,11 @@ declare class TestProject {
957
955
  /**
958
956
  * Test files that match the filters.
959
957
  */
960
- testFiles: string[]
958
+ testFiles: string[];
961
959
  /**
962
960
  * Typecheck test files that match the filters. This will be empty unless `typecheck.enabled` is `true`.
963
961
  */
964
- typecheckTestFiles: string[]
962
+ typecheckTestFiles: string[];
965
963
  }>;
966
964
  private globAllTestFiles;
967
965
  isBrowserEnabled(): boolean;
@@ -1011,7 +1009,7 @@ interface InitializeProjectOptions extends TestProjectInlineConfiguration {
1011
1009
  * @deprecated use TestSpecification instead
1012
1010
  */
1013
1011
  type WorkspaceSpec = TestSpecification & [project: TestProject, file: string, options: {
1014
- pool: Pool
1012
+ pool: Pool;
1015
1013
  }];
1016
1014
  type RunWithFiles = (files: TestSpecification[], invalidates?: string[]) => Awaitable<void>;
1017
1015
  interface ProcessPool {
@@ -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[];
@@ -1062,14 +1060,14 @@ declare class VitestCache {
1062
1060
  constructor(version: string);
1063
1061
  getFileTestResults(key: string): SuiteResultCache | undefined;
1064
1062
  getFileStats(key: string): {
1065
- size: number
1063
+ size: number;
1066
1064
  } | undefined;
1067
1065
  static resolveCacheDir(root: string, dir?: string, projectName?: string): string;
1068
1066
  }
1069
1067
 
1070
1068
  declare class VitestPackageInstaller {
1071
1069
  isPackageExists(name: string, options?: {
1072
- paths?: string[]
1070
+ paths?: string[];
1073
1071
  }): boolean;
1074
1072
  ensureInstalled(dependency: string, root: string, version?: string): Promise<boolean>;
1075
1073
  }
@@ -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;
@@ -1173,7 +1175,6 @@ declare class Vitest {
1173
1175
  private _state?;
1174
1176
  private _cache?;
1175
1177
  private _snapshot?;
1176
- private _workspaceConfigPath?;
1177
1178
  constructor(mode: VitestRunMode, cliOptions: UserConfig, options?: VitestOptions);
1178
1179
  private _onRestartListeners;
1179
1180
  private _onClose;
@@ -1240,7 +1241,6 @@ declare class Vitest {
1240
1241
  * @param moduleId The ID of the module in Vite module graph
1241
1242
  */
1242
1243
  import<T>(moduleId: string): Promise<T>;
1243
- private resolveWorkspaceConfigPath;
1244
1244
  private resolveProjects;
1245
1245
  /**
1246
1246
  * Glob test files in every project and create a TestSpecification for each file and pool.
@@ -1742,8 +1742,6 @@ interface ClassnameTemplateVariables {
1742
1742
  }
1743
1743
  interface JUnitOptions {
1744
1744
  outputFile?: string;
1745
- /** @deprecated Use `classnameTemplate` instead. */
1746
- classname?: string;
1747
1745
  /**
1748
1746
  * Template for the classname attribute. Can be either a string or a function. The string can contain placeholders {filename} and {filepath}.
1749
1747
  */
@@ -1837,17 +1835,17 @@ declare class VerboseReporter extends DefaultReporter {
1837
1835
  }
1838
1836
 
1839
1837
  type FormattedBenchmarkResult = BenchmarkResult & {
1840
- id: string
1838
+ id: string;
1841
1839
  };
1842
1840
 
1843
1841
  declare function renderTable(options: {
1844
- tasks: Task[]
1845
- level: number
1846
- shallow?: boolean
1847
- showHeap: boolean
1848
- columns: number
1849
- slowTestThreshold: number
1850
- compare?: Record<Task["id"], FormattedBenchmarkResult>
1842
+ tasks: Task[];
1843
+ level: number;
1844
+ shallow?: boolean;
1845
+ showHeap: boolean;
1846
+ columns: number;
1847
+ slowTestThreshold: number;
1848
+ compare?: Record<Task["id"], FormattedBenchmarkResult>;
1851
1849
  }): string;
1852
1850
 
1853
1851
  declare class BenchmarkReporter extends DefaultReporter {
@@ -1865,22 +1863,22 @@ declare class VerboseBenchmarkReporter extends BenchmarkReporter {
1865
1863
  }
1866
1864
 
1867
1865
  declare const BenchmarkReportsMap: {
1868
- default: typeof BenchmarkReporter
1869
- verbose: typeof VerboseBenchmarkReporter
1866
+ default: typeof BenchmarkReporter;
1867
+ verbose: typeof VerboseBenchmarkReporter;
1870
1868
  };
1871
1869
  type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
1872
1870
 
1873
1871
  declare const ReportersMap: {
1874
- default: typeof DefaultReporter
1875
- blob: typeof BlobReporter
1876
- verbose: typeof VerboseReporter
1877
- dot: typeof DotReporter
1878
- json: typeof JsonReporter
1879
- tap: typeof TapReporter
1880
- "tap-flat": typeof TapFlatReporter
1881
- junit: typeof JUnitReporter
1882
- "hanging-process": typeof HangingProcessReporter
1883
- "github-actions": typeof GithubActionsReporter
1872
+ default: typeof DefaultReporter;
1873
+ blob: typeof BlobReporter;
1874
+ verbose: typeof VerboseReporter;
1875
+ dot: typeof DotReporter;
1876
+ json: typeof JsonReporter;
1877
+ tap: typeof TapReporter;
1878
+ "tap-flat": typeof TapFlatReporter;
1879
+ junit: typeof JUnitReporter;
1880
+ "hanging-process": typeof HangingProcessReporter;
1881
+ "github-actions": typeof GithubActionsReporter;
1884
1882
  };
1885
1883
  type BuiltinReporters = keyof typeof ReportersMap;
1886
1884
  interface BuiltinReporterOptions {
@@ -2070,23 +2068,23 @@ type CoverageReporter = keyof ReportOptions | (string & {});
2070
2068
  type CoverageReporterWithOptions<ReporterName extends CoverageReporter = CoverageReporter> = ReporterName extends keyof ReportOptions ? ReportOptions[ReporterName] extends never ? [ReporterName, object] : [ReporterName, Partial<ReportOptions[ReporterName]>] : [ReporterName, Record<string, unknown>];
2071
2069
  type CoverageProviderName = "v8" | "istanbul" | "custom" | undefined;
2072
2070
  type CoverageOptions<T extends CoverageProviderName = CoverageProviderName> = T extends "istanbul" ? {
2073
- provider: T
2071
+ provider: T;
2074
2072
  } & CoverageIstanbulOptions : T extends "v8" ? {
2075
2073
  /**
2076
2074
  * Provider to use for coverage collection.
2077
2075
  *
2078
2076
  * @default 'v8'
2079
2077
  */
2080
- provider: T
2078
+ provider: T;
2081
2079
  } & CoverageV8Options : T extends "custom" ? {
2082
- provider: T
2080
+ provider: T;
2083
2081
  } & CustomProviderOptions : {
2084
- provider?: T
2082
+ provider?: T;
2085
2083
  } & CoverageV8Options;
2086
2084
  /** Fields that have default values. Internally these will always be defined. */
2087
2085
  type FieldsWithDefaultValues = "enabled" | "clean" | "cleanOnRerun" | "reportsDirectory" | "exclude" | "reportOnFailure" | "allowExternal" | "processingConcurrency";
2088
2086
  type ResolvedCoverageOptions<T extends CoverageProviderName = CoverageProviderName> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
2089
- reporter: CoverageReporterWithOptions[]
2087
+ reporter: CoverageReporterWithOptions[];
2090
2088
  };
2091
2089
  interface BaseCoverageOptions {
2092
2090
  /**
@@ -2162,7 +2160,7 @@ interface BaseCoverageOptions {
2162
2160
  * ```
2163
2161
  */
2164
2162
  thresholds?: Thresholds | ({
2165
- [glob: string]: Pick<Thresholds, 100 | "statements" | "functions" | "branches" | "lines">
2163
+ [glob: string]: Pick<Thresholds, 100 | "statements" | "functions" | "branches" | "lines">;
2166
2164
  } & Thresholds);
2167
2165
  /**
2168
2166
  * Watermarks for statements, lines, branches and functions.
@@ -2170,10 +2168,10 @@ interface BaseCoverageOptions {
2170
2168
  * Default value is `[50,80]` for each property.
2171
2169
  */
2172
2170
  watermarks?: {
2173
- statements?: [number, number]
2174
- functions?: [number, number]
2175
- branches?: [number, number]
2176
- lines?: [number, number]
2171
+ statements?: [number, number];
2172
+ functions?: [number, number];
2173
+ branches?: [number, number];
2174
+ lines?: [number, number];
2177
2175
  };
2178
2176
  /**
2179
2177
  * Generate coverage report even when tests fail.
@@ -2284,12 +2282,12 @@ interface SequenceOptions {
2284
2282
  * earlier if you enable this option.
2285
2283
  * @default false
2286
2284
  */
2287
- files?: boolean
2285
+ files?: boolean;
2288
2286
  /**
2289
2287
  * Should tests run in random order.
2290
2288
  * @default false
2291
2289
  */
2292
- tests?: boolean
2290
+ tests?: boolean;
2293
2291
  };
2294
2292
  /**
2295
2293
  * Should tests run in parallel.
@@ -2318,7 +2316,7 @@ interface SequenceOptions {
2318
2316
  hooks?: SequenceHooks;
2319
2317
  }
2320
2318
  type DepsOptimizationOptions = Omit<DepOptimizationConfig, "disabled" | "noDiscovery"> & {
2321
- enabled?: boolean
2319
+ enabled?: boolean;
2322
2320
  };
2323
2321
  interface TransformModePatterns {
2324
2322
  /**
@@ -2342,8 +2340,8 @@ interface DepsOptions {
2342
2340
  * Enable dependency optimization. This can improve the performance of your tests.
2343
2341
  */
2344
2342
  optimizer?: {
2345
- web?: DepsOptimizationOptions
2346
- ssr?: DepsOptimizationOptions
2343
+ web?: DepsOptimizationOptions;
2344
+ ssr?: DepsOptimizationOptions;
2347
2345
  };
2348
2346
  web?: {
2349
2347
  /**
@@ -2355,7 +2353,7 @@ interface DepsOptions {
2355
2353
  *
2356
2354
  * @default true
2357
2355
  */
2358
- transformAssets?: boolean
2356
+ transformAssets?: boolean;
2359
2357
  /**
2360
2358
  * Should Vitest process CSS (.css, .scss, .sass, etc) files and resolve them like Vite does in the browser.
2361
2359
  *
@@ -2365,7 +2363,7 @@ interface DepsOptions {
2365
2363
  *
2366
2364
  * @default true
2367
2365
  */
2368
- transformCss?: boolean
2366
+ transformCss?: boolean;
2369
2367
  /**
2370
2368
  * Regexp pattern to match external files that should be transformed.
2371
2369
  *
@@ -2375,7 +2373,7 @@ interface DepsOptions {
2375
2373
  *
2376
2374
  * @default []
2377
2375
  */
2378
- transformGlobPattern?: RegExp | RegExp[]
2376
+ transformGlobPattern?: RegExp | RegExp[];
2379
2377
  };
2380
2378
  /**
2381
2379
  * Externalize means that Vite will bypass the package to native Node.
@@ -2492,23 +2490,6 @@ interface InlineConfig {
2492
2490
  */
2493
2491
  environmentOptions?: EnvironmentOptions;
2494
2492
  /**
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
2493
  * Run tests in an isolated environment. This option has no effect on vmThreads pool.
2513
2494
  *
2514
2495
  * Disabling this option might improve performance if your code doesn't rely on side effects.
@@ -2544,30 +2525,10 @@ interface InlineConfig {
2544
2525
  */
2545
2526
  fileParallelism?: boolean;
2546
2527
  /**
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
2528
  * Options for projects
2563
2529
  */
2564
2530
  projects?: TestProjectConfiguration[];
2565
2531
  /**
2566
- * Path to a workspace configuration file
2567
- * @deprecated use `projects` instead
2568
- */
2569
- workspace?: string | TestProjectConfiguration[];
2570
- /**
2571
2532
  * Update snapshot
2572
2533
  *
2573
2534
  * @default false
@@ -2723,7 +2684,9 @@ interface InlineConfig {
2723
2684
  /**
2724
2685
  * Format options for snapshot testing.
2725
2686
  */
2726
- snapshotFormat?: Omit<PrettyFormatOptions, "plugins">;
2687
+ snapshotFormat?: Omit<PrettyFormatOptions, "plugins" | "compareKeys"> & {
2688
+ compareKeys?: null | undefined;
2689
+ };
2727
2690
  /**
2728
2691
  * Path to a module which has a default export of diff config.
2729
2692
  */
@@ -2776,6 +2739,10 @@ interface InlineConfig {
2776
2739
  */
2777
2740
  onStackTrace?: (error: TestError, frame: ParsedStack) => boolean | void;
2778
2741
  /**
2742
+ * A callback that can return `false` to ignore an unhandled error
2743
+ */
2744
+ onUnhandledError?: OnUnhandledErrorCallback;
2745
+ /**
2779
2746
  * Indicates if CSS files should be processed.
2780
2747
  *
2781
2748
  * When excluded, the CSS files will be replaced with empty strings to bypass the subsequent processing.
@@ -2783,11 +2750,11 @@ interface InlineConfig {
2783
2750
  * @default { include: [], modules: { classNameStrategy: false } }
2784
2751
  */
2785
2752
  css?: boolean | {
2786
- include?: RegExp | RegExp[]
2787
- exclude?: RegExp | RegExp[]
2753
+ include?: RegExp | RegExp[];
2754
+ exclude?: RegExp | RegExp[];
2788
2755
  modules?: {
2789
- classNameStrategy?: CSSModuleScopeStrategy
2790
- }
2756
+ classNameStrategy?: CSSModuleScopeStrategy;
2757
+ };
2791
2758
  };
2792
2759
  /**
2793
2760
  * A number of tests that are allowed to run at the same time marked with `test.concurrent`.
@@ -2802,7 +2769,7 @@ interface InlineConfig {
2802
2769
  /**
2803
2770
  * @deprecated Use Vite's "cacheDir" instead if you want to change the cache director. Note caches will be written to "cacheDir\/vitest".
2804
2771
  */
2805
- dir: string
2772
+ dir: string;
2806
2773
  };
2807
2774
  /**
2808
2775
  * Options for configuring the order of running tests.
@@ -2855,19 +2822,19 @@ interface InlineConfig {
2855
2822
  /**
2856
2823
  * Enable inspector
2857
2824
  */
2858
- enabled?: boolean
2825
+ enabled?: boolean;
2859
2826
  /**
2860
2827
  * Port to run inspector on
2861
2828
  */
2862
- port?: number
2829
+ port?: number;
2863
2830
  /**
2864
2831
  * Host to run inspector on
2865
2832
  */
2866
- host?: string
2833
+ host?: string;
2867
2834
  /**
2868
2835
  * Wait for debugger to connect before running tests
2869
2836
  */
2870
- waitForDebugger?: boolean
2837
+ waitForDebugger?: boolean;
2871
2838
  };
2872
2839
  /**
2873
2840
  * Define variables that will be returned from `inject` in the test environment.
@@ -2896,7 +2863,7 @@ interface InlineConfig {
2896
2863
  /**
2897
2864
  * Throw an error if tests don't have any expect() assertions.
2898
2865
  */
2899
- requireAssertions?: boolean
2866
+ requireAssertions?: boolean;
2900
2867
  /**
2901
2868
  * Default options for expect.poll()
2902
2869
  */
@@ -2905,13 +2872,13 @@ interface InlineConfig {
2905
2872
  * Timeout in milliseconds
2906
2873
  * @default 1000
2907
2874
  */
2908
- timeout?: number
2875
+ timeout?: number;
2909
2876
  /**
2910
2877
  * Polling interval in milliseconds
2911
2878
  * @default 50
2912
2879
  */
2913
- interval?: number
2914
- }
2880
+ interval?: number;
2881
+ };
2915
2882
  };
2916
2883
  /**
2917
2884
  * Modify default Chai config. Vitest uses Chai for `expect` and `assert` matches.
@@ -3021,7 +2988,7 @@ interface UserConfig extends InlineConfig {
3021
2988
  *
3022
2989
  * Vitest will only run tests if it's called programmatically or the test file changes.
3023
2990
  *
3024
- * CLI file filters will be ignored.
2991
+ * If CLI file filters are passed, standalone mode is ignored.
3025
2992
  */
3026
2993
  standalone?: boolean;
3027
2994
  /**
@@ -3076,6 +3043,9 @@ interface UserConfig extends InlineConfig {
3076
3043
  */
3077
3044
  mergeReports?: string;
3078
3045
  }
3046
+ type OnUnhandledErrorCallback = (error: (TestError | Error) & {
3047
+ type: string;
3048
+ }) => boolean | void;
3079
3049
  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
3050
  mode: VitestRunMode;
3081
3051
  name: ProjectName["label"];
@@ -3097,47 +3067,47 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config"
3097
3067
  reporters: (InlineReporter | ReporterWithOptions)[];
3098
3068
  defines: Record<string, any>;
3099
3069
  api: ApiConfig & {
3100
- token: string
3070
+ token: string;
3101
3071
  };
3102
3072
  cliExclude?: string[];
3103
3073
  project: string[];
3104
3074
  benchmark?: Required<Omit<BenchmarkUserOptions, "outputFile" | "compare" | "outputJson">> & Pick<BenchmarkUserOptions, "outputFile" | "compare" | "outputJson">;
3105
3075
  shard?: {
3106
- index: number
3107
- count: number
3076
+ index: number;
3077
+ count: number;
3108
3078
  };
3109
3079
  cache: {
3110
3080
  /**
3111
3081
  * @deprecated
3112
3082
  */
3113
- dir: string
3083
+ dir: string;
3114
3084
  } | false;
3115
3085
  sequence: {
3116
- sequencer: TestSequencerConstructor
3117
- hooks: SequenceHooks
3118
- setupFiles: SequenceSetupFiles
3119
- shuffle?: boolean
3120
- concurrent?: boolean
3121
- seed: number
3122
- groupOrder: number
3086
+ sequencer: TestSequencerConstructor;
3087
+ hooks: SequenceHooks;
3088
+ setupFiles: SequenceSetupFiles;
3089
+ shuffle?: boolean;
3090
+ concurrent?: boolean;
3091
+ seed: number;
3092
+ groupOrder: number;
3123
3093
  };
3124
3094
  typecheck: Omit<TypecheckConfig, "enabled"> & {
3125
- enabled: boolean
3095
+ enabled: boolean;
3126
3096
  };
3127
3097
  runner?: string;
3128
3098
  maxWorkers: number;
3129
3099
  minWorkers: number;
3130
3100
  }
3131
- type NonProjectOptions = "shard" | "watch" | "run" | "cache" | "update" | "reporters" | "outputFile" | "teardownTimeout" | "silent" | "forceRerunTriggers" | "testNamePattern" | "ui" | "open" | "uiBase" | "snapshotFormat" | "resolveSnapshotPath" | "passWithNoTests" | "onConsoleLog" | "onStackTrace" | "dangerouslyIgnoreUnhandledErrors" | "slowTestThreshold" | "inspect" | "inspectBrk" | "coverage" | "maxWorkers" | "minWorkers" | "fileParallelism" | "workspace" | "watchTriggerPatterns";
3101
+ type NonProjectOptions = "shard" | "watch" | "run" | "cache" | "update" | "reporters" | "outputFile" | "teardownTimeout" | "silent" | "forceRerunTriggers" | "testNamePattern" | "ui" | "open" | "uiBase" | "snapshotFormat" | "resolveSnapshotPath" | "passWithNoTests" | "onConsoleLog" | "onStackTrace" | "dangerouslyIgnoreUnhandledErrors" | "slowTestThreshold" | "inspect" | "inspectBrk" | "coverage" | "maxWorkers" | "minWorkers" | "fileParallelism" | "watchTriggerPatterns";
3132
3102
  type ProjectConfig = Omit<InlineConfig, NonProjectOptions | "sequencer" | "deps" | "poolOptions"> & {
3133
- mode?: string
3134
- sequencer?: Omit<SequenceOptions, "sequencer" | "seed">
3135
- deps?: Omit<DepsOptions, "moduleDirectories">
3103
+ mode?: string;
3104
+ sequencer?: Omit<SequenceOptions, "sequencer" | "seed">;
3105
+ deps?: Omit<DepsOptions, "moduleDirectories">;
3136
3106
  poolOptions?: {
3137
- threads?: Pick<NonNullable<PoolOptions["threads"]>, "singleThread" | "isolate">
3138
- vmThreads?: Pick<NonNullable<PoolOptions["vmThreads"]>, "singleThread">
3139
- forks?: Pick<NonNullable<PoolOptions["forks"]>, "singleFork" | "isolate">
3140
- }
3107
+ threads?: Pick<NonNullable<PoolOptions["threads"]>, "singleThread" | "isolate">;
3108
+ vmThreads?: Pick<NonNullable<PoolOptions["vmThreads"]>, "singleThread">;
3109
+ forks?: Pick<NonNullable<PoolOptions["forks"]>, "singleFork" | "isolate">;
3110
+ };
3141
3111
  };
3142
3112
  type ResolvedProjectConfig = Omit<ResolvedConfig, Exclude<NonProjectOptions, "coverage" | "watch">>;
3143
3113
  interface UserWorkspaceConfig extends UserConfig$1 {
@@ -3152,7 +3122,7 @@ type TestProjectInlineConfiguration = (UserWorkspaceConfig & {
3152
3122
  * If `true`, the project will inherit all options from the root config.
3153
3123
  * @example '../vite.config.ts'
3154
3124
  */
3155
- extends?: string | true
3125
+ extends?: string | true;
3156
3126
  });
3157
3127
  type TestProjectConfiguration = string | TestProjectInlineConfiguration | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
3158
3128
 
@@ -1,8 +1,8 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import { startTests, collectTests } from '@vitest/runner';
3
- import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.D-VkfKhf.js';
4
- import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.D7ZqXFx-.js';
5
- import { a as globalExpect, v as vi } from './vi.bdSIJ99Y.js';
3
+ import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.Dppt57hu.js';
4
+ import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.Ebx5x0eP.js';
5
+ import { a as globalExpect, v as vi } from './vi.CA0EPI9Y.js';
6
6
  import { c as closeInspector } from './inspector.C914Efll.js';
7
7
  import { createRequire } from 'node:module';
8
8
  import timers from 'node:timers';
@@ -11,7 +11,7 @@ import util from 'node:util';
11
11
  import { getSafeTimers } from '@vitest/utils';
12
12
  import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
13
13
  import { installSourcemapsSupport } from 'vite-node/source-map';
14
- import { V as VitestIndex } from './index.BWf_gE5n.js';
14
+ import { V as VitestIndex } from './index.D1_MsKEt.js';
15
15
  import { g as getWorkerState, r as resetModules } from './utils.XdZDrNZV.js';
16
16
  import 'chai';
17
17
  import 'node:path';
@@ -72,7 +72,7 @@ function resolveAsset(mod, url) {
72
72
  mod.exports = url;
73
73
  }
74
74
  async function setupConsoleLogSpy() {
75
- const { createCustomConsole } = await import('./console.CtFJOzRO.js');
75
+ const { createCustomConsole } = await import('./console.DoJHFxmj.js');
76
76
  globalThis.console = createCustomConsole();
77
77
  }
78
78
  async function withEnv({ environment }, options, fn) {
@@ -25,7 +25,7 @@ async function setupCommonEnv(config) {
25
25
  if (globalSetup) return;
26
26
  globalSetup = true;
27
27
  setSafeTimers();
28
- if (config.globals) (await import('./globals.Cxal6MLI.js')).registerApiGlobally();
28
+ if (config.globals) (await import('./globals.Dgo-vS5G.js')).registerApiGlobally();
29
29
  }
30
30
  function setupDefines(defines) {
31
31
  for (const key in defines) globalThis[key] = defines[key];
@@ -1,5 +1,5 @@
1
1
  import { Test } from '@vitest/runner';
2
- import { c as BenchmarkAPI, a as BenchFunction } from './benchmark.d.BwvBVTda.js';
2
+ import { c as BenchmarkAPI, a as BenchFunction } from './benchmark.d.DAaHLpsq.js';
3
3
  import { Options } from 'tinybench';
4
4
  import '@vitest/runner/utils';
5
5