vitest 2.1.3 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE.md +1 -209
  2. package/dist/browser.d.ts +24 -24
  3. package/dist/browser.js +7 -7
  4. package/dist/chunks/{RandomSequencer.Bh5-tlNJ.js → RandomSequencer.CMRlh2v4.js} +143 -142
  5. package/dist/chunks/{base.BO5Jx7vw.js → base.BZZh4cSm.js} +3 -3
  6. package/dist/chunks/{benchmark.C8CRJYG4.js → benchmark.Cdu9hjj4.js} +2 -2
  7. package/dist/chunks/{benchmark.JVlTzojj.d.ts → benchmark.geERunq4.d.ts} +1 -1
  8. package/dist/chunks/{cac.BSMVokHR.js → cac.DWAW3Uh5.js} +11 -10
  9. package/dist/chunks/{cli-api.btGgw3PC.js → cli-api.BtqJwSCh.js} +828 -644
  10. package/dist/chunks/{config.Crbj2GAb.d.ts → config.Cy0C388Z.d.ts} +0 -1
  11. package/dist/chunks/{console.CfT1Wjed.js → console.BYGVloWk.js} +2 -6
  12. package/dist/chunks/{coverage.zlNdAMHK.js → coverage.BoMDb1ip.js} +1 -1
  13. package/dist/chunks/{creator.CBPphXqR.js → creator.IIqd8RWT.js} +8 -8
  14. package/dist/chunks/{execute._eQQfgI8.js → execute.2pr0rHgK.js} +8 -6
  15. package/dist/chunks/{globals.Bdzt04Qm.js → globals.D8ZVAdXd.js} +8 -13
  16. package/dist/chunks/{index.BpSiYbpB.js → index.68735LiX.js} +28 -5
  17. package/dist/chunks/{index.X0nbfr6-.js → index.BJDntFik.js} +7 -7
  18. package/dist/chunks/{index.CPD77dLA.js → index.CqYx2Nsr.js} +7 -7
  19. package/dist/chunks/{index.Dz2opmmU.js → index.DsZFoqi9.js} +3711 -3788
  20. package/dist/chunks/{index.lVXYBqEP.js → index.K90BXFOx.js} +186 -186
  21. package/dist/chunks/index.ckWaX2gY.js +54 -0
  22. package/dist/chunks/{index.4GFF2h22.js → index.nEwtF0bu.js} +6 -6
  23. package/dist/chunks/{node.Bx4JZjMG.js → node.AKq966Jp.js} +1 -5
  24. package/dist/chunks/{reporters.C4ZHgdxQ.d.ts → reporters.D7Jzd9GS.d.ts} +1246 -1221
  25. package/dist/chunks/{resolveConfig.Dha6ilPI.js → resolveConfig.RxKrDli4.js} +3196 -3176
  26. package/dist/chunks/{rpc.B7Mfb-Yf.js → rpc.C3q9uwRX.js} +2 -2
  27. package/dist/chunks/{run-once.Sxe67Wng.js → run-once.2ogXb3JV.js} +1 -1
  28. package/dist/chunks/{runBaseTests.Cx4wXyTR.js → runBaseTests.3qpJUEJM.js} +21 -25
  29. package/dist/chunks/{setup-common.BKyF15v_.js → setup-common.Dj6BZI3u.js} +3 -3
  30. package/dist/chunks/{suite.BMWOKiTe.d.ts → suite.B2jumIFP.d.ts} +2 -2
  31. package/dist/chunks/utils.C8RiOc4B.js +77 -0
  32. package/dist/chunks/{utils.CY6Spixo.js → utils.DNoFbBUZ.js} +7 -3
  33. package/dist/chunks/{vi.BskyZC5g.js → vi.DgezovHB.js} +177 -142
  34. package/dist/chunks/{vite.YH7MrecS.d.ts → vite.C-N5BBZe.d.ts} +1 -1
  35. package/dist/chunks/{vm.DB_hLchi.js → vm.Zr4qWzDJ.js} +8 -8
  36. package/dist/chunks/{worker.CcJLfX8w.d.ts → worker.B9FxPCaC.d.ts} +1 -1
  37. package/dist/chunks/{worker.B6RjTtbk.d.ts → worker.tN5KGIih.d.ts} +14 -4
  38. package/dist/cli.js +3 -4
  39. package/dist/config.cjs +4 -4
  40. package/dist/config.d.ts +11 -11
  41. package/dist/config.js +4 -4
  42. package/dist/coverage.d.ts +10 -10
  43. package/dist/coverage.js +8 -11
  44. package/dist/environments.d.ts +2 -2
  45. package/dist/environments.js +1 -1
  46. package/dist/execute.d.ts +54 -54
  47. package/dist/execute.js +7 -6
  48. package/dist/index.d.ts +106 -1101
  49. package/dist/index.js +7 -18
  50. package/dist/node.d.ts +44 -42
  51. package/dist/node.js +23 -29
  52. package/dist/path.js +1 -1
  53. package/dist/reporters.d.ts +10 -10
  54. package/dist/reporters.js +12 -18
  55. package/dist/runners.d.ts +12 -19
  56. package/dist/runners.js +142 -148
  57. package/dist/snapshot.js +2 -6
  58. package/dist/suite.d.ts +2 -2
  59. package/dist/suite.js +2 -6
  60. package/dist/worker.js +10 -7
  61. package/dist/workers/forks.js +9 -8
  62. package/dist/workers/runVmTests.js +16 -20
  63. package/dist/workers/threads.js +9 -8
  64. package/dist/workers/vmForks.js +9 -12
  65. package/dist/workers/vmThreads.js +9 -12
  66. package/dist/workers.d.ts +14 -14
  67. package/dist/workers.js +15 -18
  68. package/package.json +27 -27
  69. package/dist/chunks/base.DwXGwWst.js +0 -89
  70. package/dist/chunks/env.CmHVDJnw.js +0 -7
  71. package/dist/chunks/index.-d_XpZEA.js +0 -140
  72. package/dist/chunks/index.CxRxs566.js +0 -23
  73. package/dist/chunks/tasks.BZnCS9aT.js +0 -18
  74. package/dist/chunks/utils.Ck2hJTRs.js +0 -23
  75. package/dist/chunks/{environment.CzISCQ7o.d.ts → environment.LoooBwUu.d.ts} +24 -24
@@ -1,270 +1,141 @@
1
1
  import * as _vitest_runner from '@vitest/runner';
2
- import { File, Test, Suite, TaskResultPack, Task, CancelReason, Custom, TaskMeta, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
2
+ import { File, TaskResultPack, Task, Test, Suite, CancelReason, Custom, TaskMeta, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
3
+ import { b as Awaitable, U as UserConsoleLog, P as ProvidedContext, A as AfterSuiteRunMeta, c as Arrayable$1, f as EnvironmentOptions, d as ArgumentsType, O as OnServerRestartHandler } from './environment.LoooBwUu.js';
4
+ import { Writable } from 'node:stream';
3
5
  import * as vite from 'vite';
4
6
  import { ViteDevServer, TransformResult as TransformResult$1, ServerOptions, DepOptimizationConfig, AliasOptions, UserConfig as UserConfig$1, ConfigEnv } from 'vite';
7
+ import { ParsedStack, Awaitable as Awaitable$1, ErrorWithDiff, TestError, Arrayable } from '@vitest/utils';
8
+ import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.Cy0C388Z.js';
5
9
  import { PrettyFormatOptions } from '@vitest/pretty-format';
6
- import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.Crbj2GAb.js';
7
- import { RawSourceMap, ViteNodeServerOptions } from 'vite-node';
8
10
  import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
9
- import { b as Awaitable, P as ProvidedContext, U as UserConsoleLog, A as AfterSuiteRunMeta, c as Arrayable, d as ArgumentsType, O as OnServerRestartHandler, f as EnvironmentOptions } from './environment.CzISCQ7o.js';
10
- import { Writable } from 'node:stream';
11
+ import { RawSourceMap, ViteNodeServerOptions } from 'vite-node';
12
+ import * as chai from 'chai';
13
+ import { StackTraceParserOptions } from '@vitest/utils/source-map';
11
14
  import { ViteNodeRunner } from 'vite-node/client';
12
- import { SnapshotManager } from '@vitest/snapshot/manager';
13
15
  import { ViteNodeServer } from 'vite-node/server';
14
- import { ParsedStack, Awaitable as Awaitable$1, ErrorWithDiff, TestError, Arrayable as Arrayable$1 } from '@vitest/utils';
15
- import { StackTraceParserOptions } from '@vitest/utils/source-map';
16
+ import { B as BenchmarkResult } from './benchmark.geERunq4.js';
17
+ import { SnapshotManager } from '@vitest/snapshot/manager';
16
18
  import { Stats } from 'node:fs';
17
- import * as chai from 'chai';
18
- import { B as BenchmarkResult } from './benchmark.JVlTzojj.js';
19
19
 
20
- type BuiltinPool = 'browser' | 'threads' | 'forks' | 'vmThreads' | 'vmForks' | 'typescript';
21
- type Pool = BuiltinPool | (string & {});
22
- interface PoolOptions extends Record<string, unknown> {
23
- /**
24
- * Run tests in `node:worker_threads`.
25
- *
26
- * Test isolation (when enabled) is done by spawning a new thread for each test file.
27
- *
28
- * This pool is used by default.
29
- */
30
- threads?: ThreadsOptions & WorkerContextOptions;
31
- /**
32
- * Run tests in `node:child_process` using [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
33
- *
34
- * Test isolation (when enabled) is done by spawning a new child process for each test file.
35
- */
36
- forks?: ForksOptions & WorkerContextOptions;
37
- /**
38
- * Run tests in isolated `node:vm`.
39
- * Test files are run parallel using `node:worker_threads`.
40
- *
41
- * This makes tests run faster, but VM module is unstable. Your tests might leak memory.
42
- */
43
- vmThreads?: ThreadsOptions & VmOptions;
44
- /**
45
- * Run tests in isolated `node:vm`.
46
- *
47
- * Test files are run parallel using `node:child_process` [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
48
- *
49
- * This makes tests run faster, but VM module is unstable. Your tests might leak memory.
50
- */
51
- vmForks?: ForksOptions & VmOptions;
20
+ type SerializedTestSpecification = [
21
+ project: {
22
+ name: string | undefined;
23
+ root: string;
24
+ },
25
+ file: string,
26
+ options: {
27
+ pool: string;
28
+ }
29
+ ];
30
+
31
+ type ChaiConfig = Omit<Partial<typeof chai.config>, 'useProxy' | 'proxyExcludedKeys'>;
32
+
33
+ interface Reporter {
34
+ onInit?: (ctx: Vitest) => void;
35
+ onPathsCollected?: (paths?: string[]) => Awaitable<void>;
36
+ onSpecsCollected?: (specs?: SerializedTestSpecification[]) => Awaitable<void>;
37
+ onCollected?: (files?: File[]) => Awaitable<void>;
38
+ onFinished?: (files: File[], errors: unknown[], coverage?: unknown) => Awaitable<void>;
39
+ onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
40
+ onTestRemoved?: (trigger?: string) => Awaitable<void>;
41
+ onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
42
+ onWatcherRerun?: (files: string[], trigger?: string) => Awaitable<void>;
43
+ onServerRestart?: (reason?: string) => Awaitable<void>;
44
+ onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
45
+ onProcessTimeout?: () => Awaitable<void>;
52
46
  }
53
- interface ResolvedPoolOptions extends PoolOptions {
54
- threads?: ResolvedThreadsOptions & WorkerContextOptions;
55
- forks?: ResolvedForksOptions & WorkerContextOptions;
56
- vmThreads?: ResolvedThreadsOptions & VmOptions;
57
- vmForks?: ResolvedForksOptions & VmOptions;
47
+
48
+ interface BaseOptions {
49
+ isTTY?: boolean;
58
50
  }
59
- interface ThreadsOptions {
60
- /** Minimum amount of threads to use */
61
- minThreads?: number | string;
62
- /** Maximum amount of threads to use */
63
- maxThreads?: number | string;
64
- /**
65
- * Run tests inside a single thread.
66
- *
67
- * @default false
68
- */
69
- singleThread?: boolean;
70
- /**
71
- * Use Atomics to synchronize threads
72
- *
73
- * This can improve performance in some cases, but might cause segfault in older Node versions.
74
- *
75
- * @default false
76
- */
77
- useAtomics?: boolean;
51
+ declare abstract class BaseReporter implements Reporter {
52
+ start: number;
53
+ end: number;
54
+ watchFilters?: string[];
55
+ failedUnwatchedFiles: Task[];
56
+ isTTY: boolean;
57
+ ctx: Vitest;
58
+ protected verbose: boolean;
59
+ private _filesInWatchMode;
60
+ private _timeStart;
61
+ private _lastRunTimeout;
62
+ private _lastRunTimer;
63
+ private _lastRunCount;
64
+ constructor(options?: BaseOptions);
65
+ onInit(ctx: Vitest): void;
66
+ log(...messages: any): void;
67
+ error(...messages: any): void;
68
+ relative(path: string): string;
69
+ onFinished(files?: File[], errors?: unknown[]): void;
70
+ onTaskUpdate(packs: TaskResultPack[]): void;
71
+ protected printTask(task: Task): void;
72
+ private getDurationPrefix;
73
+ onWatcherStart(files?: File[], errors?: unknown[]): void;
74
+ private resetLastRunLog;
75
+ onWatcherRerun(files: string[], trigger?: string): void;
76
+ onUserConsoleLog(log: UserConsoleLog): void;
77
+ onTestRemoved(trigger?: string): void;
78
+ shouldLog(log: UserConsoleLog): boolean;
79
+ onServerRestart(reason?: string): void;
80
+ reportSummary(files: File[], errors: unknown[]): void;
81
+ reportTestSummary(files: File[], errors: unknown[]): void;
82
+ private printErrorsSummary;
83
+ reportBenchmarkSummary(files: File[]): void;
84
+ private printTaskErrors;
78
85
  }
79
- interface ResolvedThreadsOptions extends ThreadsOptions {
80
- minThreads?: number;
81
- maxThreads?: number;
86
+
87
+ interface ParsedFile extends File {
88
+ start: number;
89
+ end: number;
82
90
  }
83
- interface ForksOptions {
84
- /** Minimum amount of child processes to use */
85
- minForks?: number | string;
86
- /** Maximum amount of child processes to use */
87
- maxForks?: number | string;
88
- /**
89
- * Run tests inside a single fork.
90
- *
91
- * @default false
92
- */
93
- singleFork?: boolean;
91
+ interface ParsedTest extends Test {
92
+ start: number;
93
+ end: number;
94
94
  }
95
- interface ResolvedForksOptions extends ForksOptions {
96
- minForks?: number;
97
- maxForks?: number;
95
+ interface ParsedSuite extends Suite {
96
+ start: number;
97
+ end: number;
98
98
  }
99
- interface WorkerContextOptions {
100
- /**
101
- * Isolate test environment by recycling `worker_threads` or `child_process` after each test
102
- *
103
- * @default true
104
- */
105
- isolate?: boolean;
106
- /**
107
- * Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
108
- *
109
- * See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
110
- *
111
- * Set to `process.execArgv` to pass all arguments of the current process.
112
- *
113
- * Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
114
- *
115
- * @default [] // no execution arguments are passed
116
- */
117
- execArgv?: string[];
99
+ interface LocalCallDefinition {
100
+ start: number;
101
+ end: number;
102
+ name: string;
103
+ type: 'suite' | 'test';
104
+ mode: 'run' | 'skip' | 'only' | 'todo';
105
+ task: ParsedSuite | ParsedFile | ParsedTest;
118
106
  }
119
- interface VmOptions {
120
- /**
121
- * Specifies the memory limit for `worker_thread` or `child_process` before they are recycled.
122
- * If you see memory leaks, try to tinker this value.
123
- */
124
- memoryLimit?: string | number;
125
- /** Isolation is always enabled */
126
- isolate?: true;
127
- /**
128
- * Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
129
- *
130
- * See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
131
- *
132
- * Set to `process.execArgv` to pass all arguments of the current process.
133
- *
134
- * Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
135
- *
136
- * @default [] // no execution arguments are passed
137
- */
138
- execArgv?: string[];
107
+ interface FileInformation {
108
+ file: File;
109
+ filepath: string;
110
+ parsed: string;
111
+ map: RawSourceMap | null;
112
+ definitions: LocalCallDefinition[];
139
113
  }
140
114
 
141
- interface Options {
142
- /**
143
- Show the cursor. This can be useful when a CLI accepts input from a user.
144
-
145
- @example
146
- ```
147
- import {createLogUpdate} from 'log-update';
148
-
149
- // Write output but don't hide the cursor
150
- const log = createLogUpdate(process.stdout, {
151
- showCursor: true
152
- });
153
- ```
154
- */
155
- readonly showCursor?: boolean;
115
+ type RawErrsMap = Map<string, TscErrorInfo[]>;
116
+ interface TscErrorInfo {
117
+ filePath: string;
118
+ errCode: number;
119
+ errMsg: string;
120
+ line: number;
121
+ column: number;
156
122
  }
157
-
158
- type LogUpdateMethods = {
159
- /**
160
- Clear the logged output.
161
- */
162
- clear(): void;
163
-
164
- /**
165
- Persist the logged output. Useful if you want to start a new log session below the current one.
166
- */
167
- done(): void;
168
- };
169
-
170
- /**
171
- Log to `stdout` by overwriting the previous output in the terminal.
172
-
173
- @param text - The text to log to `stdout`.
174
-
175
- @example
176
- ```
177
- import logUpdate from 'log-update';
178
-
179
- const frames = ['-', '\\', '|', '/'];
180
- let index = 0;
181
-
182
- setInterval(() => {
183
- const frame = frames[index = ++index % frames.length];
184
-
185
- logUpdate(
186
- `
187
- ♥♥
188
- ${frame} unicorns ${frame}
189
- ♥♥
190
- `
191
- );
192
- }, 80);
193
- ```
194
- */
195
- declare const logUpdate: ((...text: string[]) => void) & LogUpdateMethods;
196
-
197
-
198
- /**
199
- Get a `logUpdate` method that logs to the specified stream.
200
-
201
- @param stream - The stream to log to.
202
-
203
- @example
204
- ```
205
- import {createLogUpdate} from 'log-update';
206
-
207
- // Write output but don't hide the cursor
208
- const log = createLogUpdate(process.stdout);
209
- ```
210
- */
211
- declare function createLogUpdate(
212
- stream: NodeJS.WritableStream,
213
- options?: Options
214
- ): typeof logUpdate;
215
-
216
- interface ParsedFile extends File {
217
- start: number;
218
- end: number;
219
- }
220
- interface ParsedTest extends Test {
221
- start: number;
222
- end: number;
223
- }
224
- interface ParsedSuite extends Suite {
225
- start: number;
226
- end: number;
227
- }
228
- interface LocalCallDefinition {
229
- start: number;
230
- end: number;
231
- name: string;
232
- type: 'suite' | 'test';
233
- mode: 'run' | 'skip' | 'only' | 'todo';
234
- task: ParsedSuite | ParsedFile | ParsedTest;
235
- }
236
- interface FileInformation {
237
- file: File;
238
- filepath: string;
239
- parsed: string;
240
- map: RawSourceMap | null;
241
- definitions: LocalCallDefinition[];
242
- }
243
-
244
- type RawErrsMap = Map<string, TscErrorInfo[]>;
245
- interface TscErrorInfo {
246
- filePath: string;
247
- errCode: number;
248
- errMsg: string;
249
- line: number;
250
- column: number;
251
- }
252
- interface CollectLineNumbers {
253
- target: number;
254
- next: number;
255
- prev?: number;
256
- }
257
- type CollectLines = {
258
- [key in keyof CollectLineNumbers]: string;
259
- };
260
- interface RootAndTarget {
261
- root: string;
262
- targetAbsPath: string;
263
- }
264
- type Context = RootAndTarget & {
265
- rawErrsMap: RawErrsMap;
266
- openedDirs: Set<string>;
267
- lastActivePath?: string;
123
+ interface CollectLineNumbers {
124
+ target: number;
125
+ next: number;
126
+ prev?: number;
127
+ }
128
+ type CollectLines = {
129
+ [key in keyof CollectLineNumbers]: string;
130
+ };
131
+ interface RootAndTarget {
132
+ root: string;
133
+ targetAbsPath: string;
134
+ }
135
+ type Context = RootAndTarget & {
136
+ rawErrsMap: RawErrsMap;
137
+ openedDirs: Set<string>;
138
+ lastActivePath?: string;
268
139
  };
269
140
 
270
141
  declare class TypeCheckError extends Error {
@@ -326,6 +197,81 @@ interface PrintErrorResult {
326
197
  nearest?: ParsedStack;
327
198
  }
328
199
 
200
+ interface Options {
201
+ /**
202
+ Show the cursor. This can be useful when a CLI accepts input from a user.
203
+
204
+ @example
205
+ ```
206
+ import {createLogUpdate} from 'log-update';
207
+
208
+ // Write output but don't hide the cursor
209
+ const log = createLogUpdate(process.stdout, {
210
+ showCursor: true
211
+ });
212
+ ```
213
+ */
214
+ readonly showCursor?: boolean;
215
+ }
216
+
217
+ type LogUpdateMethods = {
218
+ /**
219
+ Clear the logged output.
220
+ */
221
+ clear(): void;
222
+
223
+ /**
224
+ Persist the logged output. Useful if you want to start a new log session below the current one.
225
+ */
226
+ done(): void;
227
+ };
228
+
229
+ /**
230
+ Log to `stdout` by overwriting the previous output in the terminal.
231
+
232
+ @param text - The text to log to `stdout`.
233
+
234
+ @example
235
+ ```
236
+ import logUpdate from 'log-update';
237
+
238
+ const frames = ['-', '\\', '|', '/'];
239
+ let index = 0;
240
+
241
+ setInterval(() => {
242
+ const frame = frames[index = ++index % frames.length];
243
+
244
+ logUpdate(
245
+ `
246
+ ♥♥
247
+ ${frame} unicorns ${frame}
248
+ ♥♥
249
+ `
250
+ );
251
+ }, 80);
252
+ ```
253
+ */
254
+ declare const logUpdate: ((...text: string[]) => void) & LogUpdateMethods;
255
+
256
+
257
+ /**
258
+ Get a `logUpdate` method that logs to the specified stream.
259
+
260
+ @param stream - The stream to log to.
261
+
262
+ @example
263
+ ```
264
+ import {createLogUpdate} from 'log-update';
265
+
266
+ // Write output but don't hide the cursor
267
+ const log = createLogUpdate(process.stdout);
268
+ ```
269
+ */
270
+ declare function createLogUpdate(
271
+ stream: NodeJS.WritableStream,
272
+ options?: Options
273
+ ): typeof logUpdate;
274
+
329
275
  interface ErrorOptions {
330
276
  type?: string;
331
277
  fullStack?: boolean;
@@ -347,7 +293,7 @@ declare class Logger {
347
293
  log(...args: any[]): void;
348
294
  error(...args: any[]): void;
349
295
  warn(...args: any[]): void;
350
- clearFullScreen(message: string): void;
296
+ clearFullScreen(message?: string): void;
351
297
  clearScreen(message: string, force?: boolean): void;
352
298
  private _clearScreen;
353
299
  printError(err: unknown, options?: ErrorOptions): PrintErrorResult | undefined;
@@ -355,8 +301,10 @@ declare class Logger {
355
301
  highlight(filename: string, source: string): string;
356
302
  printNoTestFound(filters?: string[]): void;
357
303
  printBanner(): void;
304
+ printBrowserBanner(project: WorkspaceProject): void;
358
305
  printUnhandledErrors(errors: unknown[]): void;
359
306
  printSourceTypeErrors(errors: TypeCheckError[]): void;
307
+ private registerUnhandledRejection;
360
308
  }
361
309
 
362
310
  interface BrowserProviderInitializationOptions {
@@ -488,8 +436,13 @@ interface BrowserConfigOptions {
488
436
  screenshotFailures?: boolean;
489
437
  /**
490
438
  * Scripts injected into the tester iframe.
439
+ * @deprecated Will be removed in the future, use `testerHtmlPath` instead.
491
440
  */
492
441
  testerScripts?: BrowserScript[];
442
+ /**
443
+ * Path to the index.html file that will be used to run tests.
444
+ */
445
+ testerHtmlPath?: string;
493
446
  /**
494
447
  * Scripts injected into the main window.
495
448
  */
@@ -516,6 +469,7 @@ interface BrowserServerStateContext {
516
469
  interface BrowserOrchestrator {
517
470
  createTesters: (files: string[]) => Promise<void>;
518
471
  onCancel: (reason: CancelReason) => Promise<void>;
472
+ $close: () => void;
519
473
  }
520
474
  interface BrowserServerState {
521
475
  orchestrators: Map<string, BrowserOrchestrator>;
@@ -579,50 +533,6 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
579
533
  };
580
534
  }
581
535
 
582
- declare class TestProject {
583
- /**
584
- * The global vitest instance.
585
- * @experimental The public Vitest API is experimental and does not follow semver.
586
- */
587
- readonly vitest: Vitest;
588
- /**
589
- * The workspace project this test project is associated with.
590
- * @experimental The public Vitest API is experimental and does not follow semver.
591
- */
592
- readonly workspaceProject: WorkspaceProject;
593
- /**
594
- * Resolved project configuration.
595
- */
596
- readonly config: ResolvedProjectConfig;
597
- /**
598
- * Resolved global configuration. If there are no workspace projects, this will be the same as `config`.
599
- */
600
- readonly globalConfig: ResolvedConfig;
601
- /**
602
- * The name of the project or an empty string if not set.
603
- */
604
- readonly name: string;
605
- constructor(workspaceProject: WorkspaceProject);
606
- /**
607
- * Serialized project configuration. This is the config that tests receive.
608
- */
609
- get serializedConfig(): SerializedConfig;
610
- /**
611
- * Custom context provided to the project.
612
- */
613
- context(): ProvidedContext;
614
- /**
615
- * Provide a custom serializable context to the project. This context will be available for tests once they run.
616
- */
617
- provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
618
- toJSON(): SerializedTestProject;
619
- }
620
- interface SerializedTestProject {
621
- name: string;
622
- serializedConfig: SerializedConfig;
623
- context: ProvidedContext;
624
- }
625
-
626
536
  interface InitializeProjectOptions extends UserWorkspaceConfig {
627
537
  workspaceConfigPath: string;
628
538
  extends?: string;
@@ -670,7 +580,7 @@ declare class WorkspaceProject {
670
580
  isTargetFile(id: string, source?: string): Promise<boolean>;
671
581
  isInSourceTestFile(code: string): boolean;
672
582
  filterFiles(testFiles: string[], filters: string[], dir: string): string[];
673
- initBrowserServer(configFile: string | undefined): Promise<void>;
583
+ initBrowserServer(): Promise<void>;
674
584
  static createBasicProject(ctx: Vitest): WorkspaceProject;
675
585
  static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
676
586
  setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
@@ -681,82 +591,31 @@ declare class WorkspaceProject {
681
591
  initBrowserProvider(): Promise<void>;
682
592
  }
683
593
 
684
- type SerializedTestSpecification = [
685
- project: {
686
- name: string | undefined;
687
- root: string;
688
- },
689
- file: string,
690
- options: {
691
- pool: string;
692
- }
693
- ];
594
+ interface BlobOptions {
595
+ outputFile?: string;
596
+ }
597
+ declare class BlobReporter implements Reporter {
598
+ ctx: Vitest;
599
+ options: BlobOptions;
600
+ constructor(options: BlobOptions);
601
+ onInit(ctx: Vitest): void;
602
+ onFinished(files: File[] | undefined, errors: unknown[] | undefined, coverage: unknown): Promise<void>;
603
+ }
694
604
 
695
- declare class TestSpecification {
605
+ interface HTMLOptions {
606
+ outputFile?: string;
607
+ }
608
+
609
+ declare class ReportedTaskImplementation {
696
610
  /**
697
- * @deprecated use `project` instead
611
+ * Task instance.
612
+ * @experimental Public runner task API is experimental and does not follow semver.
698
613
  */
699
- readonly 0: WorkspaceProject;
614
+ readonly task: Task;
700
615
  /**
701
- * @deprecated use `moduleId` instead
616
+ * The project assosiacted with the test or suite.
702
617
  */
703
- readonly 1: string;
704
- /**
705
- * @deprecated use `pool` instead
706
- */
707
- readonly 2: {
708
- pool: Pool;
709
- };
710
- readonly project: TestProject;
711
- readonly moduleId: string;
712
- readonly pool: Pool;
713
- constructor(workspaceProject: WorkspaceProject, moduleId: string, pool: Pool);
714
- toJSON(): SerializedTestSpecification;
715
- /**
716
- * for backwards compatibility
717
- * @deprecated
718
- */
719
- [Symbol.iterator](): Generator<string | WorkspaceProject, void, unknown>;
720
- }
721
-
722
- /**
723
- * @deprecated use TestSpecification instead
724
- */
725
- type WorkspaceSpec = TestSpecification & [
726
- /**
727
- * @deprecated use spec.project instead
728
- */
729
- project: WorkspaceProject,
730
- /**
731
- * @deprecated use spec.moduleId instead
732
- */
733
- file: string,
734
- /**
735
- * @deprecated use spec.pool instead
736
- */
737
- options: {
738
- pool: Pool;
739
- }
740
- ];
741
- type RunWithFiles = (files: WorkspaceSpec[], invalidates?: string[]) => Awaitable$1<void>;
742
- interface ProcessPool {
743
- name: string;
744
- runTests: RunWithFiles;
745
- collectTests: RunWithFiles;
746
- close?: () => Awaitable$1<void>;
747
- }
748
- declare function getFilePoolName(project: WorkspaceProject, file: string): Pool;
749
-
750
- declare class ReportedTaskImplementation {
751
- /**
752
- * Task instance.
753
- * @experimental Public runner task API is experimental and does not follow semver.
754
- */
755
- readonly task: Task;
756
- /**
757
- * The project assosiacted with the test or suite.
758
- */
759
- readonly project: TestProject;
618
+ readonly project: TestProject;
760
619
  /**
761
620
  * Unique identifier.
762
621
  * This ID is deterministic and will be the same for the same test across multiple runs.
@@ -948,6 +807,10 @@ interface TestResultSkipped {
948
807
  errors: undefined;
949
808
  }
950
809
  interface TestDiagnostic {
810
+ /**
811
+ * If the duration of the test is above `slowTestThreshold`.
812
+ */
813
+ slow: boolean;
951
814
  /**
952
815
  * The amount of memory used by the test in bytes.
953
816
  * This value is only available if the test was executed with `logHeapUsage` flag.
@@ -999,140 +862,374 @@ interface ModuleDiagnostic {
999
862
  duration: number;
1000
863
  }
1001
864
 
1002
- declare class StateManager {
1003
- filesMap: Map<string, File[]>;
1004
- pathsSet: Set<string>;
1005
- idMap: Map<string, Task>;
1006
- taskFileMap: WeakMap<Task, File>;
1007
- errorsSet: Set<unknown>;
1008
- processTimeoutCauses: Set<string>;
1009
- reportedTasksMap: WeakMap<Task, TestCase | TestSuite | TestModule>;
1010
- catchError(err: unknown, type: string): void;
1011
- clearErrors(): void;
1012
- getUnhandledErrors(): unknown[];
1013
- addProcessTimeoutCause(cause: string): void;
1014
- getProcessTimeoutCauses(): string[];
1015
- getPaths(): string[];
1016
- /**
1017
- * Return files that were running or collected.
1018
- */
1019
- getFiles(keys?: string[]): File[];
1020
- getFilepaths(): string[];
1021
- getFailedFilepaths(): string[];
1022
- collectPaths(paths?: string[]): void;
1023
- collectFiles(project: WorkspaceProject, files?: File[]): void;
1024
- clearFiles(project: WorkspaceProject, paths?: string[]): void;
1025
- updateId(task: Task, project: WorkspaceProject): void;
1026
- getReportedEntity(task: Task): TestCase | TestSuite | TestModule | undefined;
1027
- updateTasks(packs: TaskResultPack[]): void;
1028
- updateUserLog(log: UserConsoleLog): void;
1029
- getCountOfFailedTests(): number;
1030
- cancelFiles(files: string[], project: WorkspaceProject): void;
865
+ declare class BasicReporter extends BaseReporter {
866
+ constructor();
867
+ reportSummary(files: File[], errors: unknown[]): void;
1031
868
  }
1032
869
 
1033
- interface SuiteResultCache {
1034
- failed: boolean;
1035
- duration: number;
1036
- }
1037
- declare class ResultsCache {
1038
- private cache;
1039
- private workspacesKeyMap;
1040
- private cachePath;
1041
- private version;
1042
- private root;
1043
- constructor(version: string);
1044
- getCachePath(): string | null;
1045
- setConfig(root: string, config: ResolvedConfig['cache']): void;
1046
- getResults(key: string): SuiteResultCache | undefined;
1047
- readFromCache(): Promise<void>;
1048
- updateResults(files: File[]): void;
1049
- removeFromCache(filepath: string): void;
1050
- writeToCache(): Promise<void>;
870
+ interface ListRendererOptions {
871
+ renderSucceed?: boolean;
872
+ logger: Logger;
873
+ showHeap: boolean;
874
+ slowTestThreshold: number;
875
+ mode: VitestRunMode;
1051
876
  }
877
+ declare function createListRenderer(_tasks: Task[], options: ListRendererOptions): {
878
+ start(): any;
879
+ update(_tasks: Task[]): any;
880
+ stop(): any;
881
+ clear(): void;
882
+ };
1052
883
 
1053
- type FileStatsCache = Pick<Stats, 'size'>;
1054
- declare class FilesStatsCache {
1055
- cache: Map<string, FileStatsCache>;
1056
- getStats(key: string): FileStatsCache | undefined;
1057
- populateStats(root: string, specs: WorkspaceSpec[]): Promise<void>;
1058
- updateStats(fsPath: string, key: string): Promise<void>;
1059
- removeStats(fsPath: string): void;
884
+ declare class DefaultReporter extends BaseReporter {
885
+ renderer?: ReturnType<typeof createListRenderer>;
886
+ rendererOptions: ListRendererOptions;
887
+ private renderSucceedDefault?;
888
+ onPathsCollected(paths?: string[]): void;
889
+ onTestRemoved(trigger?: string): Promise<void>;
890
+ onCollected(): void;
891
+ onFinished(files?: _vitest_runner.File[], errors?: unknown[]): void;
892
+ onWatcherStart(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
893
+ stopListRender(): void;
894
+ onWatcherRerun(files: string[], trigger?: string): Promise<void>;
895
+ onUserConsoleLog(log: UserConsoleLog): void;
1060
896
  }
1061
897
 
1062
- declare class VitestCache {
1063
- results: ResultsCache;
1064
- stats: FilesStatsCache;
1065
- constructor(version: string);
1066
- getFileTestResults(key: string): SuiteResultCache | undefined;
1067
- getFileStats(key: string): {
1068
- size: number;
1069
- } | undefined;
1070
- static resolveCacheDir(root: string, dir?: string, projectName?: string): string;
898
+ interface DotRendererOptions {
899
+ logger: Logger;
1071
900
  }
901
+ declare function createDotRenderer(_tasks: Task[], options: DotRendererOptions): {
902
+ start(): any;
903
+ update(_tasks: Task[]): any;
904
+ stop(): Promise<any>;
905
+ clear(): void;
906
+ };
1072
907
 
1073
- declare class VitestPackageInstaller {
1074
- ensureInstalled(dependency: string, root: string, version?: string): Promise<boolean>;
908
+ declare class DotReporter extends BaseReporter {
909
+ renderer?: ReturnType<typeof createDotRenderer>;
910
+ onCollected(): void;
911
+ onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
912
+ onWatcherStart(): Promise<void>;
913
+ stopListRender(): Promise<void>;
914
+ onWatcherRerun(files: string[], trigger?: string): Promise<void>;
915
+ onUserConsoleLog(log: UserConsoleLog): void;
1075
916
  }
1076
917
 
1077
- interface Node {
1078
- isRoot(): boolean;
1079
- visit(visitor: Visitor, state: any): void;
918
+ declare class GithubActionsReporter implements Reporter {
919
+ ctx: Vitest;
920
+ onInit(ctx: Vitest): void;
921
+ onFinished(files?: File[], errors?: unknown[]): void;
1080
922
  }
1081
923
 
1082
- interface Visitor<N extends Node = Node> {
1083
- onStart(root: N, state: any): void;
1084
- onSummary(root: N, state: any): void;
1085
- onDetail(root: N, state: any): void;
1086
- onSummaryEnd(root: N, state: any): void;
1087
- onEnd(root: N, state: any): void;
924
+ declare class HangingProcessReporter implements Reporter {
925
+ whyRunning: (() => void) | undefined;
926
+ onInit(): void;
927
+ onProcessTimeout(): void;
1088
928
  }
1089
929
 
1090
- interface FileOptions {
1091
- file: string;
930
+ type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';
931
+ type Milliseconds = number;
932
+ interface Callsite {
933
+ line: number;
934
+ column: number;
1092
935
  }
1093
-
1094
- interface ProjectOptions {
1095
- projectRoot: string;
936
+ interface JsonAssertionResult {
937
+ ancestorTitles: Array<string>;
938
+ fullName: string;
939
+ status: Status;
940
+ title: string;
941
+ meta: TaskMeta;
942
+ duration?: Milliseconds | null;
943
+ failureMessages: Array<string> | null;
944
+ location?: Callsite | null;
1096
945
  }
1097
-
1098
- interface ReportOptions {
1099
- clover: CloverOptions;
1100
- cobertura: CoberturaOptions;
1101
- "html-spa": HtmlSpaOptions;
1102
- html: HtmlOptions;
1103
- json: JsonOptions$1;
1104
- "json-summary": JsonSummaryOptions;
1105
- lcov: LcovOptions;
1106
- lcovonly: LcovOnlyOptions;
1107
- none: never;
1108
- teamcity: TeamcityOptions;
1109
- text: TextOptions;
1110
- "text-lcov": TextLcovOptions;
1111
- "text-summary": TextSummaryOptions;
946
+ interface JsonTestResult {
947
+ message: string;
948
+ name: string;
949
+ status: 'failed' | 'passed';
950
+ startTime: number;
951
+ endTime: number;
952
+ assertionResults: Array<JsonAssertionResult>;
1112
953
  }
1113
-
1114
- interface CloverOptions extends FileOptions, ProjectOptions {}
1115
-
1116
- interface CoberturaOptions extends FileOptions, ProjectOptions {}
1117
-
1118
- interface HtmlSpaOptions extends HtmlOptions {
1119
- metricsToShow: Array<"lines" | "branches" | "functions" | "statements">;
954
+ interface JsonTestResults {
955
+ numFailedTests: number;
956
+ numFailedTestSuites: number;
957
+ numPassedTests: number;
958
+ numPassedTestSuites: number;
959
+ numPendingTests: number;
960
+ numPendingTestSuites: number;
961
+ numTodoTests: number;
962
+ numTotalTests: number;
963
+ numTotalTestSuites: number;
964
+ startTime: number;
965
+ success: boolean;
966
+ testResults: Array<JsonTestResult>;
967
+ snapshot: SnapshotSummary;
1120
968
  }
1121
- interface HtmlOptions {
1122
- verbose: boolean;
1123
- skipEmpty: boolean;
1124
- subdir: string;
1125
- linkMapper: LinkMapper;
969
+ interface JsonOptions$1 {
970
+ outputFile?: string;
1126
971
  }
1127
-
1128
- type JsonOptions$1 = FileOptions;
1129
- type JsonSummaryOptions = FileOptions;
1130
-
1131
- interface LcovOptions extends FileOptions, ProjectOptions {}
1132
- interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
1133
-
1134
- interface TeamcityOptions extends FileOptions {
1135
- blockName: string;
972
+ declare class JsonReporter implements Reporter {
973
+ start: number;
974
+ ctx: Vitest;
975
+ options: JsonOptions$1;
976
+ constructor(options: JsonOptions$1);
977
+ onInit(ctx: Vitest): void;
978
+ protected logTasks(files: File[]): Promise<void>;
979
+ onFinished(files?: File[]): Promise<void>;
980
+ /**
981
+ * Writes the report to an output file if specified in the config,
982
+ * or logs it to the console otherwise.
983
+ * @param report
984
+ */
985
+ writeReport(report: string): Promise<void>;
986
+ }
987
+
988
+ interface JUnitOptions {
989
+ outputFile?: string;
990
+ classname?: string;
991
+ suiteName?: string;
992
+ /**
993
+ * Write <system-out> and <system-err> for console output
994
+ * @default true
995
+ */
996
+ includeConsoleOutput?: boolean;
997
+ /**
998
+ * Add <testcase file="..."> attribute (validated on CIRCLE CI and GitLab CI)
999
+ * @default false
1000
+ */
1001
+ addFileAttribute?: boolean;
1002
+ }
1003
+ declare class JUnitReporter implements Reporter {
1004
+ private ctx;
1005
+ private reportFile?;
1006
+ private baseLog;
1007
+ private logger;
1008
+ private _timeStart;
1009
+ private fileFd?;
1010
+ private options;
1011
+ constructor(options: JUnitOptions);
1012
+ onInit(ctx: Vitest): Promise<void>;
1013
+ writeElement(name: string, attrs: Record<string, any>, children: () => Promise<void>): Promise<void>;
1014
+ writeLogs(task: Task, type: 'err' | 'out'): Promise<void>;
1015
+ writeTasks(tasks: Task[], filename: string): Promise<void>;
1016
+ onFinished(files?: _vitest_runner.File[]): Promise<void>;
1017
+ }
1018
+
1019
+ declare class TapReporter implements Reporter {
1020
+ protected ctx: Vitest;
1021
+ private logger;
1022
+ onInit(ctx: Vitest): void;
1023
+ static getComment(task: Task): string;
1024
+ private logErrorDetails;
1025
+ protected logTasks(tasks: Task[]): void;
1026
+ onFinished(files?: _vitest_runner.File[]): void;
1027
+ }
1028
+
1029
+ declare class TapFlatReporter extends TapReporter {
1030
+ onInit(ctx: Vitest): void;
1031
+ onFinished(files?: _vitest_runner.File[]): void;
1032
+ }
1033
+
1034
+ declare class VerboseReporter extends DefaultReporter {
1035
+ protected verbose: boolean;
1036
+ constructor();
1037
+ onTaskUpdate(packs: TaskResultPack[]): void;
1038
+ }
1039
+
1040
+ interface TableRendererOptions {
1041
+ renderSucceed?: boolean;
1042
+ logger: Logger;
1043
+ showHeap: boolean;
1044
+ slowTestThreshold: number;
1045
+ compare?: FlatBenchmarkReport;
1046
+ }
1047
+ declare function createTableRenderer(_tasks: Task[], options: TableRendererOptions): {
1048
+ start(): any;
1049
+ update(_tasks: Task[]): any;
1050
+ stop(): any;
1051
+ clear(): void;
1052
+ };
1053
+
1054
+ declare class TableReporter extends BaseReporter {
1055
+ renderer?: ReturnType<typeof createTableRenderer>;
1056
+ rendererOptions: TableRendererOptions;
1057
+ onTestRemoved(trigger?: string): void;
1058
+ onCollected(): Promise<void>;
1059
+ onTaskUpdate(packs: TaskResultPack[]): void;
1060
+ onFinished(files?: File[], errors?: unknown[]): Promise<void>;
1061
+ onWatcherStart(): Promise<void>;
1062
+ stopListRender(): void;
1063
+ onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1064
+ onUserConsoleLog(log: UserConsoleLog): void;
1065
+ }
1066
+ interface FlatBenchmarkReport {
1067
+ [id: string]: FormattedBenchmarkResult;
1068
+ }
1069
+ type FormattedBenchmarkResult = BenchmarkResult & {
1070
+ id: string;
1071
+ };
1072
+
1073
+ declare const BenchmarkReportsMap: {
1074
+ default: typeof TableReporter;
1075
+ verbose: typeof VerboseReporter;
1076
+ };
1077
+ type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
1078
+
1079
+ /**
1080
+ * @deprecated Use `TestModule` instead
1081
+ */
1082
+ declare const TestFile: typeof TestModule;
1083
+
1084
+ /**
1085
+ * @deprecated Use `ModuleDiagnostic` instead
1086
+ */
1087
+ type FileDiagnostic = ModuleDiagnostic;
1088
+
1089
+ declare const ReportersMap: {
1090
+ default: typeof DefaultReporter;
1091
+ basic: typeof BasicReporter;
1092
+ blob: typeof BlobReporter;
1093
+ verbose: typeof VerboseReporter;
1094
+ dot: typeof DotReporter;
1095
+ json: typeof JsonReporter;
1096
+ tap: typeof TapReporter;
1097
+ 'tap-flat': typeof TapFlatReporter;
1098
+ junit: typeof JUnitReporter;
1099
+ 'hanging-process': typeof HangingProcessReporter;
1100
+ 'github-actions': typeof GithubActionsReporter;
1101
+ };
1102
+ type BuiltinReporters = keyof typeof ReportersMap;
1103
+ interface BuiltinReporterOptions {
1104
+ 'default': BaseOptions;
1105
+ 'basic': BaseOptions;
1106
+ 'verbose': never;
1107
+ 'dot': BaseOptions;
1108
+ 'json': JsonOptions$1;
1109
+ 'blob': BlobOptions;
1110
+ 'tap': never;
1111
+ 'tap-flat': never;
1112
+ 'junit': JUnitOptions;
1113
+ 'hanging-process': never;
1114
+ 'html': HTMLOptions;
1115
+ }
1116
+
1117
+ interface TestSequencer {
1118
+ /**
1119
+ * Slicing tests into shards. Will be run before `sort`.
1120
+ * Only run, if `shard` is defined.
1121
+ */
1122
+ shard: (files: WorkspaceSpec[]) => Awaitable<WorkspaceSpec[]>;
1123
+ sort: (files: WorkspaceSpec[]) => Awaitable<WorkspaceSpec[]>;
1124
+ }
1125
+ interface TestSequencerConstructor {
1126
+ new (ctx: Vitest): TestSequencer;
1127
+ }
1128
+
1129
+ interface BenchmarkUserOptions {
1130
+ /**
1131
+ * Include globs for benchmark test files
1132
+ *
1133
+ * @default ['**\/*.{bench,benchmark}.?(c|m)[jt]s?(x)']
1134
+ */
1135
+ include?: string[];
1136
+ /**
1137
+ * Exclude globs for benchmark test files
1138
+ * @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
1139
+ */
1140
+ exclude?: string[];
1141
+ /**
1142
+ * Include globs for in-source benchmark test files
1143
+ *
1144
+ * @default []
1145
+ */
1146
+ includeSource?: string[];
1147
+ /**
1148
+ * Custom reporter for output. Can contain one or more built-in report names, reporter instances,
1149
+ * and/or paths to custom reporters
1150
+ *
1151
+ * @default ['default']
1152
+ */
1153
+ reporters?: Arrayable<BenchmarkBuiltinReporters | Reporter>;
1154
+ /**
1155
+ * @deprecated Use `benchmark.outputJson` instead
1156
+ */
1157
+ outputFile?: string | (Partial<Record<BenchmarkBuiltinReporters, string>> & Record<string, string>);
1158
+ /**
1159
+ * benchmark output file to compare against
1160
+ */
1161
+ compare?: string;
1162
+ /**
1163
+ * benchmark output file
1164
+ */
1165
+ outputJson?: string;
1166
+ /**
1167
+ * Include `samples` array of benchmark results for API or custom reporter usages.
1168
+ * This is disabled by default to reduce memory usage.
1169
+ * @default false
1170
+ */
1171
+ includeSamples?: boolean;
1172
+ }
1173
+
1174
+ interface Node {
1175
+ isRoot(): boolean;
1176
+ visit(visitor: Visitor, state: any): void;
1177
+ }
1178
+
1179
+ interface Visitor<N extends Node = Node> {
1180
+ onStart(root: N, state: any): void;
1181
+ onSummary(root: N, state: any): void;
1182
+ onDetail(root: N, state: any): void;
1183
+ onSummaryEnd(root: N, state: any): void;
1184
+ onEnd(root: N, state: any): void;
1185
+ }
1186
+
1187
+ interface FileOptions {
1188
+ file: string;
1189
+ }
1190
+
1191
+ interface ProjectOptions {
1192
+ projectRoot: string;
1193
+ }
1194
+
1195
+ interface ReportOptions {
1196
+ clover: CloverOptions;
1197
+ cobertura: CoberturaOptions;
1198
+ "html-spa": HtmlSpaOptions;
1199
+ html: HtmlOptions;
1200
+ json: JsonOptions;
1201
+ "json-summary": JsonSummaryOptions;
1202
+ lcov: LcovOptions;
1203
+ lcovonly: LcovOnlyOptions;
1204
+ none: never;
1205
+ teamcity: TeamcityOptions;
1206
+ text: TextOptions;
1207
+ "text-lcov": TextLcovOptions;
1208
+ "text-summary": TextSummaryOptions;
1209
+ }
1210
+
1211
+ interface CloverOptions extends FileOptions, ProjectOptions {}
1212
+
1213
+ interface CoberturaOptions extends FileOptions, ProjectOptions {}
1214
+
1215
+ interface HtmlSpaOptions extends HtmlOptions {
1216
+ metricsToShow: Array<"lines" | "branches" | "functions" | "statements">;
1217
+ }
1218
+ interface HtmlOptions {
1219
+ verbose: boolean;
1220
+ skipEmpty: boolean;
1221
+ subdir: string;
1222
+ linkMapper: LinkMapper;
1223
+ }
1224
+
1225
+ type JsonOptions = FileOptions;
1226
+ type JsonSummaryOptions = FileOptions;
1227
+
1228
+ interface LcovOptions extends FileOptions, ProjectOptions {}
1229
+ interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
1230
+
1231
+ interface TeamcityOptions extends FileOptions {
1232
+ blockName: string;
1136
1233
  }
1137
1234
 
1138
1235
  interface TextOptions extends FileOptions {
@@ -1271,7 +1368,7 @@ interface BaseCoverageOptions {
1271
1368
  *
1272
1369
  * @default ['text', 'html', 'clover', 'json']
1273
1370
  */
1274
- reporter?: Arrayable<CoverageReporter> | (CoverageReporter | [CoverageReporter] | CoverageReporterWithOptions)[];
1371
+ reporter?: Arrayable$1<CoverageReporter> | (CoverageReporter | [CoverageReporter] | CoverageReporterWithOptions)[];
1275
1372
  /**
1276
1373
  * Do not show files with 100% statement, branch, and function coverage
1277
1374
  *
@@ -1329,561 +1426,177 @@ interface BaseCoverageOptions {
1329
1426
  * Apply exclusions again after coverage has been remapped to original sources.
1330
1427
  * This is useful when your source files are transpiled and may contain source maps
1331
1428
  * of non-source files.
1332
- *
1333
- * Use this option when you are seeing files that show up in report even if they
1334
- * match your `coverage.exclude` patterns.
1335
- *
1336
- * @default false
1337
- */
1338
- excludeAfterRemap?: boolean;
1339
- /**
1340
- * Concurrency limit used when processing the coverage results.
1341
- * Defaults to `Math.min(20, os.availableParallelism?.() ?? os.cpus().length)`
1342
- */
1343
- processingConcurrency?: number;
1344
- }
1345
- interface CoverageIstanbulOptions extends BaseCoverageOptions {
1346
- /**
1347
- * Set to array of class method names to ignore for coverage
1348
- *
1349
- * @default []
1350
- */
1351
- ignoreClassMethods?: string[];
1352
- }
1353
- interface CoverageV8Options extends BaseCoverageOptions {
1354
- /**
1355
- * Ignore empty lines, comments and other non-runtime code, e.g. Typescript types
1356
- */
1357
- ignoreEmptyLines?: boolean;
1358
- }
1359
- interface CustomProviderOptions extends Pick<BaseCoverageOptions, FieldsWithDefaultValues> {
1360
- /** Name of the module or path to a file to load the custom provider from */
1361
- customProviderModule: string;
1362
- }
1363
- interface Thresholds {
1364
- /** Set global thresholds to `100` */
1365
- 100?: boolean;
1366
- /** Check thresholds per file. */
1367
- perFile?: boolean;
1368
- /**
1369
- * Update threshold values automatically when current coverage is higher than earlier thresholds
1370
- *
1371
- * @default false
1372
- */
1373
- autoUpdate?: boolean;
1374
- /** Thresholds for statements */
1375
- statements?: number;
1376
- /** Thresholds for functions */
1377
- functions?: number;
1378
- /** Thresholds for branches */
1379
- branches?: number;
1380
- /** Thresholds for lines */
1381
- lines?: number;
1382
- }
1383
-
1384
- interface VitestOptions {
1385
- packageInstaller?: VitestPackageInstaller;
1386
- stdin?: NodeJS.ReadStream;
1387
- stdout?: NodeJS.WriteStream | Writable;
1388
- stderr?: NodeJS.WriteStream | Writable;
1389
- }
1390
- declare class Vitest {
1391
- readonly mode: VitestRunMode;
1392
- version: string;
1393
- config: ResolvedConfig;
1394
- configOverride: Partial<ResolvedConfig>;
1395
- server: ViteDevServer;
1396
- state: StateManager;
1397
- snapshot: SnapshotManager;
1398
- cache: VitestCache;
1399
- reporters: Reporter[];
1400
- coverageProvider: CoverageProvider | null | undefined;
1401
- logger: Logger;
1402
- pool: ProcessPool | undefined;
1403
- vitenode: ViteNodeServer;
1404
- invalidates: Set<string>;
1405
- changedTests: Set<string>;
1406
- watchedTests: Set<string>;
1407
- filenamePattern?: string;
1408
- runningPromise?: Promise<void>;
1409
- closingPromise?: Promise<void>;
1410
- isCancelling: boolean;
1411
- isFirstRun: boolean;
1412
- restartsCount: number;
1413
- runner: ViteNodeRunner;
1414
- packageInstaller: VitestPackageInstaller;
1415
- private coreWorkspaceProject;
1416
- private resolvedProjects;
1417
- projects: WorkspaceProject[];
1418
- distPath: string;
1419
- private _cachedSpecs;
1420
- /** @deprecated use `_cachedSpecs` */
1421
- projectTestFiles: Map<string, WorkspaceSpec[]>;
1422
- constructor(mode: VitestRunMode, options?: VitestOptions);
1423
- private _onRestartListeners;
1424
- private _onClose;
1425
- private _onSetServer;
1426
- private _onCancelListeners;
1427
- setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
1428
- provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
1429
- /**
1430
- * @deprecated internal, use `_createCoreProject` instead
1431
- */
1432
- createCoreProject(): Promise<WorkspaceProject>;
1433
- /**
1434
- * @internal
1435
- */
1436
- _createCoreProject(): Promise<WorkspaceProject>;
1437
- getCoreWorkspaceProject(): WorkspaceProject;
1438
- /**
1439
- * @deprecated use Reported Task API instead
1440
- */
1441
- getProjectByTaskId(taskId: string): WorkspaceProject;
1442
- getProjectByName(name?: string): WorkspaceProject;
1443
- private getWorkspaceConfigPath;
1444
- private resolveWorkspace;
1445
- private initCoverageProvider;
1446
- private initBrowserProviders;
1447
- mergeReports(): Promise<void>;
1448
- collect(filters?: string[]): Promise<{
1449
- tests: File[];
1450
- errors: unknown[];
1451
- }>;
1452
- listFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
1453
- start(filters?: string[]): Promise<void>;
1454
- init(): Promise<void>;
1455
- private getTestDependencies;
1456
- filterTestsBySource(specs: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
1457
- /**
1458
- * @deprecated remove when vscode extension supports "getFileWorkspaceSpecs"
1459
- */
1460
- getProjectsByTestFile(file: string): WorkspaceSpec[];
1461
- getFileWorkspaceSpecs(file: string): WorkspaceSpec[];
1462
- initializeGlobalSetup(paths: TestSpecification[]): Promise<void>;
1463
- runFiles(specs: TestSpecification[], allTestsRun: boolean): Promise<void>;
1464
- collectFiles(specs: WorkspaceSpec[]): Promise<void>;
1465
- cancelCurrentRun(reason: CancelReason): Promise<void>;
1466
- rerunFiles(files?: string[], trigger?: string): Promise<void>;
1467
- changeProjectName(pattern: string): Promise<void>;
1468
- changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
1469
- changeFilenamePattern(pattern: string, files?: string[]): Promise<void>;
1470
- rerunFailed(): Promise<void>;
1471
- updateSnapshot(files?: string[]): Promise<void>;
1472
- private _rerunTimer;
1473
- private scheduleRerun;
1474
- getModuleProjects(filepath: string): WorkspaceProject[];
1475
- /**
1476
- * Watch only the specified tests. If no tests are provided, all tests will be watched.
1477
- */
1478
- watchTests(tests: string[]): void;
1479
- private updateLastChanged;
1480
- onChange: (id: string) => void;
1481
- onUnlink: (id: string) => void;
1482
- onAdd: (id: string) => Promise<void>;
1483
- private unregisterWatcher;
1484
- private registerWatcher;
1485
- /**
1486
- * @returns A value indicating whether rerun is needed (changedTests was mutated)
1487
- */
1488
- private handleFileChanged;
1489
- private reportCoverage;
1490
- close(): Promise<void>;
1491
- /**
1492
- * Close the thread pool and exit the process
1493
- */
1494
- exit(force?: boolean): Promise<void>;
1495
- report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
1496
- getTestFilepaths(): Promise<string[]>;
1497
- globTestSpecs(filters?: string[]): Promise<WorkspaceSpec[]>;
1498
- /**
1499
- * @deprecated use globTestSpecs instead
1500
- */
1501
- globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
1502
- private ensureSpecCached;
1503
- shouldKeepServer(): boolean;
1504
- onServerRestart(fn: OnServerRestartHandler): void;
1505
- onAfterSetServer(fn: OnServerRestartHandler): void;
1506
- onCancel(fn: (reason: CancelReason) => void): void;
1507
- onClose(fn: () => void): void;
1508
- }
1509
-
1510
- interface Reporter {
1511
- onInit?: (ctx: Vitest) => void;
1512
- onPathsCollected?: (paths?: string[]) => Awaitable<void>;
1513
- onSpecsCollected?: (specs?: SerializedTestSpecification[]) => Awaitable<void>;
1514
- onCollected?: (files?: File[]) => Awaitable<void>;
1515
- onFinished?: (files: File[], errors: unknown[], coverage?: unknown) => Awaitable<void>;
1516
- onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
1517
- onTestRemoved?: (trigger?: string) => Awaitable<void>;
1518
- onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
1519
- onWatcherRerun?: (files: string[], trigger?: string) => Awaitable<void>;
1520
- onServerRestart?: (reason?: string) => Awaitable<void>;
1521
- onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
1522
- onProcessTimeout?: () => Awaitable<void>;
1523
- }
1524
-
1525
- interface BaseOptions {
1526
- isTTY?: boolean;
1527
- }
1528
- declare abstract class BaseReporter implements Reporter {
1529
- start: number;
1530
- end: number;
1531
- watchFilters?: string[];
1532
- failedUnwatchedFiles: Task[];
1533
- isTTY: boolean;
1534
- ctx: Vitest;
1535
- protected verbose: boolean;
1536
- private _filesInWatchMode;
1537
- private _lastRunTimeout;
1538
- private _lastRunTimer;
1539
- private _lastRunCount;
1540
- private _timeStart;
1541
- private _offUnhandledRejection?;
1542
- constructor(options?: BaseOptions);
1543
- get mode(): VitestRunMode;
1544
- onInit(ctx: Vitest): void;
1545
- relative(path: string): string;
1546
- onFinished(files?: File[], errors?: unknown[]): void;
1547
- onTaskUpdate(packs: TaskResultPack[]): void;
1548
- protected printTask(task: Task): void;
1549
- onWatcherStart(files?: File[], errors?: unknown[]): void;
1550
- private resetLastRunLog;
1551
- onWatcherRerun(files: string[], trigger?: string): void;
1552
- onUserConsoleLog(log: UserConsoleLog): void;
1553
- shouldLog(log: UserConsoleLog): boolean;
1554
- onServerRestart(reason?: string): void;
1555
- reportSummary(files: File[], errors: unknown[]): void;
1556
- reportTestSummary(files: File[], errors: unknown[]): void;
1557
- private printErrorsSummary;
1558
- reportBenchmarkSummary(files: File[]): void;
1559
- private printTaskErrors;
1560
- registerUnhandledRejection(): void;
1561
- }
1562
-
1563
- declare class BasicReporter extends BaseReporter {
1564
- constructor();
1565
- reportSummary(files: File[], errors: unknown[]): void;
1566
- }
1567
-
1568
- interface ListRendererOptions {
1569
- renderSucceed?: boolean;
1570
- logger: Logger;
1571
- showHeap: boolean;
1572
- slowTestThreshold: number;
1573
- mode: VitestRunMode;
1574
- }
1575
- declare function createListRenderer(_tasks: Task[], options: ListRendererOptions): {
1576
- start(): any;
1577
- update(_tasks: Task[]): any;
1578
- stop(): any;
1579
- clear(): void;
1580
- };
1581
-
1582
- declare class DefaultReporter extends BaseReporter {
1583
- renderer?: ReturnType<typeof createListRenderer>;
1584
- rendererOptions: ListRendererOptions;
1585
- private renderSucceedDefault?;
1586
- onPathsCollected(paths?: string[]): void;
1587
- onTestRemoved(trigger?: string): Promise<void>;
1588
- onCollected(): void;
1589
- onFinished(files?: _vitest_runner.File[], errors?: unknown[]): void;
1590
- onWatcherStart(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
1591
- stopListRender(): void;
1592
- onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1593
- onUserConsoleLog(log: UserConsoleLog): void;
1594
- }
1595
-
1596
- interface DotRendererOptions {
1597
- logger: Logger;
1598
- }
1599
- declare function createDotRenderer(_tasks: Task[], options: DotRendererOptions): {
1600
- start(): any;
1601
- update(_tasks: Task[]): any;
1602
- stop(): Promise<any>;
1603
- clear(): void;
1604
- };
1605
-
1606
- declare class DotReporter extends BaseReporter {
1607
- renderer?: ReturnType<typeof createDotRenderer>;
1608
- onCollected(): void;
1609
- onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
1610
- onWatcherStart(): Promise<void>;
1611
- stopListRender(): Promise<void>;
1612
- onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1613
- onUserConsoleLog(log: UserConsoleLog): void;
1614
- }
1615
-
1616
- type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';
1617
- type Milliseconds = number;
1618
- interface Callsite {
1619
- line: number;
1620
- column: number;
1621
- }
1622
- interface JsonAssertionResult {
1623
- ancestorTitles: Array<string>;
1624
- fullName: string;
1625
- status: Status;
1626
- title: string;
1627
- meta: TaskMeta;
1628
- duration?: Milliseconds | null;
1629
- failureMessages: Array<string> | null;
1630
- location?: Callsite | null;
1631
- }
1632
- interface JsonTestResult {
1633
- message: string;
1634
- name: string;
1635
- status: 'failed' | 'passed';
1636
- startTime: number;
1637
- endTime: number;
1638
- assertionResults: Array<JsonAssertionResult>;
1639
- }
1640
- interface JsonTestResults {
1641
- numFailedTests: number;
1642
- numFailedTestSuites: number;
1643
- numPassedTests: number;
1644
- numPassedTestSuites: number;
1645
- numPendingTests: number;
1646
- numPendingTestSuites: number;
1647
- numTodoTests: number;
1648
- numTotalTests: number;
1649
- numTotalTestSuites: number;
1650
- startTime: number;
1651
- success: boolean;
1652
- testResults: Array<JsonTestResult>;
1653
- snapshot: SnapshotSummary;
1654
- }
1655
- interface JsonOptions {
1656
- outputFile?: string;
1657
- }
1658
- declare class JsonReporter implements Reporter {
1659
- start: number;
1660
- ctx: Vitest;
1661
- options: JsonOptions;
1662
- constructor(options: JsonOptions);
1663
- onInit(ctx: Vitest): void;
1664
- protected logTasks(files: File[]): Promise<void>;
1665
- onFinished(files?: File[]): Promise<void>;
1666
- /**
1667
- * Writes the report to an output file if specified in the config,
1668
- * or logs it to the console otherwise.
1669
- * @param report
1670
- */
1671
- writeReport(report: string): Promise<void>;
1672
- }
1673
-
1674
- declare class VerboseReporter extends DefaultReporter {
1675
- protected verbose: boolean;
1676
- constructor();
1677
- onTaskUpdate(packs: TaskResultPack[]): void;
1678
- }
1679
-
1680
- declare class TapReporter implements Reporter {
1681
- protected ctx: Vitest;
1682
- private logger;
1683
- onInit(ctx: Vitest): void;
1684
- static getComment(task: Task): string;
1685
- private logErrorDetails;
1686
- protected logTasks(tasks: Task[]): void;
1687
- onFinished(files?: _vitest_runner.File[]): void;
1688
- }
1689
-
1690
- interface JUnitOptions {
1691
- outputFile?: string;
1692
- classname?: string;
1693
- suiteName?: string;
1694
- /**
1695
- * Write <system-out> and <system-err> for console output
1696
- * @default true
1429
+ *
1430
+ * Use this option when you are seeing files that show up in report even if they
1431
+ * match your `coverage.exclude` patterns.
1432
+ *
1433
+ * @default false
1697
1434
  */
1698
- includeConsoleOutput?: boolean;
1435
+ excludeAfterRemap?: boolean;
1699
1436
  /**
1700
- * Add <testcase file="..."> attribute (validated on CIRCLE CI and GitLab CI)
1701
- * @default false
1437
+ * Concurrency limit used when processing the coverage results.
1438
+ * Defaults to `Math.min(20, os.availableParallelism?.() ?? os.cpus().length)`
1702
1439
  */
1703
- addFileAttribute?: boolean;
1704
- }
1705
- declare class JUnitReporter implements Reporter {
1706
- private ctx;
1707
- private reportFile?;
1708
- private baseLog;
1709
- private logger;
1710
- private _timeStart;
1711
- private fileFd?;
1712
- private options;
1713
- constructor(options: JUnitOptions);
1714
- onInit(ctx: Vitest): Promise<void>;
1715
- writeElement(name: string, attrs: Record<string, any>, children: () => Promise<void>): Promise<void>;
1716
- writeLogs(task: Task, type: 'err' | 'out'): Promise<void>;
1717
- writeTasks(tasks: Task[], filename: string): Promise<void>;
1718
- onFinished(files?: _vitest_runner.File[]): Promise<void>;
1719
- }
1720
-
1721
- declare class TapFlatReporter extends TapReporter {
1722
- onInit(ctx: Vitest): void;
1723
- onFinished(files?: _vitest_runner.File[]): void;
1724
- }
1725
-
1726
- declare class HangingProcessReporter implements Reporter {
1727
- whyRunning: (() => void) | undefined;
1728
- onInit(): void;
1729
- onProcessTimeout(): void;
1730
- }
1731
-
1732
- declare class GithubActionsReporter implements Reporter {
1733
- ctx: Vitest;
1734
- onInit(ctx: Vitest): void;
1735
- onFinished(files?: File[], errors?: unknown[]): void;
1736
- }
1737
-
1738
- interface HTMLOptions {
1739
- outputFile?: string;
1740
- }
1741
-
1742
- interface BlobOptions {
1743
- outputFile?: string;
1744
- }
1745
- declare class BlobReporter implements Reporter {
1746
- ctx: Vitest;
1747
- options: BlobOptions;
1748
- constructor(options: BlobOptions);
1749
- onInit(ctx: Vitest): void;
1750
- onFinished(files: File[] | undefined, errors: unknown[] | undefined, coverage: unknown): Promise<void>;
1751
- }
1752
-
1753
- interface TableRendererOptions {
1754
- renderSucceed?: boolean;
1755
- logger: Logger;
1756
- showHeap: boolean;
1757
- slowTestThreshold: number;
1758
- compare?: FlatBenchmarkReport;
1440
+ processingConcurrency?: number;
1759
1441
  }
1760
- declare function createTableRenderer(_tasks: Task[], options: TableRendererOptions): {
1761
- start(): any;
1762
- update(_tasks: Task[]): any;
1763
- stop(): any;
1764
- clear(): void;
1765
- };
1766
-
1767
- declare class TableReporter extends BaseReporter {
1768
- renderer?: ReturnType<typeof createTableRenderer>;
1769
- rendererOptions: TableRendererOptions;
1770
- onTestRemoved(trigger?: string): void;
1771
- onCollected(): Promise<void>;
1772
- onTaskUpdate(packs: TaskResultPack[]): void;
1773
- onFinished(files?: File[], errors?: unknown[]): Promise<void>;
1774
- onWatcherStart(): Promise<void>;
1775
- stopListRender(): void;
1776
- onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1777
- onUserConsoleLog(log: UserConsoleLog): void;
1442
+ interface CoverageIstanbulOptions extends BaseCoverageOptions {
1443
+ /**
1444
+ * Set to array of class method names to ignore for coverage
1445
+ *
1446
+ * @default []
1447
+ */
1448
+ ignoreClassMethods?: string[];
1778
1449
  }
1779
- interface FlatBenchmarkReport {
1780
- [id: string]: FormattedBenchmarkResult;
1450
+ interface CoverageV8Options extends BaseCoverageOptions {
1451
+ /**
1452
+ * Ignore empty lines, comments and other non-runtime code, e.g. Typescript types
1453
+ */
1454
+ ignoreEmptyLines?: boolean;
1781
1455
  }
1782
- type FormattedBenchmarkResult = BenchmarkResult & {
1783
- id: string;
1784
- };
1785
-
1786
- declare const BenchmarkReportsMap: {
1787
- default: typeof TableReporter;
1788
- verbose: typeof VerboseReporter;
1789
- };
1790
- type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
1791
-
1792
- /**
1793
- * @deprecated Use `TestModule` instead
1794
- */
1795
- declare const TestFile: typeof TestModule;
1796
-
1797
- /**
1798
- * @deprecated Use `ModuleDiagnostic` instead
1799
- */
1800
- type FileDiagnostic = ModuleDiagnostic;
1801
-
1802
- declare const ReportersMap: {
1803
- default: typeof DefaultReporter;
1804
- basic: typeof BasicReporter;
1805
- blob: typeof BlobReporter;
1806
- verbose: typeof VerboseReporter;
1807
- dot: typeof DotReporter;
1808
- json: typeof JsonReporter;
1809
- tap: typeof TapReporter;
1810
- 'tap-flat': typeof TapFlatReporter;
1811
- junit: typeof JUnitReporter;
1812
- 'hanging-process': typeof HangingProcessReporter;
1813
- 'github-actions': typeof GithubActionsReporter;
1814
- };
1815
- type BuiltinReporters = keyof typeof ReportersMap;
1816
- interface BuiltinReporterOptions {
1817
- 'default': BaseOptions;
1818
- 'basic': BaseOptions;
1819
- 'verbose': never;
1820
- 'dot': BaseOptions;
1821
- 'json': JsonOptions;
1822
- 'blob': BlobOptions;
1823
- 'tap': never;
1824
- 'tap-flat': never;
1825
- 'junit': JUnitOptions;
1826
- 'hanging-process': never;
1827
- 'html': HTMLOptions;
1456
+ interface CustomProviderOptions extends Pick<BaseCoverageOptions, FieldsWithDefaultValues> {
1457
+ /** Name of the module or path to a file to load the custom provider from */
1458
+ customProviderModule: string;
1828
1459
  }
1829
-
1830
- interface TestSequencer {
1460
+ interface Thresholds {
1461
+ /** Set global thresholds to `100` */
1462
+ 100?: boolean;
1463
+ /** Check thresholds per file. */
1464
+ perFile?: boolean;
1831
1465
  /**
1832
- * Slicing tests into shards. Will be run before `sort`.
1833
- * Only run, if `shard` is defined.
1466
+ * Update threshold values automatically when current coverage is higher than earlier thresholds
1467
+ *
1468
+ * @default false
1834
1469
  */
1835
- shard: (files: WorkspaceSpec[]) => Awaitable<WorkspaceSpec[]>;
1836
- sort: (files: WorkspaceSpec[]) => Awaitable<WorkspaceSpec[]>;
1837
- }
1838
- interface TestSequencerConstructor {
1839
- new (ctx: Vitest): TestSequencer;
1470
+ autoUpdate?: boolean;
1471
+ /** Thresholds for statements */
1472
+ statements?: number;
1473
+ /** Thresholds for functions */
1474
+ functions?: number;
1475
+ /** Thresholds for branches */
1476
+ branches?: number;
1477
+ /** Thresholds for lines */
1478
+ lines?: number;
1840
1479
  }
1841
1480
 
1842
- type ChaiConfig = Omit<Partial<typeof chai.config>, 'useProxy' | 'proxyExcludedKeys'>;
1843
-
1844
- interface BenchmarkUserOptions {
1481
+ type BuiltinPool = 'browser' | 'threads' | 'forks' | 'vmThreads' | 'vmForks' | 'typescript';
1482
+ type Pool = BuiltinPool | (string & {});
1483
+ interface PoolOptions extends Record<string, unknown> {
1845
1484
  /**
1846
- * Include globs for benchmark test files
1485
+ * Run tests in `node:worker_threads`.
1847
1486
  *
1848
- * @default ['**\/*.{bench,benchmark}.?(c|m)[jt]s?(x)']
1487
+ * Test isolation (when enabled) is done by spawning a new thread for each test file.
1488
+ *
1489
+ * This pool is used by default.
1849
1490
  */
1850
- include?: string[];
1491
+ threads?: ThreadsOptions & WorkerContextOptions;
1851
1492
  /**
1852
- * Exclude globs for benchmark test files
1853
- * @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
1493
+ * Run tests in `node:child_process` using [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
1494
+ *
1495
+ * Test isolation (when enabled) is done by spawning a new child process for each test file.
1854
1496
  */
1855
- exclude?: string[];
1497
+ forks?: ForksOptions & WorkerContextOptions;
1856
1498
  /**
1857
- * Include globs for in-source benchmark test files
1499
+ * Run tests in isolated `node:vm`.
1500
+ * Test files are run parallel using `node:worker_threads`.
1858
1501
  *
1859
- * @default []
1502
+ * This makes tests run faster, but VM module is unstable. Your tests might leak memory.
1860
1503
  */
1861
- includeSource?: string[];
1504
+ vmThreads?: ThreadsOptions & VmOptions;
1862
1505
  /**
1863
- * Custom reporter for output. Can contain one or more built-in report names, reporter instances,
1864
- * and/or paths to custom reporters
1506
+ * Run tests in isolated `node:vm`.
1865
1507
  *
1866
- * @default ['default']
1508
+ * Test files are run parallel using `node:child_process` [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
1509
+ *
1510
+ * This makes tests run faster, but VM module is unstable. Your tests might leak memory.
1511
+ */
1512
+ vmForks?: ForksOptions & VmOptions;
1513
+ }
1514
+ interface ResolvedPoolOptions extends PoolOptions {
1515
+ threads?: ResolvedThreadsOptions & WorkerContextOptions;
1516
+ forks?: ResolvedForksOptions & WorkerContextOptions;
1517
+ vmThreads?: ResolvedThreadsOptions & VmOptions;
1518
+ vmForks?: ResolvedForksOptions & VmOptions;
1519
+ }
1520
+ interface ThreadsOptions {
1521
+ /** Minimum amount of threads to use */
1522
+ minThreads?: number | string;
1523
+ /** Maximum amount of threads to use */
1524
+ maxThreads?: number | string;
1525
+ /**
1526
+ * Run tests inside a single thread.
1527
+ *
1528
+ * @default false
1529
+ */
1530
+ singleThread?: boolean;
1531
+ /**
1532
+ * Use Atomics to synchronize threads
1533
+ *
1534
+ * This can improve performance in some cases, but might cause segfault in older Node versions.
1535
+ *
1536
+ * @default false
1537
+ */
1538
+ useAtomics?: boolean;
1539
+ }
1540
+ interface ResolvedThreadsOptions extends ThreadsOptions {
1541
+ minThreads?: number;
1542
+ maxThreads?: number;
1543
+ }
1544
+ interface ForksOptions {
1545
+ /** Minimum amount of child processes to use */
1546
+ minForks?: number | string;
1547
+ /** Maximum amount of child processes to use */
1548
+ maxForks?: number | string;
1549
+ /**
1550
+ * Run tests inside a single fork.
1551
+ *
1552
+ * @default false
1867
1553
  */
1868
- reporters?: Arrayable$1<BenchmarkBuiltinReporters | Reporter>;
1554
+ singleFork?: boolean;
1555
+ }
1556
+ interface ResolvedForksOptions extends ForksOptions {
1557
+ minForks?: number;
1558
+ maxForks?: number;
1559
+ }
1560
+ interface WorkerContextOptions {
1869
1561
  /**
1870
- * @deprecated Use `benchmark.outputJson` instead
1562
+ * Isolate test environment by recycling `worker_threads` or `child_process` after each test
1563
+ *
1564
+ * @default true
1871
1565
  */
1872
- outputFile?: string | (Partial<Record<BenchmarkBuiltinReporters, string>> & Record<string, string>);
1566
+ isolate?: boolean;
1873
1567
  /**
1874
- * benchmark output file to compare against
1568
+ * Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
1569
+ *
1570
+ * See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
1571
+ *
1572
+ * Set to `process.execArgv` to pass all arguments of the current process.
1573
+ *
1574
+ * Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
1575
+ *
1576
+ * @default [] // no execution arguments are passed
1875
1577
  */
1876
- compare?: string;
1578
+ execArgv?: string[];
1579
+ }
1580
+ interface VmOptions {
1877
1581
  /**
1878
- * benchmark output file
1582
+ * Specifies the memory limit for `worker_thread` or `child_process` before they are recycled.
1583
+ * If you see memory leaks, try to tinker this value.
1879
1584
  */
1880
- outputJson?: string;
1585
+ memoryLimit?: string | number;
1586
+ /** Isolation is always enabled */
1587
+ isolate?: true;
1881
1588
  /**
1882
- * Include `samples` array of benchmark results for API or custom reporter usages.
1883
- * This is disabled by default to reduce memory usage.
1884
- * @default false
1589
+ * Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
1590
+ *
1591
+ * See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
1592
+ *
1593
+ * Set to `process.execArgv` to pass all arguments of the current process.
1594
+ *
1595
+ * Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
1596
+ *
1597
+ * @default [] // no execution arguments are passed
1885
1598
  */
1886
- includeSamples?: boolean;
1599
+ execArgv?: string[];
1887
1600
  }
1888
1601
 
1889
1602
  type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
@@ -2207,7 +1920,7 @@ interface InlineConfig {
2207
1920
  *
2208
1921
  * @default []
2209
1922
  */
2210
- reporters?: Arrayable<ReporterName | InlineReporter> | ((ReporterName | InlineReporter) | [ReporterName] | ReporterWithOptions)[];
1923
+ reporters?: Arrayable$1<ReporterName | InlineReporter> | ((ReporterName | InlineReporter) | [ReporterName] | ReporterWithOptions)[];
2211
1924
  /**
2212
1925
  * Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
2213
1926
  * Also definable individually per reporter by using an object instead.
@@ -2474,274 +2187,586 @@ interface InlineConfig {
2474
2187
  */
2475
2188
  host?: string;
2476
2189
  /**
2477
- * Wait for debugger to connect before running tests
2190
+ * Wait for debugger to connect before running tests
2191
+ */
2192
+ waitForDebugger?: boolean;
2193
+ };
2194
+ /**
2195
+ * Define variables that will be returned from `inject` in the test environment.
2196
+ * @example
2197
+ * ```ts
2198
+ * // vitest.config.ts
2199
+ * export default defineConfig({
2200
+ * test: {
2201
+ * provide: {
2202
+ * someKey: 'someValue'
2203
+ * }
2204
+ * }
2205
+ * })
2206
+ * ```
2207
+ * ```ts
2208
+ * // test file
2209
+ * import { inject } from 'vitest'
2210
+ * const value = inject('someKey') // 'someValue'
2211
+ * ```
2212
+ */
2213
+ provide?: Partial<ProvidedContext>;
2214
+ /**
2215
+ * Configuration options for expect() matches.
2216
+ */
2217
+ expect?: {
2218
+ /**
2219
+ * Throw an error if tests don't have any expect() assertions.
2220
+ */
2221
+ requireAssertions?: boolean;
2222
+ /**
2223
+ * Default options for expect.poll()
2224
+ */
2225
+ poll?: {
2226
+ /**
2227
+ * Timeout in milliseconds
2228
+ * @default 1000
2229
+ */
2230
+ timeout?: number;
2231
+ /**
2232
+ * Polling interval in milliseconds
2233
+ * @default 50
2234
+ */
2235
+ interval?: number;
2236
+ };
2237
+ };
2238
+ /**
2239
+ * Modify default Chai config. Vitest uses Chai for `expect` and `assert` matches.
2240
+ * https://github.com/chaijs/chai/blob/4.x.x/lib/chai/config.js
2241
+ */
2242
+ chaiConfig?: ChaiConfig;
2243
+ /**
2244
+ * Stop test execution when given number of tests have failed.
2245
+ */
2246
+ bail?: number;
2247
+ /**
2248
+ * Retry the test specific number of times if it fails.
2249
+ *
2250
+ * @default 0
2251
+ */
2252
+ retry?: number;
2253
+ /**
2254
+ * Show full diff when snapshot fails instead of a patch.
2255
+ */
2256
+ expandSnapshotDiff?: boolean;
2257
+ /**
2258
+ * By default, Vitest automatically intercepts console logging during tests for extra formatting of test file, test title, etc...
2259
+ * This is also required for console log preview on Vitest UI.
2260
+ * However, disabling such interception might help when you want to debug a code with normal synchronus terminal console logging.
2261
+ *
2262
+ * This option has no effect on browser pool since Vitest preserves original logging on browser devtools.
2263
+ *
2264
+ * @default false
2265
+ */
2266
+ disableConsoleIntercept?: boolean;
2267
+ /**
2268
+ * Always print console stack traces.
2269
+ *
2270
+ * @default false
2271
+ */
2272
+ printConsoleTrace?: boolean;
2273
+ /**
2274
+ * Include "location" property inside the test definition
2275
+ *
2276
+ * @default false
2277
+ */
2278
+ includeTaskLocation?: boolean;
2279
+ }
2280
+ interface TypecheckConfig {
2281
+ /**
2282
+ * Run typechecking tests alongisde regular tests.
2283
+ */
2284
+ enabled?: boolean;
2285
+ /**
2286
+ * When typechecking is enabled, only run typechecking tests.
2287
+ */
2288
+ only?: boolean;
2289
+ /**
2290
+ * What tools to use for type checking.
2291
+ *
2292
+ * @default 'tsc'
2293
+ */
2294
+ checker: 'tsc' | 'vue-tsc' | (string & Record<never, never>);
2295
+ /**
2296
+ * Pattern for files that should be treated as test files
2297
+ *
2298
+ * @default ['**\/*.{test,spec}-d.?(c|m)[jt]s?(x)']
2299
+ */
2300
+ include: string[];
2301
+ /**
2302
+ * Pattern for files that should not be treated as test files
2303
+ *
2304
+ * @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
2305
+ */
2306
+ exclude: string[];
2307
+ /**
2308
+ * Check JS files that have `@ts-check` comment.
2309
+ * If you have it enabled in tsconfig, this will not overwrite it.
2310
+ */
2311
+ allowJs?: boolean;
2312
+ /**
2313
+ * Do not fail, if Vitest found errors outside the test files.
2314
+ */
2315
+ ignoreSourceErrors?: boolean;
2316
+ /**
2317
+ * Path to tsconfig, relative to the project root.
2318
+ */
2319
+ tsconfig?: string;
2320
+ }
2321
+ interface UserConfig extends InlineConfig {
2322
+ /**
2323
+ * Path to the config file.
2324
+ *
2325
+ * Default resolving to `vitest.config.*`, `vite.config.*`
2326
+ *
2327
+ * Setting to `false` will disable config resolving.
2328
+ */
2329
+ config?: string | false | undefined;
2330
+ /**
2331
+ * Do not run tests when Vitest starts.
2332
+ *
2333
+ * Vitest will only run tests if it's called programmatically or the test file changes.
2334
+ *
2335
+ * CLI file filters will be ignored.
2336
+ */
2337
+ standalone?: boolean;
2338
+ /**
2339
+ * Use happy-dom
2340
+ */
2341
+ dom?: boolean;
2342
+ /**
2343
+ * Run tests that cover a list of source files
2344
+ */
2345
+ related?: string[] | string;
2346
+ /**
2347
+ * Overrides Vite mode
2348
+ * @default 'test'
2349
+ */
2350
+ mode?: string;
2351
+ /**
2352
+ * Runs tests that are affected by the changes in the repository, or between specified branch or commit hash
2353
+ * Requires initialized git repository
2354
+ * @default false
2355
+ */
2356
+ changed?: boolean | string;
2357
+ /**
2358
+ * Test suite shard to execute in a format of <index>/<count>.
2359
+ * Will divide tests into a `count` numbers, and run only the `indexed` part.
2360
+ * Cannot be used with enabled watch.
2361
+ * @example --shard=2/3
2362
+ */
2363
+ shard?: string;
2364
+ /**
2365
+ * Name of the project or projects to run.
2366
+ */
2367
+ project?: string | string[];
2368
+ /**
2369
+ * Additional exclude patterns
2370
+ */
2371
+ cliExclude?: string[];
2372
+ /**
2373
+ * Override vite config's clearScreen from cli
2374
+ */
2375
+ clearScreen?: boolean;
2376
+ /**
2377
+ * benchmark.compare option exposed at the top level for cli
2378
+ */
2379
+ compare?: string;
2380
+ /**
2381
+ * benchmark.outputJson option exposed at the top level for cli
2382
+ */
2383
+ outputJson?: string;
2384
+ /**
2385
+ * Directory of blob reports to merge
2386
+ * @default '.vitest-reports'
2387
+ */
2388
+ mergeReports?: string;
2389
+ }
2390
+ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool' | 'cliExclude' | 'diff' | 'setupFiles' | 'snapshotEnvironment' | 'bail'> {
2391
+ mode: VitestRunMode;
2392
+ base?: string;
2393
+ diff?: string;
2394
+ bail?: number;
2395
+ setupFiles: string[];
2396
+ snapshotEnvironment?: string;
2397
+ config?: string;
2398
+ filters?: string[];
2399
+ testNamePattern?: RegExp;
2400
+ related?: string[];
2401
+ coverage: ResolvedCoverageOptions;
2402
+ snapshotOptions: SnapshotStateOptions;
2403
+ browser: ResolvedBrowserOptions;
2404
+ pool: Pool;
2405
+ poolOptions?: ResolvedPoolOptions;
2406
+ reporters: (InlineReporter | ReporterWithOptions)[];
2407
+ defines: Record<string, any>;
2408
+ api?: ApiConfig;
2409
+ cliExclude?: string[];
2410
+ benchmark?: Required<Omit<BenchmarkUserOptions, 'outputFile' | 'compare' | 'outputJson'>> & Pick<BenchmarkUserOptions, 'outputFile' | 'compare' | 'outputJson'>;
2411
+ shard?: {
2412
+ index: number;
2413
+ count: number;
2414
+ };
2415
+ cache: {
2416
+ /**
2417
+ * @deprecated
2478
2418
  */
2479
- waitForDebugger?: boolean;
2419
+ dir: string;
2420
+ } | false;
2421
+ sequence: {
2422
+ sequencer: TestSequencerConstructor;
2423
+ hooks: SequenceHooks;
2424
+ setupFiles: SequenceSetupFiles;
2425
+ shuffle?: boolean;
2426
+ concurrent?: boolean;
2427
+ seed: number;
2428
+ };
2429
+ typecheck: Omit<TypecheckConfig, 'enabled'> & {
2430
+ enabled: boolean;
2431
+ };
2432
+ runner?: string;
2433
+ maxWorkers: number;
2434
+ minWorkers: number;
2435
+ }
2436
+ 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';
2437
+ type ProjectConfig = Omit<UserConfig, NonProjectOptions | 'sequencer' | 'deps' | 'poolOptions'> & {
2438
+ sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
2439
+ deps?: Omit<DepsOptions, 'moduleDirectories'>;
2440
+ poolOptions?: {
2441
+ threads?: Pick<NonNullable<PoolOptions['threads']>, 'singleThread' | 'isolate'>;
2442
+ vmThreads?: Pick<NonNullable<PoolOptions['vmThreads']>, 'singleThread'>;
2443
+ forks?: Pick<NonNullable<PoolOptions['forks']>, 'singleFork' | 'isolate'>;
2480
2444
  };
2445
+ };
2446
+ type ResolvedProjectConfig = Omit<ResolvedConfig, NonProjectOptions>;
2447
+ interface UserWorkspaceConfig extends UserConfig$1 {
2448
+ test?: ProjectConfig;
2449
+ }
2450
+ type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>;
2451
+ type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
2452
+ type WorkspaceProjectConfiguration = string | (UserProjectConfigExport & {
2481
2453
  /**
2482
- * Define variables that will be returned from `inject` in the test environment.
2483
- * @example
2484
- * ```ts
2485
- * // vitest.config.ts
2486
- * export default defineConfig({
2487
- * test: {
2488
- * provide: {
2489
- * someKey: 'someValue'
2490
- * }
2491
- * }
2492
- * })
2493
- * ```
2494
- * ```ts
2495
- * // test file
2496
- * import { inject } from 'vitest'
2497
- * const value = inject('someKey') // 'someValue'
2498
- * ```
2454
+ * Relative path to the extendable config. All other options will be merged with this config.
2455
+ * @example '../vite.config.ts'
2499
2456
  */
2500
- provide?: Partial<ProvidedContext>;
2457
+ extends?: string;
2458
+ });
2459
+
2460
+ declare class TestProject {
2501
2461
  /**
2502
- * Configuration options for expect() matches.
2462
+ * The global vitest instance.
2463
+ * @experimental The public Vitest API is experimental and does not follow semver.
2503
2464
  */
2504
- expect?: {
2505
- /**
2506
- * Throw an error if tests don't have any expect() assertions.
2507
- */
2508
- requireAssertions?: boolean;
2509
- /**
2510
- * Default options for expect.poll()
2511
- */
2512
- poll?: {
2513
- /**
2514
- * Timeout in milliseconds
2515
- * @default 1000
2516
- */
2517
- timeout?: number;
2518
- /**
2519
- * Polling interval in milliseconds
2520
- * @default 50
2521
- */
2522
- interval?: number;
2523
- };
2524
- };
2465
+ readonly vitest: Vitest;
2525
2466
  /**
2526
- * Modify default Chai config. Vitest uses Chai for `expect` and `assert` matches.
2527
- * https://github.com/chaijs/chai/blob/4.x.x/lib/chai/config.js
2467
+ * The workspace project this test project is associated with.
2468
+ * @experimental The public Vitest API is experimental and does not follow semver.
2528
2469
  */
2529
- chaiConfig?: ChaiConfig;
2470
+ readonly workspaceProject: WorkspaceProject;
2530
2471
  /**
2531
- * Stop test execution when given number of tests have failed.
2472
+ * Vite's dev server instance. Every workspace project has its own server.
2532
2473
  */
2533
- bail?: number;
2474
+ readonly vite: ViteDevServer;
2534
2475
  /**
2535
- * Retry the test specific number of times if it fails.
2536
- *
2537
- * @default 0
2476
+ * Resolved project configuration.
2538
2477
  */
2539
- retry?: number;
2478
+ readonly config: ResolvedProjectConfig;
2540
2479
  /**
2541
- * Show full diff when snapshot fails instead of a patch.
2480
+ * Resolved global configuration. If there are no workspace projects, this will be the same as `config`.
2542
2481
  */
2543
- expandSnapshotDiff?: boolean;
2482
+ readonly globalConfig: ResolvedConfig;
2544
2483
  /**
2545
- * By default, Vitest automatically intercepts console logging during tests for extra formatting of test file, test title, etc...
2546
- * This is also required for console log preview on Vitest UI.
2547
- * However, disabling such interception might help when you want to debug a code with normal synchronus terminal console logging.
2548
- *
2549
- * This option has no effect on browser pool since Vitest preserves original logging on browser devtools.
2550
- *
2551
- * @default false
2484
+ * The name of the project or an empty string if not set.
2552
2485
  */
2553
- disableConsoleIntercept?: boolean;
2486
+ readonly name: string;
2487
+ constructor(workspaceProject: WorkspaceProject);
2554
2488
  /**
2555
- * Always print console stack traces.
2556
- *
2557
- * @default false
2489
+ * Serialized project configuration. This is the config that tests receive.
2558
2490
  */
2559
- printConsoleTrace?: boolean;
2491
+ get serializedConfig(): SerializedConfig;
2560
2492
  /**
2561
- * Include "location" property inside the test definition
2562
- *
2563
- * @default false
2493
+ * Custom context provided to the project.
2564
2494
  */
2565
- includeTaskLocation?: boolean;
2566
- }
2567
- interface TypecheckConfig {
2495
+ context(): ProvidedContext;
2568
2496
  /**
2569
- * Run typechecking tests alongisde regular tests.
2497
+ * Provide a custom serializable context to the project. This context will be available for tests once they run.
2570
2498
  */
2571
- enabled?: boolean;
2499
+ provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
2500
+ toJSON(): SerializedTestProject;
2501
+ }
2502
+ interface SerializedTestProject {
2503
+ name: string;
2504
+ serializedConfig: SerializedConfig;
2505
+ context: ProvidedContext;
2506
+ }
2507
+
2508
+ declare class TestSpecification {
2572
2509
  /**
2573
- * When typechecking is enabled, only run typechecking tests.
2510
+ * @deprecated use `project` instead
2574
2511
  */
2575
- only?: boolean;
2512
+ readonly 0: WorkspaceProject;
2576
2513
  /**
2577
- * What tools to use for type checking.
2578
- *
2579
- * @default 'tsc'
2514
+ * @deprecated use `moduleId` instead
2580
2515
  */
2581
- checker: 'tsc' | 'vue-tsc' | (string & Record<never, never>);
2516
+ readonly 1: string;
2582
2517
  /**
2583
- * Pattern for files that should be treated as test files
2584
- *
2585
- * @default ['**\/*.{test,spec}-d.?(c|m)[jt]s?(x)']
2518
+ * @deprecated use `pool` instead
2586
2519
  */
2587
- include: string[];
2520
+ readonly 2: {
2521
+ pool: Pool;
2522
+ };
2523
+ readonly project: TestProject;
2524
+ readonly moduleId: string;
2525
+ readonly pool: Pool;
2526
+ constructor(workspaceProject: WorkspaceProject, moduleId: string, pool: Pool);
2527
+ toJSON(): SerializedTestSpecification;
2588
2528
  /**
2589
- * Pattern for files that should not be treated as test files
2590
- *
2591
- * @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
2529
+ * for backwards compatibility
2530
+ * @deprecated
2592
2531
  */
2593
- exclude: string[];
2532
+ [Symbol.iterator](): Generator<string | WorkspaceProject, void, unknown>;
2533
+ }
2534
+
2535
+ /**
2536
+ * @deprecated use TestSpecification instead
2537
+ */
2538
+ type WorkspaceSpec = TestSpecification & [
2594
2539
  /**
2595
- * Check JS files that have `@ts-check` comment.
2596
- * If you have it enabled in tsconfig, this will not overwrite it.
2540
+ * @deprecated use spec.project instead
2597
2541
  */
2598
- allowJs?: boolean;
2542
+ project: WorkspaceProject,
2599
2543
  /**
2600
- * Do not fail, if Vitest found errors outside the test files.
2544
+ * @deprecated use spec.moduleId instead
2601
2545
  */
2602
- ignoreSourceErrors?: boolean;
2546
+ file: string,
2603
2547
  /**
2604
- * Path to tsconfig, relative to the project root.
2548
+ * @deprecated use spec.pool instead
2605
2549
  */
2606
- tsconfig?: string;
2550
+ options: {
2551
+ pool: Pool;
2552
+ }
2553
+ ];
2554
+ type RunWithFiles = (files: WorkspaceSpec[], invalidates?: string[]) => Awaitable$1<void>;
2555
+ interface ProcessPool {
2556
+ name: string;
2557
+ runTests: RunWithFiles;
2558
+ collectTests: RunWithFiles;
2559
+ close?: () => Awaitable$1<void>;
2560
+ }
2561
+ declare function getFilePoolName(project: WorkspaceProject, file: string): Pool;
2562
+
2563
+ interface SuiteResultCache {
2564
+ failed: boolean;
2565
+ duration: number;
2566
+ }
2567
+ declare class ResultsCache {
2568
+ private cache;
2569
+ private workspacesKeyMap;
2570
+ private cachePath;
2571
+ private version;
2572
+ private root;
2573
+ constructor(version: string);
2574
+ getCachePath(): string | null;
2575
+ setConfig(root: string, config: ResolvedConfig['cache']): void;
2576
+ getResults(key: string): SuiteResultCache | undefined;
2577
+ readFromCache(): Promise<void>;
2578
+ updateResults(files: File[]): void;
2579
+ removeFromCache(filepath: string): void;
2580
+ writeToCache(): Promise<void>;
2581
+ }
2582
+
2583
+ type FileStatsCache = Pick<Stats, 'size'>;
2584
+ declare class FilesStatsCache {
2585
+ cache: Map<string, FileStatsCache>;
2586
+ getStats(key: string): FileStatsCache | undefined;
2587
+ populateStats(root: string, specs: WorkspaceSpec[]): Promise<void>;
2588
+ updateStats(fsPath: string, key: string): Promise<void>;
2589
+ removeStats(fsPath: string): void;
2590
+ }
2591
+
2592
+ declare class VitestCache {
2593
+ results: ResultsCache;
2594
+ stats: FilesStatsCache;
2595
+ constructor(version: string);
2596
+ getFileTestResults(key: string): SuiteResultCache | undefined;
2597
+ getFileStats(key: string): {
2598
+ size: number;
2599
+ } | undefined;
2600
+ static resolveCacheDir(root: string, dir?: string, projectName?: string): string;
2601
+ }
2602
+
2603
+ declare class VitestPackageInstaller {
2604
+ isPackageExists(name: string, options?: {
2605
+ paths?: string[];
2606
+ }): boolean;
2607
+ ensureInstalled(dependency: string, root: string, version?: string): Promise<boolean>;
2607
2608
  }
2608
- interface UserConfig extends InlineConfig {
2609
- /**
2610
- * Path to the config file.
2611
- *
2612
- * Default resolving to `vitest.config.*`, `vite.config.*`
2613
- *
2614
- * Setting to `false` will disable config resolving.
2615
- */
2616
- config?: string | false | undefined;
2617
- /**
2618
- * Do not run tests when Vitest starts.
2619
- *
2620
- * Vitest will only run tests if it's called programmatically or the test file changes.
2621
- *
2622
- * CLI file filters will be ignored.
2623
- */
2624
- standalone?: boolean;
2625
- /**
2626
- * Use happy-dom
2627
- */
2628
- dom?: boolean;
2629
- /**
2630
- * Run tests that cover a list of source files
2631
- */
2632
- related?: string[] | string;
2609
+
2610
+ declare class StateManager {
2611
+ filesMap: Map<string, File[]>;
2612
+ pathsSet: Set<string>;
2613
+ idMap: Map<string, Task>;
2614
+ taskFileMap: WeakMap<Task, File>;
2615
+ errorsSet: Set<unknown>;
2616
+ processTimeoutCauses: Set<string>;
2617
+ reportedTasksMap: WeakMap<Task, TestCase | TestSuite | TestModule>;
2618
+ catchError(err: unknown, type: string): void;
2619
+ clearErrors(): void;
2620
+ getUnhandledErrors(): unknown[];
2621
+ addProcessTimeoutCause(cause: string): void;
2622
+ getProcessTimeoutCauses(): string[];
2623
+ getPaths(): string[];
2633
2624
  /**
2634
- * Overrides Vite mode
2635
- * @default 'test'
2625
+ * Return files that were running or collected.
2636
2626
  */
2637
- mode?: string;
2627
+ getFiles(keys?: string[]): File[];
2628
+ getFilepaths(): string[];
2629
+ getFailedFilepaths(): string[];
2630
+ collectPaths(paths?: string[]): void;
2631
+ collectFiles(project: WorkspaceProject, files?: File[]): void;
2632
+ clearFiles(project: WorkspaceProject, paths?: string[]): void;
2633
+ updateId(task: Task, project: WorkspaceProject): void;
2634
+ getReportedEntity(task: Task): TestCase | TestSuite | TestModule | undefined;
2635
+ updateTasks(packs: TaskResultPack[]): void;
2636
+ updateUserLog(log: UserConsoleLog): void;
2637
+ getCountOfFailedTests(): number;
2638
+ cancelFiles(files: string[], project: WorkspaceProject): void;
2639
+ }
2640
+
2641
+ interface VitestOptions {
2642
+ packageInstaller?: VitestPackageInstaller;
2643
+ stdin?: NodeJS.ReadStream;
2644
+ stdout?: NodeJS.WriteStream | Writable;
2645
+ stderr?: NodeJS.WriteStream | Writable;
2646
+ }
2647
+ declare class Vitest {
2648
+ readonly mode: VitestRunMode;
2649
+ version: string;
2650
+ config: ResolvedConfig;
2651
+ configOverride: Partial<ResolvedConfig>;
2652
+ server: ViteDevServer;
2653
+ state: StateManager;
2654
+ snapshot: SnapshotManager;
2655
+ cache: VitestCache;
2656
+ reporters: Reporter[];
2657
+ coverageProvider: CoverageProvider | null | undefined;
2658
+ logger: Logger;
2659
+ pool: ProcessPool | undefined;
2660
+ vitenode: ViteNodeServer;
2661
+ invalidates: Set<string>;
2662
+ changedTests: Set<string>;
2663
+ watchedTests: Set<string>;
2664
+ filenamePattern?: string;
2665
+ runningPromise?: Promise<void>;
2666
+ closingPromise?: Promise<void>;
2667
+ isCancelling: boolean;
2668
+ isFirstRun: boolean;
2669
+ restartsCount: number;
2670
+ runner: ViteNodeRunner;
2671
+ packageInstaller: VitestPackageInstaller;
2672
+ private coreWorkspaceProject;
2673
+ /** @private */
2674
+ resolvedProjects: WorkspaceProject[];
2675
+ projects: WorkspaceProject[];
2676
+ distPath: string;
2677
+ private _cachedSpecs;
2678
+ private _workspaceConfigPath?;
2679
+ /** @deprecated use `_cachedSpecs` */
2680
+ projectTestFiles: Map<string, WorkspaceSpec[]>;
2681
+ /** @private */
2682
+ _browserLastPort: number;
2683
+ constructor(mode: VitestRunMode, options?: VitestOptions);
2684
+ private _onRestartListeners;
2685
+ private _onClose;
2686
+ private _onSetServer;
2687
+ private _onCancelListeners;
2688
+ setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
2689
+ provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
2638
2690
  /**
2639
- * Runs tests that are affected by the changes in the repository, or between specified branch or commit hash
2640
- * Requires initialized git repository
2641
- * @default false
2691
+ * @deprecated internal, use `_createCoreProject` instead
2642
2692
  */
2643
- changed?: boolean | string;
2693
+ createCoreProject(): Promise<WorkspaceProject>;
2644
2694
  /**
2645
- * Test suite shard to execute in a format of <index>/<count>.
2646
- * Will divide tests into a `count` numbers, and run only the `indexed` part.
2647
- * Cannot be used with enabled watch.
2648
- * @example --shard=2/3
2695
+ * @internal
2649
2696
  */
2650
- shard?: string;
2697
+ _createCoreProject(): Promise<WorkspaceProject>;
2698
+ getCoreWorkspaceProject(): WorkspaceProject;
2651
2699
  /**
2652
- * Name of the project or projects to run.
2700
+ * @deprecated use Reported Task API instead
2653
2701
  */
2654
- project?: string | string[];
2702
+ getProjectByTaskId(taskId: string): WorkspaceProject;
2703
+ getProjectByName(name?: string): WorkspaceProject;
2704
+ private getWorkspaceConfigPath;
2705
+ private resolveWorkspace;
2706
+ private initCoverageProvider;
2707
+ mergeReports(): Promise<void>;
2708
+ collect(filters?: string[]): Promise<{
2709
+ tests: File[];
2710
+ errors: unknown[];
2711
+ }>;
2712
+ listFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
2713
+ start(filters?: string[]): Promise<void>;
2714
+ init(): Promise<void>;
2715
+ private getTestDependencies;
2716
+ filterTestsBySource(specs: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
2655
2717
  /**
2656
- * Additional exclude patterns
2718
+ * @deprecated remove when vscode extension supports "getFileWorkspaceSpecs"
2657
2719
  */
2658
- cliExclude?: string[];
2720
+ getProjectsByTestFile(file: string): WorkspaceSpec[];
2721
+ getFileWorkspaceSpecs(file: string): WorkspaceSpec[];
2722
+ initializeGlobalSetup(paths: TestSpecification[]): Promise<void>;
2723
+ runFiles(specs: TestSpecification[], allTestsRun: boolean): Promise<void>;
2724
+ collectFiles(specs: WorkspaceSpec[]): Promise<void>;
2725
+ cancelCurrentRun(reason: CancelReason): Promise<void>;
2726
+ initBrowserServers(): Promise<void>;
2727
+ rerunFiles(files?: string[], trigger?: string, allTestsRun?: boolean): Promise<void>;
2728
+ changeProjectName(pattern: string): Promise<void>;
2729
+ changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
2730
+ changeFilenamePattern(pattern: string, files?: string[]): Promise<void>;
2731
+ rerunFailed(): Promise<void>;
2732
+ updateSnapshot(files?: string[]): Promise<void>;
2733
+ private _rerunTimer;
2734
+ private scheduleRerun;
2735
+ getModuleProjects(filepath: string): WorkspaceProject[];
2659
2736
  /**
2660
- * Override vite config's clearScreen from cli
2737
+ * Watch only the specified tests. If no tests are provided, all tests will be watched.
2661
2738
  */
2662
- clearScreen?: boolean;
2739
+ watchTests(tests: string[]): void;
2740
+ private updateLastChanged;
2741
+ onChange: (id: string) => void;
2742
+ onUnlink: (id: string) => void;
2743
+ onAdd: (id: string) => Promise<void>;
2744
+ checkUnhandledErrors(errors: unknown[]): void;
2745
+ private unregisterWatcher;
2746
+ private registerWatcher;
2663
2747
  /**
2664
- * benchmark.compare option exposed at the top level for cli
2748
+ * @returns A value indicating whether rerun is needed (changedTests was mutated)
2665
2749
  */
2666
- compare?: string;
2750
+ private handleFileChanged;
2751
+ private reportCoverage;
2752
+ close(): Promise<void>;
2667
2753
  /**
2668
- * benchmark.outputJson option exposed at the top level for cli
2754
+ * Close the thread pool and exit the process
2669
2755
  */
2670
- outputJson?: string;
2756
+ exit(force?: boolean): Promise<void>;
2757
+ report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
2758
+ getTestFilepaths(): Promise<string[]>;
2759
+ globTestSpecs(filters?: string[]): Promise<WorkspaceSpec[]>;
2671
2760
  /**
2672
- * Directory of blob reports to merge
2673
- * @default '.vitest-reports'
2761
+ * @deprecated use globTestSpecs instead
2674
2762
  */
2675
- mergeReports?: string;
2676
- }
2677
- interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool' | 'cliExclude' | 'diff' | 'setupFiles' | 'snapshotEnvironment' | 'bail'> {
2678
- mode: VitestRunMode;
2679
- base?: string;
2680
- diff?: string;
2681
- bail?: number;
2682
- setupFiles: string[];
2683
- snapshotEnvironment?: string;
2684
- config?: string;
2685
- filters?: string[];
2686
- testNamePattern?: RegExp;
2687
- related?: string[];
2688
- coverage: ResolvedCoverageOptions;
2689
- snapshotOptions: SnapshotStateOptions;
2690
- browser: ResolvedBrowserOptions;
2691
- pool: Pool;
2692
- poolOptions?: ResolvedPoolOptions;
2693
- reporters: (InlineReporter | ReporterWithOptions)[];
2694
- defines: Record<string, any>;
2695
- api?: ApiConfig;
2696
- cliExclude?: string[];
2697
- benchmark?: Required<Omit<BenchmarkUserOptions, 'outputFile' | 'compare' | 'outputJson'>> & Pick<BenchmarkUserOptions, 'outputFile' | 'compare' | 'outputJson'>;
2698
- shard?: {
2699
- index: number;
2700
- count: number;
2701
- };
2702
- cache: {
2703
- /**
2704
- * @deprecated
2705
- */
2706
- dir: string;
2707
- } | false;
2708
- sequence: {
2709
- sequencer: TestSequencerConstructor;
2710
- hooks: SequenceHooks;
2711
- setupFiles: SequenceSetupFiles;
2712
- shuffle?: boolean;
2713
- concurrent?: boolean;
2714
- seed: number;
2715
- };
2716
- typecheck: Omit<TypecheckConfig, 'enabled'> & {
2717
- enabled: boolean;
2718
- };
2719
- runner?: string;
2720
- maxWorkers: number;
2721
- minWorkers: number;
2722
- }
2723
- 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';
2724
- type ProjectConfig = Omit<UserConfig, NonProjectOptions | 'sequencer' | 'deps' | 'poolOptions'> & {
2725
- sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
2726
- deps?: Omit<DepsOptions, 'moduleDirectories'>;
2727
- poolOptions?: {
2728
- threads?: Pick<NonNullable<PoolOptions['threads']>, 'singleThread' | 'isolate'>;
2729
- vmThreads?: Pick<NonNullable<PoolOptions['vmThreads']>, 'singleThread'>;
2730
- forks?: Pick<NonNullable<PoolOptions['forks']>, 'singleFork' | 'isolate'>;
2731
- };
2732
- };
2733
- type ResolvedProjectConfig = Omit<ResolvedConfig, NonProjectOptions>;
2734
- interface UserWorkspaceConfig extends UserConfig$1 {
2735
- test?: ProjectConfig;
2763
+ globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
2764
+ private ensureSpecCached;
2765
+ shouldKeepServer(): boolean;
2766
+ onServerRestart(fn: OnServerRestartHandler): void;
2767
+ onAfterSetServer(fn: OnServerRestartHandler): void;
2768
+ onCancel(fn: (reason: CancelReason) => void): void;
2769
+ onClose(fn: () => void): void;
2736
2770
  }
2737
- type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>;
2738
- type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
2739
- type WorkspaceProjectConfiguration = string | (UserProjectConfigExport & {
2740
- /**
2741
- * Relative path to the extendable config. All other options will be merged with this config.
2742
- * @example '../vite.config.ts'
2743
- */
2744
- extends?: string;
2745
- });
2746
2771
 
2747
- export { type BrowserProviderInitializationOptions as $, type ApiConfig as A, type BaseCoverageOptions as B, type CoverageProvider as C, type DepsOptimizationOptions as D, type ResolvedConfig as E, type ProjectConfig as F, type BenchmarkUserOptions as G, type VitestOptions as H, type InlineConfig as I, WorkspaceProject as J, type TestSequencer as K, Logger as L, type WorkspaceSpec as M, TestModule as N, type ModuleDiagnostic as O, type Pool as P, type ProcessPool as Q, type ResolvedCoverageOptions as R, type SerializedTestSpecification as S, type TscErrorInfo as T, type UserWorkspaceConfig as U, Vitest as V, type WorkspaceProjectConfiguration as W, getFilePoolName as X, VitestPackageInstaller as Y, TestSpecification as Z, type TestSequencerConstructor as _, type ReportContext as a, type BrowserProvider as a0, type CDPSession as a1, type BrowserProviderModule as a2, type ResolvedBrowserOptions as a3, type BrowserProviderOptions as a4, type BrowserBuiltinProvider as a5, type BrowserCommand as a6, type BrowserCommandContext as a7, type BrowserServer as a8, type BrowserServerState as a9, BaseReporter as aA, TestFile as aB, type FileDiagnostic as aC, ReportersMap as aD, type BuiltinReporters as aE, type BuiltinReporterOptions as aF, type JsonAssertionResult as aG, type JsonTestResult as aH, type JsonTestResults as aI, BenchmarkReportsMap as aJ, type BenchmarkBuiltinReporters as aK, type BrowserServerStateContext as aa, type BrowserOrchestrator as ab, type JsonOptions as ac, type JUnitOptions as ad, type HTMLOptions as ae, TestCase as af, TestSuite as ag, TestProject as ah, TestCollection as ai, type TaskOptions as aj, type TestDiagnostic as ak, type TestResult as al, type TestResultPassed as am, type TestResultFailed as an, type TestResultSkipped as ao, type ResolvedProjectConfig as ap, DefaultReporter as aq, BasicReporter as ar, DotReporter as as, JsonReporter as at, VerboseReporter as au, TapReporter as av, JUnitReporter as aw, TapFlatReporter as ax, HangingProcessReporter as ay, GithubActionsReporter as az, type CoverageProviderModule as b, type CoverageV8Options as c, type UserProjectConfigFn as d, type UserProjectConfigExport as e, type VitestEnvironment as f, type RawErrsMap as g, type CollectLineNumbers as h, type CollectLines as i, type RootAndTarget as j, type Context as k, type CoverageReporter as l, type CoverageProviderName as m, type CoverageOptions as n, type CoverageIstanbulOptions as o, type CustomProviderOptions as p, type Reporter as q, type BrowserScript as r, type BrowserConfigOptions as s, type BuiltinEnvironment as t, type PoolOptions as u, type CSSModuleScopeStrategy as v, type VitestRunMode as w, type TransformModePatterns as x, type TypecheckConfig as y, type UserConfig as z };
2772
+ export { type HTMLOptions as $, type ApiConfig as A, type BaseCoverageOptions as B, type CoverageProvider as C, type DepsOptimizationOptions as D, type ResolvedConfig as E, type ProjectConfig as F, type BenchmarkUserOptions as G, type VitestOptions as H, type InlineConfig as I, WorkspaceProject as J, type TestSequencer as K, Logger as L, type WorkspaceSpec as M, TestModule as N, type ModuleDiagnostic as O, type Pool as P, VitestPackageInstaller as Q, type ResolvedCoverageOptions as R, type SerializedTestSpecification as S, type TscErrorInfo as T, type UserWorkspaceConfig as U, Vitest as V, type WorkspaceProjectConfiguration as W, type ProcessPool as X, getFilePoolName as Y, TestProject as Z, type SerializedTestProject as _, type ReportContext as a, type JsonOptions$1 as a0, type JUnitOptions as a1, TestCase as a2, TestSuite as a3, type TaskOptions as a4, TestCollection as a5, type TestDiagnostic as a6, type TestResult as a7, type TestResultFailed as a8, type TestResultPassed as a9, VerboseReporter as aA, BaseReporter as aB, TestFile as aC, type FileDiagnostic as aD, ReportersMap as aE, type BuiltinReporters as aF, type BuiltinReporterOptions as aG, type JsonAssertionResult as aH, type JsonTestResult as aI, type JsonTestResults as aJ, BenchmarkReportsMap as aK, type BenchmarkBuiltinReporters as aL, type TestResultSkipped as aa, type TestSequencerConstructor as ab, TestSpecification as ac, type BrowserBuiltinProvider as ad, type BrowserCommand as ae, type BrowserCommandContext as af, type BrowserOrchestrator as ag, type BrowserProvider as ah, type BrowserProviderInitializationOptions as ai, type BrowserProviderModule as aj, type BrowserProviderOptions as ak, type BrowserServer as al, type BrowserServerState as am, type BrowserServerStateContext as an, type CDPSession as ao, type ResolvedBrowserOptions as ap, type ResolvedProjectConfig as aq, BasicReporter as ar, DefaultReporter as as, DotReporter as at, GithubActionsReporter as au, HangingProcessReporter as av, JsonReporter as aw, JUnitReporter as ax, TapFlatReporter as ay, TapReporter as az, type CoverageProviderModule as b, type CoverageV8Options as c, type UserProjectConfigFn as d, type UserProjectConfigExport as e, type VitestEnvironment as f, type RawErrsMap as g, type CollectLineNumbers as h, type CollectLines as i, type RootAndTarget as j, type Context as k, type CoverageReporter as l, type CoverageProviderName as m, type CoverageOptions as n, type CoverageIstanbulOptions as o, type CustomProviderOptions as p, type Reporter as q, type BrowserScript as r, type BrowserConfigOptions as s, type BuiltinEnvironment as t, type PoolOptions as u, type CSSModuleScopeStrategy as v, type VitestRunMode as w, type TransformModePatterns as x, type TypecheckConfig as y, type UserConfig as z };