vitest 2.2.0-beta.1 → 2.2.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +0 -75
- package/dist/browser.d.ts +6 -6
- package/dist/chunks/{RandomSequencer.CMRlh2v4.js → RandomSequencer.BPedXEug.js} +1 -0
- package/dist/chunks/{benchmark.geERunq4.d.ts → benchmark.CFFwLv-O.d.ts} +2 -2
- package/dist/chunks/{cac.Z91LBqmg.js → cac.Cs06pOqp.js} +5 -5
- package/dist/chunks/{cli-api.DVJJMJHj.js → cli-api.CB-jIbYQ.js} +570 -406
- package/dist/chunks/{index.DLRzErGF.js → index.bzFpKeaq.js} +568 -794
- package/dist/chunks/{reporters.B_9uUTGW.d.ts → reporters.F9D2idOT.d.ts} +1231 -1204
- package/dist/chunks/{resolveConfig.CQIc6fe7.js → resolveConfig.CLnvCvEs.js} +8 -8
- package/dist/chunks/{suite.B2jumIFP.d.ts → suite.BJU7kdY9.d.ts} +4 -4
- package/dist/chunks/{utils.DNoFbBUZ.js → utils.DJONn5B5.js} +15 -21
- package/dist/chunks/{vite.Bvms8Xir.d.ts → vite.DonA4fvH.d.ts} +1 -1
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +10 -9
- package/dist/coverage.d.ts +6 -6
- package/dist/coverage.js +2 -2
- package/dist/index.d.ts +7 -6
- package/dist/node.d.ts +19 -10
- package/dist/node.js +9 -9
- package/dist/reporters.d.ts +6 -6
- package/dist/reporters.js +4 -5
- package/dist/runners.d.ts +2 -2
- package/dist/suite.d.ts +2 -2
- package/package.json +13 -12
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import * as _vitest_runner from '@vitest/runner';
|
|
2
|
-
import { File, TaskResultPack, Task, Test,
|
|
3
|
-
import { b as Awaitable, U as UserConsoleLog,
|
|
2
|
+
import { File, TaskResultPack, Task, Test, Custom, TaskMeta, Suite, SequenceHooks, SequenceSetupFiles, CancelReason } from '@vitest/runner';
|
|
3
|
+
import { b as Awaitable, U as UserConsoleLog, A as AfterSuiteRunMeta, c as Arrayable$1, f as EnvironmentOptions, P as ProvidedContext, d as ArgumentsType, O as OnServerRestartHandler, h as OnTestsRerunHandler } from './environment.CT0jpO-1.js';
|
|
4
4
|
import { Writable } from 'node:stream';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { TransformResult as TransformResult$1, ServerOptions, DepOptimizationConfig, AliasOptions, UserConfig as UserConfig$1, ConfigEnv, ViteDevServer, ModuleNode } from 'vite';
|
|
6
|
+
import { TestError, ParsedStack, Arrayable, ErrorWithDiff, Awaitable as Awaitable$1 } from '@vitest/utils';
|
|
7
|
+
import { RawSourceMap, ViteNodeServerOptions } from 'vite-node';
|
|
8
|
+
import { StackTraceParserOptions } from '@vitest/utils/source-map';
|
|
8
9
|
import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.CPguQ7J1.js';
|
|
9
10
|
import { PrettyFormatOptions } from '@vitest/pretty-format';
|
|
10
11
|
import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
|
|
11
12
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
12
|
-
import { RawSourceMap, ViteNodeServerOptions } from 'vite-node';
|
|
13
13
|
import * as chai from 'chai';
|
|
14
|
-
import {
|
|
14
|
+
import { B as BenchmarkResult } from './benchmark.CFFwLv-O.js';
|
|
15
15
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
16
16
|
import { ViteNodeServer } from 'vite-node/server';
|
|
17
|
-
import { B as BenchmarkResult } from './benchmark.geERunq4.js';
|
|
18
17
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
19
18
|
import { Stats } from 'node:fs';
|
|
20
19
|
|
|
@@ -29,8 +28,6 @@ type SerializedTestSpecification = [
|
|
|
29
28
|
}
|
|
30
29
|
];
|
|
31
30
|
|
|
32
|
-
type ChaiConfig = Omit<Partial<typeof chai.config>, 'useProxy' | 'proxyExcludedKeys'>;
|
|
33
|
-
|
|
34
31
|
interface Reporter {
|
|
35
32
|
onInit?: (ctx: Vitest) => void;
|
|
36
33
|
onPathsCollected?: (paths?: string[]) => Awaitable<void>;
|
|
@@ -56,12 +53,10 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
56
53
|
failedUnwatchedFiles: Task[];
|
|
57
54
|
isTTY: boolean;
|
|
58
55
|
ctx: Vitest;
|
|
56
|
+
renderSucceed: boolean;
|
|
59
57
|
protected verbose: boolean;
|
|
60
58
|
private _filesInWatchMode;
|
|
61
59
|
private _timeStart;
|
|
62
|
-
private _lastRunTimeout;
|
|
63
|
-
private _lastRunTimer;
|
|
64
|
-
private _lastRunCount;
|
|
65
60
|
constructor(options?: BaseOptions);
|
|
66
61
|
onInit(ctx: Vitest): void;
|
|
67
62
|
log(...messages: any): void;
|
|
@@ -72,7 +67,6 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
72
67
|
protected printTask(task: Task): void;
|
|
73
68
|
private getDurationPrefix;
|
|
74
69
|
onWatcherStart(files?: File[], errors?: unknown[]): void;
|
|
75
|
-
private resetLastRunLog;
|
|
76
70
|
onWatcherRerun(files: string[], trigger?: string): void;
|
|
77
71
|
onUserConsoleLog(log: UserConsoleLog): void;
|
|
78
72
|
onTestRemoved(trigger?: string): void;
|
|
@@ -85,642 +79,149 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
85
79
|
private printTaskErrors;
|
|
86
80
|
}
|
|
87
81
|
|
|
88
|
-
interface
|
|
89
|
-
|
|
90
|
-
end: number;
|
|
91
|
-
}
|
|
92
|
-
interface ParsedTest extends Test {
|
|
93
|
-
start: number;
|
|
94
|
-
end: number;
|
|
95
|
-
}
|
|
96
|
-
interface ParsedSuite extends Suite {
|
|
97
|
-
start: number;
|
|
98
|
-
end: number;
|
|
99
|
-
}
|
|
100
|
-
interface LocalCallDefinition {
|
|
101
|
-
start: number;
|
|
102
|
-
end: number;
|
|
103
|
-
name: string;
|
|
104
|
-
type: 'suite' | 'test';
|
|
105
|
-
mode: 'run' | 'skip' | 'only' | 'todo';
|
|
106
|
-
task: ParsedSuite | ParsedFile | ParsedTest;
|
|
82
|
+
interface BlobOptions {
|
|
83
|
+
outputFile?: string;
|
|
107
84
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
85
|
+
declare class BlobReporter implements Reporter {
|
|
86
|
+
ctx: Vitest;
|
|
87
|
+
options: BlobOptions;
|
|
88
|
+
constructor(options: BlobOptions);
|
|
89
|
+
onInit(ctx: Vitest): void;
|
|
90
|
+
onFinished(files: File[] | undefined, errors: unknown[] | undefined, coverage: unknown): Promise<void>;
|
|
114
91
|
}
|
|
115
92
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
filePath: string;
|
|
119
|
-
errCode: number;
|
|
120
|
-
errMsg: string;
|
|
121
|
-
line: number;
|
|
122
|
-
column: number;
|
|
123
|
-
}
|
|
124
|
-
interface CollectLineNumbers {
|
|
125
|
-
target: number;
|
|
126
|
-
next: number;
|
|
127
|
-
prev?: number;
|
|
93
|
+
interface DefaultReporterOptions extends BaseOptions {
|
|
94
|
+
summary?: boolean;
|
|
128
95
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
96
|
+
declare class DefaultReporter extends BaseReporter {
|
|
97
|
+
private options;
|
|
98
|
+
private summary?;
|
|
99
|
+
constructor(options?: DefaultReporterOptions);
|
|
100
|
+
onInit(ctx: Vitest): void;
|
|
101
|
+
onPathsCollected(paths?: string[]): void;
|
|
102
|
+
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
103
|
+
onWatcherRerun(files: string[], trigger?: string): void;
|
|
104
|
+
onFinished(files?: File[], errors?: unknown[]): void;
|
|
135
105
|
}
|
|
136
|
-
type Context = RootAndTarget & {
|
|
137
|
-
rawErrsMap: RawErrsMap;
|
|
138
|
-
openedDirs: Set<string>;
|
|
139
|
-
lastActivePath?: string;
|
|
140
|
-
};
|
|
141
106
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
stacks: ParsedStack[];
|
|
145
|
-
name: string;
|
|
146
|
-
constructor(message: string, stacks: ParsedStack[]);
|
|
107
|
+
interface HTMLOptions {
|
|
108
|
+
outputFile?: string;
|
|
147
109
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
110
|
+
|
|
111
|
+
declare class ReportedTaskImplementation {
|
|
112
|
+
/**
|
|
113
|
+
* Task instance.
|
|
114
|
+
* @experimental Public runner task API is experimental and does not follow semver.
|
|
115
|
+
*/
|
|
116
|
+
readonly task: Task;
|
|
117
|
+
/**
|
|
118
|
+
* The project assosiacted with the test or suite.
|
|
119
|
+
*/
|
|
120
|
+
readonly project: TestProject;
|
|
121
|
+
/**
|
|
122
|
+
* Unique identifier.
|
|
123
|
+
* This ID is deterministic and will be the same for the same test across multiple runs.
|
|
124
|
+
* The ID is based on the project name, module url and test position.
|
|
125
|
+
*/
|
|
126
|
+
readonly id: string;
|
|
127
|
+
/**
|
|
128
|
+
* Location in the module where the test or suite is defined.
|
|
129
|
+
*/
|
|
130
|
+
readonly location: {
|
|
131
|
+
line: number;
|
|
132
|
+
column: number;
|
|
133
|
+
} | undefined;
|
|
134
|
+
protected constructor(task: Task, project: TestProject);
|
|
135
|
+
/**
|
|
136
|
+
* Creates a new reported task instance and stores it in the project's state for future use.
|
|
137
|
+
*/
|
|
138
|
+
static register(task: Task, project: TestProject): TestCase | TestSuite | TestModule;
|
|
152
139
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
protected
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
140
|
+
declare class TestCase extends ReportedTaskImplementation {
|
|
141
|
+
#private;
|
|
142
|
+
readonly task: Test | Custom;
|
|
143
|
+
readonly type = "test";
|
|
144
|
+
/**
|
|
145
|
+
* Direct reference to the test module where the test or suite is defined.
|
|
146
|
+
*/
|
|
147
|
+
readonly module: TestModule;
|
|
148
|
+
/**
|
|
149
|
+
* Name of the test.
|
|
150
|
+
*/
|
|
151
|
+
readonly name: string;
|
|
152
|
+
/**
|
|
153
|
+
* Options that the test was initiated with.
|
|
154
|
+
*/
|
|
155
|
+
readonly options: TaskOptions;
|
|
156
|
+
/**
|
|
157
|
+
* Parent suite. If the test was called directly inside the module, the parent will be the module itself.
|
|
158
|
+
*/
|
|
159
|
+
readonly parent: TestSuite | TestModule;
|
|
160
|
+
protected constructor(task: Test | Custom, project: TestProject);
|
|
161
|
+
/**
|
|
162
|
+
* Full name of the test including all parent suites separated with `>`.
|
|
163
|
+
*/
|
|
164
|
+
get fullName(): string;
|
|
165
|
+
/**
|
|
166
|
+
* Test results. Will be `undefined` if test is not finished yet or was just collected.
|
|
167
|
+
*/
|
|
168
|
+
result(): TestResult | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Checks if the test did not fail the suite.
|
|
171
|
+
* If the test is not finished yet or was skipped, it will return `true`.
|
|
172
|
+
*/
|
|
173
|
+
ok(): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Custom metadata that was attached to the test during its execution.
|
|
176
|
+
*/
|
|
177
|
+
meta(): TaskMeta;
|
|
178
|
+
/**
|
|
179
|
+
* Useful information about the test like duration, memory usage, etc.
|
|
180
|
+
* Diagnostic is only available after the test has finished.
|
|
181
|
+
*/
|
|
182
|
+
diagnostic(): TestDiagnostic | undefined;
|
|
195
183
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
184
|
+
declare class TestCollection {
|
|
185
|
+
#private;
|
|
186
|
+
constructor(task: Suite | File, project: TestProject);
|
|
187
|
+
/**
|
|
188
|
+
* Returns the test or suite at a specific index in the array.
|
|
189
|
+
*/
|
|
190
|
+
at(index: number): TestCase | TestSuite | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* The number of tests and suites in the collection.
|
|
193
|
+
*/
|
|
194
|
+
get size(): number;
|
|
195
|
+
/**
|
|
196
|
+
* Returns the collection in array form for easier manipulation.
|
|
197
|
+
*/
|
|
198
|
+
array(): (TestCase | TestSuite)[];
|
|
199
|
+
/**
|
|
200
|
+
* Filters all tests that are part of this collection and its children.
|
|
201
|
+
*/
|
|
202
|
+
allTests(state?: TestResult['state'] | 'running'): Generator<TestCase, undefined, void>;
|
|
203
|
+
/**
|
|
204
|
+
* Filters only the tests that are part of this collection.
|
|
205
|
+
*/
|
|
206
|
+
tests(state?: TestResult['state'] | 'running'): Generator<TestCase, undefined, void>;
|
|
207
|
+
/**
|
|
208
|
+
* Filters only the suites that are part of this collection.
|
|
209
|
+
*/
|
|
210
|
+
suites(): Generator<TestSuite, undefined, void>;
|
|
211
|
+
/**
|
|
212
|
+
* Filters all suites that are part of this collection and its children.
|
|
213
|
+
*/
|
|
214
|
+
allSuites(): Generator<TestSuite, undefined, void>;
|
|
215
|
+
[Symbol.iterator](): Generator<TestSuite | TestCase, undefined, void>;
|
|
199
216
|
}
|
|
200
217
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
// Write output but don't hide the cursor
|
|
210
|
-
const log = createLogUpdate(process.stdout, {
|
|
211
|
-
showCursor: true
|
|
212
|
-
});
|
|
213
|
-
```
|
|
214
|
-
*/
|
|
215
|
-
readonly showCursor?: boolean;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
type LogUpdateMethods = {
|
|
219
|
-
/**
|
|
220
|
-
Clear the logged output.
|
|
221
|
-
*/
|
|
222
|
-
clear(): void;
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
Persist the logged output. Useful if you want to start a new log session below the current one.
|
|
226
|
-
*/
|
|
227
|
-
done(): void;
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
Log to `stdout` by overwriting the previous output in the terminal.
|
|
232
|
-
|
|
233
|
-
@param text - The text to log to `stdout`.
|
|
234
|
-
|
|
235
|
-
@example
|
|
236
|
-
```
|
|
237
|
-
import logUpdate from 'log-update';
|
|
238
|
-
|
|
239
|
-
const frames = ['-', '\\', '|', '/'];
|
|
240
|
-
let index = 0;
|
|
241
|
-
|
|
242
|
-
setInterval(() => {
|
|
243
|
-
const frame = frames[index = ++index % frames.length];
|
|
244
|
-
|
|
245
|
-
logUpdate(
|
|
246
|
-
`
|
|
247
|
-
♥♥
|
|
248
|
-
${frame} unicorns ${frame}
|
|
249
|
-
♥♥
|
|
250
|
-
`
|
|
251
|
-
);
|
|
252
|
-
}, 80);
|
|
253
|
-
```
|
|
254
|
-
*/
|
|
255
|
-
declare const logUpdate: ((...text: string[]) => void) & LogUpdateMethods;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
Get a `logUpdate` method that logs to the specified stream.
|
|
260
|
-
|
|
261
|
-
@param stream - The stream to log to.
|
|
262
|
-
|
|
263
|
-
@example
|
|
264
|
-
```
|
|
265
|
-
import {createLogUpdate} from 'log-update';
|
|
266
|
-
|
|
267
|
-
// Write output but don't hide the cursor
|
|
268
|
-
const log = createLogUpdate(process.stdout);
|
|
269
|
-
```
|
|
270
|
-
*/
|
|
271
|
-
declare function createLogUpdate(
|
|
272
|
-
stream: NodeJS.WritableStream,
|
|
273
|
-
options?: Options
|
|
274
|
-
): typeof logUpdate;
|
|
275
|
-
|
|
276
|
-
interface ErrorOptions {
|
|
277
|
-
type?: string;
|
|
278
|
-
fullStack?: boolean;
|
|
279
|
-
project?: WorkspaceProject;
|
|
280
|
-
verbose?: boolean;
|
|
281
|
-
screenshotPaths?: string[];
|
|
282
|
-
task?: Task;
|
|
283
|
-
showCodeFrame?: boolean;
|
|
284
|
-
}
|
|
285
|
-
declare class Logger {
|
|
286
|
-
ctx: Vitest;
|
|
287
|
-
outputStream: NodeJS.WriteStream | Writable;
|
|
288
|
-
errorStream: NodeJS.WriteStream | Writable;
|
|
289
|
-
logUpdate: ReturnType<typeof createLogUpdate>;
|
|
290
|
-
private _clearScreenPending;
|
|
291
|
-
private _highlights;
|
|
292
|
-
console: Console;
|
|
293
|
-
constructor(ctx: Vitest, outputStream?: NodeJS.WriteStream | Writable, errorStream?: NodeJS.WriteStream | Writable);
|
|
294
|
-
log(...args: any[]): void;
|
|
295
|
-
error(...args: any[]): void;
|
|
296
|
-
warn(...args: any[]): void;
|
|
297
|
-
clearFullScreen(message?: string): void;
|
|
298
|
-
clearScreen(message: string, force?: boolean): void;
|
|
299
|
-
private _clearScreen;
|
|
300
|
-
printError(err: unknown, options?: ErrorOptions): PrintErrorResult | undefined;
|
|
301
|
-
clearHighlightCache(filename?: string): void;
|
|
302
|
-
highlight(filename: string, source: string): string;
|
|
303
|
-
printNoTestFound(filters?: string[]): void;
|
|
304
|
-
printBanner(): void;
|
|
305
|
-
printBrowserBanner(project: WorkspaceProject): void;
|
|
306
|
-
printUnhandledErrors(errors: unknown[]): void;
|
|
307
|
-
printSourceTypeErrors(errors: TypeCheckError[]): void;
|
|
308
|
-
private registerUnhandledRejection;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
interface BrowserProviderInitializationOptions {
|
|
312
|
-
browser: string;
|
|
313
|
-
options?: BrowserProviderOptions;
|
|
314
|
-
}
|
|
315
|
-
interface CDPSession {
|
|
316
|
-
send: (method: string, params?: Record<string, unknown>) => Promise<unknown>;
|
|
317
|
-
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
318
|
-
once: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
319
|
-
off: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
320
|
-
}
|
|
321
|
-
interface BrowserProvider {
|
|
322
|
-
name: string;
|
|
323
|
-
/**
|
|
324
|
-
* @experimental opt-in into file parallelisation
|
|
325
|
-
*/
|
|
326
|
-
supportsParallelism: boolean;
|
|
327
|
-
getSupportedBrowsers: () => readonly string[];
|
|
328
|
-
beforeCommand?: (command: string, args: unknown[]) => Awaitable$1<void>;
|
|
329
|
-
afterCommand?: (command: string, args: unknown[]) => Awaitable$1<void>;
|
|
330
|
-
getCommandsContext: (contextId: string) => Record<string, unknown>;
|
|
331
|
-
openPage: (contextId: string, url: string, beforeNavigate?: () => Promise<void>) => Promise<void>;
|
|
332
|
-
getCDPSession?: (contextId: string) => Promise<CDPSession>;
|
|
333
|
-
close: () => Awaitable$1<void>;
|
|
334
|
-
initialize(ctx: WorkspaceProject, options: BrowserProviderInitializationOptions): Awaitable$1<void>;
|
|
335
|
-
}
|
|
336
|
-
interface BrowserProviderModule {
|
|
337
|
-
new (): BrowserProvider;
|
|
338
|
-
}
|
|
339
|
-
interface BrowserProviderOptions {
|
|
340
|
-
}
|
|
341
|
-
type BrowserBuiltinProvider = 'webdriverio' | 'playwright' | 'preview';
|
|
342
|
-
interface BrowserConfigOptions {
|
|
343
|
-
/**
|
|
344
|
-
* if running tests in the browser should be the default
|
|
345
|
-
*
|
|
346
|
-
* @default false
|
|
347
|
-
*/
|
|
348
|
-
enabled?: boolean;
|
|
349
|
-
/**
|
|
350
|
-
* Name of the browser
|
|
351
|
-
*/
|
|
352
|
-
name: string;
|
|
353
|
-
/**
|
|
354
|
-
* Browser provider
|
|
355
|
-
*
|
|
356
|
-
* @default 'preview'
|
|
357
|
-
*/
|
|
358
|
-
provider?: BrowserBuiltinProvider | (string & {});
|
|
359
|
-
/**
|
|
360
|
-
* Options that are passed down to a browser provider.
|
|
361
|
-
* To support type hinting, add one of the types to your tsconfig.json "compilerOptions.types" field:
|
|
362
|
-
*
|
|
363
|
-
* - for webdriverio: `@vitest/browser/providers/webdriverio`
|
|
364
|
-
* - for playwright: `@vitest/browser/providers/playwright`
|
|
365
|
-
*
|
|
366
|
-
* @example
|
|
367
|
-
* { playwright: { launch: { devtools: true } }
|
|
368
|
-
*/
|
|
369
|
-
providerOptions?: BrowserProviderOptions;
|
|
370
|
-
/**
|
|
371
|
-
* enable headless mode
|
|
372
|
-
*
|
|
373
|
-
* @default process.env.CI
|
|
374
|
-
*/
|
|
375
|
-
headless?: boolean;
|
|
376
|
-
/**
|
|
377
|
-
* Serve API options.
|
|
378
|
-
*
|
|
379
|
-
* The default port is 63315.
|
|
380
|
-
*/
|
|
381
|
-
api?: ApiConfig | number;
|
|
382
|
-
/**
|
|
383
|
-
* Isolate test environment after each test
|
|
384
|
-
*
|
|
385
|
-
* @default true
|
|
386
|
-
*/
|
|
387
|
-
isolate?: boolean;
|
|
388
|
-
/**
|
|
389
|
-
* Run test files in parallel if provider supports this option
|
|
390
|
-
* This option only has effect in headless mode (enabled in CI by default)
|
|
391
|
-
*
|
|
392
|
-
* @default // Same as "test.fileParallelism"
|
|
393
|
-
*/
|
|
394
|
-
fileParallelism?: boolean;
|
|
395
|
-
/**
|
|
396
|
-
* Show Vitest UI
|
|
397
|
-
*
|
|
398
|
-
* @default !process.env.CI
|
|
399
|
-
*/
|
|
400
|
-
ui?: boolean;
|
|
401
|
-
/**
|
|
402
|
-
* Default viewport size
|
|
403
|
-
*/
|
|
404
|
-
viewport?: {
|
|
405
|
-
/**
|
|
406
|
-
* Width of the viewport
|
|
407
|
-
* @default 414
|
|
408
|
-
*/
|
|
409
|
-
width: number;
|
|
410
|
-
/**
|
|
411
|
-
* Height of the viewport
|
|
412
|
-
* @default 896
|
|
413
|
-
*/
|
|
414
|
-
height: number;
|
|
415
|
-
};
|
|
416
|
-
/**
|
|
417
|
-
* Locator options
|
|
418
|
-
*/
|
|
419
|
-
locators?: {
|
|
420
|
-
/**
|
|
421
|
-
* Attribute used to locate elements by test id
|
|
422
|
-
* @default 'data-testid'
|
|
423
|
-
*/
|
|
424
|
-
testIdAttribute?: string;
|
|
425
|
-
};
|
|
426
|
-
/**
|
|
427
|
-
* Directory where screenshots will be saved when page.screenshot() is called
|
|
428
|
-
* If not set, all screenshots are saved to __screenshots__ directory in the same folder as the test file.
|
|
429
|
-
* If this is set, it will be resolved relative to the project root.
|
|
430
|
-
* @default __screenshots__
|
|
431
|
-
*/
|
|
432
|
-
screenshotDirectory?: string;
|
|
433
|
-
/**
|
|
434
|
-
* Should Vitest take screenshots if the test fails
|
|
435
|
-
* @default !browser.ui
|
|
436
|
-
*/
|
|
437
|
-
screenshotFailures?: boolean;
|
|
438
|
-
/**
|
|
439
|
-
* Scripts injected into the tester iframe.
|
|
440
|
-
* @deprecated Will be removed in the future, use `testerHtmlPath` instead.
|
|
441
|
-
*/
|
|
442
|
-
testerScripts?: BrowserScript[];
|
|
443
|
-
/**
|
|
444
|
-
* Path to the index.html file that will be used to run tests.
|
|
445
|
-
*/
|
|
446
|
-
testerHtmlPath?: string;
|
|
447
|
-
/**
|
|
448
|
-
* Scripts injected into the main window.
|
|
449
|
-
*/
|
|
450
|
-
orchestratorScripts?: BrowserScript[];
|
|
451
|
-
/**
|
|
452
|
-
* Commands that will be executed on the server
|
|
453
|
-
* via the browser `import("@vitest/browser/context").commands` API.
|
|
454
|
-
* @see {@link https://vitest.dev/guide/browser/commands}
|
|
455
|
-
*/
|
|
456
|
-
commands?: Record<string, BrowserCommand<any>>;
|
|
457
|
-
}
|
|
458
|
-
interface BrowserCommandContext {
|
|
459
|
-
testPath: string | undefined;
|
|
460
|
-
provider: BrowserProvider;
|
|
461
|
-
project: WorkspaceProject;
|
|
462
|
-
contextId: string;
|
|
463
|
-
}
|
|
464
|
-
interface BrowserServerStateContext {
|
|
465
|
-
files: string[];
|
|
466
|
-
method: 'run' | 'collect';
|
|
467
|
-
resolve: () => void;
|
|
468
|
-
reject: (v: unknown) => void;
|
|
469
|
-
}
|
|
470
|
-
interface BrowserOrchestrator {
|
|
471
|
-
createTesters: (files: string[]) => Promise<void>;
|
|
472
|
-
onCancel: (reason: CancelReason) => Promise<void>;
|
|
473
|
-
$close: () => void;
|
|
474
|
-
}
|
|
475
|
-
interface BrowserServerState {
|
|
476
|
-
orchestrators: Map<string, BrowserOrchestrator>;
|
|
477
|
-
getContext: (contextId: string) => BrowserServerStateContext | undefined;
|
|
478
|
-
createAsyncContext: (method: 'collect' | 'run', contextId: string, files: string[]) => Promise<void>;
|
|
479
|
-
}
|
|
480
|
-
interface BrowserServer {
|
|
481
|
-
vite: ViteDevServer;
|
|
482
|
-
state: BrowserServerState;
|
|
483
|
-
provider: BrowserProvider;
|
|
484
|
-
close: () => Promise<void>;
|
|
485
|
-
initBrowserProvider: () => Promise<void>;
|
|
486
|
-
parseStacktrace: (stack: string) => ParsedStack[];
|
|
487
|
-
parseErrorStacktrace: (error: ErrorWithDiff, options?: StackTraceParserOptions) => ParsedStack[];
|
|
488
|
-
}
|
|
489
|
-
interface BrowserCommand<Payload extends unknown[]> {
|
|
490
|
-
(context: BrowserCommandContext, ...payload: Payload): Awaitable$1<any>;
|
|
491
|
-
}
|
|
492
|
-
interface BrowserScript {
|
|
493
|
-
/**
|
|
494
|
-
* If "content" is provided and type is "module", this will be its identifier.
|
|
495
|
-
*
|
|
496
|
-
* If you are using TypeScript, you can add `.ts` extension here for example.
|
|
497
|
-
* @default `injected-${index}.js`
|
|
498
|
-
*/
|
|
499
|
-
id?: string;
|
|
500
|
-
/**
|
|
501
|
-
* JavaScript content to be injected. This string is processed by Vite plugins if type is "module".
|
|
502
|
-
*
|
|
503
|
-
* You can use `id` to give Vite a hint about the file extension.
|
|
504
|
-
*/
|
|
505
|
-
content?: string;
|
|
506
|
-
/**
|
|
507
|
-
* Path to the script. This value is resolved by Vite so it can be a node module or a file path.
|
|
508
|
-
*/
|
|
509
|
-
src?: string;
|
|
510
|
-
/**
|
|
511
|
-
* If the script should be loaded asynchronously.
|
|
512
|
-
*/
|
|
513
|
-
async?: boolean;
|
|
514
|
-
/**
|
|
515
|
-
* Script type.
|
|
516
|
-
* @default 'module'
|
|
517
|
-
*/
|
|
518
|
-
type?: string;
|
|
519
|
-
}
|
|
520
|
-
interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
521
|
-
enabled: boolean;
|
|
522
|
-
headless: boolean;
|
|
523
|
-
isolate: boolean;
|
|
524
|
-
fileParallelism: boolean;
|
|
525
|
-
api: ApiConfig;
|
|
526
|
-
ui: boolean;
|
|
527
|
-
viewport: {
|
|
528
|
-
width: number;
|
|
529
|
-
height: number;
|
|
530
|
-
};
|
|
531
|
-
screenshotFailures: boolean;
|
|
532
|
-
locators: {
|
|
533
|
-
testIdAttribute: string;
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
interface InitializeProjectOptions extends UserWorkspaceConfig {
|
|
538
|
-
workspaceConfigPath: string;
|
|
539
|
-
extends?: string;
|
|
540
|
-
}
|
|
541
|
-
declare class WorkspaceProject {
|
|
542
|
-
path: string | number;
|
|
543
|
-
ctx: Vitest;
|
|
544
|
-
options?: InitializeProjectOptions | undefined;
|
|
545
|
-
configOverride: Partial<ResolvedConfig> | undefined;
|
|
546
|
-
config: ResolvedConfig;
|
|
547
|
-
server: ViteDevServer;
|
|
548
|
-
vitenode: ViteNodeServer;
|
|
549
|
-
runner: ViteNodeRunner;
|
|
550
|
-
browser?: BrowserServer;
|
|
551
|
-
typechecker?: Typechecker;
|
|
552
|
-
closingPromise: Promise<unknown> | undefined;
|
|
553
|
-
testFilesList: string[] | null;
|
|
554
|
-
typecheckFilesList: string[] | null;
|
|
555
|
-
testProject: TestProject;
|
|
556
|
-
readonly id: string;
|
|
557
|
-
readonly tmpDir: string;
|
|
558
|
-
private _globalSetups;
|
|
559
|
-
private _provided;
|
|
560
|
-
constructor(path: string | number, ctx: Vitest, options?: InitializeProjectOptions | undefined);
|
|
561
|
-
getName(): string;
|
|
562
|
-
isCore(): boolean;
|
|
563
|
-
provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
|
|
564
|
-
getProvidedContext(): ProvidedContext;
|
|
565
|
-
createSpec(moduleId: string, pool: string): WorkspaceSpec;
|
|
566
|
-
initializeGlobalSetup(): Promise<void>;
|
|
567
|
-
teardownGlobalSetup(): Promise<void>;
|
|
568
|
-
get logger(): Logger;
|
|
569
|
-
getModulesByFilepath(file: string): Set<vite.ModuleNode>;
|
|
570
|
-
getModuleById(id: string): vite.ModuleNode | undefined;
|
|
571
|
-
getSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
|
|
572
|
-
get reporters(): Reporter[];
|
|
573
|
-
globTestFiles(filters?: string[]): Promise<{
|
|
574
|
-
testFiles: string[];
|
|
575
|
-
typecheckTestFiles: string[];
|
|
576
|
-
}>;
|
|
577
|
-
globAllTestFiles(include: string[], exclude: string[], includeSource: string[] | undefined, cwd: string): Promise<string[]>;
|
|
578
|
-
isTestFile(id: string): boolean | null;
|
|
579
|
-
isTypecheckFile(id: string): boolean | null;
|
|
580
|
-
globFiles(include: string[], exclude: string[], cwd: string): Promise<string[]>;
|
|
581
|
-
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
582
|
-
isInSourceTestFile(code: string): boolean;
|
|
583
|
-
filterFiles(testFiles: string[], filters: string[], dir: string): string[];
|
|
584
|
-
initBrowserServer(): Promise<void>;
|
|
585
|
-
static createBasicProject(ctx: Vitest): WorkspaceProject;
|
|
586
|
-
static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
|
|
587
|
-
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
588
|
-
isBrowserEnabled(): boolean;
|
|
589
|
-
getSerializableConfig(): SerializedConfig;
|
|
590
|
-
close(): Promise<unknown>;
|
|
591
|
-
private clearTmpDir;
|
|
592
|
-
initBrowserProvider(): Promise<void>;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
interface BlobOptions {
|
|
596
|
-
outputFile?: string;
|
|
597
|
-
}
|
|
598
|
-
declare class BlobReporter implements Reporter {
|
|
599
|
-
ctx: Vitest;
|
|
600
|
-
options: BlobOptions;
|
|
601
|
-
constructor(options: BlobOptions);
|
|
602
|
-
onInit(ctx: Vitest): void;
|
|
603
|
-
onFinished(files: File[] | undefined, errors: unknown[] | undefined, coverage: unknown): Promise<void>;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
interface HTMLOptions {
|
|
607
|
-
outputFile?: string;
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
declare class ReportedTaskImplementation {
|
|
611
|
-
/**
|
|
612
|
-
* Task instance.
|
|
613
|
-
* @experimental Public runner task API is experimental and does not follow semver.
|
|
614
|
-
*/
|
|
615
|
-
readonly task: Task;
|
|
616
|
-
/**
|
|
617
|
-
* The project assosiacted with the test or suite.
|
|
618
|
-
*/
|
|
619
|
-
readonly project: TestProject;
|
|
620
|
-
/**
|
|
621
|
-
* Unique identifier.
|
|
622
|
-
* This ID is deterministic and will be the same for the same test across multiple runs.
|
|
623
|
-
* The ID is based on the project name, module url and test position.
|
|
624
|
-
*/
|
|
625
|
-
readonly id: string;
|
|
626
|
-
/**
|
|
627
|
-
* Location in the module where the test or suite is defined.
|
|
628
|
-
*/
|
|
629
|
-
readonly location: {
|
|
630
|
-
line: number;
|
|
631
|
-
column: number;
|
|
632
|
-
} | undefined;
|
|
633
|
-
protected constructor(task: Task, project: WorkspaceProject);
|
|
634
|
-
/**
|
|
635
|
-
* Creates a new reported task instance and stores it in the project's state for future use.
|
|
636
|
-
*/
|
|
637
|
-
static register(task: Task, project: WorkspaceProject): TestCase | TestSuite | TestModule;
|
|
638
|
-
}
|
|
639
|
-
declare class TestCase extends ReportedTaskImplementation {
|
|
640
|
-
#private;
|
|
641
|
-
readonly task: Test | Custom;
|
|
642
|
-
readonly type = "test";
|
|
643
|
-
/**
|
|
644
|
-
* Direct reference to the test module where the test or suite is defined.
|
|
645
|
-
*/
|
|
646
|
-
readonly module: TestModule;
|
|
647
|
-
/**
|
|
648
|
-
* Name of the test.
|
|
649
|
-
*/
|
|
650
|
-
readonly name: string;
|
|
651
|
-
/**
|
|
652
|
-
* Options that the test was initiated with.
|
|
653
|
-
*/
|
|
654
|
-
readonly options: TaskOptions;
|
|
655
|
-
/**
|
|
656
|
-
* Parent suite. If the test was called directly inside the module, the parent will be the module itself.
|
|
657
|
-
*/
|
|
658
|
-
readonly parent: TestSuite | TestModule;
|
|
659
|
-
protected constructor(task: Test | Custom, project: WorkspaceProject);
|
|
660
|
-
/**
|
|
661
|
-
* Full name of the test including all parent suites separated with `>`.
|
|
662
|
-
*/
|
|
663
|
-
get fullName(): string;
|
|
664
|
-
/**
|
|
665
|
-
* Test results. Will be `undefined` if test is not finished yet or was just collected.
|
|
666
|
-
*/
|
|
667
|
-
result(): TestResult | undefined;
|
|
668
|
-
/**
|
|
669
|
-
* Checks if the test did not fail the suite.
|
|
670
|
-
* If the test is not finished yet or was skipped, it will return `true`.
|
|
671
|
-
*/
|
|
672
|
-
ok(): boolean;
|
|
673
|
-
/**
|
|
674
|
-
* Custom metadata that was attached to the test during its execution.
|
|
675
|
-
*/
|
|
676
|
-
meta(): TaskMeta;
|
|
677
|
-
/**
|
|
678
|
-
* Useful information about the test like duration, memory usage, etc.
|
|
679
|
-
* Diagnostic is only available after the test has finished.
|
|
680
|
-
*/
|
|
681
|
-
diagnostic(): TestDiagnostic | undefined;
|
|
682
|
-
}
|
|
683
|
-
declare class TestCollection {
|
|
684
|
-
#private;
|
|
685
|
-
constructor(task: Suite | File, project: WorkspaceProject);
|
|
686
|
-
/**
|
|
687
|
-
* Returns the test or suite at a specific index in the array.
|
|
688
|
-
*/
|
|
689
|
-
at(index: number): TestCase | TestSuite | undefined;
|
|
690
|
-
/**
|
|
691
|
-
* The number of tests and suites in the collection.
|
|
692
|
-
*/
|
|
693
|
-
get size(): number;
|
|
694
|
-
/**
|
|
695
|
-
* Returns the collection in array form for easier manipulation.
|
|
696
|
-
*/
|
|
697
|
-
array(): (TestCase | TestSuite)[];
|
|
698
|
-
/**
|
|
699
|
-
* Filters all tests that are part of this collection and its children.
|
|
700
|
-
*/
|
|
701
|
-
allTests(state?: TestResult['state'] | 'running'): Generator<TestCase, undefined, void>;
|
|
702
|
-
/**
|
|
703
|
-
* Filters only the tests that are part of this collection.
|
|
704
|
-
*/
|
|
705
|
-
tests(state?: TestResult['state'] | 'running'): Generator<TestCase, undefined, void>;
|
|
706
|
-
/**
|
|
707
|
-
* Filters only the suites that are part of this collection.
|
|
708
|
-
*/
|
|
709
|
-
suites(): Generator<TestSuite, undefined, void>;
|
|
710
|
-
/**
|
|
711
|
-
* Filters all suites that are part of this collection and its children.
|
|
712
|
-
*/
|
|
713
|
-
allSuites(): Generator<TestSuite, undefined, void>;
|
|
714
|
-
[Symbol.iterator](): Generator<TestSuite | TestCase, undefined, void>;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
declare abstract class SuiteImplementation extends ReportedTaskImplementation {
|
|
718
|
-
readonly task: Suite | File;
|
|
719
|
-
/**
|
|
720
|
-
* Collection of suites and tests that are part of this suite.
|
|
721
|
-
*/
|
|
722
|
-
readonly children: TestCollection;
|
|
723
|
-
protected constructor(task: Suite | File, project: WorkspaceProject);
|
|
218
|
+
declare abstract class SuiteImplementation extends ReportedTaskImplementation {
|
|
219
|
+
readonly task: Suite | File;
|
|
220
|
+
/**
|
|
221
|
+
* Collection of suites and tests that are part of this suite.
|
|
222
|
+
*/
|
|
223
|
+
readonly children: TestCollection;
|
|
224
|
+
protected constructor(task: Suite | File, project: TestProject);
|
|
724
225
|
}
|
|
725
226
|
declare class TestSuite extends SuiteImplementation {
|
|
726
227
|
#private;
|
|
@@ -742,7 +243,7 @@ declare class TestSuite extends SuiteImplementation {
|
|
|
742
243
|
* Options that suite was initiated with.
|
|
743
244
|
*/
|
|
744
245
|
readonly options: TaskOptions;
|
|
745
|
-
protected constructor(task: Suite, project:
|
|
246
|
+
protected constructor(task: Suite, project: TestProject);
|
|
746
247
|
/**
|
|
747
248
|
* Full name of the suite including all parent suites separated with `>`.
|
|
748
249
|
*/
|
|
@@ -758,7 +259,7 @@ declare class TestModule extends SuiteImplementation {
|
|
|
758
259
|
* This value corresponds to Vite's `ModuleGraph` id.
|
|
759
260
|
*/
|
|
760
261
|
readonly moduleId: string;
|
|
761
|
-
protected constructor(task: File, project:
|
|
262
|
+
protected constructor(task: File, project: TestProject);
|
|
762
263
|
/**
|
|
763
264
|
* Useful information about the module like duration, memory usage, etc.
|
|
764
265
|
* If the module was not executed yet, all diagnostic values will return `0`.
|
|
@@ -869,35 +370,231 @@ interface ModuleDiagnostic {
|
|
|
869
370
|
|
|
870
371
|
declare class BasicReporter extends BaseReporter {
|
|
871
372
|
constructor();
|
|
373
|
+
onInit(ctx: Vitest): void;
|
|
872
374
|
reportSummary(files: File[], errors: unknown[]): void;
|
|
873
375
|
}
|
|
874
376
|
|
|
875
|
-
interface
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
showHeap: boolean;
|
|
879
|
-
slowTestThreshold: number;
|
|
880
|
-
mode: VitestRunMode;
|
|
377
|
+
interface ParsedFile extends File {
|
|
378
|
+
start: number;
|
|
379
|
+
end: number;
|
|
881
380
|
}
|
|
882
|
-
|
|
883
|
-
start
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
381
|
+
interface ParsedTest extends Test {
|
|
382
|
+
start: number;
|
|
383
|
+
end: number;
|
|
384
|
+
}
|
|
385
|
+
interface ParsedSuite extends Suite {
|
|
386
|
+
start: number;
|
|
387
|
+
end: number;
|
|
388
|
+
}
|
|
389
|
+
interface LocalCallDefinition {
|
|
390
|
+
start: number;
|
|
391
|
+
end: number;
|
|
392
|
+
name: string;
|
|
393
|
+
type: 'suite' | 'test';
|
|
394
|
+
mode: 'run' | 'skip' | 'only' | 'todo';
|
|
395
|
+
task: ParsedSuite | ParsedFile | ParsedTest;
|
|
396
|
+
}
|
|
397
|
+
interface FileInformation {
|
|
398
|
+
file: File;
|
|
399
|
+
filepath: string;
|
|
400
|
+
parsed: string;
|
|
401
|
+
map: RawSourceMap | null;
|
|
402
|
+
definitions: LocalCallDefinition[];
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
type RawErrsMap = Map<string, TscErrorInfo[]>;
|
|
406
|
+
interface TscErrorInfo {
|
|
407
|
+
filePath: string;
|
|
408
|
+
errCode: number;
|
|
409
|
+
errMsg: string;
|
|
410
|
+
line: number;
|
|
411
|
+
column: number;
|
|
412
|
+
}
|
|
413
|
+
interface CollectLineNumbers {
|
|
414
|
+
target: number;
|
|
415
|
+
next: number;
|
|
416
|
+
prev?: number;
|
|
417
|
+
}
|
|
418
|
+
type CollectLines = {
|
|
419
|
+
[key in keyof CollectLineNumbers]: string;
|
|
420
|
+
};
|
|
421
|
+
interface RootAndTarget {
|
|
422
|
+
root: string;
|
|
423
|
+
targetAbsPath: string;
|
|
424
|
+
}
|
|
425
|
+
type Context = RootAndTarget & {
|
|
426
|
+
rawErrsMap: RawErrsMap;
|
|
427
|
+
openedDirs: Set<string>;
|
|
428
|
+
lastActivePath?: string;
|
|
887
429
|
};
|
|
888
430
|
|
|
889
|
-
declare class
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
431
|
+
declare class TypeCheckError extends Error {
|
|
432
|
+
message: string;
|
|
433
|
+
stacks: ParsedStack[];
|
|
434
|
+
name: string;
|
|
435
|
+
constructor(message: string, stacks: ParsedStack[]);
|
|
436
|
+
}
|
|
437
|
+
interface TypecheckResults {
|
|
438
|
+
files: File[];
|
|
439
|
+
sourceErrors: TypeCheckError[];
|
|
440
|
+
time: number;
|
|
441
|
+
}
|
|
442
|
+
type Callback<Args extends Array<any> = []> = (...args: Args) => Awaitable<void>;
|
|
443
|
+
declare class Typechecker {
|
|
444
|
+
protected ctx: TestProject;
|
|
445
|
+
private _onParseStart?;
|
|
446
|
+
private _onParseEnd?;
|
|
447
|
+
private _onWatcherRerun?;
|
|
448
|
+
private _result;
|
|
449
|
+
private _startTime;
|
|
450
|
+
private _output;
|
|
451
|
+
private _tests;
|
|
452
|
+
private tempConfigPath?;
|
|
453
|
+
private allowJs?;
|
|
454
|
+
private process?;
|
|
455
|
+
protected files: string[];
|
|
456
|
+
constructor(ctx: TestProject);
|
|
457
|
+
setFiles(files: string[]): void;
|
|
458
|
+
onParseStart(fn: Callback): void;
|
|
459
|
+
onParseEnd(fn: Callback<[TypecheckResults]>): void;
|
|
460
|
+
onWatcherRerun(fn: Callback): void;
|
|
461
|
+
protected collectFileTests(filepath: string): Promise<FileInformation | null>;
|
|
462
|
+
protected getFiles(): string[];
|
|
463
|
+
collectTests(): Promise<Record<string, FileInformation>>;
|
|
464
|
+
protected markPassed(file: File): void;
|
|
465
|
+
protected prepareResults(output: string): Promise<{
|
|
466
|
+
files: File[];
|
|
467
|
+
sourceErrors: TypeCheckError[];
|
|
468
|
+
time: number;
|
|
469
|
+
}>;
|
|
470
|
+
protected parseTscLikeOutput(output: string): Promise<Map<string, {
|
|
471
|
+
error: TypeCheckError;
|
|
472
|
+
originalError: TscErrorInfo;
|
|
473
|
+
}[]>>;
|
|
474
|
+
clear(): Promise<void>;
|
|
475
|
+
stop(): Promise<void>;
|
|
476
|
+
protected ensurePackageInstalled(ctx: Vitest, checker: string): Promise<void>;
|
|
477
|
+
prepare(): Promise<void>;
|
|
478
|
+
getExitCode(): number | false;
|
|
479
|
+
getOutput(): string;
|
|
480
|
+
start(): Promise<void>;
|
|
481
|
+
getResult(): TypecheckResults;
|
|
482
|
+
getTestFiles(): File[];
|
|
483
|
+
getTestPacks(): TaskResultPack[];
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
interface PrintErrorResult {
|
|
487
|
+
nearest?: ParsedStack;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
interface Options {
|
|
491
|
+
/**
|
|
492
|
+
Show the cursor. This can be useful when a CLI accepts input from a user.
|
|
493
|
+
|
|
494
|
+
@example
|
|
495
|
+
```
|
|
496
|
+
import {createLogUpdate} from 'log-update';
|
|
497
|
+
|
|
498
|
+
// Write output but don't hide the cursor
|
|
499
|
+
const log = createLogUpdate(process.stdout, {
|
|
500
|
+
showCursor: true
|
|
501
|
+
});
|
|
502
|
+
```
|
|
503
|
+
*/
|
|
504
|
+
readonly showCursor?: boolean;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
type LogUpdateMethods = {
|
|
508
|
+
/**
|
|
509
|
+
Clear the logged output.
|
|
510
|
+
*/
|
|
511
|
+
clear(): void;
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
Persist the logged output. Useful if you want to start a new log session below the current one.
|
|
515
|
+
*/
|
|
516
|
+
done(): void;
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
Log to `stdout` by overwriting the previous output in the terminal.
|
|
521
|
+
|
|
522
|
+
@param text - The text to log to `stdout`.
|
|
523
|
+
|
|
524
|
+
@example
|
|
525
|
+
```
|
|
526
|
+
import logUpdate from 'log-update';
|
|
527
|
+
|
|
528
|
+
const frames = ['-', '\\', '|', '/'];
|
|
529
|
+
let index = 0;
|
|
530
|
+
|
|
531
|
+
setInterval(() => {
|
|
532
|
+
const frame = frames[index = ++index % frames.length];
|
|
533
|
+
|
|
534
|
+
logUpdate(
|
|
535
|
+
`
|
|
536
|
+
♥♥
|
|
537
|
+
${frame} unicorns ${frame}
|
|
538
|
+
♥♥
|
|
539
|
+
`
|
|
540
|
+
);
|
|
541
|
+
}, 80);
|
|
542
|
+
```
|
|
543
|
+
*/
|
|
544
|
+
declare const logUpdate: ((...text: string[]) => void) & LogUpdateMethods;
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
Get a `logUpdate` method that logs to the specified stream.
|
|
549
|
+
|
|
550
|
+
@param stream - The stream to log to.
|
|
551
|
+
|
|
552
|
+
@example
|
|
553
|
+
```
|
|
554
|
+
import {createLogUpdate} from 'log-update';
|
|
555
|
+
|
|
556
|
+
// Write output but don't hide the cursor
|
|
557
|
+
const log = createLogUpdate(process.stdout);
|
|
558
|
+
```
|
|
559
|
+
*/
|
|
560
|
+
declare function createLogUpdate(
|
|
561
|
+
stream: NodeJS.WritableStream,
|
|
562
|
+
options?: Options
|
|
563
|
+
): typeof logUpdate;
|
|
564
|
+
|
|
565
|
+
interface ErrorOptions {
|
|
566
|
+
type?: string;
|
|
567
|
+
fullStack?: boolean;
|
|
568
|
+
project?: TestProject;
|
|
569
|
+
verbose?: boolean;
|
|
570
|
+
screenshotPaths?: string[];
|
|
571
|
+
task?: Task;
|
|
572
|
+
showCodeFrame?: boolean;
|
|
573
|
+
}
|
|
574
|
+
declare class Logger {
|
|
575
|
+
ctx: Vitest;
|
|
576
|
+
outputStream: NodeJS.WriteStream | Writable;
|
|
577
|
+
errorStream: NodeJS.WriteStream | Writable;
|
|
578
|
+
logUpdate: ReturnType<typeof createLogUpdate>;
|
|
579
|
+
private _clearScreenPending;
|
|
580
|
+
private _highlights;
|
|
581
|
+
console: Console;
|
|
582
|
+
constructor(ctx: Vitest, outputStream?: NodeJS.WriteStream | Writable, errorStream?: NodeJS.WriteStream | Writable);
|
|
583
|
+
log(...args: any[]): void;
|
|
584
|
+
error(...args: any[]): void;
|
|
585
|
+
warn(...args: any[]): void;
|
|
586
|
+
clearFullScreen(message?: string): void;
|
|
587
|
+
clearScreen(message: string, force?: boolean): void;
|
|
588
|
+
private _clearScreen;
|
|
589
|
+
printError(err: unknown, options?: ErrorOptions): PrintErrorResult | undefined;
|
|
590
|
+
clearHighlightCache(filename?: string): void;
|
|
591
|
+
highlight(filename: string, source: string): string;
|
|
592
|
+
printNoTestFound(filters?: string[]): void;
|
|
593
|
+
printBanner(): void;
|
|
594
|
+
printBrowserBanner(project: TestProject): void;
|
|
595
|
+
printUnhandledErrors(errors: unknown[]): void;
|
|
596
|
+
printSourceTypeErrors(errors: TypeCheckError[]): void;
|
|
597
|
+
private registerUnhandledRejection;
|
|
901
598
|
}
|
|
902
599
|
|
|
903
600
|
interface DotRendererOptions {
|
|
@@ -912,6 +609,7 @@ declare function createDotRenderer(_tasks: Task[], options: DotRendererOptions):
|
|
|
912
609
|
|
|
913
610
|
declare class DotReporter extends BaseReporter {
|
|
914
611
|
renderer?: ReturnType<typeof createDotRenderer>;
|
|
612
|
+
onTaskUpdate(): void;
|
|
915
613
|
onCollected(): void;
|
|
916
614
|
onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
|
|
917
615
|
onWatcherStart(): Promise<void>;
|
|
@@ -1095,9 +793,18 @@ declare class JsonReporter implements Reporter {
|
|
|
1095
793
|
writeReport(report: string): Promise<void>;
|
|
1096
794
|
}
|
|
1097
795
|
|
|
796
|
+
interface ClassnameTemplateVariables {
|
|
797
|
+
filename: string;
|
|
798
|
+
filepath: string;
|
|
799
|
+
}
|
|
1098
800
|
interface JUnitOptions {
|
|
1099
801
|
outputFile?: string;
|
|
802
|
+
/** @deprecated Use `classnameTemplate` instead. */
|
|
1100
803
|
classname?: string;
|
|
804
|
+
/**
|
|
805
|
+
* Template for the classname attribute. Can be either a string or a function. The string can contain placeholders {filename} and {filepath}.
|
|
806
|
+
*/
|
|
807
|
+
classnameTemplate?: string | ((classnameVariables: ClassnameTemplateVariables) => string);
|
|
1101
808
|
suiteName?: string;
|
|
1102
809
|
/**
|
|
1103
810
|
* Write <system-out> and <system-err> for console output
|
|
@@ -1143,7 +850,7 @@ declare class TapFlatReporter extends TapReporter {
|
|
|
1143
850
|
|
|
1144
851
|
declare class VerboseReporter extends DefaultReporter {
|
|
1145
852
|
protected verbose: boolean;
|
|
1146
|
-
|
|
853
|
+
renderSucceed: boolean;
|
|
1147
854
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1148
855
|
}
|
|
1149
856
|
|
|
@@ -1211,9 +918,9 @@ declare const ReportersMap: {
|
|
|
1211
918
|
};
|
|
1212
919
|
type BuiltinReporters = keyof typeof ReportersMap;
|
|
1213
920
|
interface BuiltinReporterOptions {
|
|
1214
|
-
'default':
|
|
921
|
+
'default': DefaultReporterOptions;
|
|
1215
922
|
'basic': BaseOptions;
|
|
1216
|
-
'verbose':
|
|
923
|
+
'verbose': DefaultReporterOptions;
|
|
1217
924
|
'dot': BaseOptions;
|
|
1218
925
|
'json': JsonOptions$1;
|
|
1219
926
|
'blob': BlobOptions;
|
|
@@ -1224,6 +931,8 @@ interface BuiltinReporterOptions {
|
|
|
1224
931
|
'html': HTMLOptions;
|
|
1225
932
|
}
|
|
1226
933
|
|
|
934
|
+
type ChaiConfig = Omit<Partial<typeof chai.config>, 'useProxy' | 'proxyExcludedKeys'>;
|
|
935
|
+
|
|
1227
936
|
interface TestSequencer {
|
|
1228
937
|
/**
|
|
1229
938
|
* Slicing tests into shards. Will be run before `sort`.
|
|
@@ -1901,749 +1610,1073 @@ interface InlineConfig {
|
|
|
1901
1610
|
*/
|
|
1902
1611
|
exclude?: string[];
|
|
1903
1612
|
/**
|
|
1904
|
-
* Include globs for in-source test files
|
|
1613
|
+
* Include globs for in-source test files
|
|
1614
|
+
*
|
|
1615
|
+
* @default []
|
|
1616
|
+
*/
|
|
1617
|
+
includeSource?: string[];
|
|
1618
|
+
/**
|
|
1619
|
+
* Handling for dependencies inlining or externalizing
|
|
1620
|
+
*
|
|
1621
|
+
*/
|
|
1622
|
+
deps?: DepsOptions;
|
|
1623
|
+
/**
|
|
1624
|
+
* Vite-node server options
|
|
1625
|
+
*/
|
|
1626
|
+
server?: Omit<ViteNodeServerOptions, 'transformMode'>;
|
|
1627
|
+
/**
|
|
1628
|
+
* Base directory to scan for the test files
|
|
1629
|
+
*
|
|
1630
|
+
* @default `config.root`
|
|
1631
|
+
*/
|
|
1632
|
+
dir?: string;
|
|
1633
|
+
/**
|
|
1634
|
+
* Register apis globally
|
|
1635
|
+
*
|
|
1636
|
+
* @default false
|
|
1637
|
+
*/
|
|
1638
|
+
globals?: boolean;
|
|
1639
|
+
/**
|
|
1640
|
+
* Running environment
|
|
1641
|
+
*
|
|
1642
|
+
* Supports 'node', 'jsdom', 'happy-dom', 'edge-runtime'
|
|
1643
|
+
*
|
|
1644
|
+
* If used unsupported string, will try to load the package `vitest-environment-${env}`
|
|
1645
|
+
*
|
|
1646
|
+
* @default 'node'
|
|
1647
|
+
*/
|
|
1648
|
+
environment?: VitestEnvironment;
|
|
1649
|
+
/**
|
|
1650
|
+
* Environment options.
|
|
1651
|
+
*/
|
|
1652
|
+
environmentOptions?: EnvironmentOptions;
|
|
1653
|
+
/**
|
|
1654
|
+
* Automatically assign environment based on globs. The first match will be used.
|
|
1655
|
+
* This has effect only when running tests inside Node.js.
|
|
1656
|
+
*
|
|
1657
|
+
* Format: [glob, environment-name]
|
|
1658
|
+
*
|
|
1659
|
+
* @default []
|
|
1660
|
+
* @example [
|
|
1661
|
+
* // all tests in tests/dom will run in jsdom
|
|
1662
|
+
* ['tests/dom/**', 'jsdom'],
|
|
1663
|
+
* // all tests in tests/ with .edge.test.ts will run in edge-runtime
|
|
1664
|
+
* ['**\/*.edge.test.ts', 'edge-runtime'],
|
|
1665
|
+
* // ...
|
|
1666
|
+
* ]
|
|
1667
|
+
*/
|
|
1668
|
+
environmentMatchGlobs?: [string, VitestEnvironment][];
|
|
1669
|
+
/**
|
|
1670
|
+
* Run tests in an isolated environment. This option has no effect on vmThreads pool.
|
|
1671
|
+
*
|
|
1672
|
+
* Disabling this option might improve performance if your code doesn't rely on side effects.
|
|
1673
|
+
*
|
|
1674
|
+
* @default true
|
|
1675
|
+
*/
|
|
1676
|
+
isolate?: boolean;
|
|
1677
|
+
/**
|
|
1678
|
+
* Pool used to run tests in.
|
|
1679
|
+
*
|
|
1680
|
+
* Supports 'threads', 'forks', 'vmThreads'
|
|
1681
|
+
*
|
|
1682
|
+
* @default 'forks'
|
|
1683
|
+
*/
|
|
1684
|
+
pool?: Exclude<Pool, 'browser'>;
|
|
1685
|
+
/**
|
|
1686
|
+
* Pool options
|
|
1687
|
+
*/
|
|
1688
|
+
poolOptions?: PoolOptions;
|
|
1689
|
+
/**
|
|
1690
|
+
* Maximum number or percentage of workers to run tests in. `poolOptions.{threads,vmThreads}.maxThreads`/`poolOptions.forks.maxForks` has higher priority.
|
|
1691
|
+
*/
|
|
1692
|
+
maxWorkers?: number | string;
|
|
1693
|
+
/**
|
|
1694
|
+
* Minimum number or percentage of workers to run tests in. `poolOptions.{threads,vmThreads}.minThreads`/`poolOptions.forks.minForks` has higher priority.
|
|
1695
|
+
*/
|
|
1696
|
+
minWorkers?: number | string;
|
|
1697
|
+
/**
|
|
1698
|
+
* Should all test files run in parallel. Doesn't affect tests running in the same file.
|
|
1699
|
+
* Setting this to `false` will override `maxWorkers` and `minWorkers` options to `1`.
|
|
1700
|
+
*
|
|
1701
|
+
* @default true
|
|
1702
|
+
*/
|
|
1703
|
+
fileParallelism?: boolean;
|
|
1704
|
+
/**
|
|
1705
|
+
* Automatically assign pool based on globs. The first match will be used.
|
|
1706
|
+
*
|
|
1707
|
+
* Format: [glob, pool-name]
|
|
1708
|
+
*
|
|
1709
|
+
* @default []
|
|
1710
|
+
* @example [
|
|
1711
|
+
* // all tests in "forks" directory will run using "poolOptions.forks" API
|
|
1712
|
+
* ['tests/forks/**', 'forks'],
|
|
1713
|
+
* // all other tests will run based on "poolOptions.threads" option, if you didn't specify other globs
|
|
1714
|
+
* // ...
|
|
1715
|
+
* ]
|
|
1716
|
+
*/
|
|
1717
|
+
poolMatchGlobs?: [string, Exclude<Pool, 'browser'>][];
|
|
1718
|
+
/**
|
|
1719
|
+
* Path to a workspace configuration file
|
|
1720
|
+
*/
|
|
1721
|
+
workspace?: string;
|
|
1722
|
+
/**
|
|
1723
|
+
* Update snapshot
|
|
1724
|
+
*
|
|
1725
|
+
* @default false
|
|
1726
|
+
*/
|
|
1727
|
+
update?: boolean;
|
|
1728
|
+
/**
|
|
1729
|
+
* Watch mode
|
|
1730
|
+
*
|
|
1731
|
+
* @default !process.env.CI
|
|
1732
|
+
*/
|
|
1733
|
+
watch?: boolean;
|
|
1734
|
+
/**
|
|
1735
|
+
* Project root
|
|
1736
|
+
*
|
|
1737
|
+
* @default process.cwd()
|
|
1738
|
+
*/
|
|
1739
|
+
root?: string;
|
|
1740
|
+
/**
|
|
1741
|
+
* Custom reporter for output. Can contain one or more built-in report names, reporter instances,
|
|
1742
|
+
* and/or paths to custom reporters.
|
|
1743
|
+
*
|
|
1744
|
+
* @default []
|
|
1745
|
+
*/
|
|
1746
|
+
reporters?: Arrayable$1<ReporterName | InlineReporter> | ((ReporterName | InlineReporter) | [ReporterName] | ReporterWithOptions)[];
|
|
1747
|
+
/**
|
|
1748
|
+
* Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
|
|
1749
|
+
* Also definable individually per reporter by using an object instead.
|
|
1750
|
+
*/
|
|
1751
|
+
outputFile?: string | (Partial<Record<BuiltinReporters, string>> & Record<string, string>);
|
|
1752
|
+
/**
|
|
1753
|
+
* Default timeout of a test in milliseconds
|
|
1754
|
+
*
|
|
1755
|
+
* @default 5000
|
|
1756
|
+
*/
|
|
1757
|
+
testTimeout?: number;
|
|
1758
|
+
/**
|
|
1759
|
+
* Default timeout of a hook in milliseconds
|
|
1760
|
+
*
|
|
1761
|
+
* @default 10000
|
|
1762
|
+
*/
|
|
1763
|
+
hookTimeout?: number;
|
|
1764
|
+
/**
|
|
1765
|
+
* Default timeout to wait for close when Vitest shuts down, in milliseconds
|
|
1766
|
+
*
|
|
1767
|
+
* @default 10000
|
|
1768
|
+
*/
|
|
1769
|
+
teardownTimeout?: number;
|
|
1770
|
+
/**
|
|
1771
|
+
* Silent mode
|
|
1772
|
+
*
|
|
1773
|
+
* @default false
|
|
1774
|
+
*/
|
|
1775
|
+
silent?: boolean;
|
|
1776
|
+
/**
|
|
1777
|
+
* Hide logs for skipped tests
|
|
1778
|
+
*
|
|
1779
|
+
* @default false
|
|
1780
|
+
*/
|
|
1781
|
+
hideSkippedTests?: boolean;
|
|
1782
|
+
/**
|
|
1783
|
+
* Path to setup files
|
|
1784
|
+
*/
|
|
1785
|
+
setupFiles?: string | string[];
|
|
1786
|
+
/**
|
|
1787
|
+
* Path to global setup files
|
|
1788
|
+
*/
|
|
1789
|
+
globalSetup?: string | string[];
|
|
1790
|
+
/**
|
|
1791
|
+
* Glob patter of file paths that will trigger the whole suite rerun
|
|
1792
|
+
*
|
|
1793
|
+
* Useful if you are testing calling CLI commands
|
|
1794
|
+
*
|
|
1795
|
+
* @default ['**\/package.json/**', '**\/{vitest,vite}.config.*\/**']
|
|
1796
|
+
*/
|
|
1797
|
+
forceRerunTriggers?: string[];
|
|
1798
|
+
/**
|
|
1799
|
+
* Coverage options
|
|
1800
|
+
*/
|
|
1801
|
+
coverage?: CoverageOptions;
|
|
1802
|
+
/**
|
|
1803
|
+
* run test names with the specified pattern
|
|
1804
|
+
*/
|
|
1805
|
+
testNamePattern?: string | RegExp;
|
|
1806
|
+
/**
|
|
1807
|
+
* Will call `.mockClear()` on all spies before each test
|
|
1808
|
+
* @default false
|
|
1809
|
+
*/
|
|
1810
|
+
clearMocks?: boolean;
|
|
1811
|
+
/**
|
|
1812
|
+
* Will call `.mockReset()` on all spies before each test
|
|
1813
|
+
* @default false
|
|
1814
|
+
*/
|
|
1815
|
+
mockReset?: boolean;
|
|
1816
|
+
/**
|
|
1817
|
+
* Will call `.mockRestore()` on all spies before each test
|
|
1818
|
+
* @default false
|
|
1819
|
+
*/
|
|
1820
|
+
restoreMocks?: boolean;
|
|
1821
|
+
/**
|
|
1822
|
+
* Will restore all global stubs to their original values before each test
|
|
1823
|
+
* @default false
|
|
1824
|
+
*/
|
|
1825
|
+
unstubGlobals?: boolean;
|
|
1826
|
+
/**
|
|
1827
|
+
* Will restore all env stubs to their original values before each test
|
|
1828
|
+
* @default false
|
|
1829
|
+
*/
|
|
1830
|
+
unstubEnvs?: boolean;
|
|
1831
|
+
/**
|
|
1832
|
+
* Serve API options.
|
|
1833
|
+
*
|
|
1834
|
+
* When set to true, the default port is 51204.
|
|
1835
|
+
*
|
|
1836
|
+
* @default false
|
|
1837
|
+
*/
|
|
1838
|
+
api?: boolean | number | ApiConfig;
|
|
1839
|
+
/**
|
|
1840
|
+
* Enable Vitest UI
|
|
1841
|
+
*
|
|
1842
|
+
* @default false
|
|
1843
|
+
*/
|
|
1844
|
+
ui?: boolean;
|
|
1845
|
+
/**
|
|
1846
|
+
* options for test in a browser environment
|
|
1847
|
+
* @experimental
|
|
1848
|
+
*
|
|
1849
|
+
* @default false
|
|
1850
|
+
*/
|
|
1851
|
+
browser?: BrowserConfigOptions;
|
|
1852
|
+
/**
|
|
1853
|
+
* Open UI automatically.
|
|
1854
|
+
*
|
|
1855
|
+
* @default !process.env.CI
|
|
1856
|
+
*/
|
|
1857
|
+
open?: boolean;
|
|
1858
|
+
/**
|
|
1859
|
+
* Base url for the UI
|
|
1905
1860
|
*
|
|
1906
|
-
* @default
|
|
1861
|
+
* @default '/__vitest__/'
|
|
1907
1862
|
*/
|
|
1908
|
-
|
|
1863
|
+
uiBase?: string;
|
|
1909
1864
|
/**
|
|
1910
|
-
*
|
|
1911
|
-
*
|
|
1865
|
+
* Determine the transform method for all modules imported inside a test that matches the glob pattern.
|
|
1912
1866
|
*/
|
|
1913
|
-
|
|
1867
|
+
testTransformMode?: TransformModePatterns;
|
|
1914
1868
|
/**
|
|
1915
|
-
*
|
|
1869
|
+
* Format options for snapshot testing.
|
|
1916
1870
|
*/
|
|
1917
|
-
|
|
1871
|
+
snapshotFormat?: Omit<PrettyFormatOptions, 'plugins'>;
|
|
1918
1872
|
/**
|
|
1919
|
-
*
|
|
1920
|
-
*
|
|
1921
|
-
* @default `config.root`
|
|
1873
|
+
* Path to a module which has a default export of diff config.
|
|
1922
1874
|
*/
|
|
1923
|
-
|
|
1875
|
+
diff?: string | SerializedDiffOptions;
|
|
1924
1876
|
/**
|
|
1925
|
-
*
|
|
1926
|
-
*
|
|
1927
|
-
* @default false
|
|
1877
|
+
* Paths to snapshot serializer modules.
|
|
1928
1878
|
*/
|
|
1929
|
-
|
|
1879
|
+
snapshotSerializers?: string[];
|
|
1930
1880
|
/**
|
|
1931
|
-
*
|
|
1932
|
-
*
|
|
1933
|
-
* Supports 'node', 'jsdom', 'happy-dom', 'edge-runtime'
|
|
1934
|
-
*
|
|
1935
|
-
* If used unsupported string, will try to load the package `vitest-environment-${env}`
|
|
1936
|
-
*
|
|
1937
|
-
* @default 'node'
|
|
1881
|
+
* Resolve custom snapshot path
|
|
1938
1882
|
*/
|
|
1939
|
-
|
|
1883
|
+
resolveSnapshotPath?: ResolveSnapshotPathHandler;
|
|
1940
1884
|
/**
|
|
1941
|
-
*
|
|
1885
|
+
* Path to a custom snapshot environment module that has a default export of `SnapshotEnvironment` object.
|
|
1942
1886
|
*/
|
|
1943
|
-
|
|
1887
|
+
snapshotEnvironment?: string;
|
|
1944
1888
|
/**
|
|
1945
|
-
*
|
|
1946
|
-
* This has effect only when running tests inside Node.js.
|
|
1947
|
-
*
|
|
1948
|
-
* Format: [glob, environment-name]
|
|
1949
|
-
*
|
|
1950
|
-
* @default []
|
|
1951
|
-
* @example [
|
|
1952
|
-
* // all tests in tests/dom will run in jsdom
|
|
1953
|
-
* ['tests/dom/**', 'jsdom'],
|
|
1954
|
-
* // all tests in tests/ with .edge.test.ts will run in edge-runtime
|
|
1955
|
-
* ['**\/*.edge.test.ts', 'edge-runtime'],
|
|
1956
|
-
* // ...
|
|
1957
|
-
* ]
|
|
1889
|
+
* Pass with no tests
|
|
1958
1890
|
*/
|
|
1959
|
-
|
|
1891
|
+
passWithNoTests?: boolean;
|
|
1960
1892
|
/**
|
|
1961
|
-
*
|
|
1962
|
-
*
|
|
1963
|
-
* Disabling this option might improve performance if your code doesn't rely on side effects.
|
|
1893
|
+
* Allow tests and suites that are marked as only
|
|
1964
1894
|
*
|
|
1965
|
-
* @default
|
|
1895
|
+
* @default !process.env.CI
|
|
1966
1896
|
*/
|
|
1967
|
-
|
|
1897
|
+
allowOnly?: boolean;
|
|
1968
1898
|
/**
|
|
1969
|
-
*
|
|
1970
|
-
*
|
|
1971
|
-
* Supports 'threads', 'forks', 'vmThreads'
|
|
1972
|
-
*
|
|
1973
|
-
* @default 'forks'
|
|
1899
|
+
* Show heap usage after each test. Useful for debugging memory leaks.
|
|
1974
1900
|
*/
|
|
1975
|
-
|
|
1901
|
+
logHeapUsage?: boolean;
|
|
1976
1902
|
/**
|
|
1977
|
-
*
|
|
1903
|
+
* Custom environment variables assigned to `process.env` before running tests.
|
|
1978
1904
|
*/
|
|
1979
|
-
|
|
1905
|
+
env?: Partial<NodeJS.ProcessEnv>;
|
|
1980
1906
|
/**
|
|
1981
|
-
*
|
|
1907
|
+
* Options for @sinon/fake-timers
|
|
1982
1908
|
*/
|
|
1983
|
-
|
|
1909
|
+
fakeTimers?: FakeTimerInstallOpts;
|
|
1984
1910
|
/**
|
|
1985
|
-
*
|
|
1911
|
+
* Custom handler for console.log in tests.
|
|
1912
|
+
*
|
|
1913
|
+
* Return `false` to ignore the log.
|
|
1986
1914
|
*/
|
|
1987
|
-
|
|
1915
|
+
onConsoleLog?: (log: string, type: 'stdout' | 'stderr') => boolean | void;
|
|
1988
1916
|
/**
|
|
1989
|
-
*
|
|
1990
|
-
*
|
|
1917
|
+
* Enable stack trace filtering. If absent, all stack trace frames
|
|
1918
|
+
* will be shown.
|
|
1991
1919
|
*
|
|
1992
|
-
*
|
|
1920
|
+
* Return `false` to omit the frame.
|
|
1993
1921
|
*/
|
|
1994
|
-
|
|
1922
|
+
onStackTrace?: (error: ErrorWithDiff, frame: ParsedStack) => boolean | void;
|
|
1995
1923
|
/**
|
|
1996
|
-
*
|
|
1924
|
+
* Indicates if CSS files should be processed.
|
|
1997
1925
|
*
|
|
1998
|
-
*
|
|
1926
|
+
* When excluded, the CSS files will be replaced with empty strings to bypass the subsequent processing.
|
|
1999
1927
|
*
|
|
2000
|
-
* @default []
|
|
2001
|
-
* @example [
|
|
2002
|
-
* // all tests in "forks" directory will run using "poolOptions.forks" API
|
|
2003
|
-
* ['tests/forks/**', 'forks'],
|
|
2004
|
-
* // all other tests will run based on "poolOptions.threads" option, if you didn't specify other globs
|
|
2005
|
-
* // ...
|
|
2006
|
-
* ]
|
|
1928
|
+
* @default { include: [], modules: { classNameStrategy: false } }
|
|
2007
1929
|
*/
|
|
2008
|
-
|
|
1930
|
+
css?: boolean | {
|
|
1931
|
+
include?: RegExp | RegExp[];
|
|
1932
|
+
exclude?: RegExp | RegExp[];
|
|
1933
|
+
modules?: {
|
|
1934
|
+
classNameStrategy?: CSSModuleScopeStrategy;
|
|
1935
|
+
};
|
|
1936
|
+
};
|
|
2009
1937
|
/**
|
|
2010
|
-
*
|
|
1938
|
+
* A number of tests that are allowed to run at the same time marked with `test.concurrent`.
|
|
1939
|
+
* @default 5
|
|
2011
1940
|
*/
|
|
2012
|
-
|
|
1941
|
+
maxConcurrency?: number;
|
|
2013
1942
|
/**
|
|
2014
|
-
*
|
|
2015
|
-
*
|
|
2016
|
-
* @default false
|
|
1943
|
+
* Options for configuring cache policy.
|
|
1944
|
+
* @default { dir: 'node_modules/.vite/vitest' }
|
|
2017
1945
|
*/
|
|
2018
|
-
|
|
1946
|
+
cache?: false | {
|
|
1947
|
+
/**
|
|
1948
|
+
* @deprecated Use Vite's "cacheDir" instead if you want to change the cache director. Note caches will be written to "cacheDir\/vitest".
|
|
1949
|
+
*/
|
|
1950
|
+
dir: string;
|
|
1951
|
+
};
|
|
2019
1952
|
/**
|
|
2020
|
-
*
|
|
2021
|
-
*
|
|
2022
|
-
* @default !process.env.CI
|
|
1953
|
+
* Options for configuring the order of running tests.
|
|
2023
1954
|
*/
|
|
2024
|
-
|
|
1955
|
+
sequence?: SequenceOptions;
|
|
2025
1956
|
/**
|
|
2026
|
-
*
|
|
2027
|
-
*
|
|
2028
|
-
*
|
|
1957
|
+
* Specifies an `Object`, or an `Array` of `Object`,
|
|
1958
|
+
* which defines aliases used to replace values in `import` or `require` statements.
|
|
1959
|
+
* Will be merged with the default aliases inside `resolve.alias`.
|
|
2029
1960
|
*/
|
|
2030
|
-
|
|
1961
|
+
alias?: AliasOptions;
|
|
2031
1962
|
/**
|
|
2032
|
-
*
|
|
2033
|
-
* and/or paths to custom reporters.
|
|
1963
|
+
* Ignore any unhandled errors that occur
|
|
2034
1964
|
*
|
|
2035
|
-
* @default
|
|
1965
|
+
* @default false
|
|
2036
1966
|
*/
|
|
2037
|
-
|
|
1967
|
+
dangerouslyIgnoreUnhandledErrors?: boolean;
|
|
2038
1968
|
/**
|
|
2039
|
-
*
|
|
2040
|
-
* Also definable individually per reporter by using an object instead.
|
|
1969
|
+
* Options for configuring typechecking test environment.
|
|
2041
1970
|
*/
|
|
2042
|
-
|
|
1971
|
+
typecheck?: Partial<TypecheckConfig>;
|
|
2043
1972
|
/**
|
|
2044
|
-
*
|
|
1973
|
+
* The number of milliseconds after which a test is considered slow and reported as such in the results.
|
|
2045
1974
|
*
|
|
2046
|
-
* @default
|
|
1975
|
+
* @default 300
|
|
2047
1976
|
*/
|
|
2048
|
-
|
|
1977
|
+
slowTestThreshold?: number;
|
|
2049
1978
|
/**
|
|
2050
|
-
*
|
|
2051
|
-
*
|
|
2052
|
-
* @default 10000
|
|
1979
|
+
* Path to a custom test runner.
|
|
2053
1980
|
*/
|
|
2054
|
-
|
|
1981
|
+
runner?: string;
|
|
2055
1982
|
/**
|
|
2056
|
-
*
|
|
1983
|
+
* Debug tests by opening `node:inspector` in worker / child process.
|
|
1984
|
+
* Provides similar experience as `--inspect` Node CLI argument.
|
|
2057
1985
|
*
|
|
2058
|
-
*
|
|
1986
|
+
* Requires `poolOptions.threads.singleThread: true` OR `poolOptions.forks.singleFork: true`.
|
|
2059
1987
|
*/
|
|
2060
|
-
|
|
1988
|
+
inspect?: boolean | string;
|
|
2061
1989
|
/**
|
|
2062
|
-
*
|
|
1990
|
+
* Debug tests by opening `node:inspector` in worker / child process and wait for debugger to connect.
|
|
1991
|
+
* Provides similar experience as `--inspect-brk` Node CLI argument.
|
|
2063
1992
|
*
|
|
2064
|
-
*
|
|
1993
|
+
* Requires `poolOptions.threads.singleThread: true` OR `poolOptions.forks.singleFork: true`.
|
|
2065
1994
|
*/
|
|
2066
|
-
|
|
1995
|
+
inspectBrk?: boolean | string;
|
|
2067
1996
|
/**
|
|
2068
|
-
*
|
|
2069
|
-
*
|
|
2070
|
-
* @default false
|
|
1997
|
+
* Inspector options. If `--inspect` or `--inspect-brk` is enabled, these options will be passed to the inspector.
|
|
2071
1998
|
*/
|
|
2072
|
-
|
|
1999
|
+
inspector?: {
|
|
2000
|
+
/**
|
|
2001
|
+
* Enable inspector
|
|
2002
|
+
*/
|
|
2003
|
+
enabled?: boolean;
|
|
2004
|
+
/**
|
|
2005
|
+
* Port to run inspector on
|
|
2006
|
+
*/
|
|
2007
|
+
port?: number;
|
|
2008
|
+
/**
|
|
2009
|
+
* Host to run inspector on
|
|
2010
|
+
*/
|
|
2011
|
+
host?: string;
|
|
2012
|
+
/**
|
|
2013
|
+
* Wait for debugger to connect before running tests
|
|
2014
|
+
*/
|
|
2015
|
+
waitForDebugger?: boolean;
|
|
2016
|
+
};
|
|
2073
2017
|
/**
|
|
2074
|
-
*
|
|
2018
|
+
* Define variables that will be returned from `inject` in the test environment.
|
|
2019
|
+
* @example
|
|
2020
|
+
* ```ts
|
|
2021
|
+
* // vitest.config.ts
|
|
2022
|
+
* export default defineConfig({
|
|
2023
|
+
* test: {
|
|
2024
|
+
* provide: {
|
|
2025
|
+
* someKey: 'someValue'
|
|
2026
|
+
* }
|
|
2027
|
+
* }
|
|
2028
|
+
* })
|
|
2029
|
+
* ```
|
|
2030
|
+
* ```ts
|
|
2031
|
+
* // test file
|
|
2032
|
+
* import { inject } from 'vitest'
|
|
2033
|
+
* const value = inject('someKey') // 'someValue'
|
|
2034
|
+
* ```
|
|
2075
2035
|
*/
|
|
2076
|
-
|
|
2036
|
+
provide?: Partial<ProvidedContext>;
|
|
2077
2037
|
/**
|
|
2078
|
-
*
|
|
2038
|
+
* Configuration options for expect() matches.
|
|
2079
2039
|
*/
|
|
2080
|
-
|
|
2040
|
+
expect?: {
|
|
2041
|
+
/**
|
|
2042
|
+
* Throw an error if tests don't have any expect() assertions.
|
|
2043
|
+
*/
|
|
2044
|
+
requireAssertions?: boolean;
|
|
2045
|
+
/**
|
|
2046
|
+
* Default options for expect.poll()
|
|
2047
|
+
*/
|
|
2048
|
+
poll?: {
|
|
2049
|
+
/**
|
|
2050
|
+
* Timeout in milliseconds
|
|
2051
|
+
* @default 1000
|
|
2052
|
+
*/
|
|
2053
|
+
timeout?: number;
|
|
2054
|
+
/**
|
|
2055
|
+
* Polling interval in milliseconds
|
|
2056
|
+
* @default 50
|
|
2057
|
+
*/
|
|
2058
|
+
interval?: number;
|
|
2059
|
+
};
|
|
2060
|
+
};
|
|
2061
|
+
/**
|
|
2062
|
+
* Modify default Chai config. Vitest uses Chai for `expect` and `assert` matches.
|
|
2063
|
+
* https://github.com/chaijs/chai/blob/4.x.x/lib/chai/config.js
|
|
2064
|
+
*/
|
|
2065
|
+
chaiConfig?: ChaiConfig;
|
|
2081
2066
|
/**
|
|
2082
|
-
*
|
|
2083
|
-
*
|
|
2084
|
-
* Useful if you are testing calling CLI commands
|
|
2085
|
-
*
|
|
2086
|
-
* @default ['**\/package.json/**', '**\/{vitest,vite}.config.*\/**']
|
|
2067
|
+
* Stop test execution when given number of tests have failed.
|
|
2087
2068
|
*/
|
|
2088
|
-
|
|
2069
|
+
bail?: number;
|
|
2089
2070
|
/**
|
|
2090
|
-
*
|
|
2071
|
+
* Retry the test specific number of times if it fails.
|
|
2072
|
+
*
|
|
2073
|
+
* @default 0
|
|
2091
2074
|
*/
|
|
2092
|
-
|
|
2075
|
+
retry?: number;
|
|
2093
2076
|
/**
|
|
2094
|
-
*
|
|
2077
|
+
* Show full diff when snapshot fails instead of a patch.
|
|
2095
2078
|
*/
|
|
2096
|
-
|
|
2079
|
+
expandSnapshotDiff?: boolean;
|
|
2097
2080
|
/**
|
|
2098
|
-
*
|
|
2081
|
+
* By default, Vitest automatically intercepts console logging during tests for extra formatting of test file, test title, etc...
|
|
2082
|
+
* This is also required for console log preview on Vitest UI.
|
|
2083
|
+
* However, disabling such interception might help when you want to debug a code with normal synchronus terminal console logging.
|
|
2084
|
+
*
|
|
2085
|
+
* This option has no effect on browser pool since Vitest preserves original logging on browser devtools.
|
|
2086
|
+
*
|
|
2099
2087
|
* @default false
|
|
2100
2088
|
*/
|
|
2101
|
-
|
|
2089
|
+
disableConsoleIntercept?: boolean;
|
|
2102
2090
|
/**
|
|
2103
|
-
*
|
|
2091
|
+
* Always print console stack traces.
|
|
2092
|
+
*
|
|
2104
2093
|
* @default false
|
|
2105
2094
|
*/
|
|
2106
|
-
|
|
2095
|
+
printConsoleTrace?: boolean;
|
|
2107
2096
|
/**
|
|
2108
|
-
*
|
|
2097
|
+
* Include "location" property inside the test definition
|
|
2098
|
+
*
|
|
2109
2099
|
* @default false
|
|
2110
2100
|
*/
|
|
2111
|
-
|
|
2101
|
+
includeTaskLocation?: boolean;
|
|
2102
|
+
}
|
|
2103
|
+
interface TypecheckConfig {
|
|
2112
2104
|
/**
|
|
2113
|
-
*
|
|
2114
|
-
* @default false
|
|
2105
|
+
* Run typechecking tests alongisde regular tests.
|
|
2115
2106
|
*/
|
|
2116
|
-
|
|
2107
|
+
enabled?: boolean;
|
|
2117
2108
|
/**
|
|
2118
|
-
*
|
|
2119
|
-
* @default false
|
|
2109
|
+
* When typechecking is enabled, only run typechecking tests.
|
|
2120
2110
|
*/
|
|
2121
|
-
|
|
2111
|
+
only?: boolean;
|
|
2122
2112
|
/**
|
|
2123
|
-
*
|
|
2124
|
-
*
|
|
2125
|
-
* When set to true, the default port is 51204.
|
|
2113
|
+
* What tools to use for type checking.
|
|
2126
2114
|
*
|
|
2127
|
-
* @default
|
|
2115
|
+
* @default 'tsc'
|
|
2128
2116
|
*/
|
|
2129
|
-
|
|
2117
|
+
checker: 'tsc' | 'vue-tsc' | (string & Record<never, never>);
|
|
2130
2118
|
/**
|
|
2131
|
-
*
|
|
2119
|
+
* Pattern for files that should be treated as test files
|
|
2132
2120
|
*
|
|
2133
|
-
* @default
|
|
2121
|
+
* @default ['**\/*.{test,spec}-d.?(c|m)[jt]s?(x)']
|
|
2134
2122
|
*/
|
|
2135
|
-
|
|
2123
|
+
include: string[];
|
|
2136
2124
|
/**
|
|
2137
|
-
*
|
|
2138
|
-
* @experimental
|
|
2125
|
+
* Pattern for files that should not be treated as test files
|
|
2139
2126
|
*
|
|
2140
|
-
* @default
|
|
2127
|
+
* @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.*']
|
|
2141
2128
|
*/
|
|
2142
|
-
|
|
2129
|
+
exclude: string[];
|
|
2143
2130
|
/**
|
|
2144
|
-
*
|
|
2145
|
-
*
|
|
2146
|
-
* @default !process.env.CI
|
|
2131
|
+
* Check JS files that have `@ts-check` comment.
|
|
2132
|
+
* If you have it enabled in tsconfig, this will not overwrite it.
|
|
2147
2133
|
*/
|
|
2148
|
-
|
|
2134
|
+
allowJs?: boolean;
|
|
2149
2135
|
/**
|
|
2150
|
-
*
|
|
2151
|
-
*
|
|
2152
|
-
* @default '/__vitest__/'
|
|
2136
|
+
* Do not fail, if Vitest found errors outside the test files.
|
|
2153
2137
|
*/
|
|
2154
|
-
|
|
2138
|
+
ignoreSourceErrors?: boolean;
|
|
2155
2139
|
/**
|
|
2156
|
-
*
|
|
2140
|
+
* Path to tsconfig, relative to the project root.
|
|
2157
2141
|
*/
|
|
2158
|
-
|
|
2142
|
+
tsconfig?: string;
|
|
2143
|
+
}
|
|
2144
|
+
interface UserConfig extends InlineConfig {
|
|
2159
2145
|
/**
|
|
2160
|
-
*
|
|
2146
|
+
* Path to the config file.
|
|
2147
|
+
*
|
|
2148
|
+
* Default resolving to `vitest.config.*`, `vite.config.*`
|
|
2149
|
+
*
|
|
2150
|
+
* Setting to `false` will disable config resolving.
|
|
2161
2151
|
*/
|
|
2162
|
-
|
|
2152
|
+
config?: string | false | undefined;
|
|
2163
2153
|
/**
|
|
2164
|
-
*
|
|
2154
|
+
* Do not run tests when Vitest starts.
|
|
2155
|
+
*
|
|
2156
|
+
* Vitest will only run tests if it's called programmatically or the test file changes.
|
|
2157
|
+
*
|
|
2158
|
+
* CLI file filters will be ignored.
|
|
2165
2159
|
*/
|
|
2166
|
-
|
|
2160
|
+
standalone?: boolean;
|
|
2167
2161
|
/**
|
|
2168
|
-
*
|
|
2162
|
+
* Use happy-dom
|
|
2169
2163
|
*/
|
|
2170
|
-
|
|
2164
|
+
dom?: boolean;
|
|
2171
2165
|
/**
|
|
2172
|
-
*
|
|
2166
|
+
* Run tests that cover a list of source files
|
|
2173
2167
|
*/
|
|
2174
|
-
|
|
2168
|
+
related?: string[] | string;
|
|
2175
2169
|
/**
|
|
2176
|
-
*
|
|
2170
|
+
* Overrides Vite mode
|
|
2171
|
+
* @default 'test'
|
|
2177
2172
|
*/
|
|
2178
|
-
|
|
2173
|
+
mode?: string;
|
|
2179
2174
|
/**
|
|
2180
|
-
*
|
|
2175
|
+
* Runs tests that are affected by the changes in the repository, or between specified branch or commit hash
|
|
2176
|
+
* Requires initialized git repository
|
|
2177
|
+
* @default false
|
|
2181
2178
|
*/
|
|
2182
|
-
|
|
2179
|
+
changed?: boolean | string;
|
|
2183
2180
|
/**
|
|
2184
|
-
*
|
|
2185
|
-
*
|
|
2186
|
-
*
|
|
2181
|
+
* Test suite shard to execute in a format of <index>/<count>.
|
|
2182
|
+
* Will divide tests into a `count` numbers, and run only the `indexed` part.
|
|
2183
|
+
* Cannot be used with enabled watch.
|
|
2184
|
+
* @example --shard=2/3
|
|
2187
2185
|
*/
|
|
2188
|
-
|
|
2186
|
+
shard?: string;
|
|
2189
2187
|
/**
|
|
2190
|
-
*
|
|
2188
|
+
* Name of the project or projects to run.
|
|
2191
2189
|
*/
|
|
2192
|
-
|
|
2190
|
+
project?: string | string[];
|
|
2193
2191
|
/**
|
|
2194
|
-
*
|
|
2192
|
+
* Additional exclude patterns
|
|
2195
2193
|
*/
|
|
2196
|
-
|
|
2194
|
+
cliExclude?: string[];
|
|
2197
2195
|
/**
|
|
2198
|
-
*
|
|
2196
|
+
* Override vite config's clearScreen from cli
|
|
2199
2197
|
*/
|
|
2200
|
-
|
|
2198
|
+
clearScreen?: boolean;
|
|
2201
2199
|
/**
|
|
2202
|
-
*
|
|
2203
|
-
*
|
|
2204
|
-
* Return `false` to ignore the log.
|
|
2200
|
+
* benchmark.compare option exposed at the top level for cli
|
|
2205
2201
|
*/
|
|
2206
|
-
|
|
2202
|
+
compare?: string;
|
|
2207
2203
|
/**
|
|
2208
|
-
*
|
|
2209
|
-
* will be shown.
|
|
2210
|
-
*
|
|
2211
|
-
* Return `false` to omit the frame.
|
|
2204
|
+
* benchmark.outputJson option exposed at the top level for cli
|
|
2212
2205
|
*/
|
|
2213
|
-
|
|
2206
|
+
outputJson?: string;
|
|
2214
2207
|
/**
|
|
2215
|
-
*
|
|
2216
|
-
*
|
|
2217
|
-
* When excluded, the CSS files will be replaced with empty strings to bypass the subsequent processing.
|
|
2218
|
-
*
|
|
2219
|
-
* @default { include: [], modules: { classNameStrategy: false } }
|
|
2208
|
+
* Directory of blob reports to merge
|
|
2209
|
+
* @default '.vitest-reports'
|
|
2220
2210
|
*/
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2211
|
+
mergeReports?: string;
|
|
2212
|
+
}
|
|
2213
|
+
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'> {
|
|
2214
|
+
mode: VitestRunMode;
|
|
2215
|
+
base?: string;
|
|
2216
|
+
diff?: string | SerializedDiffOptions;
|
|
2217
|
+
bail?: number;
|
|
2218
|
+
setupFiles: string[];
|
|
2219
|
+
snapshotEnvironment?: string;
|
|
2220
|
+
config?: string;
|
|
2221
|
+
filters?: string[];
|
|
2222
|
+
testNamePattern?: RegExp;
|
|
2223
|
+
related?: string[];
|
|
2224
|
+
coverage: ResolvedCoverageOptions;
|
|
2225
|
+
snapshotOptions: SnapshotStateOptions;
|
|
2226
|
+
browser: ResolvedBrowserOptions;
|
|
2227
|
+
pool: Pool;
|
|
2228
|
+
poolOptions?: ResolvedPoolOptions;
|
|
2229
|
+
reporters: (InlineReporter | ReporterWithOptions)[];
|
|
2230
|
+
defines: Record<string, any>;
|
|
2231
|
+
api?: ApiConfig;
|
|
2232
|
+
cliExclude?: string[];
|
|
2233
|
+
benchmark?: Required<Omit<BenchmarkUserOptions, 'outputFile' | 'compare' | 'outputJson'>> & Pick<BenchmarkUserOptions, 'outputFile' | 'compare' | 'outputJson'>;
|
|
2234
|
+
shard?: {
|
|
2235
|
+
index: number;
|
|
2236
|
+
count: number;
|
|
2237
|
+
};
|
|
2238
|
+
cache: {
|
|
2239
|
+
/**
|
|
2240
|
+
* @deprecated
|
|
2241
|
+
*/
|
|
2242
|
+
dir: string;
|
|
2243
|
+
} | false;
|
|
2244
|
+
sequence: {
|
|
2245
|
+
sequencer: TestSequencerConstructor;
|
|
2246
|
+
hooks: SequenceHooks;
|
|
2247
|
+
setupFiles: SequenceSetupFiles;
|
|
2248
|
+
shuffle?: boolean;
|
|
2249
|
+
concurrent?: boolean;
|
|
2250
|
+
seed: number;
|
|
2251
|
+
};
|
|
2252
|
+
typecheck: Omit<TypecheckConfig, 'enabled'> & {
|
|
2253
|
+
enabled: boolean;
|
|
2254
|
+
};
|
|
2255
|
+
runner?: string;
|
|
2256
|
+
maxWorkers: number;
|
|
2257
|
+
minWorkers: number;
|
|
2258
|
+
}
|
|
2259
|
+
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';
|
|
2260
|
+
type ProjectConfig = Omit<UserConfig, NonProjectOptions | 'sequencer' | 'deps' | 'poolOptions'> & {
|
|
2261
|
+
sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
|
|
2262
|
+
deps?: Omit<DepsOptions, 'moduleDirectories'>;
|
|
2263
|
+
poolOptions?: {
|
|
2264
|
+
threads?: Pick<NonNullable<PoolOptions['threads']>, 'singleThread' | 'isolate'>;
|
|
2265
|
+
vmThreads?: Pick<NonNullable<PoolOptions['vmThreads']>, 'singleThread'>;
|
|
2266
|
+
forks?: Pick<NonNullable<PoolOptions['forks']>, 'singleFork' | 'isolate'>;
|
|
2227
2267
|
};
|
|
2268
|
+
};
|
|
2269
|
+
type ResolvedProjectConfig = Omit<ResolvedConfig, Exclude<NonProjectOptions, 'coverage' | 'watch'>>;
|
|
2270
|
+
interface UserWorkspaceConfig extends UserConfig$1 {
|
|
2271
|
+
test?: ProjectConfig;
|
|
2272
|
+
}
|
|
2273
|
+
type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>;
|
|
2274
|
+
type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
|
|
2275
|
+
type TestProjectConfiguration = string | (UserProjectConfigExport & {
|
|
2228
2276
|
/**
|
|
2229
|
-
*
|
|
2230
|
-
* @
|
|
2277
|
+
* Relative path to the extendable config. All other options will be merged with this config.
|
|
2278
|
+
* @example '../vite.config.ts'
|
|
2231
2279
|
*/
|
|
2232
|
-
|
|
2280
|
+
extends?: string;
|
|
2281
|
+
});
|
|
2282
|
+
/** @deprecated use `TestProjectConfiguration` instead */
|
|
2283
|
+
type WorkspaceProjectConfiguration = TestProjectConfiguration;
|
|
2284
|
+
|
|
2285
|
+
interface BrowserProviderInitializationOptions {
|
|
2286
|
+
browser: string;
|
|
2287
|
+
options?: BrowserProviderOptions;
|
|
2288
|
+
}
|
|
2289
|
+
interface CDPSession {
|
|
2290
|
+
send: (method: string, params?: Record<string, unknown>) => Promise<unknown>;
|
|
2291
|
+
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
2292
|
+
once: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
2293
|
+
off: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
2294
|
+
}
|
|
2295
|
+
interface BrowserProvider {
|
|
2296
|
+
name: string;
|
|
2297
|
+
/**
|
|
2298
|
+
* @experimental opt-in into file parallelisation
|
|
2299
|
+
*/
|
|
2300
|
+
supportsParallelism: boolean;
|
|
2301
|
+
getSupportedBrowsers: () => readonly string[];
|
|
2302
|
+
beforeCommand?: (command: string, args: unknown[]) => Awaitable$1<void>;
|
|
2303
|
+
afterCommand?: (command: string, args: unknown[]) => Awaitable$1<void>;
|
|
2304
|
+
getCommandsContext: (contextId: string) => Record<string, unknown>;
|
|
2305
|
+
openPage: (contextId: string, url: string, beforeNavigate?: () => Promise<void>) => Promise<void>;
|
|
2306
|
+
getCDPSession?: (contextId: string) => Promise<CDPSession>;
|
|
2307
|
+
close: () => Awaitable$1<void>;
|
|
2308
|
+
initialize(ctx: TestProject, options: BrowserProviderInitializationOptions): Awaitable$1<void>;
|
|
2309
|
+
}
|
|
2310
|
+
interface BrowserProviderModule {
|
|
2311
|
+
new (): BrowserProvider;
|
|
2312
|
+
}
|
|
2313
|
+
interface BrowserProviderOptions {
|
|
2314
|
+
}
|
|
2315
|
+
type BrowserBuiltinProvider = 'webdriverio' | 'playwright' | 'preview';
|
|
2316
|
+
interface BrowserConfigOptions {
|
|
2233
2317
|
/**
|
|
2234
|
-
*
|
|
2235
|
-
*
|
|
2318
|
+
* if running tests in the browser should be the default
|
|
2319
|
+
*
|
|
2320
|
+
* @default false
|
|
2236
2321
|
*/
|
|
2237
|
-
|
|
2238
|
-
/**
|
|
2239
|
-
* @deprecated Use Vite's "cacheDir" instead if you want to change the cache director. Note caches will be written to "cacheDir\/vitest".
|
|
2240
|
-
*/
|
|
2241
|
-
dir: string;
|
|
2242
|
-
};
|
|
2322
|
+
enabled?: boolean;
|
|
2243
2323
|
/**
|
|
2244
|
-
*
|
|
2324
|
+
* Name of the browser
|
|
2245
2325
|
*/
|
|
2246
|
-
|
|
2326
|
+
name: string;
|
|
2247
2327
|
/**
|
|
2248
|
-
*
|
|
2249
|
-
*
|
|
2250
|
-
*
|
|
2328
|
+
* Browser provider
|
|
2329
|
+
*
|
|
2330
|
+
* @default 'preview'
|
|
2251
2331
|
*/
|
|
2252
|
-
|
|
2332
|
+
provider?: BrowserBuiltinProvider | (string & {});
|
|
2253
2333
|
/**
|
|
2254
|
-
*
|
|
2334
|
+
* Options that are passed down to a browser provider.
|
|
2335
|
+
* To support type hinting, add one of the types to your tsconfig.json "compilerOptions.types" field:
|
|
2255
2336
|
*
|
|
2256
|
-
*
|
|
2337
|
+
* - for webdriverio: `@vitest/browser/providers/webdriverio`
|
|
2338
|
+
* - for playwright: `@vitest/browser/providers/playwright`
|
|
2339
|
+
*
|
|
2340
|
+
* @example
|
|
2341
|
+
* { playwright: { launch: { devtools: true } }
|
|
2257
2342
|
*/
|
|
2258
|
-
|
|
2343
|
+
providerOptions?: BrowserProviderOptions;
|
|
2259
2344
|
/**
|
|
2260
|
-
*
|
|
2345
|
+
* enable headless mode
|
|
2346
|
+
*
|
|
2347
|
+
* @default process.env.CI
|
|
2261
2348
|
*/
|
|
2262
|
-
|
|
2349
|
+
headless?: boolean;
|
|
2263
2350
|
/**
|
|
2264
|
-
*
|
|
2351
|
+
* Serve API options.
|
|
2265
2352
|
*
|
|
2266
|
-
*
|
|
2353
|
+
* The default port is 63315.
|
|
2267
2354
|
*/
|
|
2268
|
-
|
|
2355
|
+
api?: ApiConfig | number;
|
|
2269
2356
|
/**
|
|
2270
|
-
*
|
|
2357
|
+
* Isolate test environment after each test
|
|
2358
|
+
*
|
|
2359
|
+
* @default true
|
|
2271
2360
|
*/
|
|
2272
|
-
|
|
2361
|
+
isolate?: boolean;
|
|
2273
2362
|
/**
|
|
2274
|
-
*
|
|
2275
|
-
*
|
|
2363
|
+
* Run test files in parallel if provider supports this option
|
|
2364
|
+
* This option only has effect in headless mode (enabled in CI by default)
|
|
2276
2365
|
*
|
|
2277
|
-
*
|
|
2366
|
+
* @default // Same as "test.fileParallelism"
|
|
2278
2367
|
*/
|
|
2279
|
-
|
|
2368
|
+
fileParallelism?: boolean;
|
|
2280
2369
|
/**
|
|
2281
|
-
*
|
|
2282
|
-
* Provides similar experience as `--inspect-brk` Node CLI argument.
|
|
2370
|
+
* Show Vitest UI
|
|
2283
2371
|
*
|
|
2284
|
-
*
|
|
2372
|
+
* @default !process.env.CI
|
|
2285
2373
|
*/
|
|
2286
|
-
|
|
2374
|
+
ui?: boolean;
|
|
2287
2375
|
/**
|
|
2288
|
-
*
|
|
2376
|
+
* Default viewport size
|
|
2289
2377
|
*/
|
|
2290
|
-
|
|
2291
|
-
/**
|
|
2292
|
-
* Enable inspector
|
|
2293
|
-
*/
|
|
2294
|
-
enabled?: boolean;
|
|
2295
|
-
/**
|
|
2296
|
-
* Port to run inspector on
|
|
2297
|
-
*/
|
|
2298
|
-
port?: number;
|
|
2378
|
+
viewport?: {
|
|
2299
2379
|
/**
|
|
2300
|
-
*
|
|
2380
|
+
* Width of the viewport
|
|
2381
|
+
* @default 414
|
|
2301
2382
|
*/
|
|
2302
|
-
|
|
2383
|
+
width: number;
|
|
2303
2384
|
/**
|
|
2304
|
-
*
|
|
2385
|
+
* Height of the viewport
|
|
2386
|
+
* @default 896
|
|
2305
2387
|
*/
|
|
2306
|
-
|
|
2388
|
+
height: number;
|
|
2307
2389
|
};
|
|
2308
2390
|
/**
|
|
2309
|
-
*
|
|
2310
|
-
* @example
|
|
2311
|
-
* ```ts
|
|
2312
|
-
* // vitest.config.ts
|
|
2313
|
-
* export default defineConfig({
|
|
2314
|
-
* test: {
|
|
2315
|
-
* provide: {
|
|
2316
|
-
* someKey: 'someValue'
|
|
2317
|
-
* }
|
|
2318
|
-
* }
|
|
2319
|
-
* })
|
|
2320
|
-
* ```
|
|
2321
|
-
* ```ts
|
|
2322
|
-
* // test file
|
|
2323
|
-
* import { inject } from 'vitest'
|
|
2324
|
-
* const value = inject('someKey') // 'someValue'
|
|
2325
|
-
* ```
|
|
2326
|
-
*/
|
|
2327
|
-
provide?: Partial<ProvidedContext>;
|
|
2328
|
-
/**
|
|
2329
|
-
* Configuration options for expect() matches.
|
|
2391
|
+
* Locator options
|
|
2330
2392
|
*/
|
|
2331
|
-
|
|
2332
|
-
/**
|
|
2333
|
-
* Throw an error if tests don't have any expect() assertions.
|
|
2334
|
-
*/
|
|
2335
|
-
requireAssertions?: boolean;
|
|
2393
|
+
locators?: {
|
|
2336
2394
|
/**
|
|
2337
|
-
*
|
|
2395
|
+
* Attribute used to locate elements by test id
|
|
2396
|
+
* @default 'data-testid'
|
|
2338
2397
|
*/
|
|
2339
|
-
|
|
2340
|
-
/**
|
|
2341
|
-
* Timeout in milliseconds
|
|
2342
|
-
* @default 1000
|
|
2343
|
-
*/
|
|
2344
|
-
timeout?: number;
|
|
2345
|
-
/**
|
|
2346
|
-
* Polling interval in milliseconds
|
|
2347
|
-
* @default 50
|
|
2348
|
-
*/
|
|
2349
|
-
interval?: number;
|
|
2350
|
-
};
|
|
2398
|
+
testIdAttribute?: string;
|
|
2351
2399
|
};
|
|
2352
2400
|
/**
|
|
2353
|
-
*
|
|
2354
|
-
*
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
/**
|
|
2358
|
-
* Stop test execution when given number of tests have failed.
|
|
2401
|
+
* Directory where screenshots will be saved when page.screenshot() is called
|
|
2402
|
+
* If not set, all screenshots are saved to __screenshots__ directory in the same folder as the test file.
|
|
2403
|
+
* If this is set, it will be resolved relative to the project root.
|
|
2404
|
+
* @default __screenshots__
|
|
2359
2405
|
*/
|
|
2360
|
-
|
|
2406
|
+
screenshotDirectory?: string;
|
|
2361
2407
|
/**
|
|
2362
|
-
*
|
|
2363
|
-
*
|
|
2364
|
-
* @default 0
|
|
2408
|
+
* Should Vitest take screenshots if the test fails
|
|
2409
|
+
* @default !browser.ui
|
|
2365
2410
|
*/
|
|
2366
|
-
|
|
2411
|
+
screenshotFailures?: boolean;
|
|
2367
2412
|
/**
|
|
2368
|
-
*
|
|
2413
|
+
* Scripts injected into the tester iframe.
|
|
2414
|
+
* @deprecated Will be removed in the future, use `testerHtmlPath` instead.
|
|
2369
2415
|
*/
|
|
2370
|
-
|
|
2416
|
+
testerScripts?: BrowserScript[];
|
|
2371
2417
|
/**
|
|
2372
|
-
*
|
|
2373
|
-
* This is also required for console log preview on Vitest UI.
|
|
2374
|
-
* However, disabling such interception might help when you want to debug a code with normal synchronus terminal console logging.
|
|
2375
|
-
*
|
|
2376
|
-
* This option has no effect on browser pool since Vitest preserves original logging on browser devtools.
|
|
2377
|
-
*
|
|
2378
|
-
* @default false
|
|
2418
|
+
* Path to the index.html file that will be used to run tests.
|
|
2379
2419
|
*/
|
|
2380
|
-
|
|
2420
|
+
testerHtmlPath?: string;
|
|
2381
2421
|
/**
|
|
2382
|
-
*
|
|
2383
|
-
*
|
|
2384
|
-
* @default false
|
|
2422
|
+
* Scripts injected into the main window.
|
|
2385
2423
|
*/
|
|
2386
|
-
|
|
2424
|
+
orchestratorScripts?: BrowserScript[];
|
|
2387
2425
|
/**
|
|
2388
|
-
*
|
|
2389
|
-
*
|
|
2390
|
-
* @
|
|
2426
|
+
* Commands that will be executed on the server
|
|
2427
|
+
* via the browser `import("@vitest/browser/context").commands` API.
|
|
2428
|
+
* @see {@link https://vitest.dev/guide/browser/commands}
|
|
2391
2429
|
*/
|
|
2392
|
-
|
|
2430
|
+
commands?: Record<string, BrowserCommand<any>>;
|
|
2393
2431
|
}
|
|
2394
|
-
interface
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
/**
|
|
2416
|
-
* Pattern for files that should not be treated as test files
|
|
2417
|
-
*
|
|
2418
|
-
* @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.*']
|
|
2419
|
-
*/
|
|
2420
|
-
exclude: string[];
|
|
2421
|
-
/**
|
|
2422
|
-
* Check JS files that have `@ts-check` comment.
|
|
2423
|
-
* If you have it enabled in tsconfig, this will not overwrite it.
|
|
2424
|
-
*/
|
|
2425
|
-
allowJs?: boolean;
|
|
2426
|
-
/**
|
|
2427
|
-
* Do not fail, if Vitest found errors outside the test files.
|
|
2428
|
-
*/
|
|
2429
|
-
ignoreSourceErrors?: boolean;
|
|
2430
|
-
/**
|
|
2431
|
-
* Path to tsconfig, relative to the project root.
|
|
2432
|
-
*/
|
|
2433
|
-
tsconfig?: string;
|
|
2432
|
+
interface BrowserCommandContext {
|
|
2433
|
+
testPath: string | undefined;
|
|
2434
|
+
provider: BrowserProvider;
|
|
2435
|
+
project: TestProject;
|
|
2436
|
+
contextId: string;
|
|
2437
|
+
}
|
|
2438
|
+
interface BrowserServerStateContext {
|
|
2439
|
+
files: string[];
|
|
2440
|
+
method: 'run' | 'collect';
|
|
2441
|
+
resolve: () => void;
|
|
2442
|
+
reject: (v: unknown) => void;
|
|
2443
|
+
}
|
|
2444
|
+
interface BrowserOrchestrator {
|
|
2445
|
+
createTesters: (files: string[]) => Promise<void>;
|
|
2446
|
+
onCancel: (reason: CancelReason) => Promise<void>;
|
|
2447
|
+
$close: () => void;
|
|
2448
|
+
}
|
|
2449
|
+
interface BrowserServerState {
|
|
2450
|
+
orchestrators: Map<string, BrowserOrchestrator>;
|
|
2451
|
+
getContext: (contextId: string) => BrowserServerStateContext | undefined;
|
|
2452
|
+
createAsyncContext: (method: 'collect' | 'run', contextId: string, files: string[]) => Promise<void>;
|
|
2434
2453
|
}
|
|
2435
|
-
interface
|
|
2454
|
+
interface BrowserServer {
|
|
2455
|
+
vite: ViteDevServer;
|
|
2456
|
+
state: BrowserServerState;
|
|
2457
|
+
provider: BrowserProvider;
|
|
2458
|
+
close: () => Promise<void>;
|
|
2459
|
+
initBrowserProvider: () => Promise<void>;
|
|
2460
|
+
parseStacktrace: (stack: string) => ParsedStack[];
|
|
2461
|
+
parseErrorStacktrace: (error: ErrorWithDiff, options?: StackTraceParserOptions) => ParsedStack[];
|
|
2462
|
+
}
|
|
2463
|
+
interface BrowserCommand<Payload extends unknown[]> {
|
|
2464
|
+
(context: BrowserCommandContext, ...payload: Payload): Awaitable$1<any>;
|
|
2465
|
+
}
|
|
2466
|
+
interface BrowserScript {
|
|
2436
2467
|
/**
|
|
2437
|
-
*
|
|
2438
|
-
*
|
|
2439
|
-
* Default resolving to `vitest.config.*`, `vite.config.*`
|
|
2468
|
+
* If "content" is provided and type is "module", this will be its identifier.
|
|
2440
2469
|
*
|
|
2441
|
-
*
|
|
2470
|
+
* If you are using TypeScript, you can add `.ts` extension here for example.
|
|
2471
|
+
* @default `injected-${index}.js`
|
|
2442
2472
|
*/
|
|
2443
|
-
|
|
2473
|
+
id?: string;
|
|
2444
2474
|
/**
|
|
2445
|
-
*
|
|
2446
|
-
*
|
|
2447
|
-
* Vitest will only run tests if it's called programmatically or the test file changes.
|
|
2475
|
+
* JavaScript content to be injected. This string is processed by Vite plugins if type is "module".
|
|
2448
2476
|
*
|
|
2449
|
-
*
|
|
2477
|
+
* You can use `id` to give Vite a hint about the file extension.
|
|
2450
2478
|
*/
|
|
2451
|
-
|
|
2479
|
+
content?: string;
|
|
2452
2480
|
/**
|
|
2453
|
-
*
|
|
2481
|
+
* Path to the script. This value is resolved by Vite so it can be a node module or a file path.
|
|
2454
2482
|
*/
|
|
2455
|
-
|
|
2483
|
+
src?: string;
|
|
2456
2484
|
/**
|
|
2457
|
-
*
|
|
2485
|
+
* If the script should be loaded asynchronously.
|
|
2458
2486
|
*/
|
|
2459
|
-
|
|
2487
|
+
async?: boolean;
|
|
2460
2488
|
/**
|
|
2461
|
-
*
|
|
2462
|
-
* @default '
|
|
2489
|
+
* Script type.
|
|
2490
|
+
* @default 'module'
|
|
2463
2491
|
*/
|
|
2464
|
-
|
|
2492
|
+
type?: string;
|
|
2493
|
+
}
|
|
2494
|
+
interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
2495
|
+
enabled: boolean;
|
|
2496
|
+
headless: boolean;
|
|
2497
|
+
isolate: boolean;
|
|
2498
|
+
fileParallelism: boolean;
|
|
2499
|
+
api: ApiConfig;
|
|
2500
|
+
ui: boolean;
|
|
2501
|
+
viewport: {
|
|
2502
|
+
width: number;
|
|
2503
|
+
height: number;
|
|
2504
|
+
};
|
|
2505
|
+
screenshotFailures: boolean;
|
|
2506
|
+
locators: {
|
|
2507
|
+
testIdAttribute: string;
|
|
2508
|
+
};
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
declare class TestSpecification {
|
|
2465
2512
|
/**
|
|
2466
|
-
*
|
|
2467
|
-
* Requires initialized git repository
|
|
2468
|
-
* @default false
|
|
2513
|
+
* @deprecated use `project` instead
|
|
2469
2514
|
*/
|
|
2470
|
-
|
|
2515
|
+
readonly 0: TestProject;
|
|
2471
2516
|
/**
|
|
2472
|
-
*
|
|
2473
|
-
* Will divide tests into a `count` numbers, and run only the `indexed` part.
|
|
2474
|
-
* Cannot be used with enabled watch.
|
|
2475
|
-
* @example --shard=2/3
|
|
2517
|
+
* @deprecated use `moduleId` instead
|
|
2476
2518
|
*/
|
|
2477
|
-
|
|
2519
|
+
readonly 1: string;
|
|
2478
2520
|
/**
|
|
2479
|
-
*
|
|
2521
|
+
* @deprecated use `pool` instead
|
|
2480
2522
|
*/
|
|
2481
|
-
|
|
2523
|
+
readonly 2: {
|
|
2524
|
+
pool: Pool;
|
|
2525
|
+
};
|
|
2526
|
+
readonly project: TestProject;
|
|
2527
|
+
readonly moduleId: string;
|
|
2528
|
+
readonly pool: Pool;
|
|
2529
|
+
constructor(project: TestProject, moduleId: string, pool: Pool);
|
|
2530
|
+
toJSON(): SerializedTestSpecification;
|
|
2482
2531
|
/**
|
|
2483
|
-
*
|
|
2532
|
+
* for backwards compatibility
|
|
2533
|
+
* @deprecated
|
|
2484
2534
|
*/
|
|
2485
|
-
|
|
2535
|
+
[Symbol.iterator](): Generator<string | TestProject, void, unknown>;
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
declare class TestProject {
|
|
2539
|
+
/** @deprecated */
|
|
2540
|
+
path: string | number;
|
|
2541
|
+
/** @deprecated */
|
|
2542
|
+
options?: InitializeProjectOptions | undefined;
|
|
2486
2543
|
/**
|
|
2487
|
-
*
|
|
2544
|
+
* The global Vitest instance.
|
|
2545
|
+
* @experimental The public Vitest API is experimental and does not follow semver.
|
|
2488
2546
|
*/
|
|
2489
|
-
|
|
2547
|
+
readonly vitest: Vitest;
|
|
2490
2548
|
/**
|
|
2491
|
-
*
|
|
2549
|
+
* Resolved global configuration. If there are no workspace projects, this will be the same as `config`.
|
|
2492
2550
|
*/
|
|
2493
|
-
|
|
2551
|
+
readonly globalConfig: ResolvedConfig;
|
|
2494
2552
|
/**
|
|
2495
|
-
*
|
|
2553
|
+
* Browser instance if the browser is enabled. This is initialized when the tests run for the first time.
|
|
2496
2554
|
*/
|
|
2497
|
-
|
|
2555
|
+
browser?: BrowserServer;
|
|
2556
|
+
/** @deprecated use `vitest` instead */
|
|
2557
|
+
ctx: Vitest;
|
|
2498
2558
|
/**
|
|
2499
|
-
*
|
|
2500
|
-
* @default '.vitest-reports'
|
|
2559
|
+
* Temporary directory for the project. This is unique for each project. Vitest stores transformed content here.
|
|
2501
2560
|
*/
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
pool: Pool;
|
|
2519
|
-
poolOptions?: ResolvedPoolOptions;
|
|
2520
|
-
reporters: (InlineReporter | ReporterWithOptions)[];
|
|
2521
|
-
defines: Record<string, any>;
|
|
2522
|
-
api?: ApiConfig;
|
|
2523
|
-
cliExclude?: string[];
|
|
2524
|
-
benchmark?: Required<Omit<BenchmarkUserOptions, 'outputFile' | 'compare' | 'outputJson'>> & Pick<BenchmarkUserOptions, 'outputFile' | 'compare' | 'outputJson'>;
|
|
2525
|
-
shard?: {
|
|
2526
|
-
index: number;
|
|
2527
|
-
count: number;
|
|
2528
|
-
};
|
|
2529
|
-
cache: {
|
|
2530
|
-
/**
|
|
2531
|
-
* @deprecated
|
|
2532
|
-
*/
|
|
2533
|
-
dir: string;
|
|
2534
|
-
} | false;
|
|
2535
|
-
sequence: {
|
|
2536
|
-
sequencer: TestSequencerConstructor;
|
|
2537
|
-
hooks: SequenceHooks;
|
|
2538
|
-
setupFiles: SequenceSetupFiles;
|
|
2539
|
-
shuffle?: boolean;
|
|
2540
|
-
concurrent?: boolean;
|
|
2541
|
-
seed: number;
|
|
2542
|
-
};
|
|
2543
|
-
typecheck: Omit<TypecheckConfig, 'enabled'> & {
|
|
2544
|
-
enabled: boolean;
|
|
2545
|
-
};
|
|
2546
|
-
runner?: string;
|
|
2547
|
-
maxWorkers: number;
|
|
2548
|
-
minWorkers: number;
|
|
2549
|
-
}
|
|
2550
|
-
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';
|
|
2551
|
-
type ProjectConfig = Omit<UserConfig, NonProjectOptions | 'sequencer' | 'deps' | 'poolOptions'> & {
|
|
2552
|
-
sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
|
|
2553
|
-
deps?: Omit<DepsOptions, 'moduleDirectories'>;
|
|
2554
|
-
poolOptions?: {
|
|
2555
|
-
threads?: Pick<NonNullable<PoolOptions['threads']>, 'singleThread' | 'isolate'>;
|
|
2556
|
-
vmThreads?: Pick<NonNullable<PoolOptions['vmThreads']>, 'singleThread'>;
|
|
2557
|
-
forks?: Pick<NonNullable<PoolOptions['forks']>, 'singleFork' | 'isolate'>;
|
|
2558
|
-
};
|
|
2559
|
-
};
|
|
2560
|
-
type ResolvedProjectConfig = Omit<ResolvedConfig, NonProjectOptions>;
|
|
2561
|
-
interface UserWorkspaceConfig extends UserConfig$1 {
|
|
2562
|
-
test?: ProjectConfig;
|
|
2563
|
-
}
|
|
2564
|
-
type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>;
|
|
2565
|
-
type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
|
|
2566
|
-
type WorkspaceProjectConfiguration = string | (UserProjectConfigExport & {
|
|
2561
|
+
readonly tmpDir: string;
|
|
2562
|
+
vitenode: ViteNodeServer;
|
|
2563
|
+
runner: ViteNodeRunner;
|
|
2564
|
+
typechecker?: Typechecker;
|
|
2565
|
+
private closingPromise;
|
|
2566
|
+
private testFilesList;
|
|
2567
|
+
private typecheckFilesList;
|
|
2568
|
+
private _globalSetups?;
|
|
2569
|
+
private _provided;
|
|
2570
|
+
private _config?;
|
|
2571
|
+
private _vite?;
|
|
2572
|
+
constructor(
|
|
2573
|
+
/** @deprecated */
|
|
2574
|
+
path: string | number, vitest: Vitest,
|
|
2575
|
+
/** @deprecated */
|
|
2576
|
+
options?: InitializeProjectOptions | undefined);
|
|
2567
2577
|
/**
|
|
2568
|
-
*
|
|
2569
|
-
* @example '../vite.config.ts'
|
|
2578
|
+
* Provide a value to the test context. This value will be available to all tests with `inject`.
|
|
2570
2579
|
*/
|
|
2571
|
-
extends
|
|
2572
|
-
});
|
|
2573
|
-
|
|
2574
|
-
declare class TestProject {
|
|
2580
|
+
provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
|
|
2575
2581
|
/**
|
|
2576
|
-
* The global
|
|
2577
|
-
* @experimental The public Vitest API is experimental and does not follow semver.
|
|
2582
|
+
* Get the provided context. The project context is merged with the global context.
|
|
2578
2583
|
*/
|
|
2579
|
-
|
|
2584
|
+
getProvidedContext(): ProvidedContext;
|
|
2580
2585
|
/**
|
|
2581
|
-
*
|
|
2582
|
-
* @
|
|
2586
|
+
* Creates a new test specification. Specifications describe how to run tests.
|
|
2587
|
+
* @param moduleId The file path
|
|
2583
2588
|
*/
|
|
2584
|
-
|
|
2589
|
+
createSpecification(moduleId: string, pool?: string): TestSpecification;
|
|
2590
|
+
toJSON(): SerializedTestProject;
|
|
2585
2591
|
/**
|
|
2586
2592
|
* Vite's dev server instance. Every workspace project has its own server.
|
|
2587
2593
|
*/
|
|
2588
|
-
|
|
2594
|
+
get vite(): ViteDevServer;
|
|
2589
2595
|
/**
|
|
2590
2596
|
* Resolved project configuration.
|
|
2591
2597
|
*/
|
|
2592
|
-
|
|
2593
|
-
/**
|
|
2594
|
-
* Resolved global configuration. If there are no workspace projects, this will be the same as `config`.
|
|
2595
|
-
*/
|
|
2596
|
-
readonly globalConfig: ResolvedConfig;
|
|
2598
|
+
get config(): ResolvedConfig;
|
|
2597
2599
|
/**
|
|
2598
2600
|
* The name of the project or an empty string if not set.
|
|
2599
2601
|
*/
|
|
2600
|
-
|
|
2601
|
-
constructor(workspaceProject: WorkspaceProject);
|
|
2602
|
+
get name(): string;
|
|
2602
2603
|
/**
|
|
2603
2604
|
* Serialized project configuration. This is the config that tests receive.
|
|
2604
2605
|
*/
|
|
2605
2606
|
get serializedConfig(): SerializedConfig;
|
|
2607
|
+
/** @deprecated use `vite` instead */
|
|
2608
|
+
get server(): ViteDevServer;
|
|
2606
2609
|
/**
|
|
2607
|
-
*
|
|
2610
|
+
* Check if this is the root project. The root project is the one that has the root config.
|
|
2608
2611
|
*/
|
|
2609
|
-
|
|
2612
|
+
isRootProject(): boolean;
|
|
2613
|
+
/** @deprecated use `isRootProject` instead */
|
|
2614
|
+
isCore(): boolean;
|
|
2615
|
+
/** @deprecated use `createSpecification` instead */
|
|
2616
|
+
createSpec(moduleId: string, pool: string): WorkspaceSpec;
|
|
2617
|
+
/** @deprecated */
|
|
2618
|
+
initializeGlobalSetup(): Promise<void>;
|
|
2619
|
+
/** @deprecated */
|
|
2620
|
+
teardownGlobalSetup(): Promise<void>;
|
|
2621
|
+
/** @deprecated use `vitest.logger` instead */
|
|
2622
|
+
get logger(): Logger;
|
|
2623
|
+
/** @deprecated use `.vite` or `.browser.vite` directly */
|
|
2624
|
+
getModulesByFilepath(file: string): Set<ModuleNode>;
|
|
2625
|
+
/** @deprecated use `.vite` or `.browser.vite` directly */
|
|
2626
|
+
getModuleById(id: string): ModuleNode | undefined;
|
|
2627
|
+
/** @deprecated use `.vite` or `.browser.vite` directly */
|
|
2628
|
+
getSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
|
|
2629
|
+
/** @deprecated use `vitest.reporters` instead */
|
|
2630
|
+
get reporters(): Reporter[];
|
|
2610
2631
|
/**
|
|
2611
|
-
*
|
|
2632
|
+
* Get all files in the project that match the globs in the config and the filters.
|
|
2633
|
+
* @param filters String filters to match the test files.
|
|
2612
2634
|
*/
|
|
2613
|
-
|
|
2614
|
-
|
|
2635
|
+
globTestFiles(filters?: string[]): Promise<{
|
|
2636
|
+
/**
|
|
2637
|
+
* Test files that match the filters.
|
|
2638
|
+
*/
|
|
2639
|
+
testFiles: string[];
|
|
2640
|
+
/**
|
|
2641
|
+
* Typecheck test files that match the filters. This will be empty unless `typecheck.enabled` is `true`.
|
|
2642
|
+
*/
|
|
2643
|
+
typecheckTestFiles: string[];
|
|
2644
|
+
}>;
|
|
2645
|
+
private globAllTestFiles;
|
|
2646
|
+
isBrowserEnabled(): boolean;
|
|
2647
|
+
/** @deprecated use `serializedConfig` instead */
|
|
2648
|
+
getSerializableConfig(): SerializedConfig;
|
|
2649
|
+
/**
|
|
2650
|
+
* Test if a file matches the test globs. This does the actual glob matching unlike `isTestFile`.
|
|
2651
|
+
*/
|
|
2652
|
+
matchesTestGlob(filepath: string, source?: string): boolean;
|
|
2653
|
+
/** @deprecated use `matchesTestGlob` instead */
|
|
2654
|
+
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
2655
|
+
private isInSourceTestCode;
|
|
2656
|
+
private filterFiles;
|
|
2657
|
+
/**
|
|
2658
|
+
* Closes the project and all associated resources. This can only be called once; the closing promise is cached until the server restarts.
|
|
2659
|
+
* If the resources are needed again, create a new project.
|
|
2660
|
+
*/
|
|
2661
|
+
close(): Promise<void>;
|
|
2662
|
+
/** @deprecated use `name` instead */
|
|
2663
|
+
getName(): string;
|
|
2664
|
+
/** @deprecated internal */
|
|
2665
|
+
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
2666
|
+
private _serializeOverridenConfig;
|
|
2667
|
+
private clearTmpDir;
|
|
2668
|
+
/** @deprecated */
|
|
2669
|
+
initBrowserProvider(): Promise<void>;
|
|
2615
2670
|
}
|
|
2671
|
+
|
|
2616
2672
|
interface SerializedTestProject {
|
|
2617
2673
|
name: string;
|
|
2618
2674
|
serializedConfig: SerializedConfig;
|
|
2619
2675
|
context: ProvidedContext;
|
|
2620
2676
|
}
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
* @deprecated use `project` instead
|
|
2625
|
-
*/
|
|
2626
|
-
readonly 0: WorkspaceProject;
|
|
2627
|
-
/**
|
|
2628
|
-
* @deprecated use `moduleId` instead
|
|
2629
|
-
*/
|
|
2630
|
-
readonly 1: string;
|
|
2631
|
-
/**
|
|
2632
|
-
* @deprecated use `pool` instead
|
|
2633
|
-
*/
|
|
2634
|
-
readonly 2: {
|
|
2635
|
-
pool: Pool;
|
|
2636
|
-
};
|
|
2637
|
-
readonly project: TestProject;
|
|
2638
|
-
readonly moduleId: string;
|
|
2639
|
-
readonly pool: Pool;
|
|
2640
|
-
constructor(workspaceProject: WorkspaceProject, moduleId: string, pool: Pool);
|
|
2641
|
-
toJSON(): SerializedTestSpecification;
|
|
2642
|
-
/**
|
|
2643
|
-
* for backwards compatibility
|
|
2644
|
-
* @deprecated
|
|
2645
|
-
*/
|
|
2646
|
-
[Symbol.iterator](): Generator<string | WorkspaceProject, void, unknown>;
|
|
2677
|
+
interface InitializeProjectOptions extends UserWorkspaceConfig {
|
|
2678
|
+
workspaceConfigPath: string;
|
|
2679
|
+
extends?: string;
|
|
2647
2680
|
}
|
|
2648
2681
|
|
|
2649
2682
|
/**
|
|
@@ -2653,7 +2686,7 @@ type WorkspaceSpec = TestSpecification & [
|
|
|
2653
2686
|
/**
|
|
2654
2687
|
* @deprecated use spec.project instead
|
|
2655
2688
|
*/
|
|
2656
|
-
project:
|
|
2689
|
+
project: TestProject,
|
|
2657
2690
|
/**
|
|
2658
2691
|
* @deprecated use spec.moduleId instead
|
|
2659
2692
|
*/
|
|
@@ -2672,7 +2705,7 @@ interface ProcessPool {
|
|
|
2672
2705
|
collectTests: RunWithFiles;
|
|
2673
2706
|
close?: () => Awaitable$1<void>;
|
|
2674
2707
|
}
|
|
2675
|
-
declare function getFilePoolName(project:
|
|
2708
|
+
declare function getFilePoolName(project: TestProject, file: string): Pool;
|
|
2676
2709
|
|
|
2677
2710
|
interface SuiteResultCache {
|
|
2678
2711
|
failed: boolean;
|
|
@@ -2739,17 +2772,18 @@ declare class StateManager {
|
|
|
2739
2772
|
* Return files that were running or collected.
|
|
2740
2773
|
*/
|
|
2741
2774
|
getFiles(keys?: string[]): File[];
|
|
2775
|
+
getTestModules(keys?: string[]): TestModule[];
|
|
2742
2776
|
getFilepaths(): string[];
|
|
2743
2777
|
getFailedFilepaths(): string[];
|
|
2744
2778
|
collectPaths(paths?: string[]): void;
|
|
2745
|
-
collectFiles(project:
|
|
2746
|
-
clearFiles(project:
|
|
2747
|
-
updateId(task: Task, project:
|
|
2779
|
+
collectFiles(project: TestProject, files?: File[]): void;
|
|
2780
|
+
clearFiles(project: TestProject, paths?: string[]): void;
|
|
2781
|
+
updateId(task: Task, project: TestProject): void;
|
|
2748
2782
|
getReportedEntity(task: Task): TestCase | TestSuite | TestModule | undefined;
|
|
2749
2783
|
updateTasks(packs: TaskResultPack[]): void;
|
|
2750
2784
|
updateUserLog(log: UserConsoleLog): void;
|
|
2751
2785
|
getCountOfFailedTests(): number;
|
|
2752
|
-
cancelFiles(files: string[], project:
|
|
2786
|
+
cancelFiles(files: string[], project: TestProject): void;
|
|
2753
2787
|
}
|
|
2754
2788
|
|
|
2755
2789
|
interface VitestOptions {
|
|
@@ -2783,15 +2817,14 @@ declare class Vitest {
|
|
|
2783
2817
|
restartsCount: number;
|
|
2784
2818
|
runner: ViteNodeRunner;
|
|
2785
2819
|
packageInstaller: VitestPackageInstaller;
|
|
2786
|
-
private coreWorkspaceProject;
|
|
2787
2820
|
/** @private */
|
|
2788
|
-
resolvedProjects:
|
|
2789
|
-
projects:
|
|
2821
|
+
resolvedProjects: TestProject[];
|
|
2822
|
+
projects: TestProject[];
|
|
2790
2823
|
distPath: string;
|
|
2791
2824
|
private _cachedSpecs;
|
|
2792
2825
|
private _workspaceConfigPath?;
|
|
2793
2826
|
/** @deprecated use `_cachedSpecs` */
|
|
2794
|
-
projectTestFiles: Map<string,
|
|
2827
|
+
projectTestFiles: Map<string, TestSpecification[]>;
|
|
2795
2828
|
/** @private */
|
|
2796
2829
|
_browserLastPort: number;
|
|
2797
2830
|
constructor(mode: VitestRunMode, options?: VitestOptions);
|
|
@@ -2802,20 +2835,12 @@ declare class Vitest {
|
|
|
2802
2835
|
private _onUserTestsRerun;
|
|
2803
2836
|
setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
|
|
2804
2837
|
provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
|
|
2805
|
-
|
|
2806
|
-
* @deprecated internal, use `_createCoreProject` instead
|
|
2807
|
-
*/
|
|
2808
|
-
createCoreProject(): Promise<WorkspaceProject>;
|
|
2809
|
-
/**
|
|
2810
|
-
* @internal
|
|
2811
|
-
*/
|
|
2812
|
-
_createCoreProject(): Promise<WorkspaceProject>;
|
|
2813
|
-
getCoreWorkspaceProject(): WorkspaceProject;
|
|
2838
|
+
getRootTestProject(): TestProject;
|
|
2814
2839
|
/**
|
|
2815
2840
|
* @deprecated use Reported Task API instead
|
|
2816
2841
|
*/
|
|
2817
|
-
getProjectByTaskId(taskId: string):
|
|
2818
|
-
getProjectByName(name?: string):
|
|
2842
|
+
getProjectByTaskId(taskId: string): TestProject;
|
|
2843
|
+
getProjectByName(name?: string): TestProject;
|
|
2819
2844
|
private getWorkspaceConfigPath;
|
|
2820
2845
|
private resolveWorkspace;
|
|
2821
2846
|
private initCoverageProvider;
|
|
@@ -2833,13 +2858,15 @@ declare class Vitest {
|
|
|
2833
2858
|
* @deprecated remove when vscode extension supports "getFileWorkspaceSpecs"
|
|
2834
2859
|
*/
|
|
2835
2860
|
getProjectsByTestFile(file: string): WorkspaceSpec[];
|
|
2836
|
-
getFileWorkspaceSpecs(file: string):
|
|
2861
|
+
getFileWorkspaceSpecs(file: string): TestSpecification[];
|
|
2837
2862
|
initializeGlobalSetup(paths: TestSpecification[]): Promise<void>;
|
|
2838
2863
|
runFiles(specs: TestSpecification[], allTestsRun: boolean): Promise<void>;
|
|
2839
2864
|
collectFiles(specs: WorkspaceSpec[]): Promise<void>;
|
|
2840
2865
|
cancelCurrentRun(reason: CancelReason): Promise<void>;
|
|
2841
2866
|
initBrowserServers(): Promise<void>;
|
|
2842
|
-
rerunFiles(files?: string[], trigger?: string, allTestsRun?: boolean): Promise<void>;
|
|
2867
|
+
rerunFiles(files?: string[], trigger?: string, allTestsRun?: boolean, resetTestNamePattern?: boolean): Promise<void>;
|
|
2868
|
+
private isSuite;
|
|
2869
|
+
rerunTask(id: string): Promise<void>;
|
|
2843
2870
|
changeProjectName(pattern: string): Promise<void>;
|
|
2844
2871
|
changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
|
|
2845
2872
|
changeFilenamePattern(pattern: string, files?: string[]): Promise<void>;
|
|
@@ -2847,7 +2874,7 @@ declare class Vitest {
|
|
|
2847
2874
|
updateSnapshot(files?: string[]): Promise<void>;
|
|
2848
2875
|
private _rerunTimer;
|
|
2849
2876
|
private scheduleRerun;
|
|
2850
|
-
getModuleProjects(filepath: string):
|
|
2877
|
+
getModuleProjects(filepath: string): TestProject[];
|
|
2851
2878
|
/**
|
|
2852
2879
|
* Watch only the specified tests. If no tests are provided, all tests will be watched.
|
|
2853
2880
|
*/
|
|
@@ -2873,7 +2900,7 @@ declare class Vitest {
|
|
|
2873
2900
|
getTestFilepaths(): Promise<string[]>;
|
|
2874
2901
|
globTestSpecs(filters?: string[]): Promise<WorkspaceSpec[]>;
|
|
2875
2902
|
/**
|
|
2876
|
-
* @deprecated use globTestSpecs instead
|
|
2903
|
+
* @deprecated use `globTestSpecs` instead
|
|
2877
2904
|
*/
|
|
2878
2905
|
globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
|
|
2879
2906
|
private ensureSpecCached;
|
|
@@ -2885,4 +2912,4 @@ declare class Vitest {
|
|
|
2885
2912
|
onTestsRerun(fn: OnTestsRerunHandler): void;
|
|
2886
2913
|
}
|
|
2887
2914
|
|
|
2888
|
-
export { type SerializedTestProject as $, type ApiConfig as A, type BaseCoverageOptions as B, CoverageMap as C, type DepsOptimizationOptions as D, type
|
|
2915
|
+
export { type SerializedTestProject as $, type ApiConfig as A, type BaseCoverageOptions as B, CoverageMap as C, type DepsOptimizationOptions as D, type TypecheckConfig as E, type UserConfig as F, type ResolvedConfig as G, type ProjectConfig as H, type InlineConfig as I, type BenchmarkUserOptions as J, type VitestOptions as K, Logger as L, TestProject as M, type TestSequencer as N, type WorkspaceSpec as O, type Pool as P, TestModule as Q, type ResolvedCoverageOptions as R, type SerializedTestSpecification as S, type TestProjectConfiguration as T, type UserWorkspaceConfig as U, Vitest as V, type WorkspaceProjectConfiguration as W, type ModuleDiagnostic as X, VitestPackageInstaller as Y, type ProcessPool as Z, getFilePoolName as _, type ReportContext as a, type HTMLOptions as a0, type JsonOptions$1 as a1, type JUnitOptions as a2, TestCase as a3, TestSuite as a4, type TaskOptions as a5, TestCollection as a6, type TestDiagnostic as a7, type TestResult as a8, type TestResultFailed as a9, JUnitReporter as aA, TapFlatReporter as aB, TapReporter as aC, VerboseReporter as aD, BaseReporter as aE, TestFile as aF, type FileDiagnostic as aG, ReportersMap as aH, type BuiltinReporters as aI, type BuiltinReporterOptions as aJ, type JsonAssertionResult as aK, type JsonTestResult as aL, type JsonTestResults as aM, BenchmarkReportsMap as aN, type BenchmarkBuiltinReporters as aO, type TestResultPassed as aa, type TestResultSkipped as ab, type TestSequencerConstructor as ac, TestSpecification as ad, type BrowserBuiltinProvider as ae, type BrowserCommand as af, type BrowserCommandContext as ag, type BrowserOrchestrator as ah, type BrowserProvider as ai, type BrowserProviderInitializationOptions as aj, type BrowserProviderModule as ak, type BrowserProviderOptions as al, type BrowserServer as am, type BrowserServerState as an, type BrowserServerStateContext as ao, type CDPSession as ap, type ResolvedBrowserOptions as aq, type ResolvedProjectConfig as ar, type ResolveSnapshotPathHandler as as, type ResolveSnapshotPathHandlerContext as at, BasicReporter as au, DefaultReporter as av, DotReporter as aw, GithubActionsReporter as ax, HangingProcessReporter as ay, JsonReporter as az, type CoverageProvider as b, type CoverageProviderModule as c, type CoverageV8Options as d, type UserProjectConfigFn as e, type UserProjectConfigExport as f, type VitestEnvironment as g, type RawErrsMap as h, type TscErrorInfo as i, type CollectLineNumbers as j, type CollectLines as k, type RootAndTarget as l, type Context as m, type CoverageReporter as n, type CoverageProviderName as o, type CoverageOptions as p, type CoverageIstanbulOptions as q, type CustomProviderOptions as r, type Reporter as s, type BrowserScript as t, type BrowserConfigOptions as u, type BuiltinEnvironment as v, type PoolOptions as w, type CSSModuleScopeStrategy as x, type VitestRunMode as y, type TransformModePatterns as z };
|