vitest 0.29.7 → 0.30.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 +3 -266
- package/dist/browser.d.ts +16 -4
- package/dist/browser.js +5 -4
- package/dist/child.js +12 -17
- package/dist/{chunk-api-setup.ac7748ac.js → chunk-api-setup.6662587e.js} +65 -51
- package/dist/{chunk-install-pkg.863031f2.js → chunk-install-pkg.6450b372.js} +33 -32
- package/dist/chunk-integrations-globals.d419838f.js +26 -0
- package/dist/{chunk-node-git.ed5bded8.js → chunk-node-git.4c43bd73.js} +4 -2
- package/dist/cli-wrapper.js +6 -5
- package/dist/cli.js +27 -26
- package/dist/config.cjs +15 -7
- package/dist/config.d.ts +15 -8
- package/dist/config.js +10 -6
- package/dist/coverage.d.ts +5 -2
- package/dist/coverage.js +6 -0
- package/dist/entry.js +35 -34
- package/dist/environments.d.ts +5 -2
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +17 -21
- package/dist/index.js +9 -10
- package/dist/loader.js +396 -12
- package/dist/node.d.ts +9 -7
- package/dist/node.js +28 -30
- package/dist/runners.d.ts +5 -2
- package/dist/runners.js +34 -30
- package/dist/{types-fafda418.d.ts → types-f03c83c4.d.ts} +243 -317
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/dist/{chunk-node-pkg.f9696901.js → vendor-cli-api.c04eaa34.js} +3858 -5514
- package/dist/vendor-constants.538d9b49.js +54 -0
- package/dist/{chunk-integrations-coverage.e0a6acd2.js → vendor-coverage.a585b712.js} +5 -5
- package/dist/{chunk-runtime-mocker.344fec90.js → vendor-execute.8eaab47b.js} +9 -12
- package/dist/vendor-global.6795f91f.js +8 -0
- package/dist/vendor-index.4f82d248.js +161 -0
- package/dist/{chunk-env-node.affdd278.js → vendor-index.75f2b63d.js} +9 -2
- package/dist/{chunk-integrations-utils.d7c85bd9.js → vendor-index.81b9e499.js} +22 -21
- package/dist/{vendor-index.2cbcdd1e.js → vendor-index.c1e09929.js} +458 -373
- package/dist/vendor-index.fad2598b.js +44 -0
- package/dist/{vendor-index.534e612c.js → vendor-index.fc98d30f.js} +2 -2
- package/dist/{chunk-runtime-inspector.b1427a10.js → vendor-inspector.47fc8cbb.js} +5 -2
- package/dist/{chunk-runtime-rpc.1b5714dc.js → vendor-rpc.4d3d7a54.js} +5 -5
- package/dist/{chunk-integrations-run-once.a2b4758b.js → vendor-run-once.69ce7172.js} +3 -2
- package/dist/{chunk-runtime-setup.a49dc2f9.js → vendor-setup.common.cef38f4e.js} +2 -2
- package/dist/vendor-tasks.042d6084.js +14 -0
- package/dist/{chunk-utils-import.39ffe9c5.js → vendor-vi.a3ff54b1.js} +262 -3147
- package/dist/worker.js +13 -19
- package/package.json +40 -34
- package/utils.d.ts +1 -0
- package/dist/chunk-constants.bc18a549.js +0 -36
- package/dist/chunk-integrations-globals.a473e88a.js +0 -27
- package/dist/chunk-snapshot-env.a347d647.js +0 -11
- package/dist/chunk-utils-base.81f83dbd.js +0 -88
- package/dist/chunk-utils-env.04ffbef7.js +0 -70
- package/dist/chunk-utils-tasks.b41c8284.js +0 -107
- package/dist/env-afee91f0.d.ts +0 -10
- package/dist/vendor-index.783e7f3e.js +0 -71
- package/dist/vendor-index.bdee400f.js +0 -396
- package/dist/vendor-magic-string.es.b3bc5745.js +0 -1591
- /package/dist/{vendor-_commonjsHelpers.addc3445.js → vendor-_commonjsHelpers.76cdd49e.js} +0 -0
- /package/dist/{chunk-paths.e36446b4.js → vendor-paths.84fc7a99.js} +0 -0
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { MatchersObject, MatcherState } from '@vitest/expect';
|
|
2
|
-
import {
|
|
2
|
+
import { SnapshotResult, SnapshotStateOptions, SnapshotState } from '@vitest/snapshot';
|
|
3
|
+
import { TransformResult as TransformResult$1, ViteDevServer, UserConfig as UserConfig$1, CommonServerOptions, AliasOptions, DepOptimizationConfig } from 'vite';
|
|
3
4
|
import * as _vitest_runner from '@vitest/runner';
|
|
4
|
-
import { Task as Task$1, Test as Test$2, TaskCustom,
|
|
5
|
+
import { Task as Task$1, Test as Test$2, TaskCustom, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
5
6
|
import { File, Test as Test$1, Suite, TaskResultPack, Task } from '@vitest/runner/types';
|
|
6
7
|
import { ParsedStack, ErrorWithDiff, ChainableFunction } from '@vitest/runner/utils';
|
|
7
8
|
import { Awaitable as Awaitable$1, Arrayable as Arrayable$1 } from '@vitest/utils';
|
|
8
9
|
import { Task as Task$2, TaskResult, Bench, Options } from 'tinybench';
|
|
9
10
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
11
|
+
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
10
12
|
import { MessagePort } from 'node:worker_threads';
|
|
11
13
|
import { RawSourceMap, FetchResult, ViteNodeResolveId, ModuleCacheMap } from 'vite-node';
|
|
12
14
|
import { RawSourceMap as RawSourceMap$1 } from 'source-map';
|
|
13
|
-
import { Stats } from 'node:fs';
|
|
14
15
|
import { ViteNodeServer } from 'vite-node/server';
|
|
16
|
+
import { Stats } from 'node:fs';
|
|
17
|
+
import * as chai from 'chai';
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
20
|
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
@@ -66,7 +69,6 @@ interface PrettyFormatOptions {
|
|
|
66
69
|
printFunctionName?: boolean;
|
|
67
70
|
theme?: ThemeReceived;
|
|
68
71
|
}
|
|
69
|
-
declare type OptionsReceived = PrettyFormatOptions;
|
|
70
72
|
declare type Config = {
|
|
71
73
|
callToJSON: boolean;
|
|
72
74
|
compareKeys: CompareKeys;
|
|
@@ -166,16 +168,6 @@ interface FakeTimerInstallOpts {
|
|
|
166
168
|
shouldClearNativeTimers?: boolean | undefined;
|
|
167
169
|
}
|
|
168
170
|
|
|
169
|
-
declare class SnapshotManager {
|
|
170
|
-
options: SnapshotStateOptions;
|
|
171
|
-
summary: SnapshotSummary;
|
|
172
|
-
extension: string;
|
|
173
|
-
constructor(options: SnapshotStateOptions);
|
|
174
|
-
clear(): void;
|
|
175
|
-
add(result: SnapshotResult): void;
|
|
176
|
-
resolvePath(testPath: string): string;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
171
|
interface ParsedFile extends File {
|
|
180
172
|
start: number;
|
|
181
173
|
end: number;
|
|
@@ -216,7 +208,7 @@ interface ErrorsCache {
|
|
|
216
208
|
}
|
|
217
209
|
type Callback<Args extends Array<any> = []> = (...args: Args) => Awaitable<void>;
|
|
218
210
|
declare class Typechecker {
|
|
219
|
-
protected ctx:
|
|
211
|
+
protected ctx: WorkspaceProject;
|
|
220
212
|
protected files: string[];
|
|
221
213
|
private _onParseStart?;
|
|
222
214
|
private _onParseEnd?;
|
|
@@ -226,7 +218,7 @@ declare class Typechecker {
|
|
|
226
218
|
private tempConfigPath?;
|
|
227
219
|
private allowJs?;
|
|
228
220
|
private process;
|
|
229
|
-
constructor(ctx:
|
|
221
|
+
constructor(ctx: WorkspaceProject, files: string[]);
|
|
230
222
|
onParseStart(fn: Callback): void;
|
|
231
223
|
onParseEnd(fn: Callback<[ErrorsCache]>): void;
|
|
232
224
|
onWatcherRerun(fn: Callback): void;
|
|
@@ -252,16 +244,55 @@ declare class Typechecker {
|
|
|
252
244
|
getTestPacks(): TaskResultPack[];
|
|
253
245
|
}
|
|
254
246
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
247
|
+
declare class VitestServer extends ViteNodeServer {
|
|
248
|
+
private _vitestPath?;
|
|
249
|
+
private getVitestPath;
|
|
250
|
+
protected processTransformResult(id: string, result: TransformResult$1): Promise<TransformResult$1>;
|
|
259
251
|
}
|
|
260
252
|
|
|
253
|
+
interface InitializeOptions {
|
|
254
|
+
server?: VitestServer;
|
|
255
|
+
runner?: ViteNodeRunner;
|
|
256
|
+
}
|
|
257
|
+
declare class WorkspaceProject {
|
|
258
|
+
path: string | number;
|
|
259
|
+
ctx: Vitest;
|
|
260
|
+
configOverride: Partial<ResolvedConfig> | undefined;
|
|
261
|
+
config: ResolvedConfig;
|
|
262
|
+
server: ViteDevServer;
|
|
263
|
+
vitenode: VitestServer;
|
|
264
|
+
runner: ViteNodeRunner;
|
|
265
|
+
browser: ViteDevServer;
|
|
266
|
+
typechecker?: Typechecker;
|
|
267
|
+
closingPromise: Promise<unknown> | undefined;
|
|
268
|
+
browserProvider: BrowserProvider | undefined;
|
|
269
|
+
constructor(path: string | number, ctx: Vitest);
|
|
270
|
+
getName(): string;
|
|
271
|
+
isCore(): boolean;
|
|
272
|
+
get reporters(): Reporter[];
|
|
273
|
+
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
274
|
+
globAllTestFiles(config: ResolvedConfig, cwd: string): Promise<string[]>;
|
|
275
|
+
globFiles(include: string[], exclude: string[], cwd: string): Promise<string[]>;
|
|
276
|
+
filterFiles(testFiles: string[], filters?: string[]): string[];
|
|
277
|
+
initBrowserServer(options: UserConfig): Promise<void>;
|
|
278
|
+
setServer(options: UserConfig, server: ViteDevServer, params?: InitializeOptions): Promise<void>;
|
|
279
|
+
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
|
|
280
|
+
typecheck(filters?: string[]): Promise<void>;
|
|
281
|
+
isBrowserEnabled(): boolean | 0;
|
|
282
|
+
getSerializableConfig(): ResolvedConfig;
|
|
283
|
+
close(): Promise<unknown>;
|
|
284
|
+
initBrowserProvider(): Promise<void>;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
interface BrowserProviderOptions {
|
|
288
|
+
browser: string;
|
|
289
|
+
}
|
|
261
290
|
interface BrowserProvider {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
291
|
+
name: string;
|
|
292
|
+
getSupportedBrowsers(): readonly string[];
|
|
293
|
+
initialize(ctx: WorkspaceProject, options: BrowserProviderOptions): Awaitable$1<void>;
|
|
294
|
+
openPage(url: string): Awaitable$1<void>;
|
|
295
|
+
close(): Awaitable$1<void>;
|
|
265
296
|
}
|
|
266
297
|
interface BrowserConfigOptions {
|
|
267
298
|
/**
|
|
@@ -272,16 +303,14 @@ interface BrowserConfigOptions {
|
|
|
272
303
|
enabled?: boolean;
|
|
273
304
|
/**
|
|
274
305
|
* Name of the browser
|
|
275
|
-
*
|
|
276
|
-
* @default tries to find the first available browser
|
|
277
306
|
*/
|
|
278
|
-
name
|
|
307
|
+
name: string;
|
|
279
308
|
/**
|
|
280
309
|
* browser provider
|
|
281
310
|
*
|
|
282
|
-
* @default '
|
|
311
|
+
* @default 'webdriverio'
|
|
283
312
|
*/
|
|
284
|
-
provider?: string;
|
|
313
|
+
provider?: 'webdriverio' | 'playwright' | (string & {});
|
|
285
314
|
/**
|
|
286
315
|
* enable headless mode
|
|
287
316
|
*
|
|
@@ -301,14 +330,25 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
|
301
330
|
api: ApiConfig;
|
|
302
331
|
}
|
|
303
332
|
|
|
333
|
+
type WorkspaceSpec = [project: WorkspaceProject, testFile: string];
|
|
334
|
+
type RunWithFiles = (files: WorkspaceSpec[], invalidates?: string[]) => Promise<void>;
|
|
335
|
+
interface ProcessPool {
|
|
336
|
+
runTests: RunWithFiles;
|
|
337
|
+
close: () => Promise<void>;
|
|
338
|
+
}
|
|
339
|
+
|
|
304
340
|
interface CollectingPromise {
|
|
305
341
|
promise: Promise<void>;
|
|
306
342
|
resolve: () => void;
|
|
307
343
|
}
|
|
308
344
|
declare class StateManager {
|
|
309
|
-
filesMap: Map<string, File>;
|
|
345
|
+
filesMap: Map<string, File[]>;
|
|
310
346
|
pathsSet: Set<string>;
|
|
311
347
|
collectingPromise: CollectingPromise | undefined;
|
|
348
|
+
browserTestPromises: Map<string, {
|
|
349
|
+
resolve: (v: unknown) => void;
|
|
350
|
+
reject: (v: unknown) => void;
|
|
351
|
+
}>;
|
|
312
352
|
idMap: Map<string, Task>;
|
|
313
353
|
taskFileMap: WeakMap<Task, File>;
|
|
314
354
|
errorsSet: Set<unknown>;
|
|
@@ -324,7 +364,7 @@ declare class StateManager {
|
|
|
324
364
|
getFailedFilepaths(): string[];
|
|
325
365
|
collectPaths(paths?: string[]): void;
|
|
326
366
|
collectFiles(files?: File[]): void;
|
|
327
|
-
clearFiles(paths?: string[]): void;
|
|
367
|
+
clearFiles(project: WorkspaceProject, paths?: string[]): void;
|
|
328
368
|
updateId(task: Task): void;
|
|
329
369
|
updateTasks(packs: TaskResultPack[]): void;
|
|
330
370
|
updateUserLog(log: UserConsoleLog): void;
|
|
@@ -364,12 +404,13 @@ interface SuiteResultCache {
|
|
|
364
404
|
}
|
|
365
405
|
declare class ResultsCache {
|
|
366
406
|
private cache;
|
|
407
|
+
private workspacesKeyMap;
|
|
367
408
|
private cachePath;
|
|
368
409
|
private version;
|
|
369
410
|
private root;
|
|
370
411
|
getCachePath(): string | null;
|
|
371
412
|
setConfig(root: string, config: ResolvedConfig['cache']): void;
|
|
372
|
-
getResults(
|
|
413
|
+
getResults(key: string): SuiteResultCache | undefined;
|
|
373
414
|
readFromCache(): Promise<void>;
|
|
374
415
|
updateResults(files: File[]): void;
|
|
375
416
|
removeFromCache(filepath: string): void;
|
|
@@ -392,16 +433,17 @@ declare function startVitest(mode: VitestRunMode, cliFilters: string[], options:
|
|
|
392
433
|
type FileStatsCache = Pick<Stats, 'size'>;
|
|
393
434
|
declare class FilesStatsCache {
|
|
394
435
|
cache: Map<string, FileStatsCache>;
|
|
395
|
-
getStats(
|
|
396
|
-
|
|
436
|
+
getStats(key: string): FileStatsCache | undefined;
|
|
437
|
+
populateStats(root: string, specs: WorkspaceSpec[]): Promise<void>;
|
|
438
|
+
updateStats(fsPath: string, key: string): Promise<void>;
|
|
397
439
|
removeStats(fsPath: string): void;
|
|
398
440
|
}
|
|
399
441
|
|
|
400
442
|
declare class VitestCache {
|
|
401
443
|
results: ResultsCache;
|
|
402
444
|
stats: FilesStatsCache;
|
|
403
|
-
getFileTestResults(
|
|
404
|
-
getFileStats(
|
|
445
|
+
getFileTestResults(key: string): SuiteResultCache | undefined;
|
|
446
|
+
getFileStats(key: string): {
|
|
405
447
|
size: number;
|
|
406
448
|
} | undefined;
|
|
407
449
|
static resolveCacheDir(root: string, dir: string | undefined): string;
|
|
@@ -411,17 +453,10 @@ declare class VitestCache {
|
|
|
411
453
|
}>;
|
|
412
454
|
}
|
|
413
455
|
|
|
414
|
-
declare class VitestServer extends ViteNodeServer {
|
|
415
|
-
private _vitestPath?;
|
|
416
|
-
private getVitestPath;
|
|
417
|
-
protected processTransformResult(result: TransformResult$1): Promise<TransformResult$1>;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
456
|
declare class Vitest {
|
|
421
457
|
readonly mode: VitestRunMode;
|
|
422
458
|
config: ResolvedConfig;
|
|
423
|
-
configOverride: Partial<ResolvedConfig
|
|
424
|
-
browser: ViteDevServer;
|
|
459
|
+
configOverride: Partial<ResolvedConfig>;
|
|
425
460
|
server: ViteDevServer;
|
|
426
461
|
state: StateManager;
|
|
427
462
|
snapshot: SnapshotManager;
|
|
@@ -431,7 +466,6 @@ declare class Vitest {
|
|
|
431
466
|
browserProvider: BrowserProvider | undefined;
|
|
432
467
|
logger: Logger;
|
|
433
468
|
pool: ProcessPool | undefined;
|
|
434
|
-
typechecker: Typechecker | undefined;
|
|
435
469
|
vitenode: VitestServer;
|
|
436
470
|
invalidates: Set<string>;
|
|
437
471
|
changedTests: Set<string>;
|
|
@@ -441,19 +475,24 @@ declare class Vitest {
|
|
|
441
475
|
isFirstRun: boolean;
|
|
442
476
|
restartsCount: number;
|
|
443
477
|
runner: ViteNodeRunner;
|
|
478
|
+
private coreWorkspace;
|
|
479
|
+
projects: WorkspaceProject[];
|
|
480
|
+
private projectsTestFiles;
|
|
444
481
|
constructor(mode: VitestRunMode);
|
|
445
482
|
private _onRestartListeners;
|
|
446
483
|
private _onSetServer;
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
484
|
+
setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
|
|
485
|
+
private createCoreWorkspace;
|
|
486
|
+
getCoreWorkspaceProject(): WorkspaceProject;
|
|
487
|
+
private resolveWorkspace;
|
|
488
|
+
private initCoverageProvider;
|
|
489
|
+
private initBrowserProviders;
|
|
490
|
+
typecheck(filters?: string[]): Promise<void[]>;
|
|
453
491
|
start(filters?: string[]): Promise<void>;
|
|
454
492
|
private getTestDependencies;
|
|
455
|
-
filterTestsBySource(
|
|
456
|
-
|
|
493
|
+
filterTestsBySource(specs: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
|
|
494
|
+
getProjectsByTestFile(file: string): WorkspaceSpec[];
|
|
495
|
+
runFiles(paths: WorkspaceSpec[]): Promise<void>;
|
|
457
496
|
rerunFiles(files?: string[], trigger?: string): Promise<void>;
|
|
458
497
|
changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
|
|
459
498
|
changeFilenamePattern(pattern: string): Promise<void>;
|
|
@@ -461,6 +500,7 @@ declare class Vitest {
|
|
|
461
500
|
updateSnapshot(files?: string[]): Promise<void>;
|
|
462
501
|
private _rerunTimer;
|
|
463
502
|
private scheduleRerun;
|
|
503
|
+
getModuleProjects(id: string): WorkspaceProject[];
|
|
464
504
|
private unregisterWatcher;
|
|
465
505
|
private registerWatcher;
|
|
466
506
|
/**
|
|
@@ -474,13 +514,8 @@ declare class Vitest {
|
|
|
474
514
|
*/
|
|
475
515
|
exit(force?: boolean): Promise<void>;
|
|
476
516
|
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
|
|
477
|
-
|
|
478
|
-
private
|
|
479
|
-
globAllTestFiles(config: ResolvedConfig, cwd: string): Promise<string[]>;
|
|
480
|
-
filterFiles(testFiles: string[], filters?: string[]): string[];
|
|
481
|
-
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
482
|
-
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
483
|
-
isBrowserEnabled(): boolean;
|
|
517
|
+
globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
|
|
518
|
+
private isTargetFile;
|
|
484
519
|
shouldKeepServer(): boolean;
|
|
485
520
|
isInSourceTestFile(code: string): boolean;
|
|
486
521
|
onServerRestart(fn: OnServerRestartHandler): void;
|
|
@@ -496,8 +531,8 @@ interface TestSequencer {
|
|
|
496
531
|
* Slicing tests into shards. Will be run before `sort`.
|
|
497
532
|
* Only run, if `shard` is defined.
|
|
498
533
|
*/
|
|
499
|
-
shard(files:
|
|
500
|
-
sort(files:
|
|
534
|
+
shard(files: WorkspaceSpec[]): Awaitable<WorkspaceSpec[]>;
|
|
535
|
+
sort(files: WorkspaceSpec[]): Awaitable<WorkspaceSpec[]>;
|
|
501
536
|
}
|
|
502
537
|
interface TestSequencerConstructor {
|
|
503
538
|
new (ctx: Vitest): TestSequencer;
|
|
@@ -581,7 +616,7 @@ interface ListRendererOptions$1 {
|
|
|
581
616
|
showHeap: boolean;
|
|
582
617
|
mode: VitestRunMode;
|
|
583
618
|
}
|
|
584
|
-
declare
|
|
619
|
+
declare function createListRenderer(_tasks: Task[], options: ListRendererOptions$1): {
|
|
585
620
|
start(): any;
|
|
586
621
|
update(_tasks: Task[]): any;
|
|
587
622
|
stop(): Promise<any>;
|
|
@@ -702,7 +737,7 @@ interface ListRendererOptions {
|
|
|
702
737
|
logger: Logger;
|
|
703
738
|
showHeap: boolean;
|
|
704
739
|
}
|
|
705
|
-
declare
|
|
740
|
+
declare function createTableRenderer(_tasks: Task[], options: ListRendererOptions): {
|
|
706
741
|
start(): any;
|
|
707
742
|
update(_tasks: Task[]): any;
|
|
708
743
|
stop(): Promise<any>;
|
|
@@ -741,42 +776,48 @@ declare const ReportersMap: {
|
|
|
741
776
|
};
|
|
742
777
|
type BuiltinReporters = keyof typeof ReportersMap;
|
|
743
778
|
|
|
744
|
-
|
|
745
|
-
|
|
779
|
+
declare function createExpect(test?: Test$2): Vi.ExpectStatic;
|
|
780
|
+
declare const globalExpect: Vi.ExpectStatic;
|
|
781
|
+
|
|
782
|
+
declare function setupChaiConfig(config: ChaiConfig): void;
|
|
783
|
+
type ChaiConfig = Omit<Partial<typeof chai.config>, 'useProxy' | 'proxyExcludedKeys'>;
|
|
784
|
+
|
|
785
|
+
// utils
|
|
786
|
+
type NullValue = null | undefined | void;
|
|
787
|
+
|
|
788
|
+
type PartialNull<T> = {
|
|
789
|
+
[P in keyof T]: T[P] | null;
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
interface RollupError extends RollupLog {
|
|
793
|
+
name?: string;
|
|
746
794
|
stack?: string;
|
|
747
795
|
watchFiles?: string[];
|
|
748
796
|
}
|
|
749
797
|
|
|
750
|
-
|
|
751
|
-
chunkName?: string;
|
|
752
|
-
cycle?: string[];
|
|
753
|
-
exportName?: string;
|
|
754
|
-
exporter?: string;
|
|
755
|
-
guess?: string;
|
|
756
|
-
importer?: string;
|
|
757
|
-
missing?: string;
|
|
758
|
-
modules?: string[];
|
|
759
|
-
names?: string[];
|
|
760
|
-
reexporter?: string;
|
|
761
|
-
source?: string;
|
|
762
|
-
sources?: string[];
|
|
763
|
-
}
|
|
798
|
+
type RollupWarning = RollupLog;
|
|
764
799
|
|
|
765
|
-
interface
|
|
800
|
+
interface RollupLog {
|
|
801
|
+
binding?: string;
|
|
802
|
+
cause?: unknown;
|
|
766
803
|
code?: string;
|
|
804
|
+
exporter?: string;
|
|
767
805
|
frame?: string;
|
|
768
806
|
hook?: string;
|
|
769
807
|
id?: string;
|
|
808
|
+
ids?: string[];
|
|
770
809
|
loc?: {
|
|
771
810
|
column: number;
|
|
772
811
|
file?: string;
|
|
773
812
|
line: number;
|
|
774
813
|
};
|
|
775
814
|
message: string;
|
|
776
|
-
|
|
815
|
+
names?: string[];
|
|
777
816
|
plugin?: string;
|
|
778
817
|
pluginCode?: string;
|
|
779
818
|
pos?: number;
|
|
819
|
+
reexporter?: string;
|
|
820
|
+
stack?: string;
|
|
780
821
|
url?: string;
|
|
781
822
|
}
|
|
782
823
|
|
|
@@ -786,8 +827,9 @@ interface ExistingRawSourceMap {
|
|
|
786
827
|
names: string[];
|
|
787
828
|
sourceRoot?: string;
|
|
788
829
|
sources: string[];
|
|
789
|
-
sourcesContent?: string[];
|
|
830
|
+
sourcesContent?: (string | null)[];
|
|
790
831
|
version: number;
|
|
832
|
+
x_google_ignoreList?: number[];
|
|
791
833
|
}
|
|
792
834
|
|
|
793
835
|
interface SourceMap {
|
|
@@ -795,7 +837,7 @@ interface SourceMap {
|
|
|
795
837
|
mappings: string;
|
|
796
838
|
names: string[];
|
|
797
839
|
sources: string[];
|
|
798
|
-
sourcesContent: string[];
|
|
840
|
+
sourcesContent: (string | null)[];
|
|
799
841
|
version: number;
|
|
800
842
|
toString(): string;
|
|
801
843
|
toUrl(): string;
|
|
@@ -803,11 +845,8 @@ interface SourceMap {
|
|
|
803
845
|
|
|
804
846
|
type SourceMapInput = ExistingRawSourceMap | string | null | { mappings: '' };
|
|
805
847
|
|
|
806
|
-
type PartialNull<T> = {
|
|
807
|
-
[P in keyof T]: T[P] | null;
|
|
808
|
-
};
|
|
809
|
-
|
|
810
848
|
interface ModuleOptions {
|
|
849
|
+
assertions: Record<string, string>;
|
|
811
850
|
meta: CustomPluginOptions;
|
|
812
851
|
moduleSideEffects: boolean | 'no-treeshake';
|
|
813
852
|
syntheticNamedExports: boolean | string;
|
|
@@ -833,6 +872,7 @@ interface MinimalPluginContext {
|
|
|
833
872
|
interface EmittedAsset {
|
|
834
873
|
fileName?: string;
|
|
835
874
|
name?: string;
|
|
875
|
+
needsCodeReference?: boolean;
|
|
836
876
|
source?: string | Uint8Array;
|
|
837
877
|
type: 'asset';
|
|
838
878
|
}
|
|
@@ -849,10 +889,6 @@ interface EmittedChunk {
|
|
|
849
889
|
|
|
850
890
|
type EmittedFile = EmittedAsset | EmittedChunk;
|
|
851
891
|
|
|
852
|
-
type EmitAsset = (name: string, source?: string | Uint8Array) => string;
|
|
853
|
-
|
|
854
|
-
type EmitChunk = (id: string, options?: { name?: string }) => string;
|
|
855
|
-
|
|
856
892
|
type EmitFile = (emittedFile: EmittedFile) => string;
|
|
857
893
|
|
|
858
894
|
interface ModuleInfo extends ModuleOptions {
|
|
@@ -861,6 +897,8 @@ interface ModuleInfo extends ModuleOptions {
|
|
|
861
897
|
dynamicImporters: readonly string[];
|
|
862
898
|
dynamicallyImportedIdResolutions: readonly ResolvedId[];
|
|
863
899
|
dynamicallyImportedIds: readonly string[];
|
|
900
|
+
exportedBindings: Record<string, string[]> | null;
|
|
901
|
+
exports: string[] | null;
|
|
864
902
|
hasDefaultExport: boolean | null;
|
|
865
903
|
/** @deprecated Use `moduleSideEffects` instead */
|
|
866
904
|
hasModuleSideEffects: boolean | 'no-treeshake';
|
|
@@ -884,22 +922,12 @@ interface CustomPluginOptions {
|
|
|
884
922
|
interface PluginContext extends MinimalPluginContext {
|
|
885
923
|
addWatchFile: (id: string) => void;
|
|
886
924
|
cache: PluginCache;
|
|
887
|
-
/** @deprecated Use `this.emitFile` instead */
|
|
888
|
-
emitAsset: EmitAsset;
|
|
889
|
-
/** @deprecated Use `this.emitFile` instead */
|
|
890
|
-
emitChunk: EmitChunk;
|
|
891
925
|
emitFile: EmitFile;
|
|
892
|
-
error: (
|
|
893
|
-
/** @deprecated Use `this.getFileName` instead */
|
|
894
|
-
getAssetFileName: (assetReferenceId: string) => string;
|
|
895
|
-
/** @deprecated Use `this.getFileName` instead */
|
|
896
|
-
getChunkFileName: (chunkReferenceId: string) => string;
|
|
926
|
+
error: (error: RollupError | string, pos?: number | { column: number; line: number }) => never;
|
|
897
927
|
getFileName: (fileReferenceId: string) => string;
|
|
898
928
|
getModuleIds: () => IterableIterator<string>;
|
|
899
929
|
getModuleInfo: GetModuleInfo;
|
|
900
930
|
getWatchFiles: () => string[];
|
|
901
|
-
/** @deprecated Use `this.resolve` instead */
|
|
902
|
-
isExternal: IsExternal;
|
|
903
931
|
load: (
|
|
904
932
|
options: { id: string; resolveDependencies?: boolean } & Partial<PartialNull<ModuleOptions>>
|
|
905
933
|
) => Promise<ModuleInfo>;
|
|
@@ -909,10 +937,13 @@ interface PluginContext extends MinimalPluginContext {
|
|
|
909
937
|
resolve: (
|
|
910
938
|
source: string,
|
|
911
939
|
importer?: string,
|
|
912
|
-
options?: {
|
|
940
|
+
options?: {
|
|
941
|
+
assertions?: Record<string, string>;
|
|
942
|
+
custom?: CustomPluginOptions;
|
|
943
|
+
isEntry?: boolean;
|
|
944
|
+
skipSelf?: boolean;
|
|
945
|
+
}
|
|
913
946
|
) => Promise<ResolvedId | null>;
|
|
914
|
-
/** @deprecated Use `this.resolve` instead */
|
|
915
|
-
resolveId: (source: string, importer?: string) => Promise<string | null>;
|
|
916
947
|
setAssetSource: (assetReferenceId: string, source: string | Uint8Array) => void;
|
|
917
948
|
warn: (warning: RollupWarning | string, pos?: number | { column: number; line: number }) => void;
|
|
918
949
|
}
|
|
@@ -925,19 +956,14 @@ interface PluginContextMeta {
|
|
|
925
956
|
interface ResolvedId extends ModuleOptions {
|
|
926
957
|
external: boolean | 'absolute';
|
|
927
958
|
id: string;
|
|
959
|
+
resolvedBy: string;
|
|
928
960
|
}
|
|
929
961
|
|
|
930
|
-
type IsExternal = (
|
|
931
|
-
source: string,
|
|
932
|
-
importer: string | undefined,
|
|
933
|
-
isResolved: boolean
|
|
934
|
-
) => boolean;
|
|
935
|
-
|
|
936
962
|
interface TransformPluginContext extends PluginContext {
|
|
937
963
|
getCombinedSourcemap: () => SourceMap;
|
|
938
964
|
}
|
|
939
965
|
|
|
940
|
-
type TransformResult = string |
|
|
966
|
+
type TransformResult = string | NullValue | Partial<SourceDescription>;
|
|
941
967
|
type PreserveEntrySignaturesOption = false | 'strict' | 'allow-extension' | 'exports-only';
|
|
942
968
|
|
|
943
969
|
interface AcornNode {
|
|
@@ -1040,53 +1066,6 @@ declare type BirpcReturn<RemoteFunctions> = {
|
|
|
1040
1066
|
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
|
|
1041
1067
|
};
|
|
1042
1068
|
|
|
1043
|
-
type SnapshotData = Record<string, string>;
|
|
1044
|
-
type SnapshotUpdateState = 'all' | 'new' | 'none';
|
|
1045
|
-
interface SnapshotStateOptions {
|
|
1046
|
-
updateSnapshot: SnapshotUpdateState;
|
|
1047
|
-
expand?: boolean;
|
|
1048
|
-
snapshotFormat?: OptionsReceived;
|
|
1049
|
-
resolveSnapshotPath?: (path: string, extension: string) => string;
|
|
1050
|
-
}
|
|
1051
|
-
interface SnapshotMatchOptions {
|
|
1052
|
-
testName: string;
|
|
1053
|
-
received: unknown;
|
|
1054
|
-
key?: string;
|
|
1055
|
-
inlineSnapshot?: string;
|
|
1056
|
-
isInline: boolean;
|
|
1057
|
-
error?: Error;
|
|
1058
|
-
}
|
|
1059
|
-
interface SnapshotResult {
|
|
1060
|
-
filepath: string;
|
|
1061
|
-
added: number;
|
|
1062
|
-
fileDeleted: boolean;
|
|
1063
|
-
matched: number;
|
|
1064
|
-
unchecked: number;
|
|
1065
|
-
uncheckedKeys: Array<string>;
|
|
1066
|
-
unmatched: number;
|
|
1067
|
-
updated: number;
|
|
1068
|
-
}
|
|
1069
|
-
interface UncheckedSnapshot {
|
|
1070
|
-
filePath: string;
|
|
1071
|
-
keys: Array<string>;
|
|
1072
|
-
}
|
|
1073
|
-
interface SnapshotSummary {
|
|
1074
|
-
added: number;
|
|
1075
|
-
didUpdate: boolean;
|
|
1076
|
-
failure: boolean;
|
|
1077
|
-
filesAdded: number;
|
|
1078
|
-
filesRemoved: number;
|
|
1079
|
-
filesRemovedList: Array<string>;
|
|
1080
|
-
filesUnmatched: number;
|
|
1081
|
-
filesUpdated: number;
|
|
1082
|
-
matched: number;
|
|
1083
|
-
total: number;
|
|
1084
|
-
unchecked: number;
|
|
1085
|
-
uncheckedKeysByFile: Array<UncheckedSnapshot>;
|
|
1086
|
-
unmatched: number;
|
|
1087
|
-
updated: number;
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
1069
|
interface RuntimeRPC {
|
|
1091
1070
|
fetch: (id: string, environment: VitestEnvironment) => Promise<FetchResult>;
|
|
1092
1071
|
resolveId: (id: string, importer: string | undefined, environment: VitestEnvironment) => Promise<ViteNodeResolveId | null>;
|
|
@@ -1130,6 +1109,10 @@ interface WorkerGlobalState {
|
|
|
1130
1109
|
environmentTeardownRun?: boolean;
|
|
1131
1110
|
moduleCache: ModuleCacheMap;
|
|
1132
1111
|
mockMap: MockMap;
|
|
1112
|
+
durations: {
|
|
1113
|
+
environment: number;
|
|
1114
|
+
prepare: number;
|
|
1115
|
+
};
|
|
1133
1116
|
}
|
|
1134
1117
|
|
|
1135
1118
|
interface CoverageProvider {
|
|
@@ -1470,6 +1453,84 @@ interface EnvironmentOptions {
|
|
|
1470
1453
|
[x: string]: unknown;
|
|
1471
1454
|
}
|
|
1472
1455
|
type VitestRunMode = 'test' | 'benchmark' | 'typecheck';
|
|
1456
|
+
interface SequenceOptions {
|
|
1457
|
+
/**
|
|
1458
|
+
* Class that handles sorting and sharding algorithm.
|
|
1459
|
+
* If you only need to change sorting, you can extend
|
|
1460
|
+
* your custom sequencer from `BaseSequencer` from `vitest/node`.
|
|
1461
|
+
* @default BaseSequencer
|
|
1462
|
+
*/
|
|
1463
|
+
sequencer?: TestSequencerConstructor;
|
|
1464
|
+
/**
|
|
1465
|
+
* Should tests run in random order.
|
|
1466
|
+
* @default false
|
|
1467
|
+
*/
|
|
1468
|
+
shuffle?: boolean;
|
|
1469
|
+
/**
|
|
1470
|
+
* Defines how setup files should be ordered
|
|
1471
|
+
* - 'parallel' will run all setup files in parallel
|
|
1472
|
+
* - 'list' will run all setup files in the order they are defined in the config file
|
|
1473
|
+
* @default 'parallel'
|
|
1474
|
+
*/
|
|
1475
|
+
setupFiles?: SequenceSetupFiles;
|
|
1476
|
+
/**
|
|
1477
|
+
* Seed for the random number generator.
|
|
1478
|
+
* @default Date.now()
|
|
1479
|
+
*/
|
|
1480
|
+
seed?: number;
|
|
1481
|
+
/**
|
|
1482
|
+
* Defines how hooks should be ordered
|
|
1483
|
+
* - `stack` will order "after" hooks in reverse order, "before" hooks will run sequentially
|
|
1484
|
+
* - `list` will order hooks in the order they are defined
|
|
1485
|
+
* - `parallel` will run hooks in a single group in parallel
|
|
1486
|
+
* @default 'parallel'
|
|
1487
|
+
*/
|
|
1488
|
+
hooks?: SequenceHooks;
|
|
1489
|
+
}
|
|
1490
|
+
interface DepsOptions {
|
|
1491
|
+
/**
|
|
1492
|
+
* Enable dependency optimization. This can improve the performance of your tests.
|
|
1493
|
+
*/
|
|
1494
|
+
experimentalOptimizer?: Omit<DepOptimizationConfig, 'disabled'> & {
|
|
1495
|
+
enabled: boolean;
|
|
1496
|
+
};
|
|
1497
|
+
/**
|
|
1498
|
+
* Externalize means that Vite will bypass the package to native Node.
|
|
1499
|
+
*
|
|
1500
|
+
* Externalized dependencies will not be applied Vite's transformers and resolvers.
|
|
1501
|
+
* And does not support HMR on reload.
|
|
1502
|
+
*
|
|
1503
|
+
* Typically, packages under `node_modules` are externalized.
|
|
1504
|
+
*/
|
|
1505
|
+
external?: (string | RegExp)[];
|
|
1506
|
+
/**
|
|
1507
|
+
* Vite will process inlined modules.
|
|
1508
|
+
*
|
|
1509
|
+
* This could be helpful to handle packages that ship `.js` in ESM format (that Node can't handle).
|
|
1510
|
+
*
|
|
1511
|
+
* If `true`, every dependency will be inlined
|
|
1512
|
+
*/
|
|
1513
|
+
inline?: (string | RegExp)[] | true;
|
|
1514
|
+
/**
|
|
1515
|
+
* Interpret CJS module's default as named exports
|
|
1516
|
+
*
|
|
1517
|
+
* @default true
|
|
1518
|
+
*/
|
|
1519
|
+
interopDefault?: boolean;
|
|
1520
|
+
/**
|
|
1521
|
+
* When a dependency is a valid ESM package, try to guess the cjs version based on the path.
|
|
1522
|
+
* This will significantly improve the performance in huge repo, but might potentially
|
|
1523
|
+
* cause some misalignment if a package have different logic in ESM and CJS mode.
|
|
1524
|
+
*
|
|
1525
|
+
* @default false
|
|
1526
|
+
*/
|
|
1527
|
+
fallbackCJS?: boolean;
|
|
1528
|
+
/**
|
|
1529
|
+
* Use experimental Node loader to resolve imports inside node_modules using Vite resolve algorithm.
|
|
1530
|
+
* @default false
|
|
1531
|
+
*/
|
|
1532
|
+
registerNodeLoader?: boolean;
|
|
1533
|
+
}
|
|
1473
1534
|
interface InlineConfig {
|
|
1474
1535
|
/**
|
|
1475
1536
|
* Name of the project. Will be used to display in the reporter.
|
|
@@ -1501,50 +1562,7 @@ interface InlineConfig {
|
|
|
1501
1562
|
/**
|
|
1502
1563
|
* Handling for dependencies inlining or externalizing
|
|
1503
1564
|
*/
|
|
1504
|
-
deps?:
|
|
1505
|
-
/**
|
|
1506
|
-
* Enable dependency optimization. This can improve the performance of your tests.
|
|
1507
|
-
*/
|
|
1508
|
-
experimentalOptimizer?: Omit<DepOptimizationConfig, 'disabled'> & {
|
|
1509
|
-
enabled: boolean;
|
|
1510
|
-
};
|
|
1511
|
-
/**
|
|
1512
|
-
* Externalize means that Vite will bypass the package to native Node.
|
|
1513
|
-
*
|
|
1514
|
-
* Externalized dependencies will not be applied Vite's transformers and resolvers.
|
|
1515
|
-
* And does not support HMR on reload.
|
|
1516
|
-
*
|
|
1517
|
-
* Typically, packages under `node_modules` are externalized.
|
|
1518
|
-
*/
|
|
1519
|
-
external?: (string | RegExp)[];
|
|
1520
|
-
/**
|
|
1521
|
-
* Vite will process inlined modules.
|
|
1522
|
-
*
|
|
1523
|
-
* This could be helpful to handle packages that ship `.js` in ESM format (that Node can't handle).
|
|
1524
|
-
*
|
|
1525
|
-
* If `true`, every dependency will be inlined
|
|
1526
|
-
*/
|
|
1527
|
-
inline?: (string | RegExp)[] | true;
|
|
1528
|
-
/**
|
|
1529
|
-
* Interpret CJS module's default as named exports
|
|
1530
|
-
*
|
|
1531
|
-
* @default true
|
|
1532
|
-
*/
|
|
1533
|
-
interopDefault?: boolean;
|
|
1534
|
-
/**
|
|
1535
|
-
* When a dependency is a valid ESM package, try to guess the cjs version based on the path.
|
|
1536
|
-
* This will significantly improve the performance in huge repo, but might potentially
|
|
1537
|
-
* cause some misalignment if a package have different logic in ESM and CJS mode.
|
|
1538
|
-
*
|
|
1539
|
-
* @default false
|
|
1540
|
-
*/
|
|
1541
|
-
fallbackCJS?: boolean;
|
|
1542
|
-
/**
|
|
1543
|
-
* Use experimental Node loader to resolve imports inside node_modules using Vite resolve algorithm.
|
|
1544
|
-
* @default false
|
|
1545
|
-
*/
|
|
1546
|
-
registerNodeLoader?: boolean;
|
|
1547
|
-
};
|
|
1565
|
+
deps?: DepsOptions;
|
|
1548
1566
|
/**
|
|
1549
1567
|
* Base directory to scan for the test files
|
|
1550
1568
|
*
|
|
@@ -1623,29 +1641,6 @@ interface InlineConfig {
|
|
|
1623
1641
|
* and/or paths to custom reporters.
|
|
1624
1642
|
*/
|
|
1625
1643
|
reporters?: Arrayable<BuiltinReporters | 'html' | Reporter | Omit<string, BuiltinReporters>>;
|
|
1626
|
-
/**
|
|
1627
|
-
* Truncates lines in the output to the given length.
|
|
1628
|
-
* @default stdout.columns || 80
|
|
1629
|
-
*/
|
|
1630
|
-
outputTruncateLength?: number;
|
|
1631
|
-
/**
|
|
1632
|
-
* Maximum number of line to show in a single diff.
|
|
1633
|
-
* @default 15
|
|
1634
|
-
*/
|
|
1635
|
-
outputDiffLines?: number;
|
|
1636
|
-
/**
|
|
1637
|
-
* The maximum number of characters allowed in a single object before doing a diff.
|
|
1638
|
-
* Vitest tries to stringify an object before doing a diff, but if the object is too large,
|
|
1639
|
-
* it will reduce the depth of the object to fit within this limit.
|
|
1640
|
-
* Because of this if object is too big or nested, you might not see the diff.
|
|
1641
|
-
* @default 10000
|
|
1642
|
-
*/
|
|
1643
|
-
outputDiffMaxSize?: number;
|
|
1644
|
-
/**
|
|
1645
|
-
* Maximum number of lines in a diff overall.
|
|
1646
|
-
* @default 50
|
|
1647
|
-
*/
|
|
1648
|
-
outputDiffMaxLines?: number;
|
|
1649
1644
|
/**
|
|
1650
1645
|
* Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
|
|
1651
1646
|
* Also definable individually per reporter by using an object instead.
|
|
@@ -1881,40 +1876,7 @@ interface InlineConfig {
|
|
|
1881
1876
|
/**
|
|
1882
1877
|
* Options for configuring the order of running tests.
|
|
1883
1878
|
*/
|
|
1884
|
-
sequence?:
|
|
1885
|
-
/**
|
|
1886
|
-
* Class that handles sorting and sharding algorithm.
|
|
1887
|
-
* If you only need to change sorting, you can extend
|
|
1888
|
-
* your custom sequencer from `BaseSequencer` from `vitest/node`.
|
|
1889
|
-
* @default BaseSequencer
|
|
1890
|
-
*/
|
|
1891
|
-
sequencer?: TestSequencerConstructor;
|
|
1892
|
-
/**
|
|
1893
|
-
* Should tests run in random order.
|
|
1894
|
-
* @default false
|
|
1895
|
-
*/
|
|
1896
|
-
shuffle?: boolean;
|
|
1897
|
-
/**
|
|
1898
|
-
* Defines how setup files should be ordered
|
|
1899
|
-
* - 'parallel' will run all setup files in parallel
|
|
1900
|
-
* - 'list' will run all setup files in the order they are defined in the config file
|
|
1901
|
-
* @default 'parallel'
|
|
1902
|
-
*/
|
|
1903
|
-
setupFiles?: SequenceSetupFiles;
|
|
1904
|
-
/**
|
|
1905
|
-
* Seed for the random number generator.
|
|
1906
|
-
* @default Date.now()
|
|
1907
|
-
*/
|
|
1908
|
-
seed?: number;
|
|
1909
|
-
/**
|
|
1910
|
-
* Defines how hooks should be ordered
|
|
1911
|
-
* - `stack` will order "after" hooks in reverse order, "before" hooks will run sequentially
|
|
1912
|
-
* - `list` will order hooks in the order they are defined
|
|
1913
|
-
* - `parallel` will run hooks in a single group in parallel
|
|
1914
|
-
* @default 'parallel'
|
|
1915
|
-
*/
|
|
1916
|
-
hooks?: SequenceHooks;
|
|
1917
|
-
};
|
|
1879
|
+
sequence?: SequenceOptions;
|
|
1918
1880
|
/**
|
|
1919
1881
|
* Specifies an `Object`, or an `Array` of `Object`,
|
|
1920
1882
|
* which defines aliases used to replace values in `import` or `require` statements.
|
|
@@ -1951,6 +1913,11 @@ interface InlineConfig {
|
|
|
1951
1913
|
* Requires `singleThread: true` OR `threads: false`.
|
|
1952
1914
|
*/
|
|
1953
1915
|
inspectBrk?: boolean;
|
|
1916
|
+
/**
|
|
1917
|
+
* Modify default Chai config. Vitest uses Chai for `expect` and `assert` matches.
|
|
1918
|
+
* https://github.com/chaijs/chai/blob/4.x.x/lib/chai/config.js
|
|
1919
|
+
*/
|
|
1920
|
+
chaiConfig?: ChaiConfig;
|
|
1954
1921
|
}
|
|
1955
1922
|
interface TypecheckConfig {
|
|
1956
1923
|
/**
|
|
@@ -2048,6 +2015,10 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2048
2015
|
typecheck: TypecheckConfig;
|
|
2049
2016
|
runner?: string;
|
|
2050
2017
|
}
|
|
2018
|
+
type ProjectConfig = Omit<UserConfig, 'sequencer' | 'shard' | 'watch' | 'run' | 'cache' | 'update' | 'reporters' | 'outputFile' | 'maxThreads' | 'minThreads' | 'useAtomics' | 'teardownTimeout' | 'silent' | 'watchExclude' | 'forceRerunTriggers' | 'testNamePattern' | 'ui' | 'open' | 'uiBase' | 'snapshotFormat' | 'resolveSnapshotPath' | 'passWithNoTests' | 'onConsoleLog' | 'dangerouslyIgnoreUnhandledErrors' | 'slowTestThreshold' | 'inspect' | 'inspectBrk' | 'deps' | 'coverage'> & {
|
|
2019
|
+
sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
|
|
2020
|
+
deps?: Omit<DepsOptions, 'registerNodeLoader'>;
|
|
2021
|
+
};
|
|
2051
2022
|
type RuntimeConfig = Pick<UserConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency'> & {
|
|
2052
2023
|
sequence?: {
|
|
2053
2024
|
hooks?: SequenceHooks;
|
|
@@ -2064,56 +2035,6 @@ declare module 'vite' {
|
|
|
2064
2035
|
}
|
|
2065
2036
|
}
|
|
2066
2037
|
|
|
2067
|
-
/**
|
|
2068
|
-
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
2069
|
-
*
|
|
2070
|
-
* This source code is licensed under the MIT license found in the
|
|
2071
|
-
* LICENSE file in the root directory of this source tree.
|
|
2072
|
-
*/
|
|
2073
|
-
|
|
2074
|
-
interface SnapshotReturnOptions {
|
|
2075
|
-
actual: string;
|
|
2076
|
-
count: number;
|
|
2077
|
-
expected?: string;
|
|
2078
|
-
key: string;
|
|
2079
|
-
pass: boolean;
|
|
2080
|
-
}
|
|
2081
|
-
interface SaveStatus {
|
|
2082
|
-
deleted: boolean;
|
|
2083
|
-
saved: boolean;
|
|
2084
|
-
}
|
|
2085
|
-
declare class SnapshotState {
|
|
2086
|
-
testFilePath: string;
|
|
2087
|
-
snapshotPath: string;
|
|
2088
|
-
private _counters;
|
|
2089
|
-
private _dirty;
|
|
2090
|
-
private _updateSnapshot;
|
|
2091
|
-
private _snapshotData;
|
|
2092
|
-
private _initialData;
|
|
2093
|
-
private _inlineSnapshots;
|
|
2094
|
-
private _uncheckedKeys;
|
|
2095
|
-
private _snapshotFormat;
|
|
2096
|
-
private _environment;
|
|
2097
|
-
private _fileExists;
|
|
2098
|
-
added: number;
|
|
2099
|
-
expand: boolean;
|
|
2100
|
-
matched: number;
|
|
2101
|
-
unmatched: number;
|
|
2102
|
-
updated: number;
|
|
2103
|
-
private constructor();
|
|
2104
|
-
static create(testFilePath: string, options: SnapshotStateOptions): Promise<SnapshotState>;
|
|
2105
|
-
markSnapshotsAsCheckedForTest(testName: string): void;
|
|
2106
|
-
private _inferInlineSnapshotStack;
|
|
2107
|
-
private _addSnapshot;
|
|
2108
|
-
clear(): void;
|
|
2109
|
-
save(): Promise<SaveStatus>;
|
|
2110
|
-
getUncheckedCount(): number;
|
|
2111
|
-
getUncheckedKeys(): Array<string>;
|
|
2112
|
-
removeUncheckedKeys(): void;
|
|
2113
|
-
match({ testName, received, key, inlineSnapshot, isInline, error, }: SnapshotMatchOptions): SnapshotReturnOptions;
|
|
2114
|
-
pack(): Promise<SnapshotResult>;
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
2038
|
type Promisify<O> = {
|
|
2118
2039
|
[K in keyof O]: O[K] extends (...args: infer A) => infer R ? O extends R ? Promisify<O[K]> : (...args: A) => Promise<R> : O[K];
|
|
2119
2040
|
};
|
|
@@ -2127,6 +2048,10 @@ declare module '@vitest/runner' {
|
|
|
2127
2048
|
interface TestContext {
|
|
2128
2049
|
expect: Vi.ExpectStatic;
|
|
2129
2050
|
}
|
|
2051
|
+
interface File {
|
|
2052
|
+
prepareDuration?: number;
|
|
2053
|
+
environmentLoad?: number;
|
|
2054
|
+
}
|
|
2130
2055
|
interface TaskBase {
|
|
2131
2056
|
logs?: UserConsoleLog[];
|
|
2132
2057
|
}
|
|
@@ -2136,7 +2061,7 @@ declare module '@vitest/runner' {
|
|
|
2136
2061
|
}
|
|
2137
2062
|
declare global {
|
|
2138
2063
|
namespace jest {
|
|
2139
|
-
interface Matchers<
|
|
2064
|
+
interface Matchers<_R, _T = {}> {
|
|
2140
2065
|
}
|
|
2141
2066
|
}
|
|
2142
2067
|
namespace Vi {
|
|
@@ -2154,23 +2079,24 @@ declare global {
|
|
|
2154
2079
|
}
|
|
2155
2080
|
interface AsymmetricMatchersContaining {
|
|
2156
2081
|
stringContaining(expected: string): any;
|
|
2157
|
-
objectContaining(expected:
|
|
2082
|
+
objectContaining<T = any>(expected: T): any;
|
|
2158
2083
|
arrayContaining<T = unknown>(expected: Array<T>): any;
|
|
2159
2084
|
stringMatching(expected: string | RegExp): any;
|
|
2160
2085
|
}
|
|
2161
2086
|
interface JestAssertion<T = any> extends jest.Matchers<void, T> {
|
|
2162
|
-
toMatchSnapshot<U extends {
|
|
2163
|
-
[P in keyof T]: any;
|
|
2164
|
-
}>(snapshot: Partial<U>, message?: string): void;
|
|
2165
|
-
toMatchSnapshot(message?: string): void;
|
|
2166
2087
|
matchSnapshot<U extends {
|
|
2167
2088
|
[P in keyof T]: any;
|
|
2168
2089
|
}>(snapshot: Partial<U>, message?: string): void;
|
|
2169
2090
|
matchSnapshot(message?: string): void;
|
|
2091
|
+
toMatchSnapshot<U extends {
|
|
2092
|
+
[P in keyof T]: any;
|
|
2093
|
+
}>(snapshot: Partial<U>, message?: string): void;
|
|
2094
|
+
toMatchSnapshot(message?: string): void;
|
|
2170
2095
|
toMatchInlineSnapshot<U extends {
|
|
2171
2096
|
[P in keyof T]: any;
|
|
2172
2097
|
}>(properties: Partial<U>, snapshot?: string, message?: string): void;
|
|
2173
2098
|
toMatchInlineSnapshot(snapshot?: string, message?: string): void;
|
|
2099
|
+
toMatchFileSnapshot(filepath: string, message?: string): Promise<void>;
|
|
2174
2100
|
toThrowErrorMatchingSnapshot(message?: string): void;
|
|
2175
2101
|
toThrowErrorMatchingInlineSnapshot(snapshot?: string, message?: string): void;
|
|
2176
2102
|
toEqual<E>(expected: E): void;
|
|
@@ -2256,4 +2182,4 @@ type Context = RootAndTarget & {
|
|
|
2256
2182
|
lastActivePath?: string;
|
|
2257
2183
|
};
|
|
2258
2184
|
|
|
2259
|
-
export {
|
|
2185
|
+
export { ResolvedCoverageOptions as $, AfterSuiteRunMeta as A, BenchmarkAPI as B, ChaiConfig as C, ArgumentsType$1 as D, EnvironmentOptions as E, FakeTimerInstallOpts as F, MutableArray as G, Constructable as H, InlineConfig as I, JSDOMOptions as J, ModuleCache as K, EnvironmentReturn as L, MockFactoryWithHelper as M, Nullable as N, Environment as O, ProjectConfig as P, OnServerRestartHandler as Q, RuntimeConfig as R, CoverageProvider as S, TscErrorInfo as T, UserConsoleLog as U, VitestEnvironment as V, WorkerContext as W, ReportContext as X, CoverageProviderModule as Y, CoverageReporter as Z, CoverageOptions as _, ResolvedConfig as a, BaseCoverageOptions as a0, CoverageIstanbulOptions as a1, CoverageC8Options as a2, CustomProviderOptions as a3, BenchmarkUserOptions as a4, Benchmark as a5, BenchmarkResult as a6, BenchFunction as a7, MockFactory as a8, MockMap as a9, TestSequencer as aa, WorkspaceSpec as ab, WorkspaceProject as ac, startVitest as ad, TestSequencerConstructor as ae, HtmlOptions as af, FileOptions as ag, CloverOptions as ah, CoberturaOptions as ai, HtmlSpaOptions as aj, LcovOptions as ak, LcovOnlyOptions as al, TeamcityOptions as am, TextOptions as an, ProjectOptions as ao, ModuleGraphData as b, Reporter as c, createExpect as d, RawErrsMap as e, CollectLineNumbers as f, globalExpect as g, CollectLines as h, RootAndTarget as i, Context as j, BuiltinEnvironment as k, VitestPool as l, CSSModuleScopeStrategy as m, ApiConfig as n, VitestRunMode as o, TypecheckConfig as p, UserConfig as q, RuntimeRPC as r, setupChaiConfig as s, ContextTestEnvironment as t, ContextRPC as u, Vitest as v, ResolveIdFunction as w, WorkerGlobalState as x, Awaitable as y, Arrayable as z };
|