vitest 0.29.8 → 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 +2 -81
- package/dist/browser.d.ts +5 -3
- package/dist/browser.js +5 -6
- package/dist/child.js +12 -16
- package/dist/{chunk-api-setup.3aabe9ac.js → chunk-api-setup.6662587e.js} +53 -48
- package/dist/{chunk-install-pkg.6aa7cf6d.js → chunk-install-pkg.6450b372.js} +32 -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 +26 -26
- package/dist/config.cjs +15 -2
- package/dist/config.d.ts +15 -4
- package/dist/config.js +10 -1
- package/dist/coverage.d.ts +5 -2
- package/dist/coverage.js +6 -0
- package/dist/entry.js +34 -34
- package/dist/environments.d.ts +5 -2
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.js +9 -11
- package/dist/loader.js +396 -13
- package/dist/node.d.ts +9 -7
- package/dist/node.js +27 -30
- package/dist/runners.d.ts +5 -2
- package/dist/runners.js +34 -31
- package/dist/{types-94cfe4b4.d.ts → types-f03c83c4.d.ts} +225 -306
- package/dist/{chunk-node-pkg.30d8b37e.js → vendor-cli-api.c04eaa34.js} +3845 -3326
- package/dist/vendor-constants.538d9b49.js +54 -0
- package/dist/{chunk-runtime-mocker.3283818a.js → vendor-execute.8eaab47b.js} +9 -12
- package/dist/{chunk-utils-base.b5ddfcc9.js → vendor-index.4f82d248.js} +80 -10
- package/dist/{chunk-env-node.affdd278.js → vendor-index.75f2b63d.js} +9 -2
- package/dist/{chunk-integrations-utils.23c19408.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.d6aa57f8.js → vendor-rpc.4d3d7a54.js} +5 -5
- package/dist/{chunk-integrations-run-once.ea614f17.js → vendor-run-once.69ce7172.js} +3 -3
- package/dist/{chunk-runtime-setup.5d504677.js → vendor-setup.common.cef38f4e.js} +2 -2
- package/dist/vendor-tasks.042d6084.js +14 -0
- package/dist/{chunk-utils-import.e488ace3.js → vendor-vi.a3ff54b1.js} +73 -2957
- package/dist/worker.js +13 -18
- package/package.json +29 -34
- package/dist/chunk-constants.bc18a549.js +0 -36
- package/dist/chunk-integrations-globals.49802775.js +0 -28
- package/dist/chunk-snapshot-env.a347d647.js +0 -11
- package/dist/chunk-utils-env.6b856dbf.js +0 -64
- package/dist/chunk-utils-tasks.8781fd71.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-integrations-coverage.d93ee824.js → vendor-coverage.a585b712.js} +0 -0
- /package/dist/{chunk-utils-global.fd174983.js → vendor-global.6795f91f.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,13 +244,53 @@ declare class Typechecker {
|
|
|
252
244
|
getTestPacks(): TaskResultPack[];
|
|
253
245
|
}
|
|
254
246
|
|
|
247
|
+
declare class VitestServer extends ViteNodeServer {
|
|
248
|
+
private _vitestPath?;
|
|
249
|
+
private getVitestPath;
|
|
250
|
+
protected processTransformResult(id: string, result: TransformResult$1): Promise<TransformResult$1>;
|
|
251
|
+
}
|
|
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
|
+
|
|
255
287
|
interface BrowserProviderOptions {
|
|
256
288
|
browser: string;
|
|
257
289
|
}
|
|
258
290
|
interface BrowserProvider {
|
|
259
291
|
name: string;
|
|
260
292
|
getSupportedBrowsers(): readonly string[];
|
|
261
|
-
initialize(ctx:
|
|
293
|
+
initialize(ctx: WorkspaceProject, options: BrowserProviderOptions): Awaitable$1<void>;
|
|
262
294
|
openPage(url: string): Awaitable$1<void>;
|
|
263
295
|
close(): Awaitable$1<void>;
|
|
264
296
|
}
|
|
@@ -298,7 +330,8 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
|
298
330
|
api: ApiConfig;
|
|
299
331
|
}
|
|
300
332
|
|
|
301
|
-
type
|
|
333
|
+
type WorkspaceSpec = [project: WorkspaceProject, testFile: string];
|
|
334
|
+
type RunWithFiles = (files: WorkspaceSpec[], invalidates?: string[]) => Promise<void>;
|
|
302
335
|
interface ProcessPool {
|
|
303
336
|
runTests: RunWithFiles;
|
|
304
337
|
close: () => Promise<void>;
|
|
@@ -309,7 +342,7 @@ interface CollectingPromise {
|
|
|
309
342
|
resolve: () => void;
|
|
310
343
|
}
|
|
311
344
|
declare class StateManager {
|
|
312
|
-
filesMap: Map<string, File>;
|
|
345
|
+
filesMap: Map<string, File[]>;
|
|
313
346
|
pathsSet: Set<string>;
|
|
314
347
|
collectingPromise: CollectingPromise | undefined;
|
|
315
348
|
browserTestPromises: Map<string, {
|
|
@@ -331,7 +364,7 @@ declare class StateManager {
|
|
|
331
364
|
getFailedFilepaths(): string[];
|
|
332
365
|
collectPaths(paths?: string[]): void;
|
|
333
366
|
collectFiles(files?: File[]): void;
|
|
334
|
-
clearFiles(paths?: string[]): void;
|
|
367
|
+
clearFiles(project: WorkspaceProject, paths?: string[]): void;
|
|
335
368
|
updateId(task: Task): void;
|
|
336
369
|
updateTasks(packs: TaskResultPack[]): void;
|
|
337
370
|
updateUserLog(log: UserConsoleLog): void;
|
|
@@ -371,12 +404,13 @@ interface SuiteResultCache {
|
|
|
371
404
|
}
|
|
372
405
|
declare class ResultsCache {
|
|
373
406
|
private cache;
|
|
407
|
+
private workspacesKeyMap;
|
|
374
408
|
private cachePath;
|
|
375
409
|
private version;
|
|
376
410
|
private root;
|
|
377
411
|
getCachePath(): string | null;
|
|
378
412
|
setConfig(root: string, config: ResolvedConfig['cache']): void;
|
|
379
|
-
getResults(
|
|
413
|
+
getResults(key: string): SuiteResultCache | undefined;
|
|
380
414
|
readFromCache(): Promise<void>;
|
|
381
415
|
updateResults(files: File[]): void;
|
|
382
416
|
removeFromCache(filepath: string): void;
|
|
@@ -399,16 +433,17 @@ declare function startVitest(mode: VitestRunMode, cliFilters: string[], options:
|
|
|
399
433
|
type FileStatsCache = Pick<Stats, 'size'>;
|
|
400
434
|
declare class FilesStatsCache {
|
|
401
435
|
cache: Map<string, FileStatsCache>;
|
|
402
|
-
getStats(
|
|
403
|
-
|
|
436
|
+
getStats(key: string): FileStatsCache | undefined;
|
|
437
|
+
populateStats(root: string, specs: WorkspaceSpec[]): Promise<void>;
|
|
438
|
+
updateStats(fsPath: string, key: string): Promise<void>;
|
|
404
439
|
removeStats(fsPath: string): void;
|
|
405
440
|
}
|
|
406
441
|
|
|
407
442
|
declare class VitestCache {
|
|
408
443
|
results: ResultsCache;
|
|
409
444
|
stats: FilesStatsCache;
|
|
410
|
-
getFileTestResults(
|
|
411
|
-
getFileStats(
|
|
445
|
+
getFileTestResults(key: string): SuiteResultCache | undefined;
|
|
446
|
+
getFileStats(key: string): {
|
|
412
447
|
size: number;
|
|
413
448
|
} | undefined;
|
|
414
449
|
static resolveCacheDir(root: string, dir: string | undefined): string;
|
|
@@ -418,17 +453,10 @@ declare class VitestCache {
|
|
|
418
453
|
}>;
|
|
419
454
|
}
|
|
420
455
|
|
|
421
|
-
declare class VitestServer extends ViteNodeServer {
|
|
422
|
-
private _vitestPath?;
|
|
423
|
-
private getVitestPath;
|
|
424
|
-
protected processTransformResult(result: TransformResult$1): Promise<TransformResult$1>;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
456
|
declare class Vitest {
|
|
428
457
|
readonly mode: VitestRunMode;
|
|
429
458
|
config: ResolvedConfig;
|
|
430
|
-
configOverride: Partial<ResolvedConfig
|
|
431
|
-
browser: ViteDevServer;
|
|
459
|
+
configOverride: Partial<ResolvedConfig>;
|
|
432
460
|
server: ViteDevServer;
|
|
433
461
|
state: StateManager;
|
|
434
462
|
snapshot: SnapshotManager;
|
|
@@ -438,7 +466,6 @@ declare class Vitest {
|
|
|
438
466
|
browserProvider: BrowserProvider | undefined;
|
|
439
467
|
logger: Logger;
|
|
440
468
|
pool: ProcessPool | undefined;
|
|
441
|
-
typechecker: Typechecker | undefined;
|
|
442
469
|
vitenode: VitestServer;
|
|
443
470
|
invalidates: Set<string>;
|
|
444
471
|
changedTests: Set<string>;
|
|
@@ -448,19 +475,24 @@ declare class Vitest {
|
|
|
448
475
|
isFirstRun: boolean;
|
|
449
476
|
restartsCount: number;
|
|
450
477
|
runner: ViteNodeRunner;
|
|
478
|
+
private coreWorkspace;
|
|
479
|
+
projects: WorkspaceProject[];
|
|
480
|
+
private projectsTestFiles;
|
|
451
481
|
constructor(mode: VitestRunMode);
|
|
452
482
|
private _onRestartListeners;
|
|
453
483
|
private _onSetServer;
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
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[]>;
|
|
460
491
|
start(filters?: string[]): Promise<void>;
|
|
461
492
|
private getTestDependencies;
|
|
462
|
-
filterTestsBySource(
|
|
463
|
-
|
|
493
|
+
filterTestsBySource(specs: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
|
|
494
|
+
getProjectsByTestFile(file: string): WorkspaceSpec[];
|
|
495
|
+
runFiles(paths: WorkspaceSpec[]): Promise<void>;
|
|
464
496
|
rerunFiles(files?: string[], trigger?: string): Promise<void>;
|
|
465
497
|
changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
|
|
466
498
|
changeFilenamePattern(pattern: string): Promise<void>;
|
|
@@ -468,6 +500,7 @@ declare class Vitest {
|
|
|
468
500
|
updateSnapshot(files?: string[]): Promise<void>;
|
|
469
501
|
private _rerunTimer;
|
|
470
502
|
private scheduleRerun;
|
|
503
|
+
getModuleProjects(id: string): WorkspaceProject[];
|
|
471
504
|
private unregisterWatcher;
|
|
472
505
|
private registerWatcher;
|
|
473
506
|
/**
|
|
@@ -481,13 +514,8 @@ declare class Vitest {
|
|
|
481
514
|
*/
|
|
482
515
|
exit(force?: boolean): Promise<void>;
|
|
483
516
|
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
|
|
484
|
-
|
|
485
|
-
private
|
|
486
|
-
globAllTestFiles(config: ResolvedConfig, cwd: string): Promise<string[]>;
|
|
487
|
-
filterFiles(testFiles: string[], filters?: string[]): string[];
|
|
488
|
-
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
489
|
-
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
490
|
-
isBrowserEnabled(): boolean | 0;
|
|
517
|
+
globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
|
|
518
|
+
private isTargetFile;
|
|
491
519
|
shouldKeepServer(): boolean;
|
|
492
520
|
isInSourceTestFile(code: string): boolean;
|
|
493
521
|
onServerRestart(fn: OnServerRestartHandler): void;
|
|
@@ -503,8 +531,8 @@ interface TestSequencer {
|
|
|
503
531
|
* Slicing tests into shards. Will be run before `sort`.
|
|
504
532
|
* Only run, if `shard` is defined.
|
|
505
533
|
*/
|
|
506
|
-
shard(files:
|
|
507
|
-
sort(files:
|
|
534
|
+
shard(files: WorkspaceSpec[]): Awaitable<WorkspaceSpec[]>;
|
|
535
|
+
sort(files: WorkspaceSpec[]): Awaitable<WorkspaceSpec[]>;
|
|
508
536
|
}
|
|
509
537
|
interface TestSequencerConstructor {
|
|
510
538
|
new (ctx: Vitest): TestSequencer;
|
|
@@ -588,7 +616,7 @@ interface ListRendererOptions$1 {
|
|
|
588
616
|
showHeap: boolean;
|
|
589
617
|
mode: VitestRunMode;
|
|
590
618
|
}
|
|
591
|
-
declare
|
|
619
|
+
declare function createListRenderer(_tasks: Task[], options: ListRendererOptions$1): {
|
|
592
620
|
start(): any;
|
|
593
621
|
update(_tasks: Task[]): any;
|
|
594
622
|
stop(): Promise<any>;
|
|
@@ -709,7 +737,7 @@ interface ListRendererOptions {
|
|
|
709
737
|
logger: Logger;
|
|
710
738
|
showHeap: boolean;
|
|
711
739
|
}
|
|
712
|
-
declare
|
|
740
|
+
declare function createTableRenderer(_tasks: Task[], options: ListRendererOptions): {
|
|
713
741
|
start(): any;
|
|
714
742
|
update(_tasks: Task[]): any;
|
|
715
743
|
stop(): Promise<any>;
|
|
@@ -748,42 +776,48 @@ declare const ReportersMap: {
|
|
|
748
776
|
};
|
|
749
777
|
type BuiltinReporters = keyof typeof ReportersMap;
|
|
750
778
|
|
|
751
|
-
|
|
752
|
-
|
|
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;
|
|
753
794
|
stack?: string;
|
|
754
795
|
watchFiles?: string[];
|
|
755
796
|
}
|
|
756
797
|
|
|
757
|
-
|
|
758
|
-
chunkName?: string;
|
|
759
|
-
cycle?: string[];
|
|
760
|
-
exportName?: string;
|
|
761
|
-
exporter?: string;
|
|
762
|
-
guess?: string;
|
|
763
|
-
importer?: string;
|
|
764
|
-
missing?: string;
|
|
765
|
-
modules?: string[];
|
|
766
|
-
names?: string[];
|
|
767
|
-
reexporter?: string;
|
|
768
|
-
source?: string;
|
|
769
|
-
sources?: string[];
|
|
770
|
-
}
|
|
798
|
+
type RollupWarning = RollupLog;
|
|
771
799
|
|
|
772
|
-
interface
|
|
800
|
+
interface RollupLog {
|
|
801
|
+
binding?: string;
|
|
802
|
+
cause?: unknown;
|
|
773
803
|
code?: string;
|
|
804
|
+
exporter?: string;
|
|
774
805
|
frame?: string;
|
|
775
806
|
hook?: string;
|
|
776
807
|
id?: string;
|
|
808
|
+
ids?: string[];
|
|
777
809
|
loc?: {
|
|
778
810
|
column: number;
|
|
779
811
|
file?: string;
|
|
780
812
|
line: number;
|
|
781
813
|
};
|
|
782
814
|
message: string;
|
|
783
|
-
|
|
815
|
+
names?: string[];
|
|
784
816
|
plugin?: string;
|
|
785
817
|
pluginCode?: string;
|
|
786
818
|
pos?: number;
|
|
819
|
+
reexporter?: string;
|
|
820
|
+
stack?: string;
|
|
787
821
|
url?: string;
|
|
788
822
|
}
|
|
789
823
|
|
|
@@ -793,8 +827,9 @@ interface ExistingRawSourceMap {
|
|
|
793
827
|
names: string[];
|
|
794
828
|
sourceRoot?: string;
|
|
795
829
|
sources: string[];
|
|
796
|
-
sourcesContent?: string[];
|
|
830
|
+
sourcesContent?: (string | null)[];
|
|
797
831
|
version: number;
|
|
832
|
+
x_google_ignoreList?: number[];
|
|
798
833
|
}
|
|
799
834
|
|
|
800
835
|
interface SourceMap {
|
|
@@ -802,7 +837,7 @@ interface SourceMap {
|
|
|
802
837
|
mappings: string;
|
|
803
838
|
names: string[];
|
|
804
839
|
sources: string[];
|
|
805
|
-
sourcesContent: string[];
|
|
840
|
+
sourcesContent: (string | null)[];
|
|
806
841
|
version: number;
|
|
807
842
|
toString(): string;
|
|
808
843
|
toUrl(): string;
|
|
@@ -810,11 +845,8 @@ interface SourceMap {
|
|
|
810
845
|
|
|
811
846
|
type SourceMapInput = ExistingRawSourceMap | string | null | { mappings: '' };
|
|
812
847
|
|
|
813
|
-
type PartialNull<T> = {
|
|
814
|
-
[P in keyof T]: T[P] | null;
|
|
815
|
-
};
|
|
816
|
-
|
|
817
848
|
interface ModuleOptions {
|
|
849
|
+
assertions: Record<string, string>;
|
|
818
850
|
meta: CustomPluginOptions;
|
|
819
851
|
moduleSideEffects: boolean | 'no-treeshake';
|
|
820
852
|
syntheticNamedExports: boolean | string;
|
|
@@ -840,6 +872,7 @@ interface MinimalPluginContext {
|
|
|
840
872
|
interface EmittedAsset {
|
|
841
873
|
fileName?: string;
|
|
842
874
|
name?: string;
|
|
875
|
+
needsCodeReference?: boolean;
|
|
843
876
|
source?: string | Uint8Array;
|
|
844
877
|
type: 'asset';
|
|
845
878
|
}
|
|
@@ -856,10 +889,6 @@ interface EmittedChunk {
|
|
|
856
889
|
|
|
857
890
|
type EmittedFile = EmittedAsset | EmittedChunk;
|
|
858
891
|
|
|
859
|
-
type EmitAsset = (name: string, source?: string | Uint8Array) => string;
|
|
860
|
-
|
|
861
|
-
type EmitChunk = (id: string, options?: { name?: string }) => string;
|
|
862
|
-
|
|
863
892
|
type EmitFile = (emittedFile: EmittedFile) => string;
|
|
864
893
|
|
|
865
894
|
interface ModuleInfo extends ModuleOptions {
|
|
@@ -868,6 +897,8 @@ interface ModuleInfo extends ModuleOptions {
|
|
|
868
897
|
dynamicImporters: readonly string[];
|
|
869
898
|
dynamicallyImportedIdResolutions: readonly ResolvedId[];
|
|
870
899
|
dynamicallyImportedIds: readonly string[];
|
|
900
|
+
exportedBindings: Record<string, string[]> | null;
|
|
901
|
+
exports: string[] | null;
|
|
871
902
|
hasDefaultExport: boolean | null;
|
|
872
903
|
/** @deprecated Use `moduleSideEffects` instead */
|
|
873
904
|
hasModuleSideEffects: boolean | 'no-treeshake';
|
|
@@ -891,22 +922,12 @@ interface CustomPluginOptions {
|
|
|
891
922
|
interface PluginContext extends MinimalPluginContext {
|
|
892
923
|
addWatchFile: (id: string) => void;
|
|
893
924
|
cache: PluginCache;
|
|
894
|
-
/** @deprecated Use `this.emitFile` instead */
|
|
895
|
-
emitAsset: EmitAsset;
|
|
896
|
-
/** @deprecated Use `this.emitFile` instead */
|
|
897
|
-
emitChunk: EmitChunk;
|
|
898
925
|
emitFile: EmitFile;
|
|
899
|
-
error: (
|
|
900
|
-
/** @deprecated Use `this.getFileName` instead */
|
|
901
|
-
getAssetFileName: (assetReferenceId: string) => string;
|
|
902
|
-
/** @deprecated Use `this.getFileName` instead */
|
|
903
|
-
getChunkFileName: (chunkReferenceId: string) => string;
|
|
926
|
+
error: (error: RollupError | string, pos?: number | { column: number; line: number }) => never;
|
|
904
927
|
getFileName: (fileReferenceId: string) => string;
|
|
905
928
|
getModuleIds: () => IterableIterator<string>;
|
|
906
929
|
getModuleInfo: GetModuleInfo;
|
|
907
930
|
getWatchFiles: () => string[];
|
|
908
|
-
/** @deprecated Use `this.resolve` instead */
|
|
909
|
-
isExternal: IsExternal;
|
|
910
931
|
load: (
|
|
911
932
|
options: { id: string; resolveDependencies?: boolean } & Partial<PartialNull<ModuleOptions>>
|
|
912
933
|
) => Promise<ModuleInfo>;
|
|
@@ -916,10 +937,13 @@ interface PluginContext extends MinimalPluginContext {
|
|
|
916
937
|
resolve: (
|
|
917
938
|
source: string,
|
|
918
939
|
importer?: string,
|
|
919
|
-
options?: {
|
|
940
|
+
options?: {
|
|
941
|
+
assertions?: Record<string, string>;
|
|
942
|
+
custom?: CustomPluginOptions;
|
|
943
|
+
isEntry?: boolean;
|
|
944
|
+
skipSelf?: boolean;
|
|
945
|
+
}
|
|
920
946
|
) => Promise<ResolvedId | null>;
|
|
921
|
-
/** @deprecated Use `this.resolve` instead */
|
|
922
|
-
resolveId: (source: string, importer?: string) => Promise<string | null>;
|
|
923
947
|
setAssetSource: (assetReferenceId: string, source: string | Uint8Array) => void;
|
|
924
948
|
warn: (warning: RollupWarning | string, pos?: number | { column: number; line: number }) => void;
|
|
925
949
|
}
|
|
@@ -932,19 +956,14 @@ interface PluginContextMeta {
|
|
|
932
956
|
interface ResolvedId extends ModuleOptions {
|
|
933
957
|
external: boolean | 'absolute';
|
|
934
958
|
id: string;
|
|
959
|
+
resolvedBy: string;
|
|
935
960
|
}
|
|
936
961
|
|
|
937
|
-
type IsExternal = (
|
|
938
|
-
source: string,
|
|
939
|
-
importer: string | undefined,
|
|
940
|
-
isResolved: boolean
|
|
941
|
-
) => boolean;
|
|
942
|
-
|
|
943
962
|
interface TransformPluginContext extends PluginContext {
|
|
944
963
|
getCombinedSourcemap: () => SourceMap;
|
|
945
964
|
}
|
|
946
965
|
|
|
947
|
-
type TransformResult = string |
|
|
966
|
+
type TransformResult = string | NullValue | Partial<SourceDescription>;
|
|
948
967
|
type PreserveEntrySignaturesOption = false | 'strict' | 'allow-extension' | 'exports-only';
|
|
949
968
|
|
|
950
969
|
interface AcornNode {
|
|
@@ -1047,53 +1066,6 @@ declare type BirpcReturn<RemoteFunctions> = {
|
|
|
1047
1066
|
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
|
|
1048
1067
|
};
|
|
1049
1068
|
|
|
1050
|
-
type SnapshotData = Record<string, string>;
|
|
1051
|
-
type SnapshotUpdateState = 'all' | 'new' | 'none';
|
|
1052
|
-
interface SnapshotStateOptions {
|
|
1053
|
-
updateSnapshot: SnapshotUpdateState;
|
|
1054
|
-
expand?: boolean;
|
|
1055
|
-
snapshotFormat?: OptionsReceived;
|
|
1056
|
-
resolveSnapshotPath?: (path: string, extension: string) => string;
|
|
1057
|
-
}
|
|
1058
|
-
interface SnapshotMatchOptions {
|
|
1059
|
-
testName: string;
|
|
1060
|
-
received: unknown;
|
|
1061
|
-
key?: string;
|
|
1062
|
-
inlineSnapshot?: string;
|
|
1063
|
-
isInline: boolean;
|
|
1064
|
-
error?: Error;
|
|
1065
|
-
}
|
|
1066
|
-
interface SnapshotResult {
|
|
1067
|
-
filepath: string;
|
|
1068
|
-
added: number;
|
|
1069
|
-
fileDeleted: boolean;
|
|
1070
|
-
matched: number;
|
|
1071
|
-
unchecked: number;
|
|
1072
|
-
uncheckedKeys: Array<string>;
|
|
1073
|
-
unmatched: number;
|
|
1074
|
-
updated: number;
|
|
1075
|
-
}
|
|
1076
|
-
interface UncheckedSnapshot {
|
|
1077
|
-
filePath: string;
|
|
1078
|
-
keys: Array<string>;
|
|
1079
|
-
}
|
|
1080
|
-
interface SnapshotSummary {
|
|
1081
|
-
added: number;
|
|
1082
|
-
didUpdate: boolean;
|
|
1083
|
-
failure: boolean;
|
|
1084
|
-
filesAdded: number;
|
|
1085
|
-
filesRemoved: number;
|
|
1086
|
-
filesRemovedList: Array<string>;
|
|
1087
|
-
filesUnmatched: number;
|
|
1088
|
-
filesUpdated: number;
|
|
1089
|
-
matched: number;
|
|
1090
|
-
total: number;
|
|
1091
|
-
unchecked: number;
|
|
1092
|
-
uncheckedKeysByFile: Array<UncheckedSnapshot>;
|
|
1093
|
-
unmatched: number;
|
|
1094
|
-
updated: number;
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
1069
|
interface RuntimeRPC {
|
|
1098
1070
|
fetch: (id: string, environment: VitestEnvironment) => Promise<FetchResult>;
|
|
1099
1071
|
resolveId: (id: string, importer: string | undefined, environment: VitestEnvironment) => Promise<ViteNodeResolveId | null>;
|
|
@@ -1137,6 +1109,10 @@ interface WorkerGlobalState {
|
|
|
1137
1109
|
environmentTeardownRun?: boolean;
|
|
1138
1110
|
moduleCache: ModuleCacheMap;
|
|
1139
1111
|
mockMap: MockMap;
|
|
1112
|
+
durations: {
|
|
1113
|
+
environment: number;
|
|
1114
|
+
prepare: number;
|
|
1115
|
+
};
|
|
1140
1116
|
}
|
|
1141
1117
|
|
|
1142
1118
|
interface CoverageProvider {
|
|
@@ -1477,6 +1453,84 @@ interface EnvironmentOptions {
|
|
|
1477
1453
|
[x: string]: unknown;
|
|
1478
1454
|
}
|
|
1479
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
|
+
}
|
|
1480
1534
|
interface InlineConfig {
|
|
1481
1535
|
/**
|
|
1482
1536
|
* Name of the project. Will be used to display in the reporter.
|
|
@@ -1508,50 +1562,7 @@ interface InlineConfig {
|
|
|
1508
1562
|
/**
|
|
1509
1563
|
* Handling for dependencies inlining or externalizing
|
|
1510
1564
|
*/
|
|
1511
|
-
deps?:
|
|
1512
|
-
/**
|
|
1513
|
-
* Enable dependency optimization. This can improve the performance of your tests.
|
|
1514
|
-
*/
|
|
1515
|
-
experimentalOptimizer?: Omit<DepOptimizationConfig, 'disabled'> & {
|
|
1516
|
-
enabled: boolean;
|
|
1517
|
-
};
|
|
1518
|
-
/**
|
|
1519
|
-
* Externalize means that Vite will bypass the package to native Node.
|
|
1520
|
-
*
|
|
1521
|
-
* Externalized dependencies will not be applied Vite's transformers and resolvers.
|
|
1522
|
-
* And does not support HMR on reload.
|
|
1523
|
-
*
|
|
1524
|
-
* Typically, packages under `node_modules` are externalized.
|
|
1525
|
-
*/
|
|
1526
|
-
external?: (string | RegExp)[];
|
|
1527
|
-
/**
|
|
1528
|
-
* Vite will process inlined modules.
|
|
1529
|
-
*
|
|
1530
|
-
* This could be helpful to handle packages that ship `.js` in ESM format (that Node can't handle).
|
|
1531
|
-
*
|
|
1532
|
-
* If `true`, every dependency will be inlined
|
|
1533
|
-
*/
|
|
1534
|
-
inline?: (string | RegExp)[] | true;
|
|
1535
|
-
/**
|
|
1536
|
-
* Interpret CJS module's default as named exports
|
|
1537
|
-
*
|
|
1538
|
-
* @default true
|
|
1539
|
-
*/
|
|
1540
|
-
interopDefault?: boolean;
|
|
1541
|
-
/**
|
|
1542
|
-
* When a dependency is a valid ESM package, try to guess the cjs version based on the path.
|
|
1543
|
-
* This will significantly improve the performance in huge repo, but might potentially
|
|
1544
|
-
* cause some misalignment if a package have different logic in ESM and CJS mode.
|
|
1545
|
-
*
|
|
1546
|
-
* @default false
|
|
1547
|
-
*/
|
|
1548
|
-
fallbackCJS?: boolean;
|
|
1549
|
-
/**
|
|
1550
|
-
* Use experimental Node loader to resolve imports inside node_modules using Vite resolve algorithm.
|
|
1551
|
-
* @default false
|
|
1552
|
-
*/
|
|
1553
|
-
registerNodeLoader?: boolean;
|
|
1554
|
-
};
|
|
1565
|
+
deps?: DepsOptions;
|
|
1555
1566
|
/**
|
|
1556
1567
|
* Base directory to scan for the test files
|
|
1557
1568
|
*
|
|
@@ -1630,29 +1641,6 @@ interface InlineConfig {
|
|
|
1630
1641
|
* and/or paths to custom reporters.
|
|
1631
1642
|
*/
|
|
1632
1643
|
reporters?: Arrayable<BuiltinReporters | 'html' | Reporter | Omit<string, BuiltinReporters>>;
|
|
1633
|
-
/**
|
|
1634
|
-
* Truncates lines in the output to the given length.
|
|
1635
|
-
* @default stdout.columns || 80
|
|
1636
|
-
*/
|
|
1637
|
-
outputTruncateLength?: number;
|
|
1638
|
-
/**
|
|
1639
|
-
* Maximum number of line to show in a single diff.
|
|
1640
|
-
* @default 15
|
|
1641
|
-
*/
|
|
1642
|
-
outputDiffLines?: number;
|
|
1643
|
-
/**
|
|
1644
|
-
* The maximum number of characters allowed in a single object before doing a diff.
|
|
1645
|
-
* Vitest tries to stringify an object before doing a diff, but if the object is too large,
|
|
1646
|
-
* it will reduce the depth of the object to fit within this limit.
|
|
1647
|
-
* Because of this if object is too big or nested, you might not see the diff.
|
|
1648
|
-
* @default 10000
|
|
1649
|
-
*/
|
|
1650
|
-
outputDiffMaxSize?: number;
|
|
1651
|
-
/**
|
|
1652
|
-
* Maximum number of lines in a diff overall.
|
|
1653
|
-
* @default 50
|
|
1654
|
-
*/
|
|
1655
|
-
outputDiffMaxLines?: number;
|
|
1656
1644
|
/**
|
|
1657
1645
|
* Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
|
|
1658
1646
|
* Also definable individually per reporter by using an object instead.
|
|
@@ -1888,40 +1876,7 @@ interface InlineConfig {
|
|
|
1888
1876
|
/**
|
|
1889
1877
|
* Options for configuring the order of running tests.
|
|
1890
1878
|
*/
|
|
1891
|
-
sequence?:
|
|
1892
|
-
/**
|
|
1893
|
-
* Class that handles sorting and sharding algorithm.
|
|
1894
|
-
* If you only need to change sorting, you can extend
|
|
1895
|
-
* your custom sequencer from `BaseSequencer` from `vitest/node`.
|
|
1896
|
-
* @default BaseSequencer
|
|
1897
|
-
*/
|
|
1898
|
-
sequencer?: TestSequencerConstructor;
|
|
1899
|
-
/**
|
|
1900
|
-
* Should tests run in random order.
|
|
1901
|
-
* @default false
|
|
1902
|
-
*/
|
|
1903
|
-
shuffle?: boolean;
|
|
1904
|
-
/**
|
|
1905
|
-
* Defines how setup files should be ordered
|
|
1906
|
-
* - 'parallel' will run all setup files in parallel
|
|
1907
|
-
* - 'list' will run all setup files in the order they are defined in the config file
|
|
1908
|
-
* @default 'parallel'
|
|
1909
|
-
*/
|
|
1910
|
-
setupFiles?: SequenceSetupFiles;
|
|
1911
|
-
/**
|
|
1912
|
-
* Seed for the random number generator.
|
|
1913
|
-
* @default Date.now()
|
|
1914
|
-
*/
|
|
1915
|
-
seed?: number;
|
|
1916
|
-
/**
|
|
1917
|
-
* Defines how hooks should be ordered
|
|
1918
|
-
* - `stack` will order "after" hooks in reverse order, "before" hooks will run sequentially
|
|
1919
|
-
* - `list` will order hooks in the order they are defined
|
|
1920
|
-
* - `parallel` will run hooks in a single group in parallel
|
|
1921
|
-
* @default 'parallel'
|
|
1922
|
-
*/
|
|
1923
|
-
hooks?: SequenceHooks;
|
|
1924
|
-
};
|
|
1879
|
+
sequence?: SequenceOptions;
|
|
1925
1880
|
/**
|
|
1926
1881
|
* Specifies an `Object`, or an `Array` of `Object`,
|
|
1927
1882
|
* which defines aliases used to replace values in `import` or `require` statements.
|
|
@@ -1958,6 +1913,11 @@ interface InlineConfig {
|
|
|
1958
1913
|
* Requires `singleThread: true` OR `threads: false`.
|
|
1959
1914
|
*/
|
|
1960
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;
|
|
1961
1921
|
}
|
|
1962
1922
|
interface TypecheckConfig {
|
|
1963
1923
|
/**
|
|
@@ -2055,6 +2015,10 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2055
2015
|
typecheck: TypecheckConfig;
|
|
2056
2016
|
runner?: string;
|
|
2057
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
|
+
};
|
|
2058
2022
|
type RuntimeConfig = Pick<UserConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency'> & {
|
|
2059
2023
|
sequence?: {
|
|
2060
2024
|
hooks?: SequenceHooks;
|
|
@@ -2071,56 +2035,6 @@ declare module 'vite' {
|
|
|
2071
2035
|
}
|
|
2072
2036
|
}
|
|
2073
2037
|
|
|
2074
|
-
/**
|
|
2075
|
-
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
2076
|
-
*
|
|
2077
|
-
* This source code is licensed under the MIT license found in the
|
|
2078
|
-
* LICENSE file in the root directory of this source tree.
|
|
2079
|
-
*/
|
|
2080
|
-
|
|
2081
|
-
interface SnapshotReturnOptions {
|
|
2082
|
-
actual: string;
|
|
2083
|
-
count: number;
|
|
2084
|
-
expected?: string;
|
|
2085
|
-
key: string;
|
|
2086
|
-
pass: boolean;
|
|
2087
|
-
}
|
|
2088
|
-
interface SaveStatus {
|
|
2089
|
-
deleted: boolean;
|
|
2090
|
-
saved: boolean;
|
|
2091
|
-
}
|
|
2092
|
-
declare class SnapshotState {
|
|
2093
|
-
testFilePath: string;
|
|
2094
|
-
snapshotPath: string;
|
|
2095
|
-
private _counters;
|
|
2096
|
-
private _dirty;
|
|
2097
|
-
private _updateSnapshot;
|
|
2098
|
-
private _snapshotData;
|
|
2099
|
-
private _initialData;
|
|
2100
|
-
private _inlineSnapshots;
|
|
2101
|
-
private _uncheckedKeys;
|
|
2102
|
-
private _snapshotFormat;
|
|
2103
|
-
private _environment;
|
|
2104
|
-
private _fileExists;
|
|
2105
|
-
added: number;
|
|
2106
|
-
expand: boolean;
|
|
2107
|
-
matched: number;
|
|
2108
|
-
unmatched: number;
|
|
2109
|
-
updated: number;
|
|
2110
|
-
private constructor();
|
|
2111
|
-
static create(testFilePath: string, options: SnapshotStateOptions): Promise<SnapshotState>;
|
|
2112
|
-
markSnapshotsAsCheckedForTest(testName: string): void;
|
|
2113
|
-
private _inferInlineSnapshotStack;
|
|
2114
|
-
private _addSnapshot;
|
|
2115
|
-
clear(): void;
|
|
2116
|
-
save(): Promise<SaveStatus>;
|
|
2117
|
-
getUncheckedCount(): number;
|
|
2118
|
-
getUncheckedKeys(): Array<string>;
|
|
2119
|
-
removeUncheckedKeys(): void;
|
|
2120
|
-
match({ testName, received, key, inlineSnapshot, isInline, error, }: SnapshotMatchOptions): SnapshotReturnOptions;
|
|
2121
|
-
pack(): Promise<SnapshotResult>;
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
2038
|
type Promisify<O> = {
|
|
2125
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];
|
|
2126
2040
|
};
|
|
@@ -2134,6 +2048,10 @@ declare module '@vitest/runner' {
|
|
|
2134
2048
|
interface TestContext {
|
|
2135
2049
|
expect: Vi.ExpectStatic;
|
|
2136
2050
|
}
|
|
2051
|
+
interface File {
|
|
2052
|
+
prepareDuration?: number;
|
|
2053
|
+
environmentLoad?: number;
|
|
2054
|
+
}
|
|
2137
2055
|
interface TaskBase {
|
|
2138
2056
|
logs?: UserConsoleLog[];
|
|
2139
2057
|
}
|
|
@@ -2143,7 +2061,7 @@ declare module '@vitest/runner' {
|
|
|
2143
2061
|
}
|
|
2144
2062
|
declare global {
|
|
2145
2063
|
namespace jest {
|
|
2146
|
-
interface Matchers<
|
|
2064
|
+
interface Matchers<_R, _T = {}> {
|
|
2147
2065
|
}
|
|
2148
2066
|
}
|
|
2149
2067
|
namespace Vi {
|
|
@@ -2166,18 +2084,19 @@ declare global {
|
|
|
2166
2084
|
stringMatching(expected: string | RegExp): any;
|
|
2167
2085
|
}
|
|
2168
2086
|
interface JestAssertion<T = any> extends jest.Matchers<void, T> {
|
|
2169
|
-
toMatchSnapshot<U extends {
|
|
2170
|
-
[P in keyof T]: any;
|
|
2171
|
-
}>(snapshot: Partial<U>, message?: string): void;
|
|
2172
|
-
toMatchSnapshot(message?: string): void;
|
|
2173
2087
|
matchSnapshot<U extends {
|
|
2174
2088
|
[P in keyof T]: any;
|
|
2175
2089
|
}>(snapshot: Partial<U>, message?: string): void;
|
|
2176
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;
|
|
2177
2095
|
toMatchInlineSnapshot<U extends {
|
|
2178
2096
|
[P in keyof T]: any;
|
|
2179
2097
|
}>(properties: Partial<U>, snapshot?: string, message?: string): void;
|
|
2180
2098
|
toMatchInlineSnapshot(snapshot?: string, message?: string): void;
|
|
2099
|
+
toMatchFileSnapshot(filepath: string, message?: string): Promise<void>;
|
|
2181
2100
|
toThrowErrorMatchingSnapshot(message?: string): void;
|
|
2182
2101
|
toThrowErrorMatchingInlineSnapshot(snapshot?: string, message?: string): void;
|
|
2183
2102
|
toEqual<E>(expected: E): void;
|
|
@@ -2263,4 +2182,4 @@ type Context = RootAndTarget & {
|
|
|
2263
2182
|
lastActivePath?: string;
|
|
2264
2183
|
};
|
|
2265
2184
|
|
|
2266
|
-
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 };
|