vitest 0.27.3 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +4 -93
- package/browser.d.ts +1 -1
- package/dist/browser.d.ts +11 -13
- package/dist/browser.js +9 -34
- package/dist/{chunk-api-setup.0a2398d8.js → chunk-api-setup.52751a38.js} +26 -12
- package/dist/chunk-constants.797d3ebf.js +42 -0
- package/dist/{chunk-install-pkg.7b006b3e.js → chunk-install-pkg.cfd23146.js} +51 -11
- package/dist/{vendor-index.57682f0c.js → chunk-integrations-coverage.48e6286b.js} +33 -4
- package/dist/chunk-integrations-globals.0d5f50f0.js +29 -0
- package/dist/chunk-integrations-run-once.38756e30.js +27 -0
- package/dist/chunk-integrations-utils.f1f6f1ed.js +118 -0
- package/dist/{chunk-node-git.59caac18.js → chunk-node-git.d9ad64ab.js} +6 -8
- package/dist/{chunk-snapshot-manager.d16903ef.js → chunk-node-pkg.dcdf4369.js} +7440 -172
- package/dist/{chunk-runtime-mocker.66533d65.js → chunk-runtime-mocker.03017e8c.js} +13 -12
- package/dist/{chunk-runtime-rpc.e79efa9a.js → chunk-runtime-rpc.9c0386cc.js} +3 -2
- package/dist/chunk-runtime-setup.d9302cfd.js +20 -0
- package/dist/chunk-snapshot-env.6457638e.js +11 -0
- package/dist/chunk-utils-base.977ae74f.js +77 -0
- package/dist/chunk-utils-env.860d90c2.js +6 -0
- package/dist/chunk-utils-global.442d1d33.js +73 -0
- package/dist/{chunk-utils-import.eb63557e.js → chunk-utils-import.9911c99d.js} +3289 -169
- package/dist/chunk-utils-tasks.1b603032.js +103 -0
- package/dist/cli-wrapper.js +7 -6
- package/dist/cli.js +16 -15
- package/dist/config.d.ts +7 -2
- package/dist/entry.js +233 -28
- package/dist/env-afee91f0.d.ts +10 -0
- package/dist/environments.d.ts +7 -2
- package/dist/index.d.ts +160 -11
- package/dist/index.js +17 -18
- package/dist/loader.js +6 -6
- package/dist/node.d.ts +9 -7
- package/dist/node.js +18 -17
- package/dist/runners-chunk.js +215 -0
- package/dist/runners.d.ts +39 -0
- package/dist/runners.js +18 -0
- package/dist/spy.js +1 -2
- package/dist/suite.d.ts +2 -0
- package/dist/suite.js +2 -19
- package/dist/{types-c1386a7d.d.ts → types-c800444e.d.ts} +160 -425
- package/dist/{vendor-index.e6c27006.js → vendor-index.618ca5a1.js} +1078 -10
- package/dist/{vendor-index.b0346fe4.js → vendor-index.bdee400f.js} +1 -0
- package/dist/worker.js +11 -13
- package/package.json +21 -12
- package/runners.d.ts +1 -0
- package/suite.d.ts +1 -0
- package/dist/chunk-integrations-coverage.18366936.js +0 -242
- package/dist/chunk-integrations-globals.59b4d460.js +0 -28
- package/dist/chunk-mock-date.91595ccd.js +0 -350
- package/dist/chunk-runtime-chain.07d16eac.js +0 -2594
- package/dist/chunk-runtime-error.f2062967.js +0 -144
- package/dist/chunk-runtime-setup.8ca273cd.js +0 -653
- package/dist/chunk-utils-env.4ebb0106.js +0 -229
- package/dist/chunk-utils-source-map.832515f7.js +0 -408
- package/dist/chunk-utils-timers.52534f96.js +0 -3573
- package/dist/index-2dd51af4.d.ts +0 -258
- package/dist/vendor-index.451e37bc.js +0 -1071
- package/dist/vendor-index.723a074f.js +0 -102
- package/dist/vendor-index.9c919048.js +0 -61
- package/dist/vendor-index.9f20a9be.js +0 -6291
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import { MatchersObject, MatcherState } from '@vitest/expect';
|
|
1
2
|
import { UserConfig as UserConfig$1, ViteDevServer, CommonServerOptions, AliasOptions } from 'vite';
|
|
2
|
-
import {
|
|
3
|
+
import { File, Test as Test$1, Suite, TaskResultPack, Task } from '@vitest/runner/types';
|
|
4
|
+
import * as _vitest_runner from '@vitest/runner';
|
|
5
|
+
import { Task as Task$1, File as File$1, TaskResultPack as TaskResultPack$1, Test as Test$2, TaskCustom } from '@vitest/runner';
|
|
6
|
+
import { ParsedStack, ErrorWithDiff, ChainableFunction } from '@vitest/runner/utils';
|
|
7
|
+
import { Arrayable as Arrayable$1 } from '@vitest/utils';
|
|
8
|
+
import { Task as Task$2, TaskResult, Bench, Options } from 'tinybench';
|
|
3
9
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
4
10
|
import { ViteNodeServer } from 'vite-node/server';
|
|
11
|
+
import { MessagePort } from 'node:worker_threads';
|
|
5
12
|
import { RawSourceMap, ViteNodeResolveId, FetchFunction, ModuleCacheMap } from 'vite-node';
|
|
6
13
|
import { Stats } from 'node:fs';
|
|
7
|
-
import { MessagePort } from 'node:worker_threads';
|
|
8
14
|
|
|
9
15
|
/**
|
|
10
16
|
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
@@ -76,10 +82,10 @@ declare type Config = {
|
|
|
76
82
|
spacingOuter: string;
|
|
77
83
|
};
|
|
78
84
|
declare type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
|
|
79
|
-
declare type Test
|
|
85
|
+
declare type Test = (arg0: any) => boolean;
|
|
80
86
|
declare type NewPlugin = {
|
|
81
87
|
serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
|
82
|
-
test: Test
|
|
88
|
+
test: Test;
|
|
83
89
|
};
|
|
84
90
|
declare type PluginOptions = {
|
|
85
91
|
edgeSpacing: string;
|
|
@@ -88,7 +94,7 @@ declare type PluginOptions = {
|
|
|
88
94
|
};
|
|
89
95
|
declare type OldPlugin = {
|
|
90
96
|
print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string;
|
|
91
|
-
test: Test
|
|
97
|
+
test: Test;
|
|
92
98
|
};
|
|
93
99
|
declare type Plugin = NewPlugin | OldPlugin;
|
|
94
100
|
declare type Plugins = Array<Plugin>;
|
|
@@ -159,282 +165,6 @@ interface FakeTimerInstallOpts {
|
|
|
159
165
|
shouldClearNativeTimers?: boolean | undefined;
|
|
160
166
|
}
|
|
161
167
|
|
|
162
|
-
type ChainableFunction<T extends string, Args extends any[], R = any, E = {}> = {
|
|
163
|
-
(...args: Args): R;
|
|
164
|
-
} & {
|
|
165
|
-
[x in T]: ChainableFunction<T, Args, R, E>;
|
|
166
|
-
} & {
|
|
167
|
-
fn: (this: Record<T, boolean | undefined>, ...args: Args) => R;
|
|
168
|
-
} & E;
|
|
169
|
-
|
|
170
|
-
interface BenchmarkUserOptions {
|
|
171
|
-
/**
|
|
172
|
-
* Include globs for benchmark test files
|
|
173
|
-
*
|
|
174
|
-
* @default ['**\/*.{bench,benchmark}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
|
|
175
|
-
*/
|
|
176
|
-
include?: string[];
|
|
177
|
-
/**
|
|
178
|
-
* Exclude globs for benchmark test files
|
|
179
|
-
* @default ['node_modules', 'dist', '.idea', '.git', '.cache']
|
|
180
|
-
*/
|
|
181
|
-
exclude?: string[];
|
|
182
|
-
/**
|
|
183
|
-
* Include globs for in-source benchmark test files
|
|
184
|
-
*
|
|
185
|
-
* @default []
|
|
186
|
-
*/
|
|
187
|
-
includeSource?: string[];
|
|
188
|
-
/**
|
|
189
|
-
* Custom reporter for output. Can contain one or more built-in report names, reporter instances,
|
|
190
|
-
* and/or paths to custom reporters
|
|
191
|
-
*/
|
|
192
|
-
reporters?: Arrayable<BenchmarkBuiltinReporters | Reporter>;
|
|
193
|
-
/**
|
|
194
|
-
* Write test results to a file when the `--reporter=json` option is also specified.
|
|
195
|
-
* Also definable individually per reporter by using an object instead.
|
|
196
|
-
*/
|
|
197
|
-
outputFile?: string | (Partial<Record<BenchmarkBuiltinReporters, string>> & Record<string, string>);
|
|
198
|
-
}
|
|
199
|
-
interface Benchmark extends TaskBase {
|
|
200
|
-
type: 'benchmark';
|
|
201
|
-
suite: Suite;
|
|
202
|
-
result?: TaskResult;
|
|
203
|
-
fails?: boolean;
|
|
204
|
-
task?: Task$1;
|
|
205
|
-
}
|
|
206
|
-
interface BenchmarkResult extends TaskResult$1 {
|
|
207
|
-
name: string;
|
|
208
|
-
rank: number;
|
|
209
|
-
}
|
|
210
|
-
type BenchFunction = (this: Bench) => Promise<void> | void;
|
|
211
|
-
type BenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', [
|
|
212
|
-
name: string,
|
|
213
|
-
fn?: BenchFunction,
|
|
214
|
-
options?: Options
|
|
215
|
-
], void> & {
|
|
216
|
-
skipIf(condition: any): BenchmarkAPI;
|
|
217
|
-
runIf(condition: any): BenchmarkAPI;
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
type Awaitable<T> = T | PromiseLike<T>;
|
|
221
|
-
type Nullable<T> = T | null | undefined;
|
|
222
|
-
type Arrayable<T> = T | Array<T>;
|
|
223
|
-
type ArgumentsType$1<T> = T extends (...args: infer U) => any ? U : never;
|
|
224
|
-
type MergeInsertions<T> = T extends object ? {
|
|
225
|
-
[K in keyof T]: MergeInsertions<T[K]>;
|
|
226
|
-
} : T;
|
|
227
|
-
type DeepMerge<F, S> = MergeInsertions<{
|
|
228
|
-
[K in keyof F | keyof S]: K extends keyof S & keyof F ? DeepMerge<F[K], S[K]> : K extends keyof S ? S[K] : K extends keyof F ? F[K] : never;
|
|
229
|
-
}>;
|
|
230
|
-
type MutableArray<T extends readonly any[]> = {
|
|
231
|
-
-readonly [k in keyof T]: T[k];
|
|
232
|
-
};
|
|
233
|
-
interface Constructable {
|
|
234
|
-
new (...args: any[]): any;
|
|
235
|
-
}
|
|
236
|
-
interface ModuleCache {
|
|
237
|
-
promise?: Promise<any>;
|
|
238
|
-
exports?: any;
|
|
239
|
-
code?: string;
|
|
240
|
-
}
|
|
241
|
-
interface EnvironmentReturn {
|
|
242
|
-
teardown: (global: any) => Awaitable<void>;
|
|
243
|
-
}
|
|
244
|
-
interface Environment {
|
|
245
|
-
name: string;
|
|
246
|
-
setup(global: any, options: Record<string, any>): Awaitable<EnvironmentReturn>;
|
|
247
|
-
}
|
|
248
|
-
interface UserConsoleLog {
|
|
249
|
-
content: string;
|
|
250
|
-
type: 'stdout' | 'stderr';
|
|
251
|
-
taskId?: string;
|
|
252
|
-
time: number;
|
|
253
|
-
size: number;
|
|
254
|
-
}
|
|
255
|
-
interface ParsedStack {
|
|
256
|
-
method: string;
|
|
257
|
-
file: string;
|
|
258
|
-
line: number;
|
|
259
|
-
column: number;
|
|
260
|
-
}
|
|
261
|
-
interface ErrorWithDiff extends Error {
|
|
262
|
-
name: string;
|
|
263
|
-
nameStr?: string;
|
|
264
|
-
stack?: string;
|
|
265
|
-
stackStr?: string;
|
|
266
|
-
stacks?: ParsedStack[];
|
|
267
|
-
showDiff?: boolean;
|
|
268
|
-
actual?: any;
|
|
269
|
-
expected?: any;
|
|
270
|
-
operator?: string;
|
|
271
|
-
type?: string;
|
|
272
|
-
frame?: string;
|
|
273
|
-
}
|
|
274
|
-
interface ModuleGraphData {
|
|
275
|
-
graph: Record<string, string[]>;
|
|
276
|
-
externalized: string[];
|
|
277
|
-
inlined: string[];
|
|
278
|
-
}
|
|
279
|
-
type OnServerRestartHandler = (reason?: string) => Promise<void> | void;
|
|
280
|
-
|
|
281
|
-
type RunMode = 'run' | 'skip' | 'only' | 'todo';
|
|
282
|
-
type TaskState = RunMode | 'pass' | 'fail';
|
|
283
|
-
interface TaskBase {
|
|
284
|
-
id: string;
|
|
285
|
-
name: string;
|
|
286
|
-
mode: RunMode;
|
|
287
|
-
concurrent?: boolean;
|
|
288
|
-
shuffle?: boolean;
|
|
289
|
-
suite?: Suite;
|
|
290
|
-
file?: File;
|
|
291
|
-
result?: TaskResult;
|
|
292
|
-
retry?: number;
|
|
293
|
-
logs?: UserConsoleLog[];
|
|
294
|
-
meta?: any;
|
|
295
|
-
}
|
|
296
|
-
interface TaskResult {
|
|
297
|
-
state: TaskState;
|
|
298
|
-
duration?: number;
|
|
299
|
-
startTime?: number;
|
|
300
|
-
heap?: number;
|
|
301
|
-
/**
|
|
302
|
-
* @deprecated Use "errors" instead
|
|
303
|
-
*/
|
|
304
|
-
error?: ErrorWithDiff;
|
|
305
|
-
errors?: ErrorWithDiff[];
|
|
306
|
-
htmlError?: string;
|
|
307
|
-
hooks?: Partial<Record<keyof SuiteHooks, TaskState>>;
|
|
308
|
-
benchmark?: BenchmarkResult;
|
|
309
|
-
retryCount?: number;
|
|
310
|
-
}
|
|
311
|
-
type TaskResultPack = [id: string, result: TaskResult | undefined];
|
|
312
|
-
interface Suite extends TaskBase {
|
|
313
|
-
type: 'suite';
|
|
314
|
-
tasks: Task[];
|
|
315
|
-
filepath?: string;
|
|
316
|
-
benchmark?: Bench;
|
|
317
|
-
projectName?: string;
|
|
318
|
-
}
|
|
319
|
-
interface File extends Suite {
|
|
320
|
-
filepath: string;
|
|
321
|
-
collectDuration?: number;
|
|
322
|
-
setupDuration?: number;
|
|
323
|
-
}
|
|
324
|
-
interface Test<ExtraContext = {}> extends TaskBase {
|
|
325
|
-
type: 'test';
|
|
326
|
-
suite: Suite;
|
|
327
|
-
result?: TaskResult;
|
|
328
|
-
fails?: boolean;
|
|
329
|
-
context: TestContext & ExtraContext;
|
|
330
|
-
onFailed?: OnTestFailedHandler[];
|
|
331
|
-
}
|
|
332
|
-
type Task = Test | Suite | File | Benchmark;
|
|
333
|
-
type DoneCallback = (error?: any) => void;
|
|
334
|
-
type TestFunction<ExtraContext = {}> = (context: TestContext & ExtraContext) => Awaitable<any> | void;
|
|
335
|
-
type ExtractEachCallbackArgs<T extends ReadonlyArray<any>> = {
|
|
336
|
-
1: [T[0]];
|
|
337
|
-
2: [T[0], T[1]];
|
|
338
|
-
3: [T[0], T[1], T[2]];
|
|
339
|
-
4: [T[0], T[1], T[2], T[3]];
|
|
340
|
-
5: [T[0], T[1], T[2], T[3], T[4]];
|
|
341
|
-
6: [T[0], T[1], T[2], T[3], T[4], T[5]];
|
|
342
|
-
7: [T[0], T[1], T[2], T[3], T[4], T[5], T[6]];
|
|
343
|
-
8: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7]];
|
|
344
|
-
9: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], T[8]];
|
|
345
|
-
10: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], T[8], T[9]];
|
|
346
|
-
fallback: Array<T extends ReadonlyArray<infer U> ? U : any>;
|
|
347
|
-
}[T extends Readonly<[any]> ? 1 : T extends Readonly<[any, any]> ? 2 : T extends Readonly<[any, any, any]> ? 3 : T extends Readonly<[any, any, any, any]> ? 4 : T extends Readonly<[any, any, any, any, any]> ? 5 : T extends Readonly<[any, any, any, any, any, any]> ? 6 : T extends Readonly<[any, any, any, any, any, any, any]> ? 7 : T extends Readonly<[any, any, any, any, any, any, any, any]> ? 8 : T extends Readonly<[any, any, any, any, any, any, any, any, any]> ? 9 : T extends Readonly<[any, any, any, any, any, any, any, any, any, any]> ? 10 : 'fallback'];
|
|
348
|
-
interface SuiteEachFunction {
|
|
349
|
-
<T extends any[] | [any]>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T) => Awaitable<void>) => void;
|
|
350
|
-
<T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (name: string, fn: (...args: ExtractEachCallbackArgs<T>) => Awaitable<void>) => void;
|
|
351
|
-
<T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => Awaitable<void>) => void;
|
|
352
|
-
}
|
|
353
|
-
interface TestEachFunction {
|
|
354
|
-
<T extends any[] | [any]>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
355
|
-
<T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (name: string, fn: (...args: ExtractEachCallbackArgs<T>) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
356
|
-
<T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
357
|
-
(...args: [TemplateStringsArray, ...any]): (name: string, fn: (...args: any[]) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
358
|
-
}
|
|
359
|
-
type ChainableTestAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'fails', [
|
|
360
|
-
name: string,
|
|
361
|
-
fn?: TestFunction<ExtraContext>,
|
|
362
|
-
options?: number | TestOptions
|
|
363
|
-
], void, {
|
|
364
|
-
each: TestEachFunction;
|
|
365
|
-
<T extends ExtraContext>(name: string, fn?: TestFunction<T>, options?: number | TestOptions): void;
|
|
366
|
-
}>;
|
|
367
|
-
interface TestOptions {
|
|
368
|
-
/**
|
|
369
|
-
* Test timeout.
|
|
370
|
-
*/
|
|
371
|
-
timeout?: number;
|
|
372
|
-
/**
|
|
373
|
-
* Times to retry the test if fails. Useful for making flaky tests more stable.
|
|
374
|
-
* When retries is up, the last test error will be thrown.
|
|
375
|
-
*
|
|
376
|
-
* @default 1
|
|
377
|
-
*/
|
|
378
|
-
retry?: number;
|
|
379
|
-
}
|
|
380
|
-
type TestAPI<ExtraContext = {}> = ChainableTestAPI<ExtraContext> & {
|
|
381
|
-
each: TestEachFunction;
|
|
382
|
-
skipIf(condition: any): ChainableTestAPI<ExtraContext>;
|
|
383
|
-
runIf(condition: any): ChainableTestAPI<ExtraContext>;
|
|
384
|
-
};
|
|
385
|
-
type ChainableSuiteAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'shuffle', [
|
|
386
|
-
name: string,
|
|
387
|
-
factory?: SuiteFactory<ExtraContext>,
|
|
388
|
-
options?: number | TestOptions
|
|
389
|
-
], SuiteCollector<ExtraContext>, {
|
|
390
|
-
each: TestEachFunction;
|
|
391
|
-
<T extends ExtraContext>(name: string, factory?: SuiteFactory<T>): SuiteCollector<T>;
|
|
392
|
-
}>;
|
|
393
|
-
type SuiteAPI<ExtraContext = {}> = ChainableSuiteAPI<ExtraContext> & {
|
|
394
|
-
each: SuiteEachFunction;
|
|
395
|
-
skipIf(condition: any): ChainableSuiteAPI<ExtraContext>;
|
|
396
|
-
runIf(condition: any): ChainableSuiteAPI<ExtraContext>;
|
|
397
|
-
};
|
|
398
|
-
type HookListener<T extends any[], Return = void> = (...args: T) => Awaitable<Return>;
|
|
399
|
-
type HookCleanupCallback = (() => Awaitable<unknown>) | void;
|
|
400
|
-
interface SuiteHooks<ExtraContext = {}> {
|
|
401
|
-
beforeAll: HookListener<[Suite | File], HookCleanupCallback>[];
|
|
402
|
-
afterAll: HookListener<[Suite | File]>[];
|
|
403
|
-
beforeEach: HookListener<[TestContext & ExtraContext, Suite], HookCleanupCallback>[];
|
|
404
|
-
afterEach: HookListener<[TestContext & ExtraContext, Suite]>[];
|
|
405
|
-
}
|
|
406
|
-
interface SuiteCollector<ExtraContext = {}> {
|
|
407
|
-
readonly name: string;
|
|
408
|
-
readonly mode: RunMode;
|
|
409
|
-
type: 'collector';
|
|
410
|
-
test: TestAPI<ExtraContext>;
|
|
411
|
-
benchmark: BenchmarkAPI;
|
|
412
|
-
tasks: (Suite | Test | Benchmark | SuiteCollector<ExtraContext>)[];
|
|
413
|
-
collect: (file?: File) => Promise<Suite>;
|
|
414
|
-
clear: () => void;
|
|
415
|
-
on: <T extends keyof SuiteHooks<ExtraContext>>(name: T, ...fn: SuiteHooks<ExtraContext>[T]) => void;
|
|
416
|
-
}
|
|
417
|
-
type SuiteFactory<ExtraContext = {}> = (test: (name: string, fn: TestFunction<ExtraContext>) => void) => Awaitable<void>;
|
|
418
|
-
interface RuntimeContext {
|
|
419
|
-
tasks: (SuiteCollector | Test)[];
|
|
420
|
-
currentSuite: SuiteCollector | null;
|
|
421
|
-
}
|
|
422
|
-
interface TestContext {
|
|
423
|
-
/**
|
|
424
|
-
* Metadata of the current test
|
|
425
|
-
*/
|
|
426
|
-
meta: Readonly<Test>;
|
|
427
|
-
/**
|
|
428
|
-
* A expect instance bound to the test
|
|
429
|
-
*/
|
|
430
|
-
expect: Vi.ExpectStatic;
|
|
431
|
-
/**
|
|
432
|
-
* Extract hooks on test failed
|
|
433
|
-
*/
|
|
434
|
-
onTestFailed: (fn: OnTestFailedHandler) => void;
|
|
435
|
-
}
|
|
436
|
-
type OnTestFailedHandler = (result: TaskResult) => Awaitable<void>;
|
|
437
|
-
|
|
438
168
|
declare class SnapshotManager {
|
|
439
169
|
options: SnapshotStateOptions;
|
|
440
170
|
summary: SnapshotSummary;
|
|
@@ -449,7 +179,7 @@ interface ParsedFile extends File {
|
|
|
449
179
|
start: number;
|
|
450
180
|
end: number;
|
|
451
181
|
}
|
|
452
|
-
interface ParsedTest extends Test {
|
|
182
|
+
interface ParsedTest extends Test$1 {
|
|
453
183
|
start: number;
|
|
454
184
|
end: number;
|
|
455
185
|
}
|
|
@@ -541,9 +271,7 @@ declare class StateManager {
|
|
|
541
271
|
catchError(err: unknown, type: string): void;
|
|
542
272
|
clearErrors(): void;
|
|
543
273
|
getUnhandledErrors(): unknown[];
|
|
544
|
-
|
|
545
|
-
finishCollectingPaths(): void;
|
|
546
|
-
getPaths(): Promise<string[]>;
|
|
274
|
+
getPaths(): string[];
|
|
547
275
|
getFiles(keys?: string[]): File[];
|
|
548
276
|
getFilepaths(): string[];
|
|
549
277
|
getFailedFilepaths(): string[];
|
|
@@ -748,6 +476,48 @@ declare class BasicReporter extends BaseReporter {
|
|
|
748
476
|
reportSummary(files: File[]): Promise<void>;
|
|
749
477
|
}
|
|
750
478
|
|
|
479
|
+
type Awaitable<T> = T | PromiseLike<T>;
|
|
480
|
+
type Nullable<T> = T | null | undefined;
|
|
481
|
+
type Arrayable<T> = T | Array<T>;
|
|
482
|
+
type ArgumentsType$1<T> = T extends (...args: infer U) => any ? U : never;
|
|
483
|
+
type MergeInsertions<T> = T extends object ? {
|
|
484
|
+
[K in keyof T]: MergeInsertions<T[K]>;
|
|
485
|
+
} : T;
|
|
486
|
+
type DeepMerge<F, S> = MergeInsertions<{
|
|
487
|
+
[K in keyof F | keyof S]: K extends keyof S & keyof F ? DeepMerge<F[K], S[K]> : K extends keyof S ? S[K] : K extends keyof F ? F[K] : never;
|
|
488
|
+
}>;
|
|
489
|
+
type MutableArray<T extends readonly any[]> = {
|
|
490
|
+
-readonly [k in keyof T]: T[k];
|
|
491
|
+
};
|
|
492
|
+
interface Constructable {
|
|
493
|
+
new (...args: any[]): any;
|
|
494
|
+
}
|
|
495
|
+
interface ModuleCache {
|
|
496
|
+
promise?: Promise<any>;
|
|
497
|
+
exports?: any;
|
|
498
|
+
code?: string;
|
|
499
|
+
}
|
|
500
|
+
interface EnvironmentReturn {
|
|
501
|
+
teardown: (global: any) => Awaitable<void>;
|
|
502
|
+
}
|
|
503
|
+
interface Environment {
|
|
504
|
+
name: string;
|
|
505
|
+
setup(global: any, options: Record<string, any>): Awaitable<EnvironmentReturn>;
|
|
506
|
+
}
|
|
507
|
+
interface UserConsoleLog {
|
|
508
|
+
content: string;
|
|
509
|
+
type: 'stdout' | 'stderr';
|
|
510
|
+
taskId?: string;
|
|
511
|
+
time: number;
|
|
512
|
+
size: number;
|
|
513
|
+
}
|
|
514
|
+
interface ModuleGraphData {
|
|
515
|
+
graph: Record<string, string[]>;
|
|
516
|
+
externalized: string[];
|
|
517
|
+
inlined: string[];
|
|
518
|
+
}
|
|
519
|
+
type OnServerRestartHandler = (reason?: string) => Promise<void> | void;
|
|
520
|
+
|
|
751
521
|
interface ListRendererOptions$1 {
|
|
752
522
|
renderSucceed?: boolean;
|
|
753
523
|
logger: Logger;
|
|
@@ -766,8 +536,8 @@ declare class DefaultReporter extends BaseReporter {
|
|
|
766
536
|
rendererOptions: ListRendererOptions$1;
|
|
767
537
|
onTestRemoved(trigger?: string): Promise<void>;
|
|
768
538
|
onCollected(): void;
|
|
769
|
-
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
770
|
-
onWatcherStart(files?: File[], errors?: unknown[]): Promise<void>;
|
|
539
|
+
onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
|
|
540
|
+
onWatcherStart(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
|
|
771
541
|
stopListRender(): Promise<void>;
|
|
772
542
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
773
543
|
onUserConsoleLog(log: UserConsoleLog): void;
|
|
@@ -776,7 +546,7 @@ declare class DefaultReporter extends BaseReporter {
|
|
|
776
546
|
declare class DotReporter extends BaseReporter {
|
|
777
547
|
renderer?: ReturnType<typeof createListRenderer>;
|
|
778
548
|
onCollected(): void;
|
|
779
|
-
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
549
|
+
onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
|
|
780
550
|
onWatcherStart(): Promise<void>;
|
|
781
551
|
stopListRender(): Promise<void>;
|
|
782
552
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
@@ -807,14 +577,28 @@ declare class VerboseReporter extends DefaultReporter {
|
|
|
807
577
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
808
578
|
}
|
|
809
579
|
|
|
580
|
+
interface Reporter {
|
|
581
|
+
onInit?(ctx: Vitest): void;
|
|
582
|
+
onPathsCollected?: (paths?: string[]) => Awaitable<void>;
|
|
583
|
+
onCollected?: (files?: File[]) => Awaitable<void>;
|
|
584
|
+
onFinished?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
585
|
+
onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
|
|
586
|
+
onTestRemoved?: (trigger?: string) => Awaitable<void>;
|
|
587
|
+
onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
588
|
+
onWatcherRerun?: (files: string[], trigger?: string) => Awaitable<void>;
|
|
589
|
+
onServerRestart?: (reason?: string) => Awaitable<void>;
|
|
590
|
+
onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
|
|
591
|
+
onProcessTimeout?: () => Awaitable<void>;
|
|
592
|
+
}
|
|
593
|
+
|
|
810
594
|
declare class TapReporter implements Reporter {
|
|
811
595
|
protected ctx: Vitest;
|
|
812
596
|
private logger;
|
|
813
597
|
onInit(ctx: Vitest): void;
|
|
814
|
-
static getComment(task: Task): string;
|
|
598
|
+
static getComment(task: Task$1): string;
|
|
815
599
|
private logErrorDetails;
|
|
816
|
-
protected logTasks(tasks: Task[]): void;
|
|
817
|
-
onFinished(files?: File[]): Promise<void>;
|
|
600
|
+
protected logTasks(tasks: Task$1[]): void;
|
|
601
|
+
onFinished(files?: _vitest_runner.File[]): Promise<void>;
|
|
818
602
|
}
|
|
819
603
|
|
|
820
604
|
declare class JUnitReporter implements Reporter {
|
|
@@ -826,14 +610,14 @@ declare class JUnitReporter implements Reporter {
|
|
|
826
610
|
onInit(ctx: Vitest): Promise<void>;
|
|
827
611
|
writeElement(name: string, attrs: Record<string, any>, children: () => Promise<void>): Promise<void>;
|
|
828
612
|
writeErrorDetails(error: ErrorWithDiff): Promise<void>;
|
|
829
|
-
writeLogs(task: Task, type: 'err' | 'out'): Promise<void>;
|
|
830
|
-
writeTasks(tasks: Task[], filename: string): Promise<void>;
|
|
831
|
-
onFinished(files?: File[]): Promise<void>;
|
|
613
|
+
writeLogs(task: Task$1, type: 'err' | 'out'): Promise<void>;
|
|
614
|
+
writeTasks(tasks: Task$1[], filename: string): Promise<void>;
|
|
615
|
+
onFinished(files?: _vitest_runner.File[]): Promise<void>;
|
|
832
616
|
}
|
|
833
617
|
|
|
834
618
|
declare class TapFlatReporter extends TapReporter {
|
|
835
619
|
onInit(ctx: Vitest): void;
|
|
836
|
-
onFinished(files?: File[]): Promise<void>;
|
|
620
|
+
onFinished(files?: _vitest_runner.File[]): Promise<void>;
|
|
837
621
|
}
|
|
838
622
|
|
|
839
623
|
declare class HangingProcessReporter implements Reporter {
|
|
@@ -873,7 +657,7 @@ declare class TableReporter extends BaseReporter {
|
|
|
873
657
|
rendererOptions: ListRendererOptions$1;
|
|
874
658
|
onTestRemoved(trigger?: string): Promise<void>;
|
|
875
659
|
onCollected(): void;
|
|
876
|
-
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
660
|
+
onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
|
|
877
661
|
onWatcherStart(): Promise<void>;
|
|
878
662
|
stopListRender(): Promise<void>;
|
|
879
663
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
@@ -1180,14 +964,14 @@ interface WorkerRPC {
|
|
|
1180
964
|
fetch: FetchFunction;
|
|
1181
965
|
resolveId: ResolveIdFunction;
|
|
1182
966
|
getSourceMap: (id: string, force?: boolean) => Promise<RawSourceMap | undefined>;
|
|
1183
|
-
onFinished: (files: File[], errors?: unknown[]) => void;
|
|
967
|
+
onFinished: (files: File$1[], errors?: unknown[]) => void;
|
|
1184
968
|
onWorkerExit: (error: unknown, code?: number) => void;
|
|
1185
969
|
onPathsCollected: (paths: string[]) => void;
|
|
1186
970
|
onUserConsoleLog: (log: UserConsoleLog) => void;
|
|
1187
971
|
onUnhandledError: (err: unknown, type: string) => void;
|
|
1188
|
-
onCollected: (files: File[]) => void;
|
|
972
|
+
onCollected: (files: File$1[]) => void;
|
|
1189
973
|
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
|
|
1190
|
-
onTaskUpdate: (pack: TaskResultPack[]) => void;
|
|
974
|
+
onTaskUpdate: (pack: TaskResultPack$1[]) => void;
|
|
1191
975
|
snapshotSaved: (snapshot: SnapshotResult) => void;
|
|
1192
976
|
resolveSnapshotPath: (testPath: string) => string;
|
|
1193
977
|
}
|
|
@@ -1195,10 +979,9 @@ interface WorkerGlobalState {
|
|
|
1195
979
|
ctx: WorkerContext;
|
|
1196
980
|
config: ResolvedConfig;
|
|
1197
981
|
rpc: BirpcReturn<WorkerRPC>;
|
|
1198
|
-
current?: Test;
|
|
982
|
+
current?: Test$2;
|
|
1199
983
|
filepath?: string;
|
|
1200
984
|
moduleCache: ModuleCacheMap;
|
|
1201
|
-
browserHashMap?: Map<string, string>;
|
|
1202
985
|
mockMap: MockMap;
|
|
1203
986
|
}
|
|
1204
987
|
|
|
@@ -1456,19 +1239,55 @@ interface JSDOMOptions {
|
|
|
1456
1239
|
resources?: 'usable' | any;
|
|
1457
1240
|
}
|
|
1458
1241
|
|
|
1459
|
-
interface
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1242
|
+
interface BenchmarkUserOptions {
|
|
1243
|
+
/**
|
|
1244
|
+
* Include globs for benchmark test files
|
|
1245
|
+
*
|
|
1246
|
+
* @default ['**\/*.{bench,benchmark}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
|
|
1247
|
+
*/
|
|
1248
|
+
include?: string[];
|
|
1249
|
+
/**
|
|
1250
|
+
* Exclude globs for benchmark test files
|
|
1251
|
+
* @default ['node_modules', 'dist', '.idea', '.git', '.cache']
|
|
1252
|
+
*/
|
|
1253
|
+
exclude?: string[];
|
|
1254
|
+
/**
|
|
1255
|
+
* Include globs for in-source benchmark test files
|
|
1256
|
+
*
|
|
1257
|
+
* @default []
|
|
1258
|
+
*/
|
|
1259
|
+
includeSource?: string[];
|
|
1260
|
+
/**
|
|
1261
|
+
* Custom reporter for output. Can contain one or more built-in report names, reporter instances,
|
|
1262
|
+
* and/or paths to custom reporters
|
|
1263
|
+
*/
|
|
1264
|
+
reporters?: Arrayable$1<BenchmarkBuiltinReporters | Reporter>;
|
|
1265
|
+
/**
|
|
1266
|
+
* Write test results to a file when the `--reporter=json` option is also specified.
|
|
1267
|
+
* Also definable individually per reporter by using an object instead.
|
|
1268
|
+
*/
|
|
1269
|
+
outputFile?: string | (Partial<Record<BenchmarkBuiltinReporters, string>> & Record<string, string>);
|
|
1270
|
+
}
|
|
1271
|
+
interface Benchmark extends TaskCustom {
|
|
1272
|
+
meta: {
|
|
1273
|
+
benchmark: true;
|
|
1274
|
+
task?: Task$2;
|
|
1275
|
+
result?: TaskResult;
|
|
1276
|
+
};
|
|
1471
1277
|
}
|
|
1278
|
+
interface BenchmarkResult extends TaskResult {
|
|
1279
|
+
name: string;
|
|
1280
|
+
rank: number;
|
|
1281
|
+
}
|
|
1282
|
+
type BenchFunction = (this: Bench) => Promise<void> | void;
|
|
1283
|
+
type BenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', [
|
|
1284
|
+
name: string,
|
|
1285
|
+
fn?: BenchFunction,
|
|
1286
|
+
options?: Options
|
|
1287
|
+
], void> & {
|
|
1288
|
+
skipIf(condition: any): BenchmarkAPI;
|
|
1289
|
+
runIf(condition: any): BenchmarkAPI;
|
|
1290
|
+
};
|
|
1472
1291
|
|
|
1473
1292
|
type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
|
|
1474
1293
|
type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
|
|
@@ -1906,6 +1725,10 @@ interface InlineConfig {
|
|
|
1906
1725
|
* @default 300
|
|
1907
1726
|
*/
|
|
1908
1727
|
slowTestThreshold?: number;
|
|
1728
|
+
/**
|
|
1729
|
+
* Path to a custom test runner.
|
|
1730
|
+
*/
|
|
1731
|
+
runner?: string;
|
|
1909
1732
|
}
|
|
1910
1733
|
interface TypecheckConfig {
|
|
1911
1734
|
/**
|
|
@@ -1968,7 +1791,7 @@ interface UserConfig extends InlineConfig {
|
|
|
1968
1791
|
*/
|
|
1969
1792
|
shard?: string;
|
|
1970
1793
|
}
|
|
1971
|
-
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck'> {
|
|
1794
|
+
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner'> {
|
|
1972
1795
|
mode: VitestRunMode;
|
|
1973
1796
|
base?: string;
|
|
1974
1797
|
config?: string;
|
|
@@ -1997,6 +1820,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
1997
1820
|
seed?: number;
|
|
1998
1821
|
};
|
|
1999
1822
|
typecheck: TypecheckConfig;
|
|
1823
|
+
runner?: string;
|
|
2000
1824
|
}
|
|
2001
1825
|
type RuntimeConfig = Pick<UserConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency'> & {
|
|
2002
1826
|
sequence?: {
|
|
@@ -2014,110 +1838,6 @@ declare module 'vite' {
|
|
|
2014
1838
|
}
|
|
2015
1839
|
}
|
|
2016
1840
|
|
|
2017
|
-
declare function stringify(object: unknown, maxDepth?: number, { maxLength, ...options }?: PrettyFormatOptions & {
|
|
2018
|
-
maxLength?: number;
|
|
2019
|
-
}): string;
|
|
2020
|
-
|
|
2021
|
-
type Formatter = (input: string | number | null | undefined) => string;
|
|
2022
|
-
|
|
2023
|
-
declare const EXPECTED_COLOR: Formatter;
|
|
2024
|
-
declare const RECEIVED_COLOR: Formatter;
|
|
2025
|
-
declare const INVERTED_COLOR: Formatter;
|
|
2026
|
-
declare const BOLD_WEIGHT: Formatter;
|
|
2027
|
-
declare const DIM_COLOR: Formatter;
|
|
2028
|
-
declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string;
|
|
2029
|
-
declare const printReceived: (object: unknown) => string;
|
|
2030
|
-
declare const printExpected: (value: unknown) => string;
|
|
2031
|
-
declare function diff(a: any, b: any, options?: DiffOptions): string;
|
|
2032
|
-
|
|
2033
|
-
declare const jestMatcherUtils_stringify: typeof stringify;
|
|
2034
|
-
declare const jestMatcherUtils_EXPECTED_COLOR: typeof EXPECTED_COLOR;
|
|
2035
|
-
declare const jestMatcherUtils_RECEIVED_COLOR: typeof RECEIVED_COLOR;
|
|
2036
|
-
declare const jestMatcherUtils_INVERTED_COLOR: typeof INVERTED_COLOR;
|
|
2037
|
-
declare const jestMatcherUtils_BOLD_WEIGHT: typeof BOLD_WEIGHT;
|
|
2038
|
-
declare const jestMatcherUtils_DIM_COLOR: typeof DIM_COLOR;
|
|
2039
|
-
declare const jestMatcherUtils_matcherHint: typeof matcherHint;
|
|
2040
|
-
declare const jestMatcherUtils_printReceived: typeof printReceived;
|
|
2041
|
-
declare const jestMatcherUtils_printExpected: typeof printExpected;
|
|
2042
|
-
declare const jestMatcherUtils_diff: typeof diff;
|
|
2043
|
-
declare namespace jestMatcherUtils {
|
|
2044
|
-
export {
|
|
2045
|
-
jestMatcherUtils_stringify as stringify,
|
|
2046
|
-
jestMatcherUtils_EXPECTED_COLOR as EXPECTED_COLOR,
|
|
2047
|
-
jestMatcherUtils_RECEIVED_COLOR as RECEIVED_COLOR,
|
|
2048
|
-
jestMatcherUtils_INVERTED_COLOR as INVERTED_COLOR,
|
|
2049
|
-
jestMatcherUtils_BOLD_WEIGHT as BOLD_WEIGHT,
|
|
2050
|
-
jestMatcherUtils_DIM_COLOR as DIM_COLOR,
|
|
2051
|
-
jestMatcherUtils_matcherHint as matcherHint,
|
|
2052
|
-
jestMatcherUtils_printReceived as printReceived,
|
|
2053
|
-
jestMatcherUtils_printExpected as printExpected,
|
|
2054
|
-
jestMatcherUtils_diff as diff,
|
|
2055
|
-
};
|
|
2056
|
-
}
|
|
2057
|
-
type Tester = (a: any, b: any) => boolean | undefined;
|
|
2058
|
-
interface MatcherHintOptions {
|
|
2059
|
-
comment?: string;
|
|
2060
|
-
expectedColor?: Formatter;
|
|
2061
|
-
isDirectExpectCall?: boolean;
|
|
2062
|
-
isNot?: boolean;
|
|
2063
|
-
promise?: string;
|
|
2064
|
-
receivedColor?: Formatter;
|
|
2065
|
-
secondArgument?: string;
|
|
2066
|
-
secondArgumentColor?: Formatter;
|
|
2067
|
-
}
|
|
2068
|
-
interface DiffOptions {
|
|
2069
|
-
aAnnotation?: string;
|
|
2070
|
-
aColor?: Formatter;
|
|
2071
|
-
aIndicator?: string;
|
|
2072
|
-
bAnnotation?: string;
|
|
2073
|
-
bColor?: Formatter;
|
|
2074
|
-
bIndicator?: string;
|
|
2075
|
-
changeColor?: Formatter;
|
|
2076
|
-
changeLineTrailingSpaceColor?: Formatter;
|
|
2077
|
-
commonColor?: Formatter;
|
|
2078
|
-
commonIndicator?: string;
|
|
2079
|
-
commonLineTrailingSpaceColor?: Formatter;
|
|
2080
|
-
contextLines?: number;
|
|
2081
|
-
emptyFirstOrLastLinePlaceholder?: string;
|
|
2082
|
-
expand?: boolean;
|
|
2083
|
-
includeChangeCounts?: boolean;
|
|
2084
|
-
omitAnnotationLines?: boolean;
|
|
2085
|
-
patchColor?: Formatter;
|
|
2086
|
-
compareKeys?: any;
|
|
2087
|
-
}
|
|
2088
|
-
interface MatcherState$1 {
|
|
2089
|
-
assertionCalls: number;
|
|
2090
|
-
currentTestName?: string;
|
|
2091
|
-
dontThrow?: () => void;
|
|
2092
|
-
error?: Error;
|
|
2093
|
-
equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
|
|
2094
|
-
expand?: boolean;
|
|
2095
|
-
expectedAssertionsNumber?: number | null;
|
|
2096
|
-
expectedAssertionsNumberErrorGen?: (() => Error) | null;
|
|
2097
|
-
isExpectingAssertions?: boolean;
|
|
2098
|
-
isExpectingAssertionsError?: Error | null;
|
|
2099
|
-
isNot: boolean;
|
|
2100
|
-
promise: string;
|
|
2101
|
-
suppressedErrors: Array<Error>;
|
|
2102
|
-
testPath?: string;
|
|
2103
|
-
utils: typeof jestMatcherUtils & {
|
|
2104
|
-
iterableEquality: Tester;
|
|
2105
|
-
subsetEquality: Tester;
|
|
2106
|
-
};
|
|
2107
|
-
}
|
|
2108
|
-
interface SyncExpectationResult {
|
|
2109
|
-
pass: boolean;
|
|
2110
|
-
message: () => string;
|
|
2111
|
-
actual?: any;
|
|
2112
|
-
expected?: any;
|
|
2113
|
-
}
|
|
2114
|
-
type AsyncExpectationResult = Promise<SyncExpectationResult>;
|
|
2115
|
-
type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
|
|
2116
|
-
interface RawMatcherFn<T extends MatcherState$1 = MatcherState$1> {
|
|
2117
|
-
(this: T, received: any, expected: any, options?: any): ExpectationResult;
|
|
2118
|
-
}
|
|
2119
|
-
type MatchersObject<T extends MatcherState$1 = MatcherState$1> = Record<string, RawMatcherFn<T>>;
|
|
2120
|
-
|
|
2121
1841
|
/**
|
|
2122
1842
|
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
2123
1843
|
*
|
|
@@ -2147,12 +1867,15 @@ declare class SnapshotState {
|
|
|
2147
1867
|
private _inlineSnapshots;
|
|
2148
1868
|
private _uncheckedKeys;
|
|
2149
1869
|
private _snapshotFormat;
|
|
1870
|
+
private _environment;
|
|
1871
|
+
private _fileExists;
|
|
2150
1872
|
added: number;
|
|
2151
1873
|
expand: boolean;
|
|
2152
1874
|
matched: number;
|
|
2153
1875
|
unmatched: number;
|
|
2154
1876
|
updated: number;
|
|
2155
|
-
constructor(
|
|
1877
|
+
private constructor();
|
|
1878
|
+
static create(testFilePath: string, options: SnapshotStateOptions): Promise<SnapshotState>;
|
|
2156
1879
|
markSnapshotsAsCheckedForTest(testName: string): void;
|
|
2157
1880
|
private _inferInlineSnapshotStack;
|
|
2158
1881
|
private _addSnapshot;
|
|
@@ -2165,14 +1888,26 @@ declare class SnapshotState {
|
|
|
2165
1888
|
pack(): Promise<SnapshotResult>;
|
|
2166
1889
|
}
|
|
2167
1890
|
|
|
2168
|
-
interface MatcherState extends MatcherState$1 {
|
|
2169
|
-
environment: VitestEnvironment;
|
|
2170
|
-
snapshotState: SnapshotState;
|
|
2171
|
-
}
|
|
2172
|
-
|
|
2173
1891
|
type Promisify<O> = {
|
|
2174
1892
|
[K in keyof O]: O[K] extends (...args: infer A) => infer R ? O extends R ? Promisify<O[K]> : (...args: A) => Promise<R> : O[K];
|
|
2175
1893
|
};
|
|
1894
|
+
declare module '@vitest/expect' {
|
|
1895
|
+
interface MatcherState {
|
|
1896
|
+
environment: VitestEnvironment;
|
|
1897
|
+
snapshotState: SnapshotState;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
declare module '@vitest/runner' {
|
|
1901
|
+
interface TestContext {
|
|
1902
|
+
expect: Vi.ExpectStatic;
|
|
1903
|
+
}
|
|
1904
|
+
interface TaskBase {
|
|
1905
|
+
logs?: UserConsoleLog[];
|
|
1906
|
+
}
|
|
1907
|
+
interface TaskResult {
|
|
1908
|
+
benchmark?: BenchmarkResult;
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
2176
1911
|
declare global {
|
|
2177
1912
|
namespace jest {
|
|
2178
1913
|
interface Matchers<R, T = {}> {
|
|
@@ -2295,4 +2030,4 @@ type Context = RootAndTarget & {
|
|
|
2295
2030
|
lastActivePath?: string;
|
|
2296
2031
|
};
|
|
2297
2032
|
|
|
2298
|
-
export {
|
|
2033
|
+
export { CoverageReporter as $, ApiConfig as A, BenchmarkAPI as B, CollectLineNumbers as C, MergeInsertions as D, EnvironmentOptions as E, FakeTimerInstallOpts as F, DeepMerge as G, MutableArray as H, InlineConfig as I, JSDOMOptions as J, Constructable as K, ModuleCache as L, MockFactoryWithHelper as M, Nullable as N, EnvironmentReturn as O, Environment as P, UserConsoleLog as Q, RuntimeConfig as R, SnapshotResult as S, TscErrorInfo as T, UserConfig as U, VitestEnvironment as V, WorkerContext as W, OnServerRestartHandler as X, CoverageProvider as Y, ReportContext as Z, CoverageProviderModule as _, ResolvedConfig as a, CoverageOptions as a0, ResolvedCoverageOptions as a1, BaseCoverageOptions as a2, CoverageIstanbulOptions as a3, CoverageC8Options as a4, BenchmarkUserOptions as a5, Benchmark as a6, BenchmarkResult as a7, BenchFunction as a8, MockFactory as a9, MockMap as aa, TestSequencer as ab, startVitest as ac, TestSequencerConstructor as ad, ModuleGraphData as b, Reporter as c, RawErrsMap as d, CollectLines as e, RootAndTarget as f, Context as g, BuiltinEnvironment as h, CSSModuleScopeStrategy as i, SequenceHooks as j, VitestRunMode as k, TypecheckConfig as l, Vitest as m, SnapshotData as n, SnapshotUpdateState as o, SnapshotStateOptions as p, SnapshotMatchOptions as q, UncheckedSnapshot as r, SnapshotSummary as s, ResolveIdFunction as t, AfterSuiteRunMeta as u, WorkerRPC as v, WorkerGlobalState as w, Awaitable as x, Arrayable as y, ArgumentsType$1 as z };
|