vitest 4.0.0-beta.17 → 4.0.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +1 -1
- package/dist/{worker-base.js → chunks/base.CtHM3ryk.js} +18 -91
- package/dist/chunks/{browser.d.CCG7W26I.d.ts → browser.d.B9iJzZyn.d.ts} +3 -2
- package/dist/chunks/{cac.BO_6jvrs.js → cac.DCrQhweU.js} +15 -62
- package/dist/chunks/{cli-api.BvCJGado.js → cli-api.BjHteKX0.js} +1322 -55
- package/dist/chunks/{config.d.C4PpNy7v.d.ts → config.d.u2CUDWwS.d.ts} +2 -16
- package/dist/chunks/{coverage.3htTSxXZ.js → coverage.FU3w4IrQ.js} +39 -1213
- package/dist/chunks/{creator.Daoa5_gR.js → creator.DucAaYBz.js} +1 -1
- package/dist/chunks/{defaults.CXFFjsi8.js → defaults.BOqNVLsY.js} +0 -1
- package/dist/chunks/evaluatedModules.Dg1zASAC.js +17 -0
- package/dist/chunks/{global.d.D1pbKXir.d.ts → global.d.BgJSTpgQ.d.ts} +2 -1
- package/dist/chunks/{globals.DC4ntO86.js → globals.BGT_RUsD.js} +5 -3
- package/dist/chunks/{index.01uBqPwR.js → index.BdSLhLDZ.js} +1 -1
- package/dist/chunks/{index.Bt-upxGS.js → index.CbWINfS7.js} +29 -4
- package/dist/chunks/{index.DehVUBn4.js → index.CcRZ6fUh.js} +1507 -12
- package/dist/chunks/{index.Dnl38iQ_.js → index.RwjEGCQ0.js} +3 -3
- package/dist/chunks/init-forks.DSafeltJ.js +54 -0
- package/dist/chunks/init-threads.SUtZ-067.js +17 -0
- package/dist/chunks/{worker.DVTUM2IW.js → init.B2EESLQM.js} +98 -81
- package/dist/chunks/{inspector.Br76Q2Mb.js → inspector.DLZxSeU3.js} +1 -2
- package/dist/chunks/{moduleRunner.d.aXWuQhZN.d.ts → moduleRunner.d.YtNsMIoJ.d.ts} +1 -1
- package/dist/chunks/{plugin.d.CqKwuCSa.d.ts → plugin.d.BB__S31E.d.ts} +1 -1
- package/dist/chunks/{reporters.d.DAyr7w3M.d.ts → reporters.d.C6nGyY9_.d.ts} +1104 -1112
- package/dist/chunks/{resolveSnapshotEnvironment.BsJpmVZR.js → resolveSnapshotEnvironment.DJJKMKxb.js} +2 -2
- package/dist/chunks/{setup-common.BewgbkTd.js → setup-common.DR1sucx6.js} +1 -1
- package/dist/chunks/{startModuleRunner.DPBo3mme.js → startModuleRunner.C2tTvmF9.js} +3 -1
- package/dist/chunks/{test.CTuWuHYH.js → test.C3RPt8JR.js} +1 -1
- package/dist/chunks/{vi.B2--mG9U.js → vi.BZvkKVkM.js} +1 -1
- package/dist/{worker-vm.js → chunks/vm.DBeOXrP9.js} +6 -66
- package/dist/chunks/{worker.d.DSgBAZPX.d.ts → worker.d.BFk-vvBU.d.ts} +79 -4
- package/dist/cli.js +8 -9
- package/dist/config.cjs +0 -1
- package/dist/config.d.ts +6 -7
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +4 -4
- package/dist/coverage.js +2 -13
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +13 -9
- package/dist/index.js +5 -3
- package/dist/module-evaluator.d.ts +3 -3
- package/dist/module-runner.js +1 -1
- package/dist/node.d.ts +79 -15
- package/dist/node.js +25 -26
- package/dist/reporters.d.ts +4 -4
- package/dist/reporters.js +9 -10
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +2 -2
- package/dist/worker.d.ts +26 -0
- package/dist/worker.js +46 -0
- package/dist/workers/forks.js +50 -0
- package/dist/workers/runVmTests.js +8 -7
- package/dist/workers/threads.js +50 -0
- package/dist/workers/vmForks.js +35 -0
- package/dist/workers/vmThreads.js +35 -0
- package/package.json +17 -14
- package/worker.d.ts +1 -0
- package/dist/chunks/typechecker.DsKAhua5.js +0 -1522
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { TaskMeta, Suite, File, TestAnnotation, ImportDuration, Test, Task, TaskResultPack, FileSpecification, CancelReason, SequenceSetupFiles, SequenceHooks } from '@vitest/runner';
|
|
2
|
+
import { TestError, SerializedError, Arrayable, ParsedStack, Awaitable } from '@vitest/utils';
|
|
3
|
+
import { A as AfterSuiteRunMeta, U as UserConsoleLog, P as ProvidedContext, C as ContextRPC, L as LabelColor } from './worker.d.BFk-vvBU.js';
|
|
4
4
|
import { Writable } from 'node:stream';
|
|
5
|
-
import {
|
|
5
|
+
import { TransformResult as TransformResult$1, ViteDevServer, Plugin, UserConfig as UserConfig$1, DepOptimizationConfig, ServerOptions, ConfigEnv, AliasOptions } from 'vite';
|
|
6
6
|
import { MockedModule } from '@vitest/mocker';
|
|
7
7
|
import { StackTraceParserOptions } from '@vitest/utils/source-map';
|
|
8
8
|
import { BrowserCommands } from 'vitest/browser';
|
|
9
|
-
import { B as BrowserTraceViewMode, S as SerializedConfig, F as FakeTimerInstallOpts } from './config.d.
|
|
10
|
-
import {
|
|
9
|
+
import { B as BrowserTraceViewMode, S as SerializedConfig, F as FakeTimerInstallOpts } from './config.d.u2CUDWwS.js';
|
|
10
|
+
import { S as SerializedTestSpecification, B as BrowserTesterOptions } from './browser.d.B9iJzZyn.js';
|
|
11
11
|
import { PrettyFormatOptions } from '@vitest/pretty-format';
|
|
12
12
|
import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
|
|
13
13
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
@@ -70,922 +70,269 @@ interface ConstructorOptionsOverride {
|
|
|
70
70
|
resources?: "usable";
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
send: (method: string, params?: Record<string, unknown>) => Promise<unknown>;
|
|
75
|
-
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
76
|
-
once: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
77
|
-
off: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
78
|
-
}
|
|
79
|
-
interface BrowserModuleMocker {
|
|
80
|
-
register: (sessionId: string, module: MockedModule) => Promise<void>;
|
|
81
|
-
delete: (sessionId: string, url: string) => Promise<void>;
|
|
82
|
-
clear: (sessionId: string) => Promise<void>;
|
|
83
|
-
}
|
|
84
|
-
interface BrowserProviderOption<Options extends object = object> {
|
|
85
|
-
name: string;
|
|
86
|
-
supportedBrowser?: ReadonlyArray<string>;
|
|
87
|
-
options: Options;
|
|
88
|
-
providerFactory: (project: TestProject) => BrowserProvider;
|
|
89
|
-
serverFactory: BrowserServerFactory;
|
|
90
|
-
}
|
|
91
|
-
interface BrowserServerOptions {
|
|
92
|
-
project: TestProject;
|
|
93
|
-
coveragePlugin: () => Plugin;
|
|
94
|
-
mocksPlugins: (options: {
|
|
95
|
-
filter: (id: string) => boolean;
|
|
96
|
-
}) => Plugin[];
|
|
97
|
-
metaEnvReplacer: () => Plugin;
|
|
98
|
-
}
|
|
99
|
-
interface BrowserServerFactory {
|
|
100
|
-
(otpions: BrowserServerOptions): Promise<ParentProjectBrowser>;
|
|
101
|
-
}
|
|
102
|
-
interface BrowserProvider {
|
|
103
|
-
name: string;
|
|
104
|
-
mocker?: BrowserModuleMocker;
|
|
105
|
-
readonly initScripts?: string[];
|
|
73
|
+
declare class ReportedTaskImplementation {
|
|
106
74
|
/**
|
|
107
|
-
*
|
|
75
|
+
* The project associated with the test or suite.
|
|
108
76
|
*/
|
|
109
|
-
|
|
110
|
-
getCommandsContext: (sessionId: string) => Record<string, unknown>;
|
|
111
|
-
openPage: (sessionId: string, url: string) => Promise<void>;
|
|
112
|
-
getCDPSession?: (sessionId: string) => Promise<CDPSession>;
|
|
113
|
-
close: () => Awaitable<void>;
|
|
114
|
-
}
|
|
115
|
-
type BrowserBuiltinProvider = "webdriverio" | "playwright" | "preview";
|
|
116
|
-
interface _BrowserNames {}
|
|
117
|
-
type UnsupportedProperties = "browser" | "typecheck" | "alias" | "sequence" | "root" | "pool" | "poolOptions" | "runner" | "api" | "deps" | "environment" | "environmentOptions" | "server" | "benchmark" | "name";
|
|
118
|
-
interface BrowserInstanceOption extends Omit<ProjectConfig, UnsupportedProperties>, Pick<BrowserConfigOptions, "headless" | "locators" | "viewport" | "testerHtmlPath" | "screenshotDirectory" | "screenshotFailures"> {
|
|
77
|
+
readonly project: TestProject;
|
|
119
78
|
/**
|
|
120
|
-
*
|
|
79
|
+
* Unique identifier.
|
|
80
|
+
* This ID is deterministic and will be the same for the same test across multiple runs.
|
|
81
|
+
* The ID is based on the project name, module url and test order.
|
|
121
82
|
*/
|
|
122
|
-
|
|
123
|
-
name?: string;
|
|
124
|
-
provider?: BrowserProviderOption;
|
|
125
|
-
}
|
|
126
|
-
interface BrowserConfigOptions {
|
|
83
|
+
readonly id: string;
|
|
127
84
|
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* @default false
|
|
85
|
+
* Location in the module where the test or suite is defined.
|
|
131
86
|
*/
|
|
132
|
-
|
|
87
|
+
readonly location: {
|
|
88
|
+
line: number;
|
|
89
|
+
column: number;
|
|
90
|
+
} | undefined;
|
|
133
91
|
/**
|
|
134
|
-
*
|
|
92
|
+
* Checks if the test did not fail the suite.
|
|
93
|
+
* If the test is not finished yet or was skipped, it will return `true`.
|
|
135
94
|
*/
|
|
136
|
-
|
|
95
|
+
ok(): boolean;
|
|
137
96
|
/**
|
|
138
|
-
*
|
|
139
|
-
* @example
|
|
140
|
-
* ```ts
|
|
141
|
-
* import { playwright } from '@vitest/browser-playwright'
|
|
142
|
-
* export default defineConfig({
|
|
143
|
-
* test: {
|
|
144
|
-
* browser: {
|
|
145
|
-
* provider: playwright(),
|
|
146
|
-
* },
|
|
147
|
-
* },
|
|
148
|
-
* })
|
|
149
|
-
* ```
|
|
97
|
+
* Custom metadata that was attached to the test during its execution.
|
|
150
98
|
*/
|
|
151
|
-
|
|
99
|
+
meta(): TaskMeta;
|
|
100
|
+
}
|
|
101
|
+
declare class TestCase extends ReportedTaskImplementation {
|
|
102
|
+
#private;
|
|
103
|
+
readonly type = "test";
|
|
152
104
|
/**
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* @default process.env.CI
|
|
105
|
+
* Direct reference to the test module where the test or suite is defined.
|
|
156
106
|
*/
|
|
157
|
-
|
|
107
|
+
readonly module: TestModule;
|
|
158
108
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* The default port is 63315.
|
|
109
|
+
* Name of the test.
|
|
162
110
|
*/
|
|
163
|
-
|
|
111
|
+
readonly name: string;
|
|
164
112
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* @default true
|
|
113
|
+
* Options that the test was initiated with.
|
|
168
114
|
*/
|
|
169
|
-
|
|
115
|
+
readonly options: TaskOptions;
|
|
170
116
|
/**
|
|
171
|
-
*
|
|
172
|
-
* This option only has effect in headless mode (enabled in CI by default)
|
|
173
|
-
*
|
|
174
|
-
* @default // Same as "test.fileParallelism"
|
|
117
|
+
* Parent suite. If the test was called directly inside the module, the parent will be the module itself.
|
|
175
118
|
*/
|
|
176
|
-
|
|
119
|
+
readonly parent: TestSuite | TestModule;
|
|
177
120
|
/**
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* @default !process.env.CI
|
|
121
|
+
* Full name of the test including all parent suites separated with `>`.
|
|
181
122
|
*/
|
|
182
|
-
|
|
123
|
+
get fullName(): string;
|
|
183
124
|
/**
|
|
184
|
-
*
|
|
125
|
+
* Test results.
|
|
126
|
+
* - **pending**: Test was collected, but didn't finish running yet.
|
|
127
|
+
* - **passed**: Test passed successfully
|
|
128
|
+
* - **failed**: Test failed to execute
|
|
129
|
+
* - **skipped**: Test was skipped during collection or dynamically with `ctx.skip()`.
|
|
185
130
|
*/
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Width of the viewport
|
|
189
|
-
* @default 414
|
|
190
|
-
*/
|
|
191
|
-
width: number;
|
|
192
|
-
/**
|
|
193
|
-
* Height of the viewport
|
|
194
|
-
* @default 896
|
|
195
|
-
*/
|
|
196
|
-
height: number;
|
|
197
|
-
};
|
|
131
|
+
result(): TestResult;
|
|
198
132
|
/**
|
|
199
|
-
*
|
|
133
|
+
* Test annotations added via the `task.annotate` API during the test execution.
|
|
200
134
|
*/
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Attribute used to locate elements by test id
|
|
204
|
-
* @default 'data-testid'
|
|
205
|
-
*/
|
|
206
|
-
testIdAttribute?: string;
|
|
207
|
-
};
|
|
135
|
+
annotations(): ReadonlyArray<TestAnnotation>;
|
|
208
136
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* This option is supported only by **playwright** provider.
|
|
137
|
+
* Useful information about the test like duration, memory usage, etc.
|
|
138
|
+
* Diagnostic is only available after the test has finished.
|
|
212
139
|
*/
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
*/
|
|
219
|
-
tracesDir?: string;
|
|
220
|
-
/**
|
|
221
|
-
* Whether to capture screenshots during tracing. Screenshots are used to build a timeline preview.
|
|
222
|
-
* @default true
|
|
223
|
-
*/
|
|
224
|
-
screenshots?: boolean;
|
|
225
|
-
/**
|
|
226
|
-
* If this option is true tracing will
|
|
227
|
-
* - capture DOM snapshot on every action
|
|
228
|
-
* - record network activity
|
|
229
|
-
* @default true
|
|
230
|
-
*/
|
|
231
|
-
snapshots?: boolean;
|
|
232
|
-
};
|
|
140
|
+
diagnostic(): TestDiagnostic | undefined;
|
|
141
|
+
}
|
|
142
|
+
declare class TestCollection {
|
|
143
|
+
#private;
|
|
144
|
+
constructor(task: Suite | File, project: TestProject);
|
|
233
145
|
/**
|
|
234
|
-
*
|
|
235
|
-
* If not set, all screenshots are saved to __screenshots__ directory in the same folder as the test file.
|
|
236
|
-
* If this is set, it will be resolved relative to the project root.
|
|
237
|
-
* @default __screenshots__
|
|
146
|
+
* Returns the test or suite at a specific index.
|
|
238
147
|
*/
|
|
239
|
-
|
|
148
|
+
at(index: number): TestCase | TestSuite | undefined;
|
|
240
149
|
/**
|
|
241
|
-
*
|
|
242
|
-
* @default !browser.ui
|
|
150
|
+
* The number of tests and suites in the collection.
|
|
243
151
|
*/
|
|
244
|
-
|
|
152
|
+
get size(): number;
|
|
245
153
|
/**
|
|
246
|
-
*
|
|
154
|
+
* Returns the collection in array form for easier manipulation.
|
|
247
155
|
*/
|
|
248
|
-
|
|
156
|
+
array(): (TestCase | TestSuite)[];
|
|
249
157
|
/**
|
|
250
|
-
*
|
|
158
|
+
* Filters all tests that are part of this collection and its children.
|
|
251
159
|
*/
|
|
252
|
-
|
|
160
|
+
allTests(state?: TestState): Generator<TestCase, undefined, void>;
|
|
253
161
|
/**
|
|
254
|
-
*
|
|
255
|
-
* via the browser `import("vitest/browser").commands` API.
|
|
256
|
-
* @see {@link https://vitest.dev/guide/browser/commands}
|
|
162
|
+
* Filters only the tests that are part of this collection.
|
|
257
163
|
*/
|
|
258
|
-
|
|
164
|
+
tests(state?: TestState): Generator<TestCase, undefined, void>;
|
|
259
165
|
/**
|
|
260
|
-
*
|
|
261
|
-
* @default 30000
|
|
166
|
+
* Filters only the suites that are part of this collection.
|
|
262
167
|
*/
|
|
263
|
-
|
|
264
|
-
expect?: {
|
|
265
|
-
toMatchScreenshot?: { [ComparatorName in keyof ToMatchScreenshotComparators] : {
|
|
266
|
-
/**
|
|
267
|
-
* The name of the comparator to use for visual diffing.
|
|
268
|
-
*
|
|
269
|
-
* @defaultValue `'pixelmatch'`
|
|
270
|
-
*/
|
|
271
|
-
comparatorName?: ComparatorName;
|
|
272
|
-
comparatorOptions?: ToMatchScreenshotComparators[ComparatorName];
|
|
273
|
-
} }[keyof ToMatchScreenshotComparators] & ToMatchScreenshotOptions;
|
|
274
|
-
};
|
|
168
|
+
suites(): Generator<TestSuite, undefined, void>;
|
|
275
169
|
/**
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
* If you need to hide certain errors, it is recommended to use [`onUnhandledError`](https://vitest.dev/config/#onunhandlederror) option instead.
|
|
279
|
-
*
|
|
280
|
-
* Disabling this will completely remove all Vitest error handlers, which can help debugging with the "Pause on exceptions" checkbox turned on.
|
|
281
|
-
* @default true
|
|
170
|
+
* Filters all suites that are part of this collection and its children.
|
|
282
171
|
*/
|
|
283
|
-
|
|
172
|
+
allSuites(): Generator<TestSuite, undefined, void>;
|
|
173
|
+
[Symbol.iterator](): Generator<TestSuite | TestCase, undefined, void>;
|
|
284
174
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
175
|
+
|
|
176
|
+
type ReportedHookContext = {
|
|
177
|
+
readonly name: "beforeAll" | "afterAll";
|
|
178
|
+
readonly entity: TestSuite | TestModule;
|
|
179
|
+
} | {
|
|
180
|
+
readonly name: "beforeEach" | "afterEach";
|
|
181
|
+
readonly entity: TestCase;
|
|
182
|
+
};
|
|
183
|
+
declare abstract class SuiteImplementation extends ReportedTaskImplementation {
|
|
184
|
+
/**
|
|
185
|
+
* Collection of suites and tests that are part of this suite.
|
|
186
|
+
*/
|
|
187
|
+
readonly children: TestCollection;
|
|
188
|
+
/**
|
|
189
|
+
* Errors that happened outside of the test run during collection, like syntax errors.
|
|
190
|
+
*/
|
|
191
|
+
errors(): SerializedError[];
|
|
291
192
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
fail: (v: Error) => void;
|
|
296
|
-
}
|
|
297
|
-
interface BrowserOrchestrator {
|
|
298
|
-
cleanupTesters: () => Promise<void>;
|
|
299
|
-
createTesters: (options: BrowserTesterOptions) => Promise<void>;
|
|
300
|
-
onCancel: (reason: CancelReason) => Promise<void>;
|
|
301
|
-
$close: () => void;
|
|
302
|
-
}
|
|
303
|
-
interface BrowserServerState {
|
|
304
|
-
orchestrators: Map<string, BrowserOrchestrator>;
|
|
305
|
-
}
|
|
306
|
-
interface ParentProjectBrowser {
|
|
307
|
-
spawn: (project: TestProject) => ProjectBrowser;
|
|
308
|
-
vite: ViteDevServer;
|
|
309
|
-
}
|
|
310
|
-
interface ProjectBrowser {
|
|
311
|
-
vite: ViteDevServer;
|
|
312
|
-
state: BrowserServerState;
|
|
313
|
-
provider: BrowserProvider;
|
|
314
|
-
close: () => Promise<void>;
|
|
315
|
-
initBrowserProvider: (project: TestProject) => Promise<void>;
|
|
316
|
-
parseStacktrace: (stack: string) => ParsedStack[];
|
|
317
|
-
parseErrorStacktrace: (error: TestError, options?: StackTraceParserOptions) => ParsedStack[];
|
|
318
|
-
registerCommand: <K extends keyof BrowserCommands>(name: K, cb: BrowserCommand<Parameters<BrowserCommands[K]>, ReturnType<BrowserCommands[K]>>) => void;
|
|
319
|
-
triggerCommand: <K extends keyof BrowserCommands>(name: K, context: BrowserCommandContext, ...args: Parameters<BrowserCommands[K]>) => ReturnType<BrowserCommands[K]>;
|
|
320
|
-
}
|
|
321
|
-
interface BrowserCommand<
|
|
322
|
-
Payload extends unknown[] = [],
|
|
323
|
-
ReturnValue = any
|
|
324
|
-
> {
|
|
325
|
-
(context: BrowserCommandContext, ...payload: Payload): Awaitable<ReturnValue>;
|
|
326
|
-
}
|
|
327
|
-
interface BrowserScript {
|
|
328
|
-
/**
|
|
329
|
-
* If "content" is provided and type is "module", this will be its identifier.
|
|
330
|
-
*
|
|
331
|
-
* If you are using TypeScript, you can add `.ts` extension here for example.
|
|
332
|
-
* @default `injected-${index}.js`
|
|
333
|
-
*/
|
|
334
|
-
id?: string;
|
|
193
|
+
declare class TestSuite extends SuiteImplementation {
|
|
194
|
+
#private;
|
|
195
|
+
readonly type = "suite";
|
|
335
196
|
/**
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* You can use `id` to give Vite a hint about the file extension.
|
|
197
|
+
* Name of the test or the suite.
|
|
339
198
|
*/
|
|
340
|
-
|
|
199
|
+
readonly name: string;
|
|
341
200
|
/**
|
|
342
|
-
*
|
|
201
|
+
* Direct reference to the test module where the test or suite is defined.
|
|
343
202
|
*/
|
|
344
|
-
|
|
203
|
+
readonly module: TestModule;
|
|
345
204
|
/**
|
|
346
|
-
* If the
|
|
205
|
+
* Parent suite. If suite was called directly inside the module, the parent will be the module itself.
|
|
347
206
|
*/
|
|
348
|
-
|
|
207
|
+
readonly parent: TestSuite | TestModule;
|
|
349
208
|
/**
|
|
350
|
-
*
|
|
351
|
-
* @default 'module'
|
|
209
|
+
* Options that suite was initiated with.
|
|
352
210
|
*/
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
356
|
-
name: string;
|
|
357
|
-
enabled: boolean;
|
|
358
|
-
headless: boolean;
|
|
359
|
-
isolate: boolean;
|
|
360
|
-
fileParallelism: boolean;
|
|
361
|
-
api: ApiConfig;
|
|
362
|
-
ui: boolean;
|
|
363
|
-
viewport: {
|
|
364
|
-
width: number;
|
|
365
|
-
height: number;
|
|
366
|
-
};
|
|
367
|
-
screenshotFailures: boolean;
|
|
368
|
-
locators: {
|
|
369
|
-
testIdAttribute: string;
|
|
370
|
-
};
|
|
371
|
-
trace: {
|
|
372
|
-
mode: BrowserTraceViewMode;
|
|
373
|
-
tracesDir?: string;
|
|
374
|
-
screenshots?: boolean;
|
|
375
|
-
snapshots?: boolean;
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
type ToMatchScreenshotResolvePath = (data: {
|
|
211
|
+
readonly options: TaskOptions;
|
|
379
212
|
/**
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
* This comes from the arguments passed to `toMatchScreenshot`; if called
|
|
383
|
-
* without arguments this will be the auto-generated name.
|
|
384
|
-
*
|
|
385
|
-
* @example
|
|
386
|
-
* test('calls `onClick`', () => {
|
|
387
|
-
* expect(locator).toMatchScreenshot()
|
|
388
|
-
* // arg = "calls-onclick-1"
|
|
389
|
-
* })
|
|
390
|
-
*
|
|
391
|
-
* @example
|
|
392
|
-
* expect(locator).toMatchScreenshot('foo/bar/baz.png')
|
|
393
|
-
* // arg = "foo/bar/baz"
|
|
394
|
-
*
|
|
395
|
-
* @example
|
|
396
|
-
* expect(locator).toMatchScreenshot('../foo/bar/baz.png')
|
|
397
|
-
* // arg = "foo/bar/baz"
|
|
213
|
+
* Checks if the suite has any failed tests.
|
|
214
|
+
* This will also return `false` if suite failed during collection.
|
|
398
215
|
*/
|
|
399
|
-
|
|
216
|
+
ok: () => boolean;
|
|
400
217
|
/**
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
* This can be set through the arguments passed to `toMatchScreenshot`, but
|
|
404
|
-
* the value will fall back to `'.png'` if an unsupported extension is used.
|
|
218
|
+
* The meta information attached to the suite during its collection or execution.
|
|
405
219
|
*/
|
|
406
|
-
|
|
220
|
+
meta: () => TaskMeta;
|
|
407
221
|
/**
|
|
408
|
-
*
|
|
222
|
+
* Checks the running state of the suite.
|
|
409
223
|
*/
|
|
410
|
-
|
|
224
|
+
state(): TestSuiteState;
|
|
411
225
|
/**
|
|
412
|
-
*
|
|
226
|
+
* Full name of the suite including all parent suites separated with `>`.
|
|
413
227
|
*/
|
|
414
|
-
|
|
228
|
+
get fullName(): string;
|
|
229
|
+
}
|
|
230
|
+
declare class TestModule extends SuiteImplementation {
|
|
231
|
+
readonly location: undefined;
|
|
232
|
+
readonly type = "module";
|
|
415
233
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
234
|
+
* This is usually an absolute UNIX file path.
|
|
235
|
+
* It can be a virtual ID if the file is not on the disk.
|
|
236
|
+
* This value corresponds to the ID in the Vite's module graph.
|
|
419
237
|
*/
|
|
420
|
-
|
|
238
|
+
readonly moduleId: string;
|
|
421
239
|
/**
|
|
422
|
-
*
|
|
423
|
-
* {@linkcode https://vitest.dev/config/#root|root}.
|
|
240
|
+
* Module id relative to the project. This is the same as `task.name`.
|
|
424
241
|
*/
|
|
425
|
-
|
|
242
|
+
readonly relativeModuleId: string;
|
|
426
243
|
/**
|
|
427
|
-
*
|
|
428
|
-
* {@linkcode https://vitest.dev/config/#root|root}.
|
|
244
|
+
* Checks the running state of the test file.
|
|
429
245
|
*/
|
|
430
|
-
|
|
246
|
+
state(): TestModuleState;
|
|
431
247
|
/**
|
|
432
|
-
*
|
|
248
|
+
* Checks if the module has any failed tests.
|
|
249
|
+
* This will also return `false` if module failed during collection.
|
|
433
250
|
*/
|
|
434
|
-
|
|
251
|
+
ok: () => boolean;
|
|
435
252
|
/**
|
|
436
|
-
* The
|
|
437
|
-
* parent {@linkcode https://vitest.dev/api/#describe|describe}, sanitized.
|
|
253
|
+
* The meta information attached to the module during its collection or execution.
|
|
438
254
|
*/
|
|
439
|
-
|
|
255
|
+
meta: () => TaskMeta;
|
|
440
256
|
/**
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
* if none is provided, its default value.
|
|
257
|
+
* Useful information about the module like duration, memory usage, etc.
|
|
258
|
+
* If the module was not executed yet, all diagnostic values will return `0`.
|
|
444
259
|
*/
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
interface
|
|
260
|
+
diagnostic(): ModuleDiagnostic;
|
|
261
|
+
}
|
|
262
|
+
interface TaskOptions {
|
|
263
|
+
readonly each: boolean | undefined;
|
|
264
|
+
readonly fails: boolean | undefined;
|
|
265
|
+
readonly concurrent: boolean | undefined;
|
|
266
|
+
readonly shuffle: boolean | undefined;
|
|
267
|
+
readonly retry: number | undefined;
|
|
268
|
+
readonly repeats: number | undefined;
|
|
269
|
+
readonly mode: "run" | "only" | "skip" | "todo";
|
|
270
|
+
}
|
|
271
|
+
type TestSuiteState = "skipped" | "pending" | "failed" | "passed";
|
|
272
|
+
type TestModuleState = TestSuiteState | "queued";
|
|
273
|
+
type TestState = TestResult["state"];
|
|
274
|
+
type TestResult = TestResultPassed | TestResultFailed | TestResultSkipped | TestResultPending;
|
|
275
|
+
interface TestResultPending {
|
|
448
276
|
/**
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
* @default `${root}/${testFileDirectory}/${screenshotDirectory}/${testFileName}/${arg}-${browserName}-${platform}${ext}`
|
|
277
|
+
* The test was collected, but didn't finish running yet.
|
|
452
278
|
*/
|
|
453
|
-
|
|
279
|
+
readonly state: "pending";
|
|
454
280
|
/**
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
* @default `${root}/${attachmentsDir}/${testFileDirectory}/${testFileName}/${arg}-${browserName}-${platform}${ext}`
|
|
281
|
+
* Pending tests have no errors.
|
|
458
282
|
*/
|
|
459
|
-
|
|
283
|
+
readonly errors: undefined;
|
|
460
284
|
}
|
|
461
|
-
interface
|
|
462
|
-
|
|
463
|
-
type BuiltinPool = "browser" | "threads" | "forks" | "vmThreads" | "vmForks" | "typescript";
|
|
464
|
-
type Pool = BuiltinPool | (string & {});
|
|
465
|
-
interface PoolOptions extends Record<string, unknown> {
|
|
285
|
+
interface TestResultPassed {
|
|
466
286
|
/**
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
* Test isolation (when enabled) is done by spawning a new thread for each test file.
|
|
470
|
-
*
|
|
471
|
-
* This pool is used by default.
|
|
287
|
+
* The test passed successfully.
|
|
472
288
|
*/
|
|
473
|
-
|
|
289
|
+
readonly state: "passed";
|
|
474
290
|
/**
|
|
475
|
-
*
|
|
291
|
+
* Errors that were thrown during the test execution.
|
|
476
292
|
*
|
|
477
|
-
*
|
|
293
|
+
* **Note**: If test was retried successfully, errors will still be reported.
|
|
478
294
|
*/
|
|
479
|
-
|
|
295
|
+
readonly errors: ReadonlyArray<TestError> | undefined;
|
|
296
|
+
}
|
|
297
|
+
interface TestResultFailed {
|
|
480
298
|
/**
|
|
481
|
-
*
|
|
482
|
-
* Test files are run parallel using `node:worker_threads`.
|
|
483
|
-
*
|
|
484
|
-
* This makes tests run faster, but VM module is unstable. Your tests might leak memory.
|
|
299
|
+
* The test failed to execute.
|
|
485
300
|
*/
|
|
486
|
-
|
|
301
|
+
readonly state: "failed";
|
|
487
302
|
/**
|
|
488
|
-
*
|
|
489
|
-
*
|
|
490
|
-
* Test files are run parallel using `node:child_process` [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
|
|
491
|
-
*
|
|
492
|
-
* This makes tests run faster, but VM module is unstable. Your tests might leak memory.
|
|
303
|
+
* Errors that were thrown during the test execution.
|
|
493
304
|
*/
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
interface ResolvedPoolOptions extends PoolOptions {
|
|
497
|
-
threads?: ResolvedThreadsOptions & WorkerContextOptions;
|
|
498
|
-
forks?: ResolvedForksOptions & WorkerContextOptions;
|
|
499
|
-
vmThreads?: ResolvedThreadsOptions & VmOptions;
|
|
500
|
-
vmForks?: ResolvedForksOptions & VmOptions;
|
|
305
|
+
readonly errors: ReadonlyArray<TestError>;
|
|
501
306
|
}
|
|
502
|
-
interface
|
|
503
|
-
/** Maximum amount of threads to use */
|
|
504
|
-
maxThreads?: number | string;
|
|
307
|
+
interface TestResultSkipped {
|
|
505
308
|
/**
|
|
506
|
-
*
|
|
507
|
-
*
|
|
508
|
-
* @default false
|
|
309
|
+
* The test was skipped with `only` (on another test), `skip` or `todo` flag.
|
|
310
|
+
* You can see which one was used in the `options.mode` option.
|
|
509
311
|
*/
|
|
510
|
-
|
|
312
|
+
readonly state: "skipped";
|
|
511
313
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
* This can improve performance in some cases, but might cause segfault in older Node versions.
|
|
515
|
-
*
|
|
516
|
-
* @default false
|
|
314
|
+
* Skipped tests have no errors.
|
|
517
315
|
*/
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
interface ResolvedThreadsOptions extends ThreadsOptions {
|
|
521
|
-
maxThreads?: number;
|
|
522
|
-
}
|
|
523
|
-
interface ForksOptions {
|
|
524
|
-
/** Maximum amount of child processes to use */
|
|
525
|
-
maxForks?: number | string;
|
|
316
|
+
readonly errors: undefined;
|
|
526
317
|
/**
|
|
527
|
-
*
|
|
528
|
-
*
|
|
529
|
-
* @default false
|
|
318
|
+
* A custom note passed down to `ctx.skip(note)`.
|
|
530
319
|
*/
|
|
531
|
-
|
|
532
|
-
}
|
|
533
|
-
interface ResolvedForksOptions extends ForksOptions {
|
|
534
|
-
maxForks?: number;
|
|
320
|
+
readonly note: string | undefined;
|
|
535
321
|
}
|
|
536
|
-
interface
|
|
322
|
+
interface TestDiagnostic {
|
|
537
323
|
/**
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
* @default true
|
|
324
|
+
* If the duration of the test is above `slowTestThreshold`.
|
|
541
325
|
*/
|
|
542
|
-
|
|
326
|
+
readonly slow: boolean;
|
|
543
327
|
/**
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
* See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
|
|
547
|
-
*
|
|
548
|
-
* Set to `process.execArgv` to pass all arguments of the current process.
|
|
549
|
-
*
|
|
550
|
-
* Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
|
|
551
|
-
*
|
|
552
|
-
* @default [] // no execution arguments are passed
|
|
328
|
+
* The amount of memory used by the test in bytes.
|
|
329
|
+
* This value is only available if the test was executed with `logHeapUsage` flag.
|
|
553
330
|
*/
|
|
554
|
-
|
|
555
|
-
}
|
|
556
|
-
interface VmOptions {
|
|
331
|
+
readonly heap: number | undefined;
|
|
557
332
|
/**
|
|
558
|
-
*
|
|
559
|
-
* If you see memory leaks, try to tinker this value.
|
|
333
|
+
* The time it takes to execute the test in ms.
|
|
560
334
|
*/
|
|
561
|
-
|
|
562
|
-
/** Isolation is always enabled */
|
|
563
|
-
isolate?: true;
|
|
564
|
-
/**
|
|
565
|
-
* Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
|
|
566
|
-
*
|
|
567
|
-
* See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
|
|
568
|
-
*
|
|
569
|
-
* Set to `process.execArgv` to pass all arguments of the current process.
|
|
570
|
-
*
|
|
571
|
-
* Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
|
|
572
|
-
*
|
|
573
|
-
* @default [] // no execution arguments are passed
|
|
574
|
-
*/
|
|
575
|
-
execArgv?: string[];
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
declare class TestSpecification {
|
|
579
|
-
/**
|
|
580
|
-
* The task ID associated with the test module.
|
|
581
|
-
*/
|
|
582
|
-
readonly taskId: string;
|
|
583
|
-
/**
|
|
584
|
-
* The test project that the module belongs to.
|
|
585
|
-
*/
|
|
586
|
-
readonly project: TestProject;
|
|
587
|
-
/**
|
|
588
|
-
* The ID of the module in the Vite module graph. It is usually an absolute file path.
|
|
589
|
-
*/
|
|
590
|
-
readonly moduleId: string;
|
|
591
|
-
/**
|
|
592
|
-
* The current test pool. It's possible to have multiple pools in a single test project with `poolMatchGlob` and `typecheck.enabled`.
|
|
593
|
-
* @experimental In Vitest 4, the project will only support a single pool and this property will be removed.
|
|
594
|
-
*/
|
|
595
|
-
readonly pool: Pool;
|
|
596
|
-
/**
|
|
597
|
-
* Line numbers of the test locations to run.
|
|
598
|
-
*/
|
|
599
|
-
readonly testLines: number[] | undefined;
|
|
600
|
-
constructor(project: TestProject, moduleId: string, pool: Pool, testLines?: number[] | undefined);
|
|
601
|
-
/**
|
|
602
|
-
* Test module associated with the specification.
|
|
603
|
-
*/
|
|
604
|
-
get testModule(): TestModule | undefined;
|
|
605
|
-
toJSON(): SerializedTestSpecification;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
declare class TestProject {
|
|
609
|
-
options?: InitializeProjectOptions | undefined;
|
|
610
|
-
/**
|
|
611
|
-
* The global Vitest instance.
|
|
612
|
-
* @experimental The public Vitest API is experimental and does not follow semver.
|
|
613
|
-
*/
|
|
614
|
-
readonly vitest: Vitest;
|
|
615
|
-
/**
|
|
616
|
-
* Resolved global configuration. If there are no workspace projects, this will be the same as `config`.
|
|
617
|
-
*/
|
|
618
|
-
readonly globalConfig: ResolvedConfig;
|
|
619
|
-
/**
|
|
620
|
-
* Browser instance if the browser is enabled. This is initialized when the tests run for the first time.
|
|
621
|
-
*/
|
|
622
|
-
browser?: ProjectBrowser;
|
|
623
|
-
/**
|
|
624
|
-
* Temporary directory for the project. This is unique for each project. Vitest stores transformed content here.
|
|
625
|
-
*/
|
|
626
|
-
readonly tmpDir: string;
|
|
627
|
-
/** @inetrnal */ testFilesList: string[] | null;
|
|
628
|
-
private runner;
|
|
629
|
-
private closingPromise;
|
|
630
|
-
private typecheckFilesList;
|
|
631
|
-
private _globalSetups?;
|
|
632
|
-
private _provided;
|
|
633
|
-
constructor(vitest: Vitest, options?: InitializeProjectOptions | undefined);
|
|
634
|
-
/**
|
|
635
|
-
* The unique hash of this project. This value is consistent between the reruns.
|
|
636
|
-
*
|
|
637
|
-
* It is based on the root of the project (not consistent between OS) and its name.
|
|
638
|
-
*/
|
|
639
|
-
get hash(): string;
|
|
640
|
-
/**
|
|
641
|
-
* Provide a value to the test context. This value will be available to all tests with `inject`.
|
|
642
|
-
*/
|
|
643
|
-
provide: <T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]) => void;
|
|
644
|
-
/**
|
|
645
|
-
* Get the provided context. The project context is merged with the global context.
|
|
646
|
-
*/
|
|
647
|
-
getProvidedContext(): ProvidedContext;
|
|
648
|
-
/**
|
|
649
|
-
* Creates a new test specification. Specifications describe how to run tests.
|
|
650
|
-
* @param moduleId The file path
|
|
651
|
-
*/
|
|
652
|
-
createSpecification(moduleId: string, locations?: number[] | undefined, pool?: string): TestSpecification;
|
|
653
|
-
toJSON(): SerializedTestProject;
|
|
654
|
-
/**
|
|
655
|
-
* Vite's dev server instance. Every workspace project has its own server.
|
|
656
|
-
*/
|
|
657
|
-
get vite(): ViteDevServer;
|
|
658
|
-
/**
|
|
659
|
-
* Resolved project configuration.
|
|
660
|
-
*/
|
|
661
|
-
get config(): ResolvedConfig;
|
|
662
|
-
/**
|
|
663
|
-
* The name of the project or an empty string if not set.
|
|
664
|
-
*/
|
|
665
|
-
get name(): string;
|
|
666
|
-
/**
|
|
667
|
-
* The color used when reporting tasks of this project.
|
|
668
|
-
*/
|
|
669
|
-
get color(): ProjectName["color"];
|
|
670
|
-
/**
|
|
671
|
-
* Serialized project configuration. This is the config that tests receive.
|
|
672
|
-
*/
|
|
673
|
-
get serializedConfig(): SerializedConfig;
|
|
674
|
-
/**
|
|
675
|
-
* Check if this is the root project. The root project is the one that has the root config.
|
|
676
|
-
*/
|
|
677
|
-
isRootProject(): boolean;
|
|
678
|
-
onTestsRerun(cb: OnTestsRerunHandler): void;
|
|
679
|
-
/**
|
|
680
|
-
* Get all files in the project that match the globs in the config and the filters.
|
|
681
|
-
* @param filters String filters to match the test files.
|
|
682
|
-
*/
|
|
683
|
-
globTestFiles(filters?: string[]): Promise<{
|
|
684
|
-
/**
|
|
685
|
-
* Test files that match the filters.
|
|
686
|
-
*/
|
|
687
|
-
testFiles: string[];
|
|
688
|
-
/**
|
|
689
|
-
* Typecheck test files that match the filters. This will be empty unless `typecheck.enabled` is `true`.
|
|
690
|
-
*/
|
|
691
|
-
typecheckTestFiles: string[];
|
|
692
|
-
}>;
|
|
693
|
-
private globAllTestFiles;
|
|
694
|
-
isBrowserEnabled(): boolean;
|
|
695
|
-
private markTestFile;
|
|
696
|
-
/**
|
|
697
|
-
* Test if a file matches the test globs. This does the actual glob matching if the test is not cached, unlike `isCachedTestFile`.
|
|
698
|
-
*/
|
|
699
|
-
matchesTestGlob(moduleId: string, source?: () => string): boolean;
|
|
700
|
-
private isInSourceTestCode;
|
|
701
|
-
private filterFiles;
|
|
702
|
-
private _parentBrowser?;
|
|
703
|
-
/**
|
|
704
|
-
* Closes the project and all associated resources. This can only be called once; the closing promise is cached until the server restarts.
|
|
705
|
-
* If the resources are needed again, create a new project.
|
|
706
|
-
*/
|
|
707
|
-
close(): Promise<void>;
|
|
708
|
-
/**
|
|
709
|
-
* Import a file using Vite module runner.
|
|
710
|
-
* @param moduleId The ID of the module in Vite module graph
|
|
711
|
-
*/
|
|
712
|
-
import<T>(moduleId: string): Promise<T>;
|
|
713
|
-
private _setHash;
|
|
714
|
-
private _serializeOverriddenConfig;
|
|
715
|
-
private clearTmpDir;
|
|
716
|
-
}
|
|
717
|
-
interface SerializedTestProject {
|
|
718
|
-
name: string;
|
|
719
|
-
serializedConfig: SerializedConfig;
|
|
720
|
-
context: ProvidedContext;
|
|
721
|
-
}
|
|
722
|
-
interface InitializeProjectOptions extends TestProjectInlineConfiguration {
|
|
723
|
-
configFile: string | false;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
declare class ReportedTaskImplementation {
|
|
727
|
-
/**
|
|
728
|
-
* The project associated with the test or suite.
|
|
729
|
-
*/
|
|
730
|
-
readonly project: TestProject;
|
|
731
|
-
/**
|
|
732
|
-
* Unique identifier.
|
|
733
|
-
* This ID is deterministic and will be the same for the same test across multiple runs.
|
|
734
|
-
* The ID is based on the project name, module url and test order.
|
|
735
|
-
*/
|
|
736
|
-
readonly id: string;
|
|
737
|
-
/**
|
|
738
|
-
* Location in the module where the test or suite is defined.
|
|
739
|
-
*/
|
|
740
|
-
readonly location: {
|
|
741
|
-
line: number;
|
|
742
|
-
column: number;
|
|
743
|
-
} | undefined;
|
|
744
|
-
/**
|
|
745
|
-
* Checks if the test did not fail the suite.
|
|
746
|
-
* If the test is not finished yet or was skipped, it will return `true`.
|
|
747
|
-
*/
|
|
748
|
-
ok(): boolean;
|
|
749
|
-
/**
|
|
750
|
-
* Custom metadata that was attached to the test during its execution.
|
|
751
|
-
*/
|
|
752
|
-
meta(): TaskMeta;
|
|
753
|
-
}
|
|
754
|
-
declare class TestCase extends ReportedTaskImplementation {
|
|
755
|
-
#private;
|
|
756
|
-
readonly type = "test";
|
|
757
|
-
/**
|
|
758
|
-
* Direct reference to the test module where the test or suite is defined.
|
|
759
|
-
*/
|
|
760
|
-
readonly module: TestModule;
|
|
761
|
-
/**
|
|
762
|
-
* Name of the test.
|
|
763
|
-
*/
|
|
764
|
-
readonly name: string;
|
|
765
|
-
/**
|
|
766
|
-
* Options that the test was initiated with.
|
|
767
|
-
*/
|
|
768
|
-
readonly options: TaskOptions;
|
|
769
|
-
/**
|
|
770
|
-
* Parent suite. If the test was called directly inside the module, the parent will be the module itself.
|
|
771
|
-
*/
|
|
772
|
-
readonly parent: TestSuite | TestModule;
|
|
773
|
-
/**
|
|
774
|
-
* Full name of the test including all parent suites separated with `>`.
|
|
775
|
-
*/
|
|
776
|
-
get fullName(): string;
|
|
777
|
-
/**
|
|
778
|
-
* Test results.
|
|
779
|
-
* - **pending**: Test was collected, but didn't finish running yet.
|
|
780
|
-
* - **passed**: Test passed successfully
|
|
781
|
-
* - **failed**: Test failed to execute
|
|
782
|
-
* - **skipped**: Test was skipped during collection or dynamically with `ctx.skip()`.
|
|
783
|
-
*/
|
|
784
|
-
result(): TestResult;
|
|
785
|
-
/**
|
|
786
|
-
* Test annotations added via the `task.annotate` API during the test execution.
|
|
787
|
-
*/
|
|
788
|
-
annotations(): ReadonlyArray<TestAnnotation>;
|
|
789
|
-
/**
|
|
790
|
-
* Useful information about the test like duration, memory usage, etc.
|
|
791
|
-
* Diagnostic is only available after the test has finished.
|
|
792
|
-
*/
|
|
793
|
-
diagnostic(): TestDiagnostic | undefined;
|
|
794
|
-
}
|
|
795
|
-
declare class TestCollection {
|
|
796
|
-
#private;
|
|
797
|
-
constructor(task: Suite | File, project: TestProject);
|
|
798
|
-
/**
|
|
799
|
-
* Returns the test or suite at a specific index.
|
|
800
|
-
*/
|
|
801
|
-
at(index: number): TestCase | TestSuite | undefined;
|
|
802
|
-
/**
|
|
803
|
-
* The number of tests and suites in the collection.
|
|
804
|
-
*/
|
|
805
|
-
get size(): number;
|
|
806
|
-
/**
|
|
807
|
-
* Returns the collection in array form for easier manipulation.
|
|
808
|
-
*/
|
|
809
|
-
array(): (TestCase | TestSuite)[];
|
|
810
|
-
/**
|
|
811
|
-
* Filters all tests that are part of this collection and its children.
|
|
812
|
-
*/
|
|
813
|
-
allTests(state?: TestState): Generator<TestCase, undefined, void>;
|
|
814
|
-
/**
|
|
815
|
-
* Filters only the tests that are part of this collection.
|
|
816
|
-
*/
|
|
817
|
-
tests(state?: TestState): Generator<TestCase, undefined, void>;
|
|
818
|
-
/**
|
|
819
|
-
* Filters only the suites that are part of this collection.
|
|
820
|
-
*/
|
|
821
|
-
suites(): Generator<TestSuite, undefined, void>;
|
|
822
|
-
/**
|
|
823
|
-
* Filters all suites that are part of this collection and its children.
|
|
824
|
-
*/
|
|
825
|
-
allSuites(): Generator<TestSuite, undefined, void>;
|
|
826
|
-
[Symbol.iterator](): Generator<TestSuite | TestCase, undefined, void>;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
type ReportedHookContext = {
|
|
830
|
-
readonly name: "beforeAll" | "afterAll";
|
|
831
|
-
readonly entity: TestSuite | TestModule;
|
|
832
|
-
} | {
|
|
833
|
-
readonly name: "beforeEach" | "afterEach";
|
|
834
|
-
readonly entity: TestCase;
|
|
835
|
-
};
|
|
836
|
-
declare abstract class SuiteImplementation extends ReportedTaskImplementation {
|
|
837
|
-
/**
|
|
838
|
-
* Collection of suites and tests that are part of this suite.
|
|
839
|
-
*/
|
|
840
|
-
readonly children: TestCollection;
|
|
841
|
-
/**
|
|
842
|
-
* Errors that happened outside of the test run during collection, like syntax errors.
|
|
843
|
-
*/
|
|
844
|
-
errors(): SerializedError[];
|
|
845
|
-
}
|
|
846
|
-
declare class TestSuite extends SuiteImplementation {
|
|
847
|
-
#private;
|
|
848
|
-
readonly type = "suite";
|
|
849
|
-
/**
|
|
850
|
-
* Name of the test or the suite.
|
|
851
|
-
*/
|
|
852
|
-
readonly name: string;
|
|
853
|
-
/**
|
|
854
|
-
* Direct reference to the test module where the test or suite is defined.
|
|
855
|
-
*/
|
|
856
|
-
readonly module: TestModule;
|
|
857
|
-
/**
|
|
858
|
-
* Parent suite. If suite was called directly inside the module, the parent will be the module itself.
|
|
859
|
-
*/
|
|
860
|
-
readonly parent: TestSuite | TestModule;
|
|
861
|
-
/**
|
|
862
|
-
* Options that suite was initiated with.
|
|
863
|
-
*/
|
|
864
|
-
readonly options: TaskOptions;
|
|
865
|
-
/**
|
|
866
|
-
* Checks if the suite has any failed tests.
|
|
867
|
-
* This will also return `false` if suite failed during collection.
|
|
868
|
-
*/
|
|
869
|
-
ok: () => boolean;
|
|
870
|
-
/**
|
|
871
|
-
* The meta information attached to the suite during its collection or execution.
|
|
872
|
-
*/
|
|
873
|
-
meta: () => TaskMeta;
|
|
874
|
-
/**
|
|
875
|
-
* Checks the running state of the suite.
|
|
876
|
-
*/
|
|
877
|
-
state(): TestSuiteState;
|
|
878
|
-
/**
|
|
879
|
-
* Full name of the suite including all parent suites separated with `>`.
|
|
880
|
-
*/
|
|
881
|
-
get fullName(): string;
|
|
882
|
-
}
|
|
883
|
-
declare class TestModule extends SuiteImplementation {
|
|
884
|
-
readonly location: undefined;
|
|
885
|
-
readonly type = "module";
|
|
886
|
-
/**
|
|
887
|
-
* This is usually an absolute UNIX file path.
|
|
888
|
-
* It can be a virtual ID if the file is not on the disk.
|
|
889
|
-
* This value corresponds to the ID in the Vite's module graph.
|
|
890
|
-
*/
|
|
891
|
-
readonly moduleId: string;
|
|
892
|
-
/**
|
|
893
|
-
* Module id relative to the project. This is the same as `task.name`.
|
|
894
|
-
*/
|
|
895
|
-
readonly relativeModuleId: string;
|
|
896
|
-
/**
|
|
897
|
-
* Checks the running state of the test file.
|
|
898
|
-
*/
|
|
899
|
-
state(): TestModuleState;
|
|
900
|
-
/**
|
|
901
|
-
* Checks if the module has any failed tests.
|
|
902
|
-
* This will also return `false` if module failed during collection.
|
|
903
|
-
*/
|
|
904
|
-
ok: () => boolean;
|
|
905
|
-
/**
|
|
906
|
-
* The meta information attached to the module during its collection or execution.
|
|
907
|
-
*/
|
|
908
|
-
meta: () => TaskMeta;
|
|
909
|
-
/**
|
|
910
|
-
* Useful information about the module like duration, memory usage, etc.
|
|
911
|
-
* If the module was not executed yet, all diagnostic values will return `0`.
|
|
912
|
-
*/
|
|
913
|
-
diagnostic(): ModuleDiagnostic;
|
|
914
|
-
}
|
|
915
|
-
interface TaskOptions {
|
|
916
|
-
readonly each: boolean | undefined;
|
|
917
|
-
readonly fails: boolean | undefined;
|
|
918
|
-
readonly concurrent: boolean | undefined;
|
|
919
|
-
readonly shuffle: boolean | undefined;
|
|
920
|
-
readonly retry: number | undefined;
|
|
921
|
-
readonly repeats: number | undefined;
|
|
922
|
-
readonly mode: "run" | "only" | "skip" | "todo";
|
|
923
|
-
}
|
|
924
|
-
type TestSuiteState = "skipped" | "pending" | "failed" | "passed";
|
|
925
|
-
type TestModuleState = TestSuiteState | "queued";
|
|
926
|
-
type TestState = TestResult["state"];
|
|
927
|
-
type TestResult = TestResultPassed | TestResultFailed | TestResultSkipped | TestResultPending;
|
|
928
|
-
interface TestResultPending {
|
|
929
|
-
/**
|
|
930
|
-
* The test was collected, but didn't finish running yet.
|
|
931
|
-
*/
|
|
932
|
-
readonly state: "pending";
|
|
933
|
-
/**
|
|
934
|
-
* Pending tests have no errors.
|
|
935
|
-
*/
|
|
936
|
-
readonly errors: undefined;
|
|
937
|
-
}
|
|
938
|
-
interface TestResultPassed {
|
|
939
|
-
/**
|
|
940
|
-
* The test passed successfully.
|
|
941
|
-
*/
|
|
942
|
-
readonly state: "passed";
|
|
943
|
-
/**
|
|
944
|
-
* Errors that were thrown during the test execution.
|
|
945
|
-
*
|
|
946
|
-
* **Note**: If test was retried successfully, errors will still be reported.
|
|
947
|
-
*/
|
|
948
|
-
readonly errors: ReadonlyArray<TestError> | undefined;
|
|
949
|
-
}
|
|
950
|
-
interface TestResultFailed {
|
|
951
|
-
/**
|
|
952
|
-
* The test failed to execute.
|
|
953
|
-
*/
|
|
954
|
-
readonly state: "failed";
|
|
955
|
-
/**
|
|
956
|
-
* Errors that were thrown during the test execution.
|
|
957
|
-
*/
|
|
958
|
-
readonly errors: ReadonlyArray<TestError>;
|
|
959
|
-
}
|
|
960
|
-
interface TestResultSkipped {
|
|
961
|
-
/**
|
|
962
|
-
* The test was skipped with `only` (on another test), `skip` or `todo` flag.
|
|
963
|
-
* You can see which one was used in the `options.mode` option.
|
|
964
|
-
*/
|
|
965
|
-
readonly state: "skipped";
|
|
966
|
-
/**
|
|
967
|
-
* Skipped tests have no errors.
|
|
968
|
-
*/
|
|
969
|
-
readonly errors: undefined;
|
|
970
|
-
/**
|
|
971
|
-
* A custom note passed down to `ctx.skip(note)`.
|
|
972
|
-
*/
|
|
973
|
-
readonly note: string | undefined;
|
|
974
|
-
}
|
|
975
|
-
interface TestDiagnostic {
|
|
976
|
-
/**
|
|
977
|
-
* If the duration of the test is above `slowTestThreshold`.
|
|
978
|
-
*/
|
|
979
|
-
readonly slow: boolean;
|
|
980
|
-
/**
|
|
981
|
-
* The amount of memory used by the test in bytes.
|
|
982
|
-
* This value is only available if the test was executed with `logHeapUsage` flag.
|
|
983
|
-
*/
|
|
984
|
-
readonly heap: number | undefined;
|
|
985
|
-
/**
|
|
986
|
-
* The time it takes to execute the test in ms.
|
|
987
|
-
*/
|
|
988
|
-
readonly duration: number;
|
|
335
|
+
readonly duration: number;
|
|
989
336
|
/**
|
|
990
337
|
* The time in ms when the test started.
|
|
991
338
|
*/
|
|
@@ -1041,6 +388,36 @@ declare function experimental_getRunnerTask(entity: TestSuite): Suite;
|
|
|
1041
388
|
declare function experimental_getRunnerTask(entity: TestModule): File;
|
|
1042
389
|
declare function experimental_getRunnerTask(entity: TestCase | TestSuite | TestModule): Suite | File | Test;
|
|
1043
390
|
|
|
391
|
+
declare class TestSpecification {
|
|
392
|
+
/**
|
|
393
|
+
* The task ID associated with the test module.
|
|
394
|
+
*/
|
|
395
|
+
readonly taskId: string;
|
|
396
|
+
/**
|
|
397
|
+
* The test project that the module belongs to.
|
|
398
|
+
*/
|
|
399
|
+
readonly project: TestProject;
|
|
400
|
+
/**
|
|
401
|
+
* The ID of the module in the Vite module graph. It is usually an absolute file path.
|
|
402
|
+
*/
|
|
403
|
+
readonly moduleId: string;
|
|
404
|
+
/**
|
|
405
|
+
* The current test pool. It's possible to have multiple pools in a single test project with `poolMatchGlob` and `typecheck.enabled`.
|
|
406
|
+
* @experimental In Vitest 4, the project will only support a single pool and this property will be removed.
|
|
407
|
+
*/
|
|
408
|
+
readonly pool: Pool;
|
|
409
|
+
/**
|
|
410
|
+
* Line numbers of the test locations to run.
|
|
411
|
+
*/
|
|
412
|
+
readonly testLines: number[] | undefined;
|
|
413
|
+
constructor(project: TestProject, moduleId: string, pool: Pool, testLines?: number[] | undefined);
|
|
414
|
+
/**
|
|
415
|
+
* Test module associated with the specification.
|
|
416
|
+
*/
|
|
417
|
+
get testModule(): TestModule | undefined;
|
|
418
|
+
toJSON(): SerializedTestSpecification;
|
|
419
|
+
}
|
|
420
|
+
|
|
1044
421
|
interface CoverageSummaryData {
|
|
1045
422
|
lines: Totals;
|
|
1046
423
|
statements: Totals;
|
|
@@ -1526,6 +903,80 @@ declare class VitestPackageInstaller {
|
|
|
1526
903
|
ensureInstalled(dependency: string, root: string, version?: string): Promise<boolean>;
|
|
1527
904
|
}
|
|
1528
905
|
|
|
906
|
+
type TestRunEndReason = "passed" | "interrupted" | "failed";
|
|
907
|
+
interface Reporter {
|
|
908
|
+
onInit?: (vitest: Vitest) => void;
|
|
909
|
+
/**
|
|
910
|
+
* Called when the project initiated the browser instance.
|
|
911
|
+
* project.browser will always be defined.
|
|
912
|
+
* @experimental
|
|
913
|
+
*/
|
|
914
|
+
onBrowserInit?: (project: TestProject) => Awaitable<void>;
|
|
915
|
+
onTestRemoved?: (trigger?: string) => Awaitable<void>;
|
|
916
|
+
onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
917
|
+
onWatcherRerun?: (files: string[], trigger?: string) => Awaitable<void>;
|
|
918
|
+
onServerRestart?: (reason?: string) => Awaitable<void>;
|
|
919
|
+
onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
|
|
920
|
+
onProcessTimeout?: () => Awaitable<void>;
|
|
921
|
+
/**
|
|
922
|
+
* Called when the new test run starts.
|
|
923
|
+
*/
|
|
924
|
+
onTestRunStart?: (specifications: ReadonlyArray<TestSpecification>) => Awaitable<void>;
|
|
925
|
+
/**
|
|
926
|
+
* Called when the test run is finished.
|
|
927
|
+
*/
|
|
928
|
+
onTestRunEnd?: (testModules: ReadonlyArray<TestModule>, unhandledErrors: ReadonlyArray<SerializedError>, reason: TestRunEndReason) => Awaitable<void>;
|
|
929
|
+
/**
|
|
930
|
+
* Called when the module is enqueued for testing. The file itself is not loaded yet.
|
|
931
|
+
*/
|
|
932
|
+
onTestModuleQueued?: (testModule: TestModule) => Awaitable<void>;
|
|
933
|
+
/**
|
|
934
|
+
* Called when the test file is loaded and the module is ready to run tests.
|
|
935
|
+
*/
|
|
936
|
+
onTestModuleCollected?: (testModule: TestModule) => Awaitable<void>;
|
|
937
|
+
/**
|
|
938
|
+
* Called when starting to run tests of the test file
|
|
939
|
+
*/
|
|
940
|
+
onTestModuleStart?: (testModule: TestModule) => Awaitable<void>;
|
|
941
|
+
/**
|
|
942
|
+
* Called when all tests of the test file have finished running.
|
|
943
|
+
*/
|
|
944
|
+
onTestModuleEnd?: (testModule: TestModule) => Awaitable<void>;
|
|
945
|
+
/**
|
|
946
|
+
* Called when test case is ready to run.
|
|
947
|
+
* Called before the `beforeEach` hooks for the test are run.
|
|
948
|
+
*/
|
|
949
|
+
onTestCaseReady?: (testCase: TestCase) => Awaitable<void>;
|
|
950
|
+
/**
|
|
951
|
+
* Called after the test and its hooks are finished running.
|
|
952
|
+
* The `result()` cannot be `pending`.
|
|
953
|
+
*/
|
|
954
|
+
onTestCaseResult?: (testCase: TestCase) => Awaitable<void>;
|
|
955
|
+
/**
|
|
956
|
+
* Called when annotation is added via the `task.annotate` API.
|
|
957
|
+
*/
|
|
958
|
+
onTestCaseAnnotate?: (testCase: TestCase, annotation: TestAnnotation) => Awaitable<void>;
|
|
959
|
+
/**
|
|
960
|
+
* Called when test suite is ready to run.
|
|
961
|
+
* Called before the `beforeAll` hooks for the test are run.
|
|
962
|
+
*/
|
|
963
|
+
onTestSuiteReady?: (testSuite: TestSuite) => Awaitable<void>;
|
|
964
|
+
/**
|
|
965
|
+
* Called after the test suite and its hooks are finished running.
|
|
966
|
+
* The `state` cannot be `pending`.
|
|
967
|
+
*/
|
|
968
|
+
onTestSuiteResult?: (testSuite: TestSuite) => Awaitable<void>;
|
|
969
|
+
/**
|
|
970
|
+
* Called before the hook starts to run.
|
|
971
|
+
*/
|
|
972
|
+
onHookStart?: (hook: ReportedHookContext) => Awaitable<void>;
|
|
973
|
+
/**
|
|
974
|
+
* Called after the hook finished running.
|
|
975
|
+
*/
|
|
976
|
+
onHookEnd?: (hook: ReportedHookContext) => Awaitable<void>;
|
|
977
|
+
onCoverage?: (coverage: unknown) => Awaitable<void>;
|
|
978
|
+
}
|
|
979
|
+
|
|
1529
980
|
interface BlobOptions {
|
|
1530
981
|
outputFile?: string;
|
|
1531
982
|
}
|
|
@@ -1552,10 +1003,19 @@ declare class StateManager {
|
|
|
1552
1003
|
idMap: Map<string, Task>;
|
|
1553
1004
|
taskFileMap: WeakMap<Task, File>;
|
|
1554
1005
|
errorsSet: Set<unknown>;
|
|
1555
|
-
processTimeoutCauses: Set<string>;
|
|
1556
1006
|
reportedTasksMap: WeakMap<Task, TestModule | TestCase | TestSuite>;
|
|
1557
1007
|
blobs?: MergedBlobs;
|
|
1558
1008
|
transformTime: number;
|
|
1009
|
+
metadata: Record<string, {
|
|
1010
|
+
externalized: Record<string, string>;
|
|
1011
|
+
duration: Record<string, number[]>;
|
|
1012
|
+
tmps: Record<string, string>;
|
|
1013
|
+
dumpDir?: string;
|
|
1014
|
+
outline?: {
|
|
1015
|
+
externalized: number;
|
|
1016
|
+
inlined: number;
|
|
1017
|
+
};
|
|
1018
|
+
}>;
|
|
1559
1019
|
onUnhandledError?: OnUnhandledErrorCallback;
|
|
1560
1020
|
constructor(options: {
|
|
1561
1021
|
onUnhandledError?: OnUnhandledErrorCallback;
|
|
@@ -1563,8 +1023,6 @@ declare class StateManager {
|
|
|
1563
1023
|
catchError(error: unknown, type: string): void;
|
|
1564
1024
|
clearErrors(): void;
|
|
1565
1025
|
getUnhandledErrors(): unknown[];
|
|
1566
|
-
addProcessTimeoutCause(cause: string): void;
|
|
1567
|
-
getProcessTimeoutCauses(): string[];
|
|
1568
1026
|
getPaths(): string[];
|
|
1569
1027
|
/**
|
|
1570
1028
|
* Return files that were running or collected.
|
|
@@ -1582,389 +1040,890 @@ declare class StateManager {
|
|
|
1582
1040
|
updateTasks(packs: TaskResultPack[]): void;
|
|
1583
1041
|
updateUserLog(log: UserConsoleLog): void;
|
|
1584
1042
|
getCountOfFailedTests(): number;
|
|
1585
|
-
cancelFiles(files:
|
|
1043
|
+
cancelFiles(files: FileSpecification[], project: TestProject): void;
|
|
1586
1044
|
}
|
|
1587
1045
|
|
|
1588
1046
|
declare class VitestWatcher {
|
|
1589
1047
|
private vitest;
|
|
1590
1048
|
/**
|
|
1591
|
-
* Modules that will be invalidated on the next run.
|
|
1049
|
+
* Modules that will be invalidated on the next run.
|
|
1050
|
+
*/
|
|
1051
|
+
readonly invalidates: Set<string>;
|
|
1052
|
+
/**
|
|
1053
|
+
* Test files that have changed and need to be rerun.
|
|
1054
|
+
*/
|
|
1055
|
+
readonly changedTests: Set<string>;
|
|
1056
|
+
private readonly _onRerun;
|
|
1057
|
+
constructor(vitest: Vitest);
|
|
1058
|
+
unregisterWatcher: () => void;
|
|
1059
|
+
registerWatcher(): this;
|
|
1060
|
+
private scheduleRerun;
|
|
1061
|
+
private getTestFilesFromWatcherTrigger;
|
|
1062
|
+
onFileChange: (id: string) => void;
|
|
1063
|
+
onFileDelete: (id: string) => void;
|
|
1064
|
+
onFileCreate: (id: string) => void;
|
|
1065
|
+
private handleSetupFile;
|
|
1066
|
+
/**
|
|
1067
|
+
* @returns A value indicating whether rerun is needed (changedTests was mutated)
|
|
1068
|
+
*/
|
|
1069
|
+
private handleFileChanged;
|
|
1070
|
+
}
|
|
1071
|
+
interface WatcherTriggerPattern {
|
|
1072
|
+
pattern: RegExp;
|
|
1073
|
+
testsToRun: (file: string, match: RegExpMatchArray) => string[] | string | null | undefined | void;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
interface VitestOptions {
|
|
1077
|
+
packageInstaller?: VitestPackageInstaller;
|
|
1078
|
+
stdin?: NodeJS.ReadStream;
|
|
1079
|
+
stdout?: NodeJS.WriteStream | Writable;
|
|
1080
|
+
stderr?: NodeJS.WriteStream | Writable;
|
|
1081
|
+
}
|
|
1082
|
+
declare class Vitest {
|
|
1083
|
+
readonly mode: VitestRunMode;
|
|
1084
|
+
/**
|
|
1085
|
+
* Current Vitest version.
|
|
1086
|
+
* @example '2.0.0'
|
|
1087
|
+
*/
|
|
1088
|
+
readonly version: string;
|
|
1089
|
+
static readonly version: string;
|
|
1090
|
+
/**
|
|
1091
|
+
* The logger instance used to log messages. It's recommended to use this logger instead of `console`.
|
|
1092
|
+
* It's possible to override stdout and stderr streams when initiating Vitest.
|
|
1093
|
+
* @example
|
|
1094
|
+
* new Vitest('test', {
|
|
1095
|
+
* stdout: new Writable(),
|
|
1096
|
+
* })
|
|
1097
|
+
*/
|
|
1098
|
+
readonly logger: Logger;
|
|
1099
|
+
/**
|
|
1100
|
+
* The package installer instance used to install Vitest packages.
|
|
1101
|
+
* @example
|
|
1102
|
+
* await vitest.packageInstaller.ensureInstalled('@vitest/browser', process.cwd())
|
|
1103
|
+
*/
|
|
1104
|
+
readonly packageInstaller: VitestPackageInstaller;
|
|
1105
|
+
/**
|
|
1106
|
+
* A path to the built Vitest directory. This is usually a folder in `node_modules`.
|
|
1107
|
+
*/
|
|
1108
|
+
readonly distPath: string;
|
|
1109
|
+
/**
|
|
1110
|
+
* A list of projects that are currently running.
|
|
1111
|
+
* If projects were filtered with `--project` flag, they won't appear here.
|
|
1112
|
+
*/
|
|
1113
|
+
projects: TestProject[];
|
|
1114
|
+
/**
|
|
1115
|
+
* A watcher handler. This is not the file system watcher. The handler only
|
|
1116
|
+
* exposes methods to handle changed files.
|
|
1117
|
+
*
|
|
1118
|
+
* If you have your own watcher, you can use these methods to replicate
|
|
1119
|
+
* Vitest behaviour.
|
|
1120
|
+
*/
|
|
1121
|
+
readonly watcher: VitestWatcher;
|
|
1122
|
+
private isFirstRun;
|
|
1123
|
+
private restartsCount;
|
|
1124
|
+
private readonly specifications;
|
|
1125
|
+
private pool;
|
|
1126
|
+
private _config?;
|
|
1127
|
+
private _vite?;
|
|
1128
|
+
private _state?;
|
|
1129
|
+
private _cache?;
|
|
1130
|
+
private _snapshot?;
|
|
1131
|
+
private _coverageProvider?;
|
|
1132
|
+
constructor(mode: VitestRunMode, cliOptions: UserConfig, options?: VitestOptions);
|
|
1133
|
+
private _onRestartListeners;
|
|
1134
|
+
private _onClose;
|
|
1135
|
+
private _onSetServer;
|
|
1136
|
+
private _onCancelListeners;
|
|
1137
|
+
private _onUserTestsRerun;
|
|
1138
|
+
private _onFilterWatchedSpecification;
|
|
1139
|
+
/**
|
|
1140
|
+
* The global config.
|
|
1141
|
+
*/
|
|
1142
|
+
get config(): ResolvedConfig;
|
|
1143
|
+
/**
|
|
1144
|
+
* Global Vite's dev server instance.
|
|
1145
|
+
*/
|
|
1146
|
+
get vite(): ViteDevServer;
|
|
1147
|
+
/**
|
|
1148
|
+
* The global test state manager.
|
|
1149
|
+
* @experimental The State API is experimental and not subject to semver.
|
|
1150
|
+
*/
|
|
1151
|
+
get state(): StateManager;
|
|
1152
|
+
/**
|
|
1153
|
+
* The global snapshot manager. You can access the current state on `snapshot.summary`.
|
|
1154
|
+
*/
|
|
1155
|
+
get snapshot(): SnapshotManager;
|
|
1156
|
+
/**
|
|
1157
|
+
* Test results and test file stats cache. Primarily used by the sequencer to sort tests.
|
|
1158
|
+
*/
|
|
1159
|
+
get cache(): VitestCache;
|
|
1160
|
+
enableCoverage(): Promise<void>;
|
|
1161
|
+
disableCoverage(): void;
|
|
1162
|
+
private _coverageOverrideCache;
|
|
1163
|
+
/**
|
|
1164
|
+
* Inject new test projects into the workspace.
|
|
1165
|
+
* @param config Glob, config path or a custom config options.
|
|
1166
|
+
* @returns An array of new test projects. Can be empty if the name was filtered out.
|
|
1167
|
+
*/
|
|
1168
|
+
private injectTestProject;
|
|
1169
|
+
/**
|
|
1170
|
+
* Provide a value to the test context. This value will be available to all tests with `inject`.
|
|
1171
|
+
*/
|
|
1172
|
+
provide: <T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]) => void;
|
|
1173
|
+
/**
|
|
1174
|
+
* Get global provided context.
|
|
1175
|
+
*/
|
|
1176
|
+
getProvidedContext(): ProvidedContext;
|
|
1177
|
+
/**
|
|
1178
|
+
* Return project that has the root (or "global") config.
|
|
1179
|
+
*/
|
|
1180
|
+
getRootProject(): TestProject;
|
|
1181
|
+
getProjectByName(name: string): TestProject;
|
|
1182
|
+
/**
|
|
1183
|
+
* Import a file using Vite module runner. The file will be transformed by Vite and executed in a separate context.
|
|
1184
|
+
* @param moduleId The ID of the module in Vite module graph
|
|
1185
|
+
*/
|
|
1186
|
+
import<T>(moduleId: string): Promise<T>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Creates a coverage provider if `coverage` is enabled in the config.
|
|
1189
|
+
*/
|
|
1190
|
+
createCoverageProvider(): Promise<CoverageProvider | null>;
|
|
1191
|
+
private resolveProjects;
|
|
1192
|
+
/**
|
|
1193
|
+
* Glob test files in every project and create a TestSpecification for each file and pool.
|
|
1194
|
+
* @param filters String filters to match the test files.
|
|
1195
|
+
*/
|
|
1196
|
+
globTestSpecifications(filters?: string[]): Promise<TestSpecification[]>;
|
|
1197
|
+
private initCoverageProvider;
|
|
1198
|
+
/**
|
|
1199
|
+
* Merge reports from multiple runs located in the specified directory (value from `--merge-reports` if not specified).
|
|
1200
|
+
*/
|
|
1201
|
+
mergeReports(directory?: string): Promise<TestRunResult>;
|
|
1202
|
+
/**
|
|
1203
|
+
* Returns the seed, if tests are running in a random order.
|
|
1204
|
+
*/
|
|
1205
|
+
getSeed(): number | null;
|
|
1206
|
+
collect(filters?: string[]): Promise<TestRunResult>;
|
|
1207
|
+
/**
|
|
1208
|
+
* Returns the list of test files that match the config and filters.
|
|
1209
|
+
* @param filters String filters to match the test files
|
|
1210
|
+
*/
|
|
1211
|
+
getRelevantTestSpecifications(filters?: string[]): Promise<TestSpecification[]>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Initialize reporters, the coverage provider, and run tests.
|
|
1214
|
+
* This method can throw an error:
|
|
1215
|
+
* - `FilesNotFoundError` if no tests are found
|
|
1216
|
+
* - `GitNotFoundError` if `--related` flag is used, but git repository is not initialized
|
|
1217
|
+
* - `Error` from the user reporters
|
|
1218
|
+
* @param filters String filters to match the test files
|
|
1219
|
+
*/
|
|
1220
|
+
start(filters?: string[]): Promise<TestRunResult>;
|
|
1221
|
+
/**
|
|
1222
|
+
* Initialize reporters and the coverage provider. This method doesn't run any tests.
|
|
1223
|
+
* If the `--watch` flag is provided, Vitest will still run changed tests even if this method was not called.
|
|
1224
|
+
*/
|
|
1225
|
+
init(): Promise<void>;
|
|
1226
|
+
/**
|
|
1227
|
+
* If there is a test run happening, returns a promise that will
|
|
1228
|
+
* resolve when the test run is finished.
|
|
1229
|
+
*/
|
|
1230
|
+
waitForTestRunEnd(): Promise<void>;
|
|
1231
|
+
/**
|
|
1232
|
+
* Get test specifications associated with the given module. If module is not a test file, an empty array is returned.
|
|
1233
|
+
*
|
|
1234
|
+
* **Note:** this method relies on a cache generated by `globTestSpecifications`. If the file was not processed yet, use `project.matchesGlobPattern` instead.
|
|
1235
|
+
* @param moduleId The module ID to get test specifications for.
|
|
1236
|
+
*/
|
|
1237
|
+
getModuleSpecifications(moduleId: string): TestSpecification[];
|
|
1238
|
+
/**
|
|
1239
|
+
* Vitest automatically caches test specifications for each file. This method clears the cache for the given file or the whole cache altogether.
|
|
1240
|
+
*/
|
|
1241
|
+
clearSpecificationsCache(moduleId?: string): void;
|
|
1242
|
+
/**
|
|
1243
|
+
* Run tests for the given test specifications. This does not trigger `onWatcher*` events.
|
|
1244
|
+
* @param specifications A list of specifications to run.
|
|
1245
|
+
* @param allTestsRun Indicates whether all tests were run. This only matters for coverage.
|
|
1246
|
+
*/
|
|
1247
|
+
runTestSpecifications(specifications: TestSpecification[], allTestsRun?: boolean): Promise<TestRunResult>;
|
|
1248
|
+
/**
|
|
1249
|
+
* Rerun files and trigger `onWatcherRerun`, `onWatcherStart` and `onTestsRerun` events.
|
|
1250
|
+
* @param specifications A list of specifications to run.
|
|
1251
|
+
* @param allTestsRun Indicates whether all tests were run. This only matters for coverage.
|
|
1252
|
+
*/
|
|
1253
|
+
rerunTestSpecifications(specifications: TestSpecification[], allTestsRun?: boolean): Promise<TestRunResult>;
|
|
1254
|
+
private runFiles;
|
|
1255
|
+
experimental_parseSpecifications(specifications: TestSpecification[], options?: {
|
|
1256
|
+
/** @default os.availableParallelism() */
|
|
1257
|
+
concurrency?: number;
|
|
1258
|
+
}): Promise<TestModule[]>;
|
|
1259
|
+
experimental_parseSpecification(specification: TestSpecification): Promise<TestModule>;
|
|
1260
|
+
/**
|
|
1261
|
+
* Collect tests in specified modules. Vitest will run the files to collect tests.
|
|
1262
|
+
* @param specifications A list of specifications to run.
|
|
1263
|
+
*/
|
|
1264
|
+
collectTests(specifications: TestSpecification[]): Promise<TestRunResult>;
|
|
1265
|
+
/**
|
|
1266
|
+
* Gracefully cancel the current test run. Vitest will wait until all running tests are finished before cancelling.
|
|
1267
|
+
*/
|
|
1268
|
+
cancelCurrentRun(reason: CancelReason): Promise<void>;
|
|
1269
|
+
private initializeGlobalSetup;
|
|
1270
|
+
/**
|
|
1271
|
+
* Update snapshots in specified files. If no files are provided, it will update files with failed tests and obsolete snapshots.
|
|
1272
|
+
* @param files The list of files on the file system
|
|
1273
|
+
*/
|
|
1274
|
+
updateSnapshot(files?: string[]): Promise<TestRunResult>;
|
|
1275
|
+
/**
|
|
1276
|
+
* Enable the mode that allows updating snapshots when running tests.
|
|
1277
|
+
* This method doesn't run any tests.
|
|
1278
|
+
*
|
|
1279
|
+
* Every test that runs after this method is called will update snapshots.
|
|
1280
|
+
* To disable the mode, call `resetSnapshotUpdate`.
|
|
1281
|
+
*/
|
|
1282
|
+
enableSnapshotUpdate(): void;
|
|
1283
|
+
/**
|
|
1284
|
+
* Disable the mode that allows updating snapshots when running tests.
|
|
1285
|
+
*/
|
|
1286
|
+
resetSnapshotUpdate(): void;
|
|
1287
|
+
/**
|
|
1288
|
+
* Set the global test name pattern to a regexp.
|
|
1289
|
+
* This method doesn't run any tests.
|
|
1592
1290
|
*/
|
|
1593
|
-
|
|
1291
|
+
setGlobalTestNamePattern(pattern: string | RegExp): void;
|
|
1594
1292
|
/**
|
|
1595
|
-
*
|
|
1293
|
+
* Returns the regexp used for the global test name pattern.
|
|
1596
1294
|
*/
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1295
|
+
getGlobalTestNamePattern(): RegExp | undefined;
|
|
1296
|
+
/**
|
|
1297
|
+
* Resets the global test name pattern. This method doesn't run any tests.
|
|
1298
|
+
*/
|
|
1299
|
+
resetGlobalTestNamePattern(): void;
|
|
1300
|
+
private _rerunTimer;
|
|
1602
1301
|
private scheduleRerun;
|
|
1603
|
-
private getTestFilesFromWatcherTrigger;
|
|
1604
|
-
onFileChange: (id: string) => void;
|
|
1605
|
-
onFileDelete: (id: string) => void;
|
|
1606
|
-
onFileCreate: (id: string) => void;
|
|
1607
|
-
private handleSetupFile;
|
|
1608
1302
|
/**
|
|
1609
|
-
*
|
|
1303
|
+
* Invalidate a file in all projects.
|
|
1610
1304
|
*/
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
interface WatcherTriggerPattern {
|
|
1614
|
-
pattern: RegExp;
|
|
1615
|
-
testsToRun: (file: string, match: RegExpMatchArray) => string[] | string | null | undefined | void;
|
|
1616
|
-
}
|
|
1617
|
-
|
|
1618
|
-
interface VitestOptions {
|
|
1619
|
-
packageInstaller?: VitestPackageInstaller;
|
|
1620
|
-
stdin?: NodeJS.ReadStream;
|
|
1621
|
-
stdout?: NodeJS.WriteStream | Writable;
|
|
1622
|
-
stderr?: NodeJS.WriteStream | Writable;
|
|
1623
|
-
}
|
|
1624
|
-
declare class Vitest {
|
|
1625
|
-
readonly mode: VitestRunMode;
|
|
1305
|
+
invalidateFile(filepath: string): void;
|
|
1306
|
+
private reportCoverage;
|
|
1626
1307
|
/**
|
|
1627
|
-
*
|
|
1628
|
-
*
|
|
1308
|
+
* Closes all projects and their associated resources.
|
|
1309
|
+
* This can only be called once; the closing promise is cached until the server restarts.
|
|
1629
1310
|
*/
|
|
1630
|
-
|
|
1631
|
-
static readonly version: string;
|
|
1311
|
+
close(): Promise<void>;
|
|
1632
1312
|
/**
|
|
1633
|
-
*
|
|
1634
|
-
*
|
|
1635
|
-
* @example
|
|
1636
|
-
* new Vitest('test', {
|
|
1637
|
-
* stdout: new Writable(),
|
|
1638
|
-
* })
|
|
1313
|
+
* Closes all projects and exit the process
|
|
1314
|
+
* @param force If true, the process will exit immediately after closing the projects.
|
|
1639
1315
|
*/
|
|
1640
|
-
|
|
1316
|
+
exit(force?: boolean): Promise<void>;
|
|
1641
1317
|
/**
|
|
1642
|
-
*
|
|
1643
|
-
* @example
|
|
1644
|
-
* await vitest.packageInstaller.ensureInstalled('@vitest/browser', process.cwd())
|
|
1318
|
+
* Should the server be kept running after the tests are done.
|
|
1645
1319
|
*/
|
|
1646
|
-
|
|
1320
|
+
shouldKeepServer(): boolean;
|
|
1647
1321
|
/**
|
|
1648
|
-
*
|
|
1322
|
+
* Register a handler that will be called when the server is restarted due to a config change.
|
|
1649
1323
|
*/
|
|
1650
|
-
|
|
1324
|
+
onServerRestart(fn: OnServerRestartHandler): void;
|
|
1651
1325
|
/**
|
|
1652
|
-
*
|
|
1653
|
-
* If projects were filtered with `--project` flag, they won't appear here.
|
|
1326
|
+
* Register a handler that will be called when the test run is cancelled with `vitest.cancelCurrentRun`.
|
|
1654
1327
|
*/
|
|
1655
|
-
|
|
1328
|
+
onCancel(fn: (reason: CancelReason) => Awaitable<void>): void;
|
|
1656
1329
|
/**
|
|
1657
|
-
*
|
|
1658
|
-
* exposes methods to handle changed files.
|
|
1659
|
-
*
|
|
1660
|
-
* If you have your own watcher, you can use these methods to replicate
|
|
1661
|
-
* Vitest behaviour.
|
|
1330
|
+
* Register a handler that will be called when the server is closed.
|
|
1662
1331
|
*/
|
|
1663
|
-
|
|
1664
|
-
private isFirstRun;
|
|
1665
|
-
private restartsCount;
|
|
1666
|
-
private readonly specifications;
|
|
1667
|
-
private pool;
|
|
1668
|
-
private _config?;
|
|
1669
|
-
private _vite?;
|
|
1670
|
-
private _state?;
|
|
1671
|
-
private _cache?;
|
|
1672
|
-
private _snapshot?;
|
|
1673
|
-
private _coverageProvider?;
|
|
1674
|
-
constructor(mode: VitestRunMode, cliOptions: UserConfig, options?: VitestOptions);
|
|
1675
|
-
private _onRestartListeners;
|
|
1676
|
-
private _onClose;
|
|
1677
|
-
private _onSetServer;
|
|
1678
|
-
private _onCancelListeners;
|
|
1679
|
-
private _onUserTestsRerun;
|
|
1680
|
-
private _onFilterWatchedSpecification;
|
|
1332
|
+
onClose(fn: () => Awaitable<void>): void;
|
|
1681
1333
|
/**
|
|
1682
|
-
*
|
|
1334
|
+
* Register a handler that will be called when the tests are rerunning.
|
|
1683
1335
|
*/
|
|
1684
|
-
|
|
1336
|
+
onTestsRerun(fn: OnTestsRerunHandler): void;
|
|
1685
1337
|
/**
|
|
1686
|
-
*
|
|
1338
|
+
* Register a handler that will be called when a file is changed.
|
|
1339
|
+
* This callback should return `true` of `false` indicating whether the test file needs to be rerun.
|
|
1340
|
+
* @example
|
|
1341
|
+
* const testsToRun = [resolve('./test.spec.ts')]
|
|
1342
|
+
* vitest.onFilterWatchedSpecification(specification => testsToRun.includes(specification.moduleId))
|
|
1687
1343
|
*/
|
|
1688
|
-
|
|
1344
|
+
onFilterWatchedSpecification(fn: (specification: TestSpecification) => boolean): void;
|
|
1689
1345
|
/**
|
|
1690
|
-
*
|
|
1691
|
-
* @experimental The State API is experimental and not subject to semver.
|
|
1346
|
+
* Check if the project with a given name should be included.
|
|
1692
1347
|
*/
|
|
1693
|
-
|
|
1348
|
+
matchesProjectFilter(name: string): boolean;
|
|
1349
|
+
}
|
|
1350
|
+
type OnServerRestartHandler = (reason?: string) => Promise<void> | void;
|
|
1351
|
+
type OnTestsRerunHandler = (testFiles: TestSpecification[]) => Promise<void> | void;
|
|
1352
|
+
|
|
1353
|
+
interface CDPSession {
|
|
1354
|
+
send: (method: string, params?: Record<string, unknown>) => Promise<unknown>;
|
|
1355
|
+
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
1356
|
+
once: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
1357
|
+
off: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
1358
|
+
}
|
|
1359
|
+
interface BrowserModuleMocker {
|
|
1360
|
+
register: (sessionId: string, module: MockedModule) => Promise<void>;
|
|
1361
|
+
delete: (sessionId: string, url: string) => Promise<void>;
|
|
1362
|
+
clear: (sessionId: string) => Promise<void>;
|
|
1363
|
+
}
|
|
1364
|
+
interface BrowserProviderOption<Options extends object = object> {
|
|
1365
|
+
name: string;
|
|
1366
|
+
supportedBrowser?: ReadonlyArray<string>;
|
|
1367
|
+
options: Options;
|
|
1368
|
+
providerFactory: (project: TestProject) => BrowserProvider;
|
|
1369
|
+
serverFactory: BrowserServerFactory;
|
|
1370
|
+
}
|
|
1371
|
+
interface BrowserServerOptions {
|
|
1372
|
+
project: TestProject;
|
|
1373
|
+
coveragePlugin: () => Plugin;
|
|
1374
|
+
mocksPlugins: (options: {
|
|
1375
|
+
filter: (id: string) => boolean;
|
|
1376
|
+
}) => Plugin[];
|
|
1377
|
+
metaEnvReplacer: () => Plugin;
|
|
1378
|
+
}
|
|
1379
|
+
interface BrowserServerFactory {
|
|
1380
|
+
(otpions: BrowserServerOptions): Promise<ParentProjectBrowser>;
|
|
1381
|
+
}
|
|
1382
|
+
interface BrowserProvider {
|
|
1383
|
+
name: string;
|
|
1384
|
+
mocker?: BrowserModuleMocker;
|
|
1385
|
+
readonly initScripts?: string[];
|
|
1694
1386
|
/**
|
|
1695
|
-
*
|
|
1387
|
+
* @experimental opt-in into file parallelisation
|
|
1696
1388
|
*/
|
|
1697
|
-
|
|
1389
|
+
supportsParallelism: boolean;
|
|
1390
|
+
getCommandsContext: (sessionId: string) => Record<string, unknown>;
|
|
1391
|
+
openPage: (sessionId: string, url: string) => Promise<void>;
|
|
1392
|
+
getCDPSession?: (sessionId: string) => Promise<CDPSession>;
|
|
1393
|
+
close: () => Awaitable<void>;
|
|
1394
|
+
}
|
|
1395
|
+
type BrowserBuiltinProvider = "webdriverio" | "playwright" | "preview";
|
|
1396
|
+
interface _BrowserNames {}
|
|
1397
|
+
type UnsupportedProperties = "browser" | "typecheck" | "alias" | "sequence" | "root" | "pool" | "runner" | "api" | "deps" | "environment" | "environmentOptions" | "server" | "benchmark" | "name";
|
|
1398
|
+
interface BrowserInstanceOption extends Omit<ProjectConfig, UnsupportedProperties>, Pick<BrowserConfigOptions, "headless" | "locators" | "viewport" | "testerHtmlPath" | "screenshotDirectory" | "screenshotFailures"> {
|
|
1698
1399
|
/**
|
|
1699
|
-
*
|
|
1400
|
+
* Name of the browser
|
|
1700
1401
|
*/
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1402
|
+
browser: keyof _BrowserNames extends never ? string : _BrowserNames[keyof _BrowserNames];
|
|
1403
|
+
name?: string;
|
|
1404
|
+
provider?: BrowserProviderOption;
|
|
1405
|
+
}
|
|
1406
|
+
interface BrowserConfigOptions {
|
|
1705
1407
|
/**
|
|
1706
|
-
*
|
|
1707
|
-
*
|
|
1708
|
-
* @
|
|
1408
|
+
* if running tests in the browser should be the default
|
|
1409
|
+
*
|
|
1410
|
+
* @default false
|
|
1709
1411
|
*/
|
|
1710
|
-
|
|
1412
|
+
enabled?: boolean;
|
|
1711
1413
|
/**
|
|
1712
|
-
*
|
|
1414
|
+
* Configurations for different browser setups
|
|
1713
1415
|
*/
|
|
1714
|
-
|
|
1416
|
+
instances?: BrowserInstanceOption[];
|
|
1715
1417
|
/**
|
|
1716
|
-
*
|
|
1418
|
+
* Browser provider
|
|
1419
|
+
* @example
|
|
1420
|
+
* ```ts
|
|
1421
|
+
* import { playwright } from '@vitest/browser-playwright'
|
|
1422
|
+
* export default defineConfig({
|
|
1423
|
+
* test: {
|
|
1424
|
+
* browser: {
|
|
1425
|
+
* provider: playwright(),
|
|
1426
|
+
* },
|
|
1427
|
+
* },
|
|
1428
|
+
* })
|
|
1429
|
+
* ```
|
|
1717
1430
|
*/
|
|
1718
|
-
|
|
1431
|
+
provider?: BrowserProviderOption;
|
|
1719
1432
|
/**
|
|
1720
|
-
*
|
|
1433
|
+
* enable headless mode
|
|
1434
|
+
*
|
|
1435
|
+
* @default process.env.CI
|
|
1721
1436
|
*/
|
|
1722
|
-
|
|
1723
|
-
getProjectByName(name: string): TestProject;
|
|
1437
|
+
headless?: boolean;
|
|
1724
1438
|
/**
|
|
1725
|
-
*
|
|
1726
|
-
*
|
|
1439
|
+
* Serve API options.
|
|
1440
|
+
*
|
|
1441
|
+
* The default port is 63315.
|
|
1727
1442
|
*/
|
|
1728
|
-
|
|
1443
|
+
api?: ApiConfig | number;
|
|
1729
1444
|
/**
|
|
1730
|
-
*
|
|
1445
|
+
* Isolate test environment after each test
|
|
1446
|
+
*
|
|
1447
|
+
* @default true
|
|
1731
1448
|
*/
|
|
1732
|
-
|
|
1733
|
-
|
|
1449
|
+
isolate?: boolean;
|
|
1450
|
+
/**
|
|
1451
|
+
* Run test files in parallel if provider supports this option
|
|
1452
|
+
* This option only has effect in headless mode (enabled in CI by default)
|
|
1453
|
+
*
|
|
1454
|
+
* @default // Same as "test.fileParallelism"
|
|
1455
|
+
*/
|
|
1456
|
+
fileParallelism?: boolean;
|
|
1457
|
+
/**
|
|
1458
|
+
* Show Vitest UI
|
|
1459
|
+
*
|
|
1460
|
+
* @default !process.env.CI
|
|
1461
|
+
*/
|
|
1462
|
+
ui?: boolean;
|
|
1463
|
+
/**
|
|
1464
|
+
* Default viewport size
|
|
1465
|
+
*/
|
|
1466
|
+
viewport?: {
|
|
1467
|
+
/**
|
|
1468
|
+
* Width of the viewport
|
|
1469
|
+
* @default 414
|
|
1470
|
+
*/
|
|
1471
|
+
width: number;
|
|
1472
|
+
/**
|
|
1473
|
+
* Height of the viewport
|
|
1474
|
+
* @default 896
|
|
1475
|
+
*/
|
|
1476
|
+
height: number;
|
|
1477
|
+
};
|
|
1478
|
+
/**
|
|
1479
|
+
* Locator options
|
|
1480
|
+
*/
|
|
1481
|
+
locators?: {
|
|
1482
|
+
/**
|
|
1483
|
+
* Attribute used to locate elements by test id
|
|
1484
|
+
* @default 'data-testid'
|
|
1485
|
+
*/
|
|
1486
|
+
testIdAttribute?: string;
|
|
1487
|
+
};
|
|
1734
1488
|
/**
|
|
1735
|
-
*
|
|
1736
|
-
*
|
|
1489
|
+
* Generate traces that can be viewed on https://trace.playwright.dev/
|
|
1490
|
+
*
|
|
1491
|
+
* This option is supported only by **playwright** provider.
|
|
1737
1492
|
*/
|
|
1738
|
-
|
|
1739
|
-
|
|
1493
|
+
trace?: BrowserTraceViewMode | {
|
|
1494
|
+
mode: BrowserTraceViewMode;
|
|
1495
|
+
/**
|
|
1496
|
+
* The directory where all traces will be stored. By default, Vitest
|
|
1497
|
+
* stores all traces in `__traces__` folder close to the test file.
|
|
1498
|
+
*/
|
|
1499
|
+
tracesDir?: string;
|
|
1500
|
+
/**
|
|
1501
|
+
* Whether to capture screenshots during tracing. Screenshots are used to build a timeline preview.
|
|
1502
|
+
* @default true
|
|
1503
|
+
*/
|
|
1504
|
+
screenshots?: boolean;
|
|
1505
|
+
/**
|
|
1506
|
+
* If this option is true tracing will
|
|
1507
|
+
* - capture DOM snapshot on every action
|
|
1508
|
+
* - record network activity
|
|
1509
|
+
* @default true
|
|
1510
|
+
*/
|
|
1511
|
+
snapshots?: boolean;
|
|
1512
|
+
};
|
|
1740
1513
|
/**
|
|
1741
|
-
*
|
|
1514
|
+
* Directory where screenshots will be saved when page.screenshot() is called
|
|
1515
|
+
* If not set, all screenshots are saved to __screenshots__ directory in the same folder as the test file.
|
|
1516
|
+
* If this is set, it will be resolved relative to the project root.
|
|
1517
|
+
* @default __screenshots__
|
|
1742
1518
|
*/
|
|
1743
|
-
|
|
1519
|
+
screenshotDirectory?: string;
|
|
1744
1520
|
/**
|
|
1745
|
-
*
|
|
1521
|
+
* Should Vitest take screenshots if the test fails
|
|
1522
|
+
* @default !browser.ui
|
|
1746
1523
|
*/
|
|
1747
|
-
|
|
1748
|
-
collect(filters?: string[]): Promise<TestRunResult>;
|
|
1524
|
+
screenshotFailures?: boolean;
|
|
1749
1525
|
/**
|
|
1750
|
-
*
|
|
1751
|
-
* @param filters String filters to match the test files
|
|
1526
|
+
* Path to the index.html file that will be used to run tests.
|
|
1752
1527
|
*/
|
|
1753
|
-
|
|
1528
|
+
testerHtmlPath?: string;
|
|
1754
1529
|
/**
|
|
1755
|
-
*
|
|
1756
|
-
* This method can throw an error:
|
|
1757
|
-
* - `FilesNotFoundError` if no tests are found
|
|
1758
|
-
* - `GitNotFoundError` if `--related` flag is used, but git repository is not initialized
|
|
1759
|
-
* - `Error` from the user reporters
|
|
1760
|
-
* @param filters String filters to match the test files
|
|
1530
|
+
* Scripts injected into the main window.
|
|
1761
1531
|
*/
|
|
1762
|
-
|
|
1532
|
+
orchestratorScripts?: BrowserScript[];
|
|
1763
1533
|
/**
|
|
1764
|
-
*
|
|
1765
|
-
*
|
|
1534
|
+
* Commands that will be executed on the server
|
|
1535
|
+
* via the browser `import("vitest/browser").commands` API.
|
|
1536
|
+
* @see {@link https://vitest.dev/guide/browser/commands}
|
|
1766
1537
|
*/
|
|
1767
|
-
|
|
1538
|
+
commands?: Record<string, BrowserCommand<any>>;
|
|
1768
1539
|
/**
|
|
1769
|
-
*
|
|
1770
|
-
*
|
|
1540
|
+
* Timeout for connecting to the browser
|
|
1541
|
+
* @default 30000
|
|
1771
1542
|
*/
|
|
1772
|
-
|
|
1543
|
+
connectTimeout?: number;
|
|
1544
|
+
expect?: {
|
|
1545
|
+
toMatchScreenshot?: { [ComparatorName in keyof ToMatchScreenshotComparators] : {
|
|
1546
|
+
/**
|
|
1547
|
+
* The name of the comparator to use for visual diffing.
|
|
1548
|
+
*
|
|
1549
|
+
* @defaultValue `'pixelmatch'`
|
|
1550
|
+
*/
|
|
1551
|
+
comparatorName?: ComparatorName;
|
|
1552
|
+
comparatorOptions?: ToMatchScreenshotComparators[ComparatorName];
|
|
1553
|
+
} }[keyof ToMatchScreenshotComparators] & ToMatchScreenshotOptions;
|
|
1554
|
+
};
|
|
1773
1555
|
/**
|
|
1774
|
-
*
|
|
1556
|
+
* Enables tracking uncaught errors and exceptions so they can be reported by Vitest.
|
|
1775
1557
|
*
|
|
1776
|
-
*
|
|
1777
|
-
*
|
|
1558
|
+
* If you need to hide certain errors, it is recommended to use [`onUnhandledError`](https://vitest.dev/config/#onunhandlederror) option instead.
|
|
1559
|
+
*
|
|
1560
|
+
* Disabling this will completely remove all Vitest error handlers, which can help debugging with the "Pause on exceptions" checkbox turned on.
|
|
1561
|
+
* @default true
|
|
1778
1562
|
*/
|
|
1779
|
-
|
|
1563
|
+
trackUnhandledErrors?: boolean;
|
|
1564
|
+
}
|
|
1565
|
+
interface BrowserCommandContext {
|
|
1566
|
+
testPath: string | undefined;
|
|
1567
|
+
provider: BrowserProvider;
|
|
1568
|
+
project: TestProject;
|
|
1569
|
+
sessionId: string;
|
|
1570
|
+
triggerCommand: <K extends keyof BrowserCommands>(name: K, ...args: Parameters<BrowserCommands[K]>) => ReturnType<BrowserCommands[K]>;
|
|
1571
|
+
}
|
|
1572
|
+
interface BrowserServerStateSession {
|
|
1573
|
+
project: TestProject;
|
|
1574
|
+
connected: () => void;
|
|
1575
|
+
fail: (v: Error) => void;
|
|
1576
|
+
}
|
|
1577
|
+
interface BrowserOrchestrator {
|
|
1578
|
+
cleanupTesters: () => Promise<void>;
|
|
1579
|
+
createTesters: (options: BrowserTesterOptions) => Promise<void>;
|
|
1580
|
+
onCancel: (reason: CancelReason) => Promise<void>;
|
|
1581
|
+
$close: () => void;
|
|
1582
|
+
}
|
|
1583
|
+
interface BrowserServerState {
|
|
1584
|
+
orchestrators: Map<string, BrowserOrchestrator>;
|
|
1585
|
+
}
|
|
1586
|
+
interface ParentProjectBrowser {
|
|
1587
|
+
spawn: (project: TestProject) => ProjectBrowser;
|
|
1588
|
+
vite: ViteDevServer;
|
|
1589
|
+
}
|
|
1590
|
+
interface ProjectBrowser {
|
|
1591
|
+
vite: ViteDevServer;
|
|
1592
|
+
state: BrowserServerState;
|
|
1593
|
+
provider: BrowserProvider;
|
|
1594
|
+
close: () => Promise<void>;
|
|
1595
|
+
initBrowserProvider: (project: TestProject) => Promise<void>;
|
|
1596
|
+
parseStacktrace: (stack: string) => ParsedStack[];
|
|
1597
|
+
parseErrorStacktrace: (error: TestError, options?: StackTraceParserOptions) => ParsedStack[];
|
|
1598
|
+
registerCommand: <K extends keyof BrowserCommands>(name: K, cb: BrowserCommand<Parameters<BrowserCommands[K]>, ReturnType<BrowserCommands[K]>>) => void;
|
|
1599
|
+
triggerCommand: <K extends keyof BrowserCommands>(name: K, context: BrowserCommandContext, ...args: Parameters<BrowserCommands[K]>) => ReturnType<BrowserCommands[K]>;
|
|
1600
|
+
}
|
|
1601
|
+
interface BrowserCommand<
|
|
1602
|
+
Payload extends unknown[] = [],
|
|
1603
|
+
ReturnValue = any
|
|
1604
|
+
> {
|
|
1605
|
+
(context: BrowserCommandContext, ...payload: Payload): Awaitable<ReturnValue>;
|
|
1606
|
+
}
|
|
1607
|
+
interface BrowserScript {
|
|
1780
1608
|
/**
|
|
1781
|
-
*
|
|
1609
|
+
* If "content" is provided and type is "module", this will be its identifier.
|
|
1610
|
+
*
|
|
1611
|
+
* If you are using TypeScript, you can add `.ts` extension here for example.
|
|
1612
|
+
* @default `injected-${index}.js`
|
|
1782
1613
|
*/
|
|
1783
|
-
|
|
1614
|
+
id?: string;
|
|
1784
1615
|
/**
|
|
1785
|
-
*
|
|
1786
|
-
*
|
|
1787
|
-
*
|
|
1616
|
+
* JavaScript content to be injected. This string is processed by Vite plugins if type is "module".
|
|
1617
|
+
*
|
|
1618
|
+
* You can use `id` to give Vite a hint about the file extension.
|
|
1788
1619
|
*/
|
|
1789
|
-
|
|
1620
|
+
content?: string;
|
|
1790
1621
|
/**
|
|
1791
|
-
*
|
|
1792
|
-
* @param specifications A list of specifications to run.
|
|
1793
|
-
* @param allTestsRun Indicates whether all tests were run. This only matters for coverage.
|
|
1622
|
+
* Path to the script. This value is resolved by Vite so it can be a node module or a file path.
|
|
1794
1623
|
*/
|
|
1795
|
-
|
|
1796
|
-
private runFiles;
|
|
1797
|
-
experimental_parseSpecifications(specifications: TestSpecification[], options?: {
|
|
1798
|
-
/** @default os.availableParallelism() */
|
|
1799
|
-
concurrency?: number;
|
|
1800
|
-
}): Promise<TestModule[]>;
|
|
1801
|
-
experimental_parseSpecification(specification: TestSpecification): Promise<TestModule>;
|
|
1624
|
+
src?: string;
|
|
1802
1625
|
/**
|
|
1803
|
-
*
|
|
1804
|
-
* @param specifications A list of specifications to run.
|
|
1626
|
+
* If the script should be loaded asynchronously.
|
|
1805
1627
|
*/
|
|
1806
|
-
|
|
1628
|
+
async?: boolean;
|
|
1807
1629
|
/**
|
|
1808
|
-
*
|
|
1630
|
+
* Script type.
|
|
1631
|
+
* @default 'module'
|
|
1809
1632
|
*/
|
|
1810
|
-
|
|
1811
|
-
|
|
1633
|
+
type?: string;
|
|
1634
|
+
}
|
|
1635
|
+
interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
1636
|
+
name: string;
|
|
1637
|
+
enabled: boolean;
|
|
1638
|
+
headless: boolean;
|
|
1639
|
+
isolate: boolean;
|
|
1640
|
+
fileParallelism: boolean;
|
|
1641
|
+
api: ApiConfig;
|
|
1642
|
+
ui: boolean;
|
|
1643
|
+
viewport: {
|
|
1644
|
+
width: number;
|
|
1645
|
+
height: number;
|
|
1646
|
+
};
|
|
1647
|
+
screenshotFailures: boolean;
|
|
1648
|
+
locators: {
|
|
1649
|
+
testIdAttribute: string;
|
|
1650
|
+
};
|
|
1651
|
+
trace: {
|
|
1652
|
+
mode: BrowserTraceViewMode;
|
|
1653
|
+
tracesDir?: string;
|
|
1654
|
+
screenshots?: boolean;
|
|
1655
|
+
snapshots?: boolean;
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
type ToMatchScreenshotResolvePath = (data: {
|
|
1812
1659
|
/**
|
|
1813
|
-
*
|
|
1814
|
-
*
|
|
1660
|
+
* Path **without** extension, sanitized and relative to the test file.
|
|
1661
|
+
*
|
|
1662
|
+
* This comes from the arguments passed to `toMatchScreenshot`; if called
|
|
1663
|
+
* without arguments this will be the auto-generated name.
|
|
1664
|
+
*
|
|
1665
|
+
* @example
|
|
1666
|
+
* test('calls `onClick`', () => {
|
|
1667
|
+
* expect(locator).toMatchScreenshot()
|
|
1668
|
+
* // arg = "calls-onclick-1"
|
|
1669
|
+
* })
|
|
1670
|
+
*
|
|
1671
|
+
* @example
|
|
1672
|
+
* expect(locator).toMatchScreenshot('foo/bar/baz.png')
|
|
1673
|
+
* // arg = "foo/bar/baz"
|
|
1674
|
+
*
|
|
1675
|
+
* @example
|
|
1676
|
+
* expect(locator).toMatchScreenshot('../foo/bar/baz.png')
|
|
1677
|
+
* // arg = "foo/bar/baz"
|
|
1815
1678
|
*/
|
|
1816
|
-
|
|
1679
|
+
arg: string;
|
|
1817
1680
|
/**
|
|
1818
|
-
*
|
|
1819
|
-
* This method doesn't run any tests.
|
|
1681
|
+
* Screenshot extension, with leading dot.
|
|
1820
1682
|
*
|
|
1821
|
-
*
|
|
1822
|
-
*
|
|
1683
|
+
* This can be set through the arguments passed to `toMatchScreenshot`, but
|
|
1684
|
+
* the value will fall back to `'.png'` if an unsupported extension is used.
|
|
1823
1685
|
*/
|
|
1824
|
-
|
|
1686
|
+
ext: string;
|
|
1825
1687
|
/**
|
|
1826
|
-
*
|
|
1688
|
+
* The instance's browser name.
|
|
1827
1689
|
*/
|
|
1828
|
-
|
|
1690
|
+
browserName: string;
|
|
1829
1691
|
/**
|
|
1830
|
-
*
|
|
1831
|
-
* This method doesn't run any tests.
|
|
1692
|
+
* The value of {@linkcode process.platform}.
|
|
1832
1693
|
*/
|
|
1833
|
-
|
|
1694
|
+
platform: NodeJS.Platform;
|
|
1834
1695
|
/**
|
|
1835
|
-
*
|
|
1696
|
+
* The value provided to
|
|
1697
|
+
* {@linkcode https://vitest.dev/guide/browser/config#browser-screenshotdirectory|browser.screenshotDirectory},
|
|
1698
|
+
* if none is provided, its default value.
|
|
1836
1699
|
*/
|
|
1837
|
-
|
|
1700
|
+
screenshotDirectory: string;
|
|
1838
1701
|
/**
|
|
1839
|
-
*
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
private scheduleRerun;
|
|
1702
|
+
* Absolute path to the project's
|
|
1703
|
+
* {@linkcode https://vitest.dev/config/#root|root}.
|
|
1704
|
+
*/
|
|
1705
|
+
root: string;
|
|
1844
1706
|
/**
|
|
1845
|
-
*
|
|
1707
|
+
* Path to the test file, relative to the project's
|
|
1708
|
+
* {@linkcode https://vitest.dev/config/#root|root}.
|
|
1846
1709
|
*/
|
|
1847
|
-
|
|
1848
|
-
private reportCoverage;
|
|
1710
|
+
testFileDirectory: string;
|
|
1849
1711
|
/**
|
|
1850
|
-
*
|
|
1851
|
-
* This can only be called once; the closing promise is cached until the server restarts.
|
|
1712
|
+
* The test's filename.
|
|
1852
1713
|
*/
|
|
1853
|
-
|
|
1714
|
+
testFileName: string;
|
|
1854
1715
|
/**
|
|
1855
|
-
*
|
|
1856
|
-
* @
|
|
1716
|
+
* The {@linkcode https://vitest.dev/api/#test|test}'s name, including
|
|
1717
|
+
* parent {@linkcode https://vitest.dev/api/#describe|describe}, sanitized.
|
|
1857
1718
|
*/
|
|
1858
|
-
|
|
1719
|
+
testName: string;
|
|
1859
1720
|
/**
|
|
1860
|
-
*
|
|
1721
|
+
* The value provided to
|
|
1722
|
+
* {@linkcode https://vitest.dev/config/#attachmentsdir|attachmentsDir},
|
|
1723
|
+
* if none is provided, its default value.
|
|
1861
1724
|
*/
|
|
1862
|
-
|
|
1725
|
+
attachmentsDir: string;
|
|
1726
|
+
}) => string;
|
|
1727
|
+
interface ToMatchScreenshotOptions {
|
|
1863
1728
|
/**
|
|
1864
|
-
*
|
|
1729
|
+
* Overrides default reference screenshot path.
|
|
1730
|
+
*
|
|
1731
|
+
* @default `${root}/${testFileDirectory}/${screenshotDirectory}/${testFileName}/${arg}-${browserName}-${platform}${ext}`
|
|
1865
1732
|
*/
|
|
1866
|
-
|
|
1733
|
+
resolveScreenshotPath?: ToMatchScreenshotResolvePath;
|
|
1867
1734
|
/**
|
|
1868
|
-
*
|
|
1735
|
+
* Overrides default screenshot path used for diffs.
|
|
1736
|
+
*
|
|
1737
|
+
* @default `${root}/${attachmentsDir}/${testFileDirectory}/${testFileName}/${arg}-${browserName}-${platform}${ext}`
|
|
1869
1738
|
*/
|
|
1870
|
-
|
|
1739
|
+
resolveDiffPath?: ToMatchScreenshotResolvePath;
|
|
1740
|
+
}
|
|
1741
|
+
interface ToMatchScreenshotComparators {}
|
|
1742
|
+
|
|
1743
|
+
declare class TestProject {
|
|
1744
|
+
options?: InitializeProjectOptions | undefined;
|
|
1871
1745
|
/**
|
|
1872
|
-
*
|
|
1746
|
+
* The global Vitest instance.
|
|
1873
1747
|
*/
|
|
1874
|
-
|
|
1748
|
+
readonly vitest: Vitest;
|
|
1875
1749
|
/**
|
|
1876
|
-
*
|
|
1750
|
+
* Resolved global configuration. If there are no workspace projects, this will be the same as `config`.
|
|
1877
1751
|
*/
|
|
1878
|
-
|
|
1752
|
+
readonly globalConfig: ResolvedConfig;
|
|
1879
1753
|
/**
|
|
1880
|
-
*
|
|
1881
|
-
* This callback should return `true` of `false` indicating whether the test file needs to be rerun.
|
|
1882
|
-
* @example
|
|
1883
|
-
* const testsToRun = [resolve('./test.spec.ts')]
|
|
1884
|
-
* vitest.onFilterWatchedSpecification(specification => testsToRun.includes(specification.moduleId))
|
|
1754
|
+
* Browser instance if the browser is enabled. This is initialized when the tests run for the first time.
|
|
1885
1755
|
*/
|
|
1886
|
-
|
|
1756
|
+
browser?: ProjectBrowser;
|
|
1887
1757
|
/**
|
|
1888
|
-
*
|
|
1758
|
+
* Temporary directory for the project. This is unique for each project. Vitest stores transformed content here.
|
|
1889
1759
|
*/
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1760
|
+
readonly tmpDir: string;
|
|
1761
|
+
/** @inetrnal */ testFilesList: string[] | null;
|
|
1762
|
+
private runner;
|
|
1763
|
+
private closingPromise;
|
|
1764
|
+
private typecheckFilesList;
|
|
1765
|
+
private _globalSetups?;
|
|
1766
|
+
private _provided;
|
|
1767
|
+
constructor(vitest: Vitest, options?: InitializeProjectOptions | undefined);
|
|
1898
1768
|
/**
|
|
1899
|
-
*
|
|
1900
|
-
*
|
|
1901
|
-
*
|
|
1769
|
+
* The unique hash of this project. This value is consistent between the reruns.
|
|
1770
|
+
*
|
|
1771
|
+
* It is based on the root of the project (not consistent between OS) and its name.
|
|
1902
1772
|
*/
|
|
1903
|
-
|
|
1904
|
-
onTestRemoved?: (trigger?: string) => Awaitable<void>;
|
|
1905
|
-
onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
1906
|
-
onWatcherRerun?: (files: string[], trigger?: string) => Awaitable<void>;
|
|
1907
|
-
onServerRestart?: (reason?: string) => Awaitable<void>;
|
|
1908
|
-
onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
|
|
1909
|
-
onProcessTimeout?: () => Awaitable<void>;
|
|
1773
|
+
get hash(): string;
|
|
1910
1774
|
/**
|
|
1911
|
-
*
|
|
1775
|
+
* Provide a value to the test context. This value will be available to all tests with `inject`.
|
|
1912
1776
|
*/
|
|
1913
|
-
|
|
1777
|
+
provide: <T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]) => void;
|
|
1914
1778
|
/**
|
|
1915
|
-
*
|
|
1779
|
+
* Get the provided context. The project context is merged with the global context.
|
|
1916
1780
|
*/
|
|
1917
|
-
|
|
1781
|
+
getProvidedContext(): ProvidedContext;
|
|
1918
1782
|
/**
|
|
1919
|
-
*
|
|
1783
|
+
* Creates a new test specification. Specifications describe how to run tests.
|
|
1784
|
+
* @param moduleId The file path
|
|
1920
1785
|
*/
|
|
1921
|
-
|
|
1786
|
+
createSpecification(moduleId: string, locations?: number[] | undefined, pool?: string): TestSpecification;
|
|
1787
|
+
toJSON(): SerializedTestProject;
|
|
1922
1788
|
/**
|
|
1923
|
-
*
|
|
1789
|
+
* Vite's dev server instance. Every workspace project has its own server.
|
|
1924
1790
|
*/
|
|
1925
|
-
|
|
1791
|
+
get vite(): ViteDevServer;
|
|
1926
1792
|
/**
|
|
1927
|
-
*
|
|
1793
|
+
* Resolved project configuration.
|
|
1928
1794
|
*/
|
|
1929
|
-
|
|
1795
|
+
get config(): ResolvedConfig;
|
|
1930
1796
|
/**
|
|
1931
|
-
*
|
|
1797
|
+
* The name of the project or an empty string if not set.
|
|
1932
1798
|
*/
|
|
1933
|
-
|
|
1799
|
+
get name(): string;
|
|
1934
1800
|
/**
|
|
1935
|
-
*
|
|
1936
|
-
* Called before the `beforeEach` hooks for the test are run.
|
|
1801
|
+
* The color used when reporting tasks of this project.
|
|
1937
1802
|
*/
|
|
1938
|
-
|
|
1803
|
+
get color(): ProjectName["color"];
|
|
1939
1804
|
/**
|
|
1940
|
-
*
|
|
1941
|
-
* The `result()` cannot be `pending`.
|
|
1805
|
+
* Serialized project configuration. This is the config that tests receive.
|
|
1942
1806
|
*/
|
|
1943
|
-
|
|
1807
|
+
get serializedConfig(): SerializedConfig;
|
|
1944
1808
|
/**
|
|
1945
|
-
*
|
|
1809
|
+
* Check if this is the root project. The root project is the one that has the root config.
|
|
1946
1810
|
*/
|
|
1947
|
-
|
|
1811
|
+
isRootProject(): boolean;
|
|
1812
|
+
onTestsRerun(cb: OnTestsRerunHandler): void;
|
|
1948
1813
|
/**
|
|
1949
|
-
*
|
|
1950
|
-
*
|
|
1814
|
+
* Get all files in the project that match the globs in the config and the filters.
|
|
1815
|
+
* @param filters String filters to match the test files.
|
|
1951
1816
|
*/
|
|
1952
|
-
|
|
1817
|
+
globTestFiles(filters?: string[]): Promise<{
|
|
1818
|
+
/**
|
|
1819
|
+
* Test files that match the filters.
|
|
1820
|
+
*/
|
|
1821
|
+
testFiles: string[];
|
|
1822
|
+
/**
|
|
1823
|
+
* Typecheck test files that match the filters. This will be empty unless `typecheck.enabled` is `true`.
|
|
1824
|
+
*/
|
|
1825
|
+
typecheckTestFiles: string[];
|
|
1826
|
+
}>;
|
|
1827
|
+
private globAllTestFiles;
|
|
1828
|
+
isBrowserEnabled(): boolean;
|
|
1829
|
+
private markTestFile;
|
|
1953
1830
|
/**
|
|
1954
|
-
*
|
|
1955
|
-
* The `state` cannot be `pending`.
|
|
1831
|
+
* Test if a file matches the test globs. This does the actual glob matching if the test is not cached, unlike `isCachedTestFile`.
|
|
1956
1832
|
*/
|
|
1957
|
-
|
|
1833
|
+
matchesTestGlob(moduleId: string, source?: () => string): boolean;
|
|
1834
|
+
private isInSourceTestCode;
|
|
1835
|
+
private filterFiles;
|
|
1836
|
+
private _parentBrowser?;
|
|
1958
1837
|
/**
|
|
1959
|
-
*
|
|
1838
|
+
* Closes the project and all associated resources. This can only be called once; the closing promise is cached until the server restarts.
|
|
1839
|
+
* If the resources are needed again, create a new project.
|
|
1960
1840
|
*/
|
|
1961
|
-
|
|
1841
|
+
close(): Promise<void>;
|
|
1962
1842
|
/**
|
|
1963
|
-
*
|
|
1843
|
+
* Import a file using Vite module runner.
|
|
1844
|
+
* @param moduleId The ID of the module in Vite module graph
|
|
1964
1845
|
*/
|
|
1965
|
-
|
|
1966
|
-
|
|
1846
|
+
import<T>(moduleId: string): Promise<T>;
|
|
1847
|
+
private _setHash;
|
|
1848
|
+
private _serializeOverriddenConfig;
|
|
1849
|
+
private clearTmpDir;
|
|
1850
|
+
}
|
|
1851
|
+
interface SerializedTestProject {
|
|
1852
|
+
name: string;
|
|
1853
|
+
serializedConfig: SerializedConfig;
|
|
1854
|
+
context: ProvidedContext;
|
|
1855
|
+
}
|
|
1856
|
+
interface InitializeProjectOptions extends TestProjectInlineConfiguration {
|
|
1857
|
+
configFile: string | false;
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
interface PoolRunnerInitializer {
|
|
1861
|
+
readonly name: string;
|
|
1862
|
+
createPoolWorker: (options: PoolOptions) => PoolWorker;
|
|
1967
1863
|
}
|
|
1864
|
+
interface PoolOptions {
|
|
1865
|
+
distPath: string;
|
|
1866
|
+
project: TestProject;
|
|
1867
|
+
method: "run" | "collect";
|
|
1868
|
+
cacheFs?: boolean;
|
|
1869
|
+
environment: string;
|
|
1870
|
+
execArgv: string[];
|
|
1871
|
+
env: Record<string, string>;
|
|
1872
|
+
}
|
|
1873
|
+
interface PoolWorker {
|
|
1874
|
+
readonly name: string;
|
|
1875
|
+
readonly execArgv: string[];
|
|
1876
|
+
readonly env: Record<string, string>;
|
|
1877
|
+
readonly reportMemory?: boolean;
|
|
1878
|
+
readonly cacheFs?: boolean;
|
|
1879
|
+
on: (event: string, callback: (arg: any) => void) => void;
|
|
1880
|
+
off: (event: string, callback: (arg: any) => void) => void;
|
|
1881
|
+
send: (message: WorkerRequest) => void;
|
|
1882
|
+
deserialize: (data: unknown) => unknown;
|
|
1883
|
+
start: () => Promise<void>;
|
|
1884
|
+
stop: () => Promise<void>;
|
|
1885
|
+
}
|
|
1886
|
+
interface PoolTask {
|
|
1887
|
+
worker: "forks" | "threads" | "vmForks" | "vmThreads" | (string & {});
|
|
1888
|
+
project: TestProject;
|
|
1889
|
+
isolate: boolean;
|
|
1890
|
+
env: Record<string, string>;
|
|
1891
|
+
execArgv: string[];
|
|
1892
|
+
context: ContextRPC;
|
|
1893
|
+
memoryLimit: number | null;
|
|
1894
|
+
}
|
|
1895
|
+
type WorkerRequest = {
|
|
1896
|
+
__vitest_worker_request__: true;
|
|
1897
|
+
} & ({
|
|
1898
|
+
type: "start";
|
|
1899
|
+
options: {
|
|
1900
|
+
reportMemory: boolean;
|
|
1901
|
+
};
|
|
1902
|
+
} | {
|
|
1903
|
+
type: "stop";
|
|
1904
|
+
} | {
|
|
1905
|
+
type: "run";
|
|
1906
|
+
context: ContextRPC;
|
|
1907
|
+
poolId: number;
|
|
1908
|
+
} | {
|
|
1909
|
+
type: "collect";
|
|
1910
|
+
context: ContextRPC;
|
|
1911
|
+
poolId: number;
|
|
1912
|
+
} | {
|
|
1913
|
+
type: "cancel";
|
|
1914
|
+
});
|
|
1915
|
+
type WorkerResponse = {
|
|
1916
|
+
__vitest_worker_response__: true;
|
|
1917
|
+
} & ({
|
|
1918
|
+
type: "started";
|
|
1919
|
+
} | {
|
|
1920
|
+
type: "stopped";
|
|
1921
|
+
error?: unknown;
|
|
1922
|
+
} | {
|
|
1923
|
+
type: "testfileFinished";
|
|
1924
|
+
usedMemory?: number;
|
|
1925
|
+
error?: unknown;
|
|
1926
|
+
});
|
|
1968
1927
|
|
|
1969
1928
|
interface BaseOptions {
|
|
1970
1929
|
isTTY?: boolean;
|
|
@@ -2034,6 +1993,22 @@ declare class DefaultReporter extends BaseReporter {
|
|
|
2034
1993
|
onInit(ctx: Vitest): void;
|
|
2035
1994
|
}
|
|
2036
1995
|
|
|
1996
|
+
interface GithubActionsReporterOptions {
|
|
1997
|
+
onWritePath?: (path: string) => string;
|
|
1998
|
+
/**
|
|
1999
|
+
* @default true
|
|
2000
|
+
*/
|
|
2001
|
+
displayAnnotations?: boolean;
|
|
2002
|
+
}
|
|
2003
|
+
declare class GithubActionsReporter implements Reporter {
|
|
2004
|
+
ctx: Vitest;
|
|
2005
|
+
options: GithubActionsReporterOptions;
|
|
2006
|
+
constructor(options?: GithubActionsReporterOptions);
|
|
2007
|
+
onInit(ctx: Vitest): void;
|
|
2008
|
+
onTestCaseAnnotate(testCase: TestCase, annotation: TestAnnotation): void;
|
|
2009
|
+
onTestRunEnd(testModules: ReadonlyArray<TestModule>, unhandledErrors: ReadonlyArray<SerializedError>): void;
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2037
2012
|
interface HTMLOptions {
|
|
2038
2013
|
outputFile?: string;
|
|
2039
2014
|
}
|
|
@@ -2151,18 +2126,6 @@ declare class DotReporter extends BaseReporter {
|
|
|
2151
2126
|
private createSummary;
|
|
2152
2127
|
}
|
|
2153
2128
|
|
|
2154
|
-
interface GithubActionsReporterOptions {
|
|
2155
|
-
onWritePath?: (path: string) => string;
|
|
2156
|
-
}
|
|
2157
|
-
declare class GithubActionsReporter implements Reporter {
|
|
2158
|
-
ctx: Vitest;
|
|
2159
|
-
options: GithubActionsReporterOptions;
|
|
2160
|
-
constructor(options?: GithubActionsReporterOptions);
|
|
2161
|
-
onInit(ctx: Vitest): void;
|
|
2162
|
-
onTestCaseAnnotate(testCase: TestCase, annotation: TestAnnotation): void;
|
|
2163
|
-
onTestRunEnd(testModules: ReadonlyArray<TestModule>, unhandledErrors: ReadonlyArray<SerializedError>): void;
|
|
2164
|
-
}
|
|
2165
|
-
|
|
2166
2129
|
declare class HangingProcessReporter implements Reporter {
|
|
2167
2130
|
whyRunning: (() => void) | undefined;
|
|
2168
2131
|
onInit(): void;
|
|
@@ -2256,6 +2219,7 @@ interface BuiltinReporterOptions {
|
|
|
2256
2219
|
"junit": JUnitOptions;
|
|
2257
2220
|
"hanging-process": never;
|
|
2258
2221
|
"html": HTMLOptions;
|
|
2222
|
+
"github-actions": GithubActionsReporterOptions;
|
|
2259
2223
|
}
|
|
2260
2224
|
|
|
2261
2225
|
interface TestSequencer {
|
|
@@ -2317,7 +2281,6 @@ interface BenchmarkUserOptions {
|
|
|
2317
2281
|
|
|
2318
2282
|
type BuiltinEnvironment = "node" | "jsdom" | "happy-dom" | "edge-runtime";
|
|
2319
2283
|
type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
|
|
2320
|
-
|
|
2321
2284
|
type CSSModuleScopeStrategy = "stable" | "scoped" | "non-scoped";
|
|
2322
2285
|
type ApiConfig = Pick<ServerOptions, "port" | "strictPort" | "host" | "middlewareMode">;
|
|
2323
2286
|
interface EnvironmentOptions {
|
|
@@ -2454,6 +2417,8 @@ interface ResolveSnapshotPathHandlerContext {
|
|
|
2454
2417
|
config: SerializedConfig;
|
|
2455
2418
|
}
|
|
2456
2419
|
type ResolveSnapshotPathHandler = (testPath: string, snapExtension: string, context: ResolveSnapshotPathHandlerContext) => string;
|
|
2420
|
+
type BuiltinPool = "browser" | "threads" | "forks" | "vmThreads" | "vmForks" | "typescript";
|
|
2421
|
+
type Pool = BuiltinPool | (string & {});
|
|
2457
2422
|
interface InlineConfig {
|
|
2458
2423
|
/**
|
|
2459
2424
|
* Name of the project. Will be used to display in the reporter.
|
|
@@ -2489,6 +2454,23 @@ interface InlineConfig {
|
|
|
2489
2454
|
deps?: DepsOptions;
|
|
2490
2455
|
server?: {
|
|
2491
2456
|
deps?: ServerDepsOptions;
|
|
2457
|
+
debug?: {
|
|
2458
|
+
/**
|
|
2459
|
+
* The folder where Vitest stores the contents of transformed
|
|
2460
|
+
* test files that can be inspected manually.
|
|
2461
|
+
*
|
|
2462
|
+
* If `true`, Vitest dumps the files in `.vitest-dump` folder relative to the root of the project.
|
|
2463
|
+
*
|
|
2464
|
+
* You can also use `VITEST_DEBUG_DUMP` env variable to enable this.
|
|
2465
|
+
*/
|
|
2466
|
+
dump?: string | true;
|
|
2467
|
+
/**
|
|
2468
|
+
* If dump is enabled, should Vitest load the files from there instead of transforming them.
|
|
2469
|
+
*
|
|
2470
|
+
* You can also use `VITEST_DEBUG_LOAD_DUMP` env variable to enable this.
|
|
2471
|
+
*/
|
|
2472
|
+
load?: boolean;
|
|
2473
|
+
};
|
|
2492
2474
|
};
|
|
2493
2475
|
/**
|
|
2494
2476
|
* Base directory to scan for the test files
|
|
@@ -2519,25 +2501,38 @@ interface InlineConfig {
|
|
|
2519
2501
|
/**
|
|
2520
2502
|
* Run tests in an isolated environment. This option has no effect on vmThreads pool.
|
|
2521
2503
|
*
|
|
2522
|
-
* Disabling this option
|
|
2504
|
+
* Disabling this option improves performance if your code doesn't rely on side effects.
|
|
2523
2505
|
*
|
|
2524
2506
|
* @default true
|
|
2525
2507
|
*/
|
|
2526
2508
|
isolate?: boolean;
|
|
2527
2509
|
/**
|
|
2528
|
-
*
|
|
2510
|
+
* Pass additional arguments to `node` process when spawning the worker.
|
|
2529
2511
|
*
|
|
2530
|
-
*
|
|
2512
|
+
* See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
|
|
2531
2513
|
*
|
|
2532
|
-
*
|
|
2514
|
+
* Set to `process.execArgv` to pass all arguments of the current process.
|
|
2515
|
+
*
|
|
2516
|
+
* Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
|
|
2517
|
+
*
|
|
2518
|
+
* @default [] // no execution arguments are passed
|
|
2519
|
+
*/
|
|
2520
|
+
execArgv?: string[];
|
|
2521
|
+
/**
|
|
2522
|
+
* Specifies the memory limit for `worker_thread` or `child_process` before they are recycled.
|
|
2523
|
+
* If you see memory leaks, try to tinker this value.
|
|
2533
2524
|
*/
|
|
2534
|
-
|
|
2525
|
+
vmMemoryLimit?: string | number;
|
|
2535
2526
|
/**
|
|
2536
|
-
* Pool
|
|
2527
|
+
* Pool used to run tests in.
|
|
2528
|
+
*
|
|
2529
|
+
* Supports 'threads', 'forks', 'vmThreads', 'vmForks'
|
|
2530
|
+
*
|
|
2531
|
+
* @default 'forks'
|
|
2537
2532
|
*/
|
|
2538
|
-
|
|
2533
|
+
pool?: Exclude<Pool, "browser"> | PoolRunnerInitializer;
|
|
2539
2534
|
/**
|
|
2540
|
-
* Maximum number or percentage of workers to run tests in.
|
|
2535
|
+
* Maximum number or percentage of workers to run tests in.
|
|
2541
2536
|
*/
|
|
2542
2537
|
maxWorkers?: number | string;
|
|
2543
2538
|
/**
|
|
@@ -2683,7 +2678,6 @@ interface InlineConfig {
|
|
|
2683
2678
|
ui?: boolean;
|
|
2684
2679
|
/**
|
|
2685
2680
|
* options for test in a browser environment
|
|
2686
|
-
* @experimental
|
|
2687
2681
|
*
|
|
2688
2682
|
* @default false
|
|
2689
2683
|
*/
|
|
@@ -2824,14 +2818,14 @@ interface InlineConfig {
|
|
|
2824
2818
|
* Debug tests by opening `node:inspector` in worker / child process.
|
|
2825
2819
|
* Provides similar experience as `--inspect` Node CLI argument.
|
|
2826
2820
|
*
|
|
2827
|
-
* Requires `
|
|
2821
|
+
* Requires `fileParallelism: false`.
|
|
2828
2822
|
*/
|
|
2829
2823
|
inspect?: boolean | string;
|
|
2830
2824
|
/**
|
|
2831
2825
|
* Debug tests by opening `node:inspector` in worker / child process and wait for debugger to connect.
|
|
2832
2826
|
* Provides similar experience as `--inspect-brk` Node CLI argument.
|
|
2833
2827
|
*
|
|
2834
|
-
* Requires `
|
|
2828
|
+
* Requires `fileParallelism: false`.
|
|
2835
2829
|
*/
|
|
2836
2830
|
inspectBrk?: boolean | string;
|
|
2837
2831
|
/**
|
|
@@ -3065,7 +3059,7 @@ interface UserConfig extends InlineConfig {
|
|
|
3065
3059
|
type OnUnhandledErrorCallback = (error: (TestError | Error) & {
|
|
3066
3060
|
type: string;
|
|
3067
3061
|
}) => boolean | void;
|
|
3068
|
-
interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config" | "filters" | "browser" | "coverage" | "testNamePattern" | "related" | "api" | "reporters" | "resolveSnapshotPath" | "benchmark" | "shard" | "cache" | "sequence" | "typecheck" | "runner" | "
|
|
3062
|
+
interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config" | "filters" | "browser" | "coverage" | "testNamePattern" | "related" | "api" | "reporters" | "resolveSnapshotPath" | "benchmark" | "shard" | "cache" | "sequence" | "typecheck" | "runner" | "pool" | "cliExclude" | "diff" | "setupFiles" | "snapshotEnvironment" | "bail" | "name" | "vmMemoryLimit"> {
|
|
3069
3063
|
mode: VitestRunMode;
|
|
3070
3064
|
name: ProjectName["label"];
|
|
3071
3065
|
color?: ProjectName["color"];
|
|
@@ -3082,7 +3076,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config"
|
|
|
3082
3076
|
snapshotOptions: SnapshotStateOptions;
|
|
3083
3077
|
browser: ResolvedBrowserOptions;
|
|
3084
3078
|
pool: Pool;
|
|
3085
|
-
|
|
3079
|
+
poolRunner?: PoolRunnerInitializer;
|
|
3086
3080
|
reporters: (InlineReporter | ReporterWithOptions)[];
|
|
3087
3081
|
defines: Record<string, any>;
|
|
3088
3082
|
api: ApiConfig & {
|
|
@@ -3115,8 +3109,10 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config"
|
|
|
3115
3109
|
};
|
|
3116
3110
|
runner?: string;
|
|
3117
3111
|
maxWorkers: number;
|
|
3112
|
+
vmMemoryLimit?: UserConfig["vmMemoryLimit"];
|
|
3113
|
+
dumpDir?: string;
|
|
3118
3114
|
}
|
|
3119
|
-
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" | "
|
|
3115
|
+
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" | "watchTriggerPatterns";
|
|
3120
3116
|
interface ServerDepsOptions {
|
|
3121
3117
|
/**
|
|
3122
3118
|
* Externalize means that Vite will bpass the package to native Node.
|
|
@@ -3141,15 +3137,11 @@ interface ServerDepsOptions {
|
|
|
3141
3137
|
*/
|
|
3142
3138
|
fallbackCJS?: boolean;
|
|
3143
3139
|
}
|
|
3144
|
-
type ProjectConfig = Omit<InlineConfig, NonProjectOptions | "sequencer" | "deps"
|
|
3140
|
+
type ProjectConfig = Omit<InlineConfig, NonProjectOptions | "sequencer" | "deps"> & {
|
|
3145
3141
|
mode?: string;
|
|
3146
3142
|
sequencer?: Omit<SequenceOptions, "sequencer" | "seed">;
|
|
3147
3143
|
deps?: Omit<DepsOptions, "moduleDirectories">;
|
|
3148
|
-
|
|
3149
|
-
threads?: Pick<NonNullable<PoolOptions["threads"]>, "singleThread" | "isolate">;
|
|
3150
|
-
vmThreads?: Pick<NonNullable<PoolOptions["vmThreads"]>, "singleThread">;
|
|
3151
|
-
forks?: Pick<NonNullable<PoolOptions["forks"]>, "singleFork" | "isolate">;
|
|
3152
|
-
};
|
|
3144
|
+
fileParallelism?: boolean;
|
|
3153
3145
|
};
|
|
3154
3146
|
type ResolvedProjectConfig = Omit<ResolvedConfig, Exclude<NonProjectOptions, "coverage" | "watch">>;
|
|
3155
3147
|
interface UserWorkspaceConfig extends UserConfig$1 {
|
|
@@ -3167,5 +3159,5 @@ type TestProjectInlineConfiguration = (UserWorkspaceConfig & {
|
|
|
3167
3159
|
});
|
|
3168
3160
|
type TestProjectConfiguration = string | TestProjectInlineConfiguration | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
|
|
3169
3161
|
|
|
3170
|
-
export {
|
|
3171
|
-
export type {
|
|
3162
|
+
export { CoverageMap as C, TestSuite as K, Logger as L, experimental_getRunnerTask as Q, TestProject as T, Vitest as V, BenchmarkReporter as aE, BenchmarkReportsMap as aF, DefaultReporter as aG, DotReporter as aH, GithubActionsReporter as aI, HangingProcessReporter as aJ, JsonReporter as aK, JUnitReporter as aL, ReportersMap as aM, TapFlatReporter as aN, TapReporter as aO, VerboseBenchmarkReporter as aP, VerboseReporter as aQ, BaseReporter as aR, TestSpecification as k, VitestPackageInstaller as p, TestCase as v, TestCollection as w, TestModule as y };
|
|
3163
|
+
export type { BrowserCommand as $, ApiConfig as A, TestResult as B, TestResultFailed as D, TestResultPassed as E, TestResultSkipped as F, TestState as G, HTMLOptions as H, InlineConfig as I, JsonOptions as J, ModuleDiagnostic as M, TestSuiteState as N, OnServerRestartHandler as O, PoolWorker as P, ResolvedCoverageOptions as R, SerializedTestProject as S, UserWorkspaceConfig as U, WatcherTriggerPattern as W, TestSequencerConstructor as X, BenchmarkUserOptions as Y, BrowserBuiltinProvider as Z, _BrowserNames as _, TestProjectConfiguration as a, BrowserCommandContext as a0, BrowserConfigOptions as a1, BrowserInstanceOption as a2, BrowserModuleMocker as a3, BrowserOrchestrator as a4, BrowserProvider as a5, BrowserProviderOption as a6, BrowserScript as a7, BrowserServerFactory as a8, BrowserServerOptions as a9, TestRunResult as aA, ReportedHookContext as aB, Reporter as aC, TestRunEndReason as aD, BenchmarkBuiltinReporters as aS, BuiltinReporterOptions as aT, BuiltinReporters as aU, JsonAssertionResult as aV, JsonTestResult as aW, JsonTestResults as aX, BrowserServerState as aa, BrowserServerStateSession as ab, CDPSession as ac, ParentProjectBrowser as ad, ProjectBrowser as ae, ResolvedBrowserOptions as af, ToMatchScreenshotComparators as ag, ToMatchScreenshotOptions as ah, BuiltinEnvironment as ai, CSSModuleScopeStrategy as aj, DepsOptimizationOptions as ak, EnvironmentOptions as al, Pool as am, ProjectConfig as an, ResolvedProjectConfig as ao, ResolveSnapshotPathHandler as ap, ResolveSnapshotPathHandlerContext as aq, TypecheckConfig as ar, VitestEnvironment as as, BaseCoverageOptions as at, CoverageIstanbulOptions as au, CoverageOptions as av, CoverageProvider as aw, CoverageProviderModule as ax, CoverageReporter as ay, CustomProviderOptions as az, ReportContext as b, CoverageV8Options as c, UserProjectConfigFn as d, UserProjectConfigExport as e, UserConfig as f, TestProjectInlineConfiguration as g, ResolvedConfig as h, VitestRunMode as i, VitestOptions as j, PoolOptions as l, WorkerRequest as m, TestSequencer as n, OnTestsRerunHandler as o, PoolRunnerInitializer as q, PoolTask as r, WorkerResponse as s, JUnitOptions as t, TaskOptions as u, TestDiagnostic as x, TestModuleState as z };
|