vitest 4.0.0-beta.6 → 4.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +3 -3
- package/dist/chunks/{browser.d.Cawq_X_N.d.ts → browser.d.DOMmqJQx.d.ts} +1 -1
- package/dist/chunks/{cac.WE-urWw5.js → cac.By1HvRIk.js} +7 -7
- package/dist/chunks/{cli-api.CZz3evYC.js → cli-api.C-JHgQgp.js} +383 -210
- package/dist/chunks/{config.d.CKNVOKm0.d.ts → config.d._GBBbReY.d.ts} +1 -0
- package/dist/chunks/{coverage.BPRS6xgn.js → coverage.DarITf6U.js} +7 -7
- package/dist/chunks/{index.VNI-1z5c.js → index.AzwzFtyi.js} +14 -5
- package/dist/chunks/{index.7w0eqmYM.js → index.BuwjkI-q.js} +1 -1
- package/dist/chunks/{index.BG0gqZH-.js → index.DfviD7lX.js} +16 -8
- package/dist/chunks/{moduleRunner.d.8kKUsuDg.d.ts → moduleRunner.d.CX4DuqOx.d.ts} +1 -1
- package/dist/chunks/{plugin.d.DuiQJfUL.d.ts → plugin.d.CHe6slQs.d.ts} +1 -1
- package/dist/chunks/{reporters.d.CqR9-CDJ.d.ts → reporters.d.37tJQ2uV.d.ts} +950 -995
- package/dist/chunks/{typechecker.Cd1wvxUM.js → typechecker.DSo_maXz.js} +1 -1
- package/dist/chunks/{worker.d.Db-UVmXc.d.ts → worker.d.BKu8cnnX.d.ts} +1 -1
- package/dist/chunks/{worker.d.D9QWnzAe.d.ts → worker.d.DYlqbejz.d.ts} +1 -1
- package/dist/cli.js +3 -3
- package/dist/config.d.ts +9 -9
- package/dist/coverage.d.ts +7 -7
- package/dist/coverage.js +2 -2
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/module-evaluator.d.ts +3 -3
- package/dist/node.d.ts +24 -12
- package/dist/node.js +11 -16
- package/dist/reporters.d.ts +7 -7
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +1 -1
- package/dist/worker.js +1 -1
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +1 -1
- package/package.json +10 -11
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { P as ProvidedContext,
|
|
1
|
+
import { CancelReason, TaskMeta, Suite, File, TestAnnotation, ImportDuration, Test, Task, TaskResultPack, SequenceSetupFiles, SequenceHooks } from '@vitest/runner';
|
|
2
|
+
import { Awaitable, ParsedStack, TestError, SerializedError, Arrayable as Arrayable$1 } from '@vitest/utils';
|
|
3
|
+
import { P as ProvidedContext, c as Arrayable, A as AfterSuiteRunMeta, U as UserConsoleLog, b as Awaitable$1, L as LabelColor } from './environment.d.2fYMoz3o.js';
|
|
4
4
|
import { Writable } from 'node:stream';
|
|
5
|
-
import { ViteDevServer,
|
|
6
|
-
import { Console } from 'node:console';
|
|
7
|
-
import { B as BrowserTesterOptions, S as SerializedTestSpecification } from './browser.d.Cawq_X_N.js';
|
|
5
|
+
import { ViteDevServer, TransformResult as TransformResult$1, DepOptimizationConfig, ServerOptions, UserConfig as UserConfig$1, ConfigEnv, AliasOptions } from 'vite';
|
|
8
6
|
import { MockedModule } from '@vitest/mocker';
|
|
9
7
|
import { StackTraceParserOptions } from '@vitest/utils/source-map';
|
|
10
|
-
import {
|
|
8
|
+
import { B as BrowserTesterOptions, S as SerializedTestSpecification } from './browser.d.DOMmqJQx.js';
|
|
9
|
+
import { a as SerializedConfig, F as FakeTimerInstallOpts } from './config.d._GBBbReY.js';
|
|
11
10
|
import { PrettyFormatOptions } from '@vitest/pretty-format';
|
|
12
11
|
import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
|
|
13
12
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
@@ -17,6 +16,7 @@ import { B as BenchmarkResult } from './benchmark.d.DAaHLpsq.js';
|
|
|
17
16
|
import { a as RuntimeCoverageProviderModule } from './coverage.d.BZtK59WP.js';
|
|
18
17
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
19
18
|
import { Stats } from 'node:fs';
|
|
19
|
+
import { Console } from 'node:console';
|
|
20
20
|
|
|
21
21
|
type ChaiConfig = Omit<Partial<typeof chai.config>, "useProxy" | "proxyExcludedKeys">;
|
|
22
22
|
|
|
@@ -69,53 +69,6 @@ interface ConstructorOptionsOverride {
|
|
|
69
69
|
resources?: "usable";
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
declare class TypeCheckError extends Error {
|
|
73
|
-
message: string;
|
|
74
|
-
stacks: ParsedStack[];
|
|
75
|
-
name: string;
|
|
76
|
-
constructor(message: string, stacks: ParsedStack[]);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
interface ErrorOptions {
|
|
80
|
-
type?: string;
|
|
81
|
-
fullStack?: boolean;
|
|
82
|
-
project?: TestProject;
|
|
83
|
-
verbose?: boolean;
|
|
84
|
-
screenshotPaths?: string[];
|
|
85
|
-
task?: Task;
|
|
86
|
-
showCodeFrame?: boolean;
|
|
87
|
-
}
|
|
88
|
-
type Listener = () => void;
|
|
89
|
-
declare class Logger {
|
|
90
|
-
ctx: Vitest;
|
|
91
|
-
outputStream: NodeJS.WriteStream | Writable;
|
|
92
|
-
errorStream: NodeJS.WriteStream | Writable;
|
|
93
|
-
private _clearScreenPending;
|
|
94
|
-
private _highlights;
|
|
95
|
-
private cleanupListeners;
|
|
96
|
-
console: Console;
|
|
97
|
-
constructor(ctx: Vitest, outputStream?: NodeJS.WriteStream | Writable, errorStream?: NodeJS.WriteStream | Writable);
|
|
98
|
-
log(...args: any[]): void;
|
|
99
|
-
error(...args: any[]): void;
|
|
100
|
-
warn(...args: any[]): void;
|
|
101
|
-
clearFullScreen(message?: string): void;
|
|
102
|
-
clearScreen(message: string, force?: boolean): void;
|
|
103
|
-
private _clearScreen;
|
|
104
|
-
printError(err: unknown, options?: ErrorOptions): void;
|
|
105
|
-
deprecate(message: string): void;
|
|
106
|
-
clearHighlightCache(filename?: string): void;
|
|
107
|
-
highlight(filename: string, source: string): string;
|
|
108
|
-
printNoTestFound(filters?: string[]): void;
|
|
109
|
-
printBanner(): void;
|
|
110
|
-
printBrowserBanner(project: TestProject): void;
|
|
111
|
-
printUnhandledErrors(errors: unknown[]): void;
|
|
112
|
-
printSourceTypeErrors(errors: TypeCheckError[]): void;
|
|
113
|
-
getColumns(): number;
|
|
114
|
-
onTerminalCleanup(listener: Listener): void;
|
|
115
|
-
private addCleanupListeners;
|
|
116
|
-
private registerUnhandledRejection;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
72
|
interface BrowserProviderInitializationOptions {
|
|
120
73
|
browser: string;
|
|
121
74
|
options?: BrowserProviderOptions;
|
|
@@ -262,11 +215,6 @@ interface BrowserConfigOptions {
|
|
|
262
215
|
*/
|
|
263
216
|
screenshotFailures?: boolean;
|
|
264
217
|
/**
|
|
265
|
-
* Scripts injected into the tester iframe.
|
|
266
|
-
* @deprecated Will be removed in the future, use `testerHtmlPath` instead.
|
|
267
|
-
*/
|
|
268
|
-
testerScripts?: BrowserScript[];
|
|
269
|
-
/**
|
|
270
218
|
* Path to the index.html file that will be used to run tests.
|
|
271
219
|
*/
|
|
272
220
|
testerHtmlPath?: string;
|
|
@@ -296,6 +244,15 @@ interface BrowserConfigOptions {
|
|
|
296
244
|
comparatorOptions?: ToMatchScreenshotComparators[ComparatorName];
|
|
297
245
|
} }[keyof ToMatchScreenshotComparators] & ToMatchScreenshotOptions;
|
|
298
246
|
};
|
|
247
|
+
/**
|
|
248
|
+
* Enables tracking uncaught errors and exceptions so they can be reported by Vitest.
|
|
249
|
+
*
|
|
250
|
+
* If you need to hide certain errors, it is recommended to use [`onUnhandledError`](https://vitest.dev/config/#onunhandlederror) option instead.
|
|
251
|
+
*
|
|
252
|
+
* Disabling this will completely remove all Vitest error handlers, which can help debugging with the "Pause on exceptions" checkbox turned on.
|
|
253
|
+
* @default true
|
|
254
|
+
*/
|
|
255
|
+
trackUnhandledErrors?: boolean;
|
|
299
256
|
}
|
|
300
257
|
interface BrowserCommandContext {
|
|
301
258
|
testPath: string | undefined;
|
|
@@ -463,129 +420,400 @@ interface ToMatchScreenshotOptions {
|
|
|
463
420
|
}
|
|
464
421
|
interface ToMatchScreenshotComparators {}
|
|
465
422
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
*/
|
|
470
|
-
readonly project: TestProject;
|
|
423
|
+
type BuiltinPool = "browser" | "threads" | "forks" | "vmThreads" | "vmForks" | "typescript";
|
|
424
|
+
type Pool = BuiltinPool | (string & {});
|
|
425
|
+
interface PoolOptions extends Record<string, unknown> {
|
|
471
426
|
/**
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
427
|
+
* Run tests in `node:worker_threads`.
|
|
428
|
+
*
|
|
429
|
+
* Test isolation (when enabled) is done by spawning a new thread for each test file.
|
|
430
|
+
*
|
|
431
|
+
* This pool is used by default.
|
|
475
432
|
*/
|
|
476
|
-
|
|
433
|
+
threads?: ThreadsOptions & WorkerContextOptions;
|
|
477
434
|
/**
|
|
478
|
-
*
|
|
435
|
+
* Run tests in `node:child_process` using [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
|
|
436
|
+
*
|
|
437
|
+
* Test isolation (when enabled) is done by spawning a new child process for each test file.
|
|
479
438
|
*/
|
|
480
|
-
|
|
481
|
-
line: number;
|
|
482
|
-
column: number;
|
|
483
|
-
} | undefined;
|
|
439
|
+
forks?: ForksOptions & WorkerContextOptions;
|
|
484
440
|
/**
|
|
485
|
-
*
|
|
486
|
-
*
|
|
441
|
+
* Run tests in isolated `node:vm`.
|
|
442
|
+
* Test files are run parallel using `node:worker_threads`.
|
|
443
|
+
*
|
|
444
|
+
* This makes tests run faster, but VM module is unstable. Your tests might leak memory.
|
|
487
445
|
*/
|
|
488
|
-
|
|
446
|
+
vmThreads?: ThreadsOptions & VmOptions;
|
|
489
447
|
/**
|
|
490
|
-
*
|
|
448
|
+
* Run tests in isolated `node:vm`.
|
|
449
|
+
*
|
|
450
|
+
* Test files are run parallel using `node:child_process` [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
|
|
451
|
+
*
|
|
452
|
+
* This makes tests run faster, but VM module is unstable. Your tests might leak memory.
|
|
491
453
|
*/
|
|
492
|
-
|
|
454
|
+
vmForks?: ForksOptions & VmOptions;
|
|
493
455
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
456
|
+
interface ResolvedPoolOptions extends PoolOptions {
|
|
457
|
+
threads?: ResolvedThreadsOptions & WorkerContextOptions;
|
|
458
|
+
forks?: ResolvedForksOptions & WorkerContextOptions;
|
|
459
|
+
vmThreads?: ResolvedThreadsOptions & VmOptions;
|
|
460
|
+
vmForks?: ResolvedForksOptions & VmOptions;
|
|
461
|
+
}
|
|
462
|
+
interface ThreadsOptions {
|
|
463
|
+
/** Minimum amount of threads to use */
|
|
464
|
+
minThreads?: number | string;
|
|
465
|
+
/** Maximum amount of threads to use */
|
|
466
|
+
maxThreads?: number | string;
|
|
501
467
|
/**
|
|
502
|
-
*
|
|
468
|
+
* Run tests inside a single thread.
|
|
469
|
+
*
|
|
470
|
+
* @default false
|
|
503
471
|
*/
|
|
504
|
-
|
|
472
|
+
singleThread?: boolean;
|
|
505
473
|
/**
|
|
506
|
-
*
|
|
474
|
+
* Use Atomics to synchronize threads
|
|
475
|
+
*
|
|
476
|
+
* This can improve performance in some cases, but might cause segfault in older Node versions.
|
|
477
|
+
*
|
|
478
|
+
* @default false
|
|
507
479
|
*/
|
|
508
|
-
|
|
480
|
+
useAtomics?: boolean;
|
|
481
|
+
}
|
|
482
|
+
interface ResolvedThreadsOptions extends ThreadsOptions {
|
|
483
|
+
minThreads?: number;
|
|
484
|
+
maxThreads?: number;
|
|
485
|
+
}
|
|
486
|
+
interface ForksOptions {
|
|
487
|
+
/** Minimum amount of child processes to use */
|
|
488
|
+
minForks?: number | string;
|
|
489
|
+
/** Maximum amount of child processes to use */
|
|
490
|
+
maxForks?: number | string;
|
|
509
491
|
/**
|
|
510
|
-
*
|
|
492
|
+
* Run tests inside a single fork.
|
|
493
|
+
*
|
|
494
|
+
* @default false
|
|
511
495
|
*/
|
|
512
|
-
|
|
496
|
+
singleFork?: boolean;
|
|
497
|
+
}
|
|
498
|
+
interface ResolvedForksOptions extends ForksOptions {
|
|
499
|
+
minForks?: number;
|
|
500
|
+
maxForks?: number;
|
|
501
|
+
}
|
|
502
|
+
interface WorkerContextOptions {
|
|
513
503
|
/**
|
|
514
|
-
*
|
|
504
|
+
* Isolate test environment by recycling `worker_threads` or `child_process` after each test
|
|
505
|
+
*
|
|
506
|
+
* @default true
|
|
515
507
|
*/
|
|
516
|
-
|
|
508
|
+
isolate?: boolean;
|
|
517
509
|
/**
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
* -
|
|
521
|
-
*
|
|
522
|
-
*
|
|
510
|
+
* Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
|
|
511
|
+
*
|
|
512
|
+
* See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
|
|
513
|
+
*
|
|
514
|
+
* Set to `process.execArgv` to pass all arguments of the current process.
|
|
515
|
+
*
|
|
516
|
+
* Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
|
|
517
|
+
*
|
|
518
|
+
* @default [] // no execution arguments are passed
|
|
523
519
|
*/
|
|
524
|
-
|
|
520
|
+
execArgv?: string[];
|
|
521
|
+
}
|
|
522
|
+
interface VmOptions {
|
|
525
523
|
/**
|
|
526
|
-
*
|
|
524
|
+
* Specifies the memory limit for `worker_thread` or `child_process` before they are recycled.
|
|
525
|
+
* If you see memory leaks, try to tinker this value.
|
|
527
526
|
*/
|
|
528
|
-
|
|
527
|
+
memoryLimit?: string | number;
|
|
528
|
+
/** Isolation is always enabled */
|
|
529
|
+
isolate?: true;
|
|
529
530
|
/**
|
|
530
|
-
*
|
|
531
|
-
*
|
|
531
|
+
* Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
|
|
532
|
+
*
|
|
533
|
+
* See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
|
|
534
|
+
*
|
|
535
|
+
* Set to `process.execArgv` to pass all arguments of the current process.
|
|
536
|
+
*
|
|
537
|
+
* Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
|
|
538
|
+
*
|
|
539
|
+
* @default [] // no execution arguments are passed
|
|
532
540
|
*/
|
|
533
|
-
|
|
541
|
+
execArgv?: string[];
|
|
534
542
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
constructor(task: Suite | File, project: TestProject);
|
|
538
|
-
/**
|
|
539
|
-
* Returns the test or suite at a specific index.
|
|
540
|
-
*/
|
|
541
|
-
at(index: number): TestCase | TestSuite | undefined;
|
|
543
|
+
|
|
544
|
+
declare class TestSpecification {
|
|
542
545
|
/**
|
|
543
|
-
* The
|
|
546
|
+
* The task ID associated with the test module.
|
|
544
547
|
*/
|
|
545
|
-
|
|
548
|
+
readonly taskId: string;
|
|
546
549
|
/**
|
|
547
|
-
*
|
|
550
|
+
* The test project that the module belongs to.
|
|
548
551
|
*/
|
|
549
|
-
|
|
552
|
+
readonly project: TestProject;
|
|
550
553
|
/**
|
|
551
|
-
*
|
|
554
|
+
* The ID of the module in the Vite module graph. It is usually an absolute file path.
|
|
552
555
|
*/
|
|
553
|
-
|
|
556
|
+
readonly moduleId: string;
|
|
554
557
|
/**
|
|
555
|
-
*
|
|
558
|
+
* The current test pool. It's possible to have multiple pools in a single test project with `poolMatchGlob` and `typecheck.enabled`.
|
|
559
|
+
* @experimental In Vitest 4, the project will only support a single pool and this property will be removed.
|
|
556
560
|
*/
|
|
557
|
-
|
|
561
|
+
readonly pool: Pool;
|
|
558
562
|
/**
|
|
559
|
-
*
|
|
563
|
+
* Line numbers of the test locations to run.
|
|
560
564
|
*/
|
|
561
|
-
|
|
565
|
+
readonly testLines: number[] | undefined;
|
|
566
|
+
constructor(project: TestProject, moduleId: string, pool: Pool, testLines?: number[] | undefined);
|
|
562
567
|
/**
|
|
563
|
-
*
|
|
568
|
+
* Test module associated with the specification.
|
|
564
569
|
*/
|
|
565
|
-
|
|
566
|
-
|
|
570
|
+
get testModule(): TestModule | undefined;
|
|
571
|
+
toJSON(): SerializedTestSpecification;
|
|
567
572
|
}
|
|
568
573
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
readonly entity: TestSuite | TestModule;
|
|
572
|
-
} | {
|
|
573
|
-
readonly name: "beforeEach" | "afterEach";
|
|
574
|
-
readonly entity: TestCase;
|
|
575
|
-
};
|
|
576
|
-
declare abstract class SuiteImplementation extends ReportedTaskImplementation {
|
|
574
|
+
declare class TestProject {
|
|
575
|
+
options?: Vitest;
|
|
577
576
|
/**
|
|
578
|
-
*
|
|
577
|
+
* The global Vitest instance.
|
|
578
|
+
* @experimental The public Vitest API is experimental and does not follow semver.
|
|
579
579
|
*/
|
|
580
|
-
readonly
|
|
580
|
+
readonly vitest: Vitest;
|
|
581
581
|
/**
|
|
582
|
-
*
|
|
582
|
+
* Resolved global configuration. If there are no workspace projects, this will be the same as `config`.
|
|
583
583
|
*/
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
584
|
+
readonly globalConfig: ResolvedConfig;
|
|
585
|
+
/**
|
|
586
|
+
* Browser instance if the browser is enabled. This is initialized when the tests run for the first time.
|
|
587
|
+
*/
|
|
588
|
+
browser?: ProjectBrowser;
|
|
589
|
+
/**
|
|
590
|
+
* Temporary directory for the project. This is unique for each project. Vitest stores transformed content here.
|
|
591
|
+
*/
|
|
592
|
+
readonly tmpDir: string;
|
|
593
|
+
/** @inetrnal */ testFilesList: string[] | null;
|
|
594
|
+
private runner;
|
|
595
|
+
private closingPromise;
|
|
596
|
+
private typecheckFilesList;
|
|
597
|
+
private _globalSetups?;
|
|
598
|
+
private _provided;
|
|
599
|
+
constructor(vitest: Vitest, options?: InitializeProjectOptions | undefined);
|
|
600
|
+
/**
|
|
601
|
+
* The unique hash of this project. This value is consistent between the reruns.
|
|
602
|
+
*
|
|
603
|
+
* It is based on the root of the project (not consistent between OS) and its name.
|
|
604
|
+
*/
|
|
605
|
+
get hash(): string;
|
|
606
|
+
// "provide" is a property, not a method to keep the context when destructed in the global setup,
|
|
607
|
+
// making it a method would be a breaking change, and can be done in Vitest 3 at minimum
|
|
608
|
+
/**
|
|
609
|
+
* Provide a value to the test context. This value will be available to all tests with `inject`.
|
|
610
|
+
*/
|
|
611
|
+
provide: <T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]) => void;
|
|
612
|
+
/**
|
|
613
|
+
* Get the provided context. The project context is merged with the global context.
|
|
614
|
+
*/
|
|
615
|
+
getProvidedContext(): ProvidedContext;
|
|
616
|
+
/**
|
|
617
|
+
* Creates a new test specification. Specifications describe how to run tests.
|
|
618
|
+
* @param moduleId The file path
|
|
619
|
+
*/
|
|
620
|
+
createSpecification(moduleId: string, locations?: number[] | undefined, pool?: string): TestSpecification;
|
|
621
|
+
toJSON(): SerializedTestProject;
|
|
622
|
+
/**
|
|
623
|
+
* Vite's dev server instance. Every workspace project has its own server.
|
|
624
|
+
*/
|
|
625
|
+
get vite(): ViteDevServer;
|
|
626
|
+
/**
|
|
627
|
+
* Resolved project configuration.
|
|
628
|
+
*/
|
|
629
|
+
get config(): ResolvedConfig;
|
|
630
|
+
/**
|
|
631
|
+
* The name of the project or an empty string if not set.
|
|
632
|
+
*/
|
|
633
|
+
get name(): string;
|
|
634
|
+
/**
|
|
635
|
+
* The color used when reporting tasks of this project.
|
|
636
|
+
*/
|
|
637
|
+
get color(): ProjectName["color"];
|
|
638
|
+
/**
|
|
639
|
+
* Serialized project configuration. This is the config that tests receive.
|
|
640
|
+
*/
|
|
641
|
+
get serializedConfig(): SerializedConfig;
|
|
642
|
+
/**
|
|
643
|
+
* Check if this is the root project. The root project is the one that has the root config.
|
|
644
|
+
*/
|
|
645
|
+
isRootProject(): boolean;
|
|
646
|
+
onTestsRerun(cb: OnTestsRerunHandler): void;
|
|
647
|
+
/**
|
|
648
|
+
* Get all files in the project that match the globs in the config and the filters.
|
|
649
|
+
* @param filters String filters to match the test files.
|
|
650
|
+
*/
|
|
651
|
+
globTestFiles(filters?: string[]): Promise<{
|
|
652
|
+
/**
|
|
653
|
+
* Test files that match the filters.
|
|
654
|
+
*/
|
|
655
|
+
testFiles: string[];
|
|
656
|
+
/**
|
|
657
|
+
* Typecheck test files that match the filters. This will be empty unless `typecheck.enabled` is `true`.
|
|
658
|
+
*/
|
|
659
|
+
typecheckTestFiles: string[];
|
|
660
|
+
}>;
|
|
661
|
+
private globAllTestFiles;
|
|
662
|
+
isBrowserEnabled(): boolean;
|
|
663
|
+
private markTestFile;
|
|
664
|
+
/**
|
|
665
|
+
* Test if a file matches the test globs. This does the actual glob matching if the test is not cached, unlike `isCachedTestFile`.
|
|
666
|
+
*/
|
|
667
|
+
matchesTestGlob(moduleId: string, source?: () => string): boolean;
|
|
668
|
+
private isInSourceTestCode;
|
|
669
|
+
private filterFiles;
|
|
670
|
+
private _parentBrowser?;
|
|
671
|
+
/**
|
|
672
|
+
* Closes the project and all associated resources. This can only be called once; the closing promise is cached until the server restarts.
|
|
673
|
+
* If the resources are needed again, create a new project.
|
|
674
|
+
*/
|
|
675
|
+
close(): Promise<void>;
|
|
676
|
+
/**
|
|
677
|
+
* Import a file using Vite module runner.
|
|
678
|
+
* @param moduleId The ID of the module in Vite module graph
|
|
679
|
+
*/
|
|
680
|
+
import<T>(moduleId: string): Promise<T>;
|
|
681
|
+
private _setHash;
|
|
682
|
+
private _serializeOverriddenConfig;
|
|
683
|
+
private clearTmpDir;
|
|
684
|
+
}
|
|
685
|
+
interface SerializedTestProject {
|
|
686
|
+
name: string;
|
|
687
|
+
serializedConfig: SerializedConfig;
|
|
688
|
+
context: ProvidedContext;
|
|
689
|
+
}
|
|
690
|
+
interface InitializeProjectOptions extends TestProjectInlineConfiguration {
|
|
691
|
+
configFile: string | false;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
declare class ReportedTaskImplementation {
|
|
695
|
+
/**
|
|
696
|
+
* The project associated with the test or suite.
|
|
697
|
+
*/
|
|
698
|
+
readonly project: TestProject;
|
|
699
|
+
/**
|
|
700
|
+
* Unique identifier.
|
|
701
|
+
* This ID is deterministic and will be the same for the same test across multiple runs.
|
|
702
|
+
* The ID is based on the project name, module url and test order.
|
|
703
|
+
*/
|
|
704
|
+
readonly id: string;
|
|
705
|
+
/**
|
|
706
|
+
* Location in the module where the test or suite is defined.
|
|
707
|
+
*/
|
|
708
|
+
readonly location: {
|
|
709
|
+
line: number;
|
|
710
|
+
column: number;
|
|
711
|
+
} | undefined;
|
|
712
|
+
/**
|
|
713
|
+
* Checks if the test did not fail the suite.
|
|
714
|
+
* If the test is not finished yet or was skipped, it will return `true`.
|
|
715
|
+
*/
|
|
716
|
+
ok(): boolean;
|
|
717
|
+
/**
|
|
718
|
+
* Custom metadata that was attached to the test during its execution.
|
|
719
|
+
*/
|
|
720
|
+
meta(): TaskMeta;
|
|
721
|
+
}
|
|
722
|
+
declare class TestCase extends ReportedTaskImplementation {
|
|
723
|
+
#private;
|
|
724
|
+
readonly type = "test";
|
|
725
|
+
/**
|
|
726
|
+
* Direct reference to the test module where the test or suite is defined.
|
|
727
|
+
*/
|
|
728
|
+
readonly module: TestModule;
|
|
729
|
+
/**
|
|
730
|
+
* Name of the test.
|
|
731
|
+
*/
|
|
732
|
+
readonly name: string;
|
|
733
|
+
/**
|
|
734
|
+
* Options that the test was initiated with.
|
|
735
|
+
*/
|
|
736
|
+
readonly options: TaskOptions;
|
|
737
|
+
/**
|
|
738
|
+
* Parent suite. If the test was called directly inside the module, the parent will be the module itself.
|
|
739
|
+
*/
|
|
740
|
+
readonly parent: TestSuite | TestModule;
|
|
741
|
+
/**
|
|
742
|
+
* Full name of the test including all parent suites separated with `>`.
|
|
743
|
+
*/
|
|
744
|
+
get fullName(): string;
|
|
745
|
+
/**
|
|
746
|
+
* Test results.
|
|
747
|
+
* - **pending**: Test was collected, but didn't finish running yet.
|
|
748
|
+
* - **passed**: Test passed successfully
|
|
749
|
+
* - **failed**: Test failed to execute
|
|
750
|
+
* - **skipped**: Test was skipped during collection or dynamically with `ctx.skip()`.
|
|
751
|
+
*/
|
|
752
|
+
result(): TestResult;
|
|
753
|
+
/**
|
|
754
|
+
* Test annotations added via the `task.annotate` API during the test execution.
|
|
755
|
+
*/
|
|
756
|
+
annotations(): ReadonlyArray<TestAnnotation>;
|
|
757
|
+
/**
|
|
758
|
+
* Useful information about the test like duration, memory usage, etc.
|
|
759
|
+
* Diagnostic is only available after the test has finished.
|
|
760
|
+
*/
|
|
761
|
+
diagnostic(): TestDiagnostic | undefined;
|
|
762
|
+
}
|
|
763
|
+
declare class TestCollection {
|
|
764
|
+
#private;
|
|
765
|
+
constructor(task: Suite | File, project: TestProject);
|
|
766
|
+
/**
|
|
767
|
+
* Returns the test or suite at a specific index.
|
|
768
|
+
*/
|
|
769
|
+
at(index: number): TestCase | TestSuite | undefined;
|
|
770
|
+
/**
|
|
771
|
+
* The number of tests and suites in the collection.
|
|
772
|
+
*/
|
|
773
|
+
get size(): number;
|
|
774
|
+
/**
|
|
775
|
+
* Returns the collection in array form for easier manipulation.
|
|
776
|
+
*/
|
|
777
|
+
array(): (TestCase | TestSuite)[];
|
|
778
|
+
/**
|
|
779
|
+
* Filters all tests that are part of this collection and its children.
|
|
780
|
+
*/
|
|
781
|
+
allTests(state?: TestState): Generator<TestCase, undefined, void>;
|
|
782
|
+
/**
|
|
783
|
+
* Filters only the tests that are part of this collection.
|
|
784
|
+
*/
|
|
785
|
+
tests(state?: TestState): Generator<TestCase, undefined, void>;
|
|
786
|
+
/**
|
|
787
|
+
* Filters only the suites that are part of this collection.
|
|
788
|
+
*/
|
|
789
|
+
suites(): Generator<TestSuite, undefined, void>;
|
|
790
|
+
/**
|
|
791
|
+
* Filters all suites that are part of this collection and its children.
|
|
792
|
+
*/
|
|
793
|
+
allSuites(): Generator<TestSuite, undefined, void>;
|
|
794
|
+
[Symbol.iterator](): Generator<TestSuite | TestCase, undefined, void>;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
type ReportedHookContext = {
|
|
798
|
+
readonly name: "beforeAll" | "afterAll";
|
|
799
|
+
readonly entity: TestSuite | TestModule;
|
|
800
|
+
} | {
|
|
801
|
+
readonly name: "beforeEach" | "afterEach";
|
|
802
|
+
readonly entity: TestCase;
|
|
803
|
+
};
|
|
804
|
+
declare abstract class SuiteImplementation extends ReportedTaskImplementation {
|
|
805
|
+
/**
|
|
806
|
+
* Collection of suites and tests that are part of this suite.
|
|
807
|
+
*/
|
|
808
|
+
readonly children: TestCollection;
|
|
809
|
+
/**
|
|
810
|
+
* Errors that happened outside of the test run during collection, like syntax errors.
|
|
811
|
+
*/
|
|
812
|
+
errors(): SerializedError[];
|
|
813
|
+
}
|
|
814
|
+
declare class TestSuite extends SuiteImplementation {
|
|
815
|
+
#private;
|
|
816
|
+
readonly type = "suite";
|
|
589
817
|
/**
|
|
590
818
|
* Name of the test or the suite.
|
|
591
819
|
*/
|
|
@@ -772,347 +1000,395 @@ interface ModuleDiagnostic {
|
|
|
772
1000
|
*/
|
|
773
1001
|
readonly importDurations: Record<string, ImportDuration>;
|
|
774
1002
|
}
|
|
1003
|
+
declare function experimental_getRunnerTask(entity: TestCase): Test;
|
|
1004
|
+
declare function experimental_getRunnerTask(entity: TestSuite): Suite;
|
|
1005
|
+
declare function experimental_getRunnerTask(entity: TestModule): File;
|
|
1006
|
+
declare function experimental_getRunnerTask(entity: TestCase | TestSuite | TestModule): Suite | File | Test;
|
|
775
1007
|
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
*
|
|
782
|
-
* Test isolation (when enabled) is done by spawning a new thread for each test file.
|
|
783
|
-
*
|
|
784
|
-
* This pool is used by default.
|
|
785
|
-
*/
|
|
786
|
-
threads?: ThreadsOptions & WorkerContextOptions;
|
|
787
|
-
/**
|
|
788
|
-
* Run tests in `node:child_process` using [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
|
|
789
|
-
*
|
|
790
|
-
* Test isolation (when enabled) is done by spawning a new child process for each test file.
|
|
791
|
-
*/
|
|
792
|
-
forks?: ForksOptions & WorkerContextOptions;
|
|
793
|
-
/**
|
|
794
|
-
* Run tests in isolated `node:vm`.
|
|
795
|
-
* Test files are run parallel using `node:worker_threads`.
|
|
796
|
-
*
|
|
797
|
-
* This makes tests run faster, but VM module is unstable. Your tests might leak memory.
|
|
798
|
-
*/
|
|
799
|
-
vmThreads?: ThreadsOptions & VmOptions;
|
|
800
|
-
/**
|
|
801
|
-
* Run tests in isolated `node:vm`.
|
|
802
|
-
*
|
|
803
|
-
* Test files are run parallel using `node:child_process` [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
|
|
804
|
-
*
|
|
805
|
-
* This makes tests run faster, but VM module is unstable. Your tests might leak memory.
|
|
806
|
-
*/
|
|
807
|
-
vmForks?: ForksOptions & VmOptions;
|
|
1008
|
+
interface CoverageSummaryData {
|
|
1009
|
+
lines: Totals;
|
|
1010
|
+
statements: Totals;
|
|
1011
|
+
branches: Totals;
|
|
1012
|
+
functions: Totals;
|
|
808
1013
|
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
1014
|
+
|
|
1015
|
+
declare class CoverageSummary {
|
|
1016
|
+
constructor(data: CoverageSummary | CoverageSummaryData);
|
|
1017
|
+
merge(obj: CoverageSummary): CoverageSummary;
|
|
1018
|
+
toJSON(): CoverageSummaryData;
|
|
1019
|
+
isEmpty(): boolean;
|
|
1020
|
+
data: CoverageSummaryData;
|
|
1021
|
+
lines: Totals;
|
|
1022
|
+
statements: Totals;
|
|
1023
|
+
branches: Totals;
|
|
1024
|
+
functions: Totals;
|
|
814
1025
|
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
/** Maximum amount of threads to use */
|
|
819
|
-
maxThreads?: number | string;
|
|
820
|
-
/**
|
|
821
|
-
* Run tests inside a single thread.
|
|
822
|
-
*
|
|
823
|
-
* @default false
|
|
824
|
-
*/
|
|
825
|
-
singleThread?: boolean;
|
|
826
|
-
/**
|
|
827
|
-
* Use Atomics to synchronize threads
|
|
828
|
-
*
|
|
829
|
-
* This can improve performance in some cases, but might cause segfault in older Node versions.
|
|
830
|
-
*
|
|
831
|
-
* @default false
|
|
832
|
-
*/
|
|
833
|
-
useAtomics?: boolean;
|
|
1026
|
+
|
|
1027
|
+
interface CoverageMapData {
|
|
1028
|
+
[key: string]: FileCoverage | FileCoverageData;
|
|
834
1029
|
}
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
1030
|
+
|
|
1031
|
+
declare class CoverageMap {
|
|
1032
|
+
constructor(data: CoverageMapData | CoverageMap);
|
|
1033
|
+
addFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): void;
|
|
1034
|
+
files(): string[];
|
|
1035
|
+
fileCoverageFor(filename: string): FileCoverage;
|
|
1036
|
+
filter(callback: (key: string) => boolean): void;
|
|
1037
|
+
getCoverageSummary(): CoverageSummary;
|
|
1038
|
+
merge(data: CoverageMapData | CoverageMap): void;
|
|
1039
|
+
toJSON(): CoverageMapData;
|
|
1040
|
+
data: CoverageMapData;
|
|
838
1041
|
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
maxForks?: number | string;
|
|
844
|
-
/**
|
|
845
|
-
* Run tests inside a single fork.
|
|
846
|
-
*
|
|
847
|
-
* @default false
|
|
848
|
-
*/
|
|
849
|
-
singleFork?: boolean;
|
|
1042
|
+
|
|
1043
|
+
interface Location {
|
|
1044
|
+
line: number;
|
|
1045
|
+
column: number;
|
|
850
1046
|
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
1047
|
+
|
|
1048
|
+
interface Range {
|
|
1049
|
+
start: Location;
|
|
1050
|
+
end: Location;
|
|
854
1051
|
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
isolate?: boolean;
|
|
862
|
-
/**
|
|
863
|
-
* Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
|
|
864
|
-
*
|
|
865
|
-
* See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
|
|
866
|
-
*
|
|
867
|
-
* Set to `process.execArgv` to pass all arguments of the current process.
|
|
868
|
-
*
|
|
869
|
-
* Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
|
|
870
|
-
*
|
|
871
|
-
* @default [] // no execution arguments are passed
|
|
872
|
-
*/
|
|
873
|
-
execArgv?: string[];
|
|
1052
|
+
|
|
1053
|
+
interface BranchMapping {
|
|
1054
|
+
loc: Range;
|
|
1055
|
+
type: string;
|
|
1056
|
+
locations: Range[];
|
|
1057
|
+
line: number;
|
|
874
1058
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
/** Isolation is always enabled */
|
|
882
|
-
isolate?: true;
|
|
883
|
-
/**
|
|
884
|
-
* Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
|
|
885
|
-
*
|
|
886
|
-
* See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
|
|
887
|
-
*
|
|
888
|
-
* Set to `process.execArgv` to pass all arguments of the current process.
|
|
889
|
-
*
|
|
890
|
-
* Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
|
|
891
|
-
*
|
|
892
|
-
* @default [] // no execution arguments are passed
|
|
893
|
-
*/
|
|
894
|
-
execArgv?: string[];
|
|
1059
|
+
|
|
1060
|
+
interface FunctionMapping {
|
|
1061
|
+
name: string;
|
|
1062
|
+
decl: Range;
|
|
1063
|
+
loc: Range;
|
|
1064
|
+
line: number;
|
|
895
1065
|
}
|
|
896
1066
|
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
readonly 1: string;
|
|
906
|
-
/**
|
|
907
|
-
* @deprecated use `pool` instead
|
|
908
|
-
*/
|
|
909
|
-
readonly 2: {
|
|
910
|
-
pool: Pool;
|
|
911
|
-
};
|
|
912
|
-
/**
|
|
913
|
-
* The task ID associated with the test module.
|
|
914
|
-
*/
|
|
915
|
-
readonly taskId: string;
|
|
916
|
-
/**
|
|
917
|
-
* The test project that the module belongs to.
|
|
918
|
-
*/
|
|
919
|
-
readonly project: TestProject;
|
|
920
|
-
/**
|
|
921
|
-
* The ID of the module in the Vite module graph. It is usually an absolute file path.
|
|
922
|
-
*/
|
|
923
|
-
readonly moduleId: string;
|
|
924
|
-
/**
|
|
925
|
-
* The current test pool. It's possible to have multiple pools in a single test project with `poolMatchGlob` and `typecheck.enabled`.
|
|
926
|
-
* @experimental In Vitest 4, the project will only support a single pool and this property will be removed.
|
|
927
|
-
*/
|
|
928
|
-
readonly pool: Pool;
|
|
929
|
-
/**
|
|
930
|
-
* Line numbers of the test locations to run.
|
|
931
|
-
*/
|
|
932
|
-
readonly testLines: number[] | undefined;
|
|
933
|
-
constructor(project: TestProject, moduleId: string, pool: Pool, testLines?: number[] | undefined);
|
|
934
|
-
/**
|
|
935
|
-
* Test module associated with the specification.
|
|
936
|
-
*/
|
|
937
|
-
get testModule(): TestModule | undefined;
|
|
938
|
-
toJSON(): SerializedTestSpecification;
|
|
939
|
-
/**
|
|
940
|
-
* for backwards compatibility
|
|
941
|
-
* @deprecated
|
|
942
|
-
*/
|
|
943
|
-
[Symbol.iterator](): Generator<string | TestProject, void, unknown>;
|
|
1067
|
+
interface FileCoverageData {
|
|
1068
|
+
path: string;
|
|
1069
|
+
statementMap: { [key: string]: Range };
|
|
1070
|
+
fnMap: { [key: string]: FunctionMapping };
|
|
1071
|
+
branchMap: { [key: string]: BranchMapping };
|
|
1072
|
+
s: { [key: string]: number };
|
|
1073
|
+
f: { [key: string]: number };
|
|
1074
|
+
b: { [key: string]: number[] };
|
|
944
1075
|
}
|
|
945
1076
|
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1077
|
+
interface Totals {
|
|
1078
|
+
total: number;
|
|
1079
|
+
covered: number;
|
|
1080
|
+
skipped: number;
|
|
1081
|
+
pct: number;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
interface Coverage {
|
|
1085
|
+
covered: number;
|
|
1086
|
+
total: number;
|
|
1087
|
+
coverage: number;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
declare class FileCoverage implements FileCoverageData {
|
|
1091
|
+
constructor(data: string | FileCoverage | FileCoverageData);
|
|
1092
|
+
merge(other: FileCoverageData): void;
|
|
1093
|
+
getBranchCoverageByLine(): { [line: number]: Coverage };
|
|
1094
|
+
getLineCoverage(): { [line: number]: number };
|
|
1095
|
+
getUncoveredLines(): number[];
|
|
1096
|
+
resetHits(): void;
|
|
1097
|
+
computeBranchTotals(): Totals;
|
|
1098
|
+
computeSimpleTotals(): Totals;
|
|
1099
|
+
toSummary(): CoverageSummary;
|
|
1100
|
+
toJSON(): object;
|
|
1101
|
+
|
|
1102
|
+
data: FileCoverageData;
|
|
1103
|
+
path: string;
|
|
1104
|
+
statementMap: { [key: string]: Range };
|
|
1105
|
+
fnMap: { [key: string]: FunctionMapping };
|
|
1106
|
+
branchMap: { [key: string]: BranchMapping };
|
|
1107
|
+
s: { [key: string]: number };
|
|
1108
|
+
f: { [key: string]: number };
|
|
1109
|
+
b: { [key: string]: number[] };
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
interface Node {
|
|
1113
|
+
isRoot(): boolean;
|
|
1114
|
+
visit(visitor: Visitor, state: any): void;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
interface Visitor<N extends Node = Node> {
|
|
1118
|
+
onStart(root: N, state: any): void;
|
|
1119
|
+
onSummary(root: N, state: any): void;
|
|
1120
|
+
onDetail(root: N, state: any): void;
|
|
1121
|
+
onSummaryEnd(root: N, state: any): void;
|
|
1122
|
+
onEnd(root: N, state: any): void;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
interface FileOptions {
|
|
1126
|
+
file: string;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
interface ProjectOptions {
|
|
1130
|
+
projectRoot: string;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
interface ReportOptions {
|
|
1134
|
+
clover: CloverOptions;
|
|
1135
|
+
cobertura: CoberturaOptions;
|
|
1136
|
+
"html-spa": HtmlSpaOptions;
|
|
1137
|
+
html: HtmlOptions;
|
|
1138
|
+
json: JsonOptions$1;
|
|
1139
|
+
"json-summary": JsonSummaryOptions;
|
|
1140
|
+
lcov: LcovOptions;
|
|
1141
|
+
lcovonly: LcovOnlyOptions;
|
|
1142
|
+
none: never;
|
|
1143
|
+
teamcity: TeamcityOptions;
|
|
1144
|
+
text: TextOptions;
|
|
1145
|
+
"text-lcov": TextLcovOptions;
|
|
1146
|
+
"text-summary": TextSummaryOptions;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
interface CloverOptions extends FileOptions, ProjectOptions {}
|
|
1150
|
+
|
|
1151
|
+
interface CoberturaOptions extends FileOptions, ProjectOptions {}
|
|
1152
|
+
|
|
1153
|
+
interface HtmlSpaOptions extends HtmlOptions {
|
|
1154
|
+
metricsToShow: Array<"lines" | "branches" | "functions" | "statements">;
|
|
1155
|
+
}
|
|
1156
|
+
interface HtmlOptions {
|
|
1157
|
+
verbose: boolean;
|
|
1158
|
+
skipEmpty: boolean;
|
|
1159
|
+
subdir: string;
|
|
1160
|
+
linkMapper: LinkMapper;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
type JsonOptions$1 = FileOptions;
|
|
1164
|
+
type JsonSummaryOptions = FileOptions;
|
|
1165
|
+
|
|
1166
|
+
interface LcovOptions extends FileOptions, ProjectOptions {}
|
|
1167
|
+
interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
|
|
1168
|
+
|
|
1169
|
+
interface TeamcityOptions extends FileOptions {
|
|
1170
|
+
blockName: string;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
interface TextOptions extends FileOptions {
|
|
1174
|
+
maxCols: number;
|
|
1175
|
+
skipEmpty: boolean;
|
|
1176
|
+
skipFull: boolean;
|
|
1177
|
+
}
|
|
1178
|
+
type TextLcovOptions = ProjectOptions;
|
|
1179
|
+
type TextSummaryOptions = FileOptions;
|
|
1180
|
+
|
|
1181
|
+
interface LinkMapper {
|
|
1182
|
+
getPath(node: string | Node): string;
|
|
1183
|
+
relativePath(source: string | Node, target: string | Node): string;
|
|
1184
|
+
assetPath(node: Node, name: string): string;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
type TransformResult = string | Partial<TransformResult$1> | undefined | null | void;
|
|
1188
|
+
type CoverageResults = unknown;
|
|
1189
|
+
interface CoverageProvider {
|
|
1190
|
+
name: string;
|
|
1191
|
+
/** Called when provider is being initialized before tests run */
|
|
1192
|
+
initialize: (ctx: Vitest) => Promise<void> | void;
|
|
1193
|
+
/** Called when setting coverage options for Vitest context (`ctx.config.coverage`) */
|
|
1194
|
+
resolveOptions: () => ResolvedCoverageOptions;
|
|
1195
|
+
/** Callback to clean previous reports */
|
|
1196
|
+
clean: (clean?: boolean) => void | Promise<void>;
|
|
1197
|
+
/** Called with coverage results after a single test file has been run */
|
|
1198
|
+
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void | Promise<void>;
|
|
1199
|
+
/** Callback called when test run fails */
|
|
1200
|
+
onTestFailure?: () => void | Promise<void>;
|
|
1201
|
+
/** Callback to generate final coverage results */
|
|
1202
|
+
generateCoverage: (reportContext: ReportContext) => CoverageResults | Promise<CoverageResults>;
|
|
1203
|
+
/** Callback to convert coverage results to coverage reports. Called with results returned from `generateCoverage` */
|
|
1204
|
+
reportCoverage: (coverage: CoverageResults, reportContext: ReportContext) => void | Promise<void>;
|
|
1205
|
+
/** Callback for `--merge-reports` options. Called with multiple coverage results generated by `generateCoverage`. */
|
|
1206
|
+
mergeReports?: (coverages: CoverageResults[]) => void | Promise<void>;
|
|
1207
|
+
/** Callback called for instrumenting files with coverage counters. */
|
|
1208
|
+
onFileTransform?: (sourceCode: string, id: string, pluginCtx: any) => TransformResult | Promise<TransformResult>;
|
|
1209
|
+
/** Callback that's called when the coverage is enabled via a programmatic `enableCoverage` API. */
|
|
1210
|
+
onEnabled?: () => void | Promise<void>;
|
|
1211
|
+
}
|
|
1212
|
+
interface ReportContext {
|
|
1213
|
+
/** Indicates whether all tests were run. False when only specific tests were run. */
|
|
1214
|
+
allTestsRun?: boolean;
|
|
1215
|
+
}
|
|
1216
|
+
interface CoverageProviderModule extends RuntimeCoverageProviderModule {
|
|
955
1217
|
/**
|
|
956
|
-
*
|
|
1218
|
+
* Factory for creating a new coverage provider
|
|
957
1219
|
*/
|
|
958
|
-
|
|
1220
|
+
getProvider: () => CoverageProvider | Promise<CoverageProvider>;
|
|
1221
|
+
}
|
|
1222
|
+
type CoverageReporter = keyof ReportOptions | (string & {});
|
|
1223
|
+
type CoverageReporterWithOptions<ReporterName extends CoverageReporter = CoverageReporter> = ReporterName extends keyof ReportOptions ? ReportOptions[ReporterName] extends never ? [ReporterName, object] : [ReporterName, Partial<ReportOptions[ReporterName]>] : [ReporterName, Record<string, unknown>];
|
|
1224
|
+
type CoverageProviderName = "v8" | "istanbul" | "custom" | undefined;
|
|
1225
|
+
type CoverageOptions<T extends CoverageProviderName = CoverageProviderName> = T extends "istanbul" ? {
|
|
1226
|
+
provider: T;
|
|
1227
|
+
} & CoverageIstanbulOptions : T extends "v8" ? {
|
|
959
1228
|
/**
|
|
960
|
-
*
|
|
1229
|
+
* Provider to use for coverage collection.
|
|
1230
|
+
*
|
|
1231
|
+
* @default 'v8'
|
|
961
1232
|
*/
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1233
|
+
provider: T;
|
|
1234
|
+
} & CoverageV8Options : T extends "custom" ? {
|
|
1235
|
+
provider: T;
|
|
1236
|
+
} & CustomProviderOptions : {
|
|
1237
|
+
provider?: T;
|
|
1238
|
+
} & CoverageV8Options;
|
|
1239
|
+
/** Fields that have default values. Internally these will always be defined. */
|
|
1240
|
+
type FieldsWithDefaultValues = "enabled" | "clean" | "cleanOnRerun" | "reportsDirectory" | "exclude" | "reportOnFailure" | "allowExternal" | "processingConcurrency";
|
|
1241
|
+
type ResolvedCoverageOptions<T extends CoverageProviderName = CoverageProviderName> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
|
|
1242
|
+
reporter: CoverageReporterWithOptions[];
|
|
1243
|
+
};
|
|
1244
|
+
interface BaseCoverageOptions {
|
|
965
1245
|
/**
|
|
966
|
-
*
|
|
1246
|
+
* Enables coverage collection. Can be overridden using `--coverage` CLI option.
|
|
1247
|
+
*
|
|
1248
|
+
* @default false
|
|
967
1249
|
*/
|
|
968
|
-
|
|
969
|
-
private runner;
|
|
970
|
-
private closingPromise;
|
|
971
|
-
private testFilesList;
|
|
972
|
-
private typecheckFilesList;
|
|
973
|
-
private _globalSetups?;
|
|
974
|
-
private _provided;
|
|
975
|
-
constructor(path: string | number, vitest: Vitest, options?: InitializeProjectOptions | undefined);
|
|
1250
|
+
enabled?: boolean;
|
|
976
1251
|
/**
|
|
977
|
-
*
|
|
1252
|
+
* List of files included in coverage as glob patterns.
|
|
1253
|
+
* By default only files covered by tests are included.
|
|
978
1254
|
*
|
|
979
|
-
*
|
|
1255
|
+
* See [Including and excluding files from coverage report](https://vitest.dev/guide/coverage.html#including-and-excluding-files-from-coverage-report) for examples.
|
|
980
1256
|
*/
|
|
981
|
-
|
|
982
|
-
// "provide" is a property, not a method to keep the context when destructed in the global setup,
|
|
983
|
-
// making it a method would be a breaking change, and can be done in Vitest 3 at minimum
|
|
1257
|
+
include?: string[];
|
|
984
1258
|
/**
|
|
985
|
-
*
|
|
1259
|
+
* List of files excluded from coverage as glob patterns.
|
|
1260
|
+
* Files are first checked against `coverage.include`.
|
|
1261
|
+
*
|
|
1262
|
+
* See [Including and excluding files from coverage report](https://vitest.dev/guide/coverage.html#including-and-excluding-files-from-coverage-report) for examples.
|
|
986
1263
|
*/
|
|
987
|
-
|
|
1264
|
+
exclude?: string[];
|
|
988
1265
|
/**
|
|
989
|
-
*
|
|
1266
|
+
* Clean coverage results before running tests
|
|
1267
|
+
*
|
|
1268
|
+
* @default true
|
|
990
1269
|
*/
|
|
991
|
-
|
|
1270
|
+
clean?: boolean;
|
|
992
1271
|
/**
|
|
993
|
-
*
|
|
994
|
-
*
|
|
1272
|
+
* Clean coverage report on watch rerun
|
|
1273
|
+
*
|
|
1274
|
+
* @default true
|
|
995
1275
|
*/
|
|
996
|
-
|
|
997
|
-
toJSON(): SerializedTestProject;
|
|
1276
|
+
cleanOnRerun?: boolean;
|
|
998
1277
|
/**
|
|
999
|
-
*
|
|
1278
|
+
* Directory to write coverage report to
|
|
1279
|
+
*
|
|
1280
|
+
* @default './coverage'
|
|
1000
1281
|
*/
|
|
1001
|
-
|
|
1282
|
+
reportsDirectory?: string;
|
|
1002
1283
|
/**
|
|
1003
|
-
*
|
|
1284
|
+
* Coverage reporters to use.
|
|
1285
|
+
* See [istanbul documentation](https://istanbul.js.org/docs/advanced/alternative-reporters/) for detailed list of all reporters.
|
|
1286
|
+
*
|
|
1287
|
+
* @default ['text', 'html', 'clover', 'json']
|
|
1004
1288
|
*/
|
|
1005
|
-
|
|
1289
|
+
reporter?: Arrayable<CoverageReporter> | (CoverageReporter | [CoverageReporter] | CoverageReporterWithOptions)[];
|
|
1006
1290
|
/**
|
|
1007
|
-
*
|
|
1291
|
+
* Do not show files with 100% statement, branch, and function coverage
|
|
1292
|
+
*
|
|
1293
|
+
* @default false
|
|
1008
1294
|
*/
|
|
1009
|
-
|
|
1295
|
+
skipFull?: boolean;
|
|
1010
1296
|
/**
|
|
1011
|
-
*
|
|
1297
|
+
* Configurations for thresholds
|
|
1298
|
+
*
|
|
1299
|
+
* @example
|
|
1300
|
+
*
|
|
1301
|
+
* ```ts
|
|
1302
|
+
* {
|
|
1303
|
+
* // Thresholds for all files
|
|
1304
|
+
* functions: 95,
|
|
1305
|
+
* branches: 70,
|
|
1306
|
+
* perFile: true,
|
|
1307
|
+
* autoUpdate: true,
|
|
1308
|
+
*
|
|
1309
|
+
* // Thresholds for utilities
|
|
1310
|
+
* 'src/utils/**.ts': {
|
|
1311
|
+
* lines: 100,
|
|
1312
|
+
* statements: 95,
|
|
1313
|
+
* }
|
|
1314
|
+
* }
|
|
1315
|
+
* ```
|
|
1012
1316
|
*/
|
|
1013
|
-
|
|
1317
|
+
thresholds?: Thresholds | ({
|
|
1318
|
+
[glob: string]: Pick<Thresholds, 100 | "statements" | "functions" | "branches" | "lines">;
|
|
1319
|
+
} & Thresholds);
|
|
1014
1320
|
/**
|
|
1015
|
-
*
|
|
1321
|
+
* Watermarks for statements, lines, branches and functions.
|
|
1322
|
+
*
|
|
1323
|
+
* Default value is `[50,80]` for each property.
|
|
1016
1324
|
*/
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1325
|
+
watermarks?: {
|
|
1326
|
+
statements?: [number, number];
|
|
1327
|
+
functions?: [number, number];
|
|
1328
|
+
branches?: [number, number];
|
|
1329
|
+
lines?: [number, number];
|
|
1330
|
+
};
|
|
1020
1331
|
/**
|
|
1021
|
-
*
|
|
1332
|
+
* Generate coverage report even when tests fail.
|
|
1333
|
+
*
|
|
1334
|
+
* @default false
|
|
1022
1335
|
*/
|
|
1023
|
-
|
|
1024
|
-
/** @deprecated use `isRootProject` instead */
|
|
1025
|
-
isCore(): boolean;
|
|
1026
|
-
/** @deprecated use `createSpecification` instead */
|
|
1027
|
-
createSpec(moduleId: string, pool: string): WorkspaceSpec;
|
|
1028
|
-
/** @deprecated */
|
|
1029
|
-
initializeGlobalSetup(): Promise<void>;
|
|
1030
|
-
onTestsRerun(cb: OnTestsRerunHandler): void;
|
|
1031
|
-
/** @deprecated */
|
|
1032
|
-
teardownGlobalSetup(): Promise<void>;
|
|
1033
|
-
/** @deprecated use `vitest.logger` instead */
|
|
1034
|
-
get logger(): Logger;
|
|
1035
|
-
// it's possible that file path was imported with different queries (?raw, ?url, etc)
|
|
1036
|
-
/** @deprecated use `.vite` or `.browser.vite` directly */
|
|
1037
|
-
getModulesByFilepath(file: string): Set<ModuleNode>;
|
|
1038
|
-
/** @deprecated use `.vite` or `.browser.vite` directly */
|
|
1039
|
-
getModuleById(id: string): ModuleNode | undefined;
|
|
1040
|
-
/** @deprecated use `.vite` or `.browser.vite` directly */
|
|
1041
|
-
getSourceMapModuleById(id: string): TransformResult$1["map"] | undefined;
|
|
1042
|
-
/** @deprecated use `vitest.reporters` instead */
|
|
1043
|
-
get reporters(): Reporter[];
|
|
1336
|
+
reportOnFailure?: boolean;
|
|
1044
1337
|
/**
|
|
1045
|
-
*
|
|
1046
|
-
*
|
|
1338
|
+
* Collect coverage of files outside the project `root`.
|
|
1339
|
+
*
|
|
1340
|
+
* @default false
|
|
1047
1341
|
*/
|
|
1048
|
-
|
|
1049
|
-
/**
|
|
1050
|
-
* Test files that match the filters.
|
|
1051
|
-
*/
|
|
1052
|
-
testFiles: string[];
|
|
1053
|
-
/**
|
|
1054
|
-
* Typecheck test files that match the filters. This will be empty unless `typecheck.enabled` is `true`.
|
|
1055
|
-
*/
|
|
1056
|
-
typecheckTestFiles: string[];
|
|
1057
|
-
}>;
|
|
1058
|
-
private globAllTestFiles;
|
|
1059
|
-
isBrowserEnabled(): boolean;
|
|
1060
|
-
private markTestFile;
|
|
1061
|
-
/** @deprecated use `serializedConfig` instead */
|
|
1062
|
-
getSerializableConfig(): SerializedConfig;
|
|
1342
|
+
allowExternal?: boolean;
|
|
1063
1343
|
/**
|
|
1064
|
-
*
|
|
1344
|
+
* Apply exclusions again after coverage has been remapped to original sources.
|
|
1345
|
+
* This is useful when your source files are transpiled and may contain source maps
|
|
1346
|
+
* of non-source files.
|
|
1347
|
+
*
|
|
1348
|
+
* Use this option when you are seeing files that show up in report even if they
|
|
1349
|
+
* match your `coverage.exclude` patterns.
|
|
1350
|
+
*
|
|
1351
|
+
* @default false
|
|
1065
1352
|
*/
|
|
1066
|
-
|
|
1067
|
-
/** @deprecated use `matchesTestGlob` instead */
|
|
1068
|
-
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
1069
|
-
private isInSourceTestCode;
|
|
1070
|
-
private filterFiles;
|
|
1071
|
-
private _parentBrowser?;
|
|
1353
|
+
excludeAfterRemap?: boolean;
|
|
1072
1354
|
/**
|
|
1073
|
-
*
|
|
1074
|
-
*
|
|
1355
|
+
* Concurrency limit used when processing the coverage results.
|
|
1356
|
+
* Defaults to `Math.min(20, os.availableParallelism?.() ?? os.cpus().length)`
|
|
1075
1357
|
*/
|
|
1076
|
-
|
|
1358
|
+
processingConcurrency?: number;
|
|
1077
1359
|
/**
|
|
1078
|
-
*
|
|
1079
|
-
*
|
|
1360
|
+
* Set to array of class method names to ignore for coverage
|
|
1361
|
+
*
|
|
1362
|
+
* @default []
|
|
1080
1363
|
*/
|
|
1081
|
-
|
|
1082
|
-
/** @deprecated use `name` instead */
|
|
1083
|
-
getName(): string;
|
|
1084
|
-
/** @deprecated internal */
|
|
1085
|
-
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
1086
|
-
private _setHash;
|
|
1087
|
-
private _serializeOverriddenConfig;
|
|
1088
|
-
private clearTmpDir;
|
|
1089
|
-
/** @deprecated */
|
|
1090
|
-
initBrowserProvider(): Promise<void>;
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
interface SerializedTestProject {
|
|
1094
|
-
name: string;
|
|
1095
|
-
serializedConfig: SerializedConfig;
|
|
1096
|
-
context: ProvidedContext;
|
|
1364
|
+
ignoreClassMethods?: string[];
|
|
1097
1365
|
}
|
|
1098
|
-
interface
|
|
1099
|
-
|
|
1366
|
+
interface CoverageIstanbulOptions extends BaseCoverageOptions {}
|
|
1367
|
+
interface CoverageV8Options extends BaseCoverageOptions {}
|
|
1368
|
+
interface CustomProviderOptions extends Pick<BaseCoverageOptions, FieldsWithDefaultValues> {
|
|
1369
|
+
/** Name of the module or path to a file to load the custom provider from */
|
|
1370
|
+
customProviderModule: string;
|
|
1100
1371
|
}
|
|
1101
|
-
|
|
1102
|
-
/**
|
|
1103
|
-
|
|
1104
|
-
*/
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1372
|
+
interface Thresholds {
|
|
1373
|
+
/** Set global thresholds to `100` */
|
|
1374
|
+
100?: boolean;
|
|
1375
|
+
/** Check thresholds per file. */
|
|
1376
|
+
perFile?: boolean;
|
|
1377
|
+
/**
|
|
1378
|
+
* Update threshold values automatically when current coverage is higher than earlier thresholds
|
|
1379
|
+
*
|
|
1380
|
+
* @default false
|
|
1381
|
+
*/
|
|
1382
|
+
autoUpdate?: boolean;
|
|
1383
|
+
/** Thresholds for statements */
|
|
1384
|
+
statements?: number;
|
|
1385
|
+
/** Thresholds for functions */
|
|
1386
|
+
functions?: number;
|
|
1387
|
+
/** Thresholds for branches */
|
|
1388
|
+
branches?: number;
|
|
1389
|
+
/** Thresholds for lines */
|
|
1390
|
+
lines?: number;
|
|
1114
1391
|
}
|
|
1115
|
-
declare function getFilePoolName(project: TestProject): Pool;
|
|
1116
1392
|
|
|
1117
1393
|
interface TestRunResult {
|
|
1118
1394
|
testModules: TestModule[];
|
|
@@ -1159,6 +1435,53 @@ declare class VitestCache {
|
|
|
1159
1435
|
static resolveCacheDir(root: string, dir?: string, projectName?: string): string;
|
|
1160
1436
|
}
|
|
1161
1437
|
|
|
1438
|
+
declare class TypeCheckError extends Error {
|
|
1439
|
+
message: string;
|
|
1440
|
+
stacks: ParsedStack[];
|
|
1441
|
+
name: string;
|
|
1442
|
+
constructor(message: string, stacks: ParsedStack[]);
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
interface ErrorOptions {
|
|
1446
|
+
type?: string;
|
|
1447
|
+
fullStack?: boolean;
|
|
1448
|
+
project?: TestProject;
|
|
1449
|
+
verbose?: boolean;
|
|
1450
|
+
screenshotPaths?: string[];
|
|
1451
|
+
task?: Task;
|
|
1452
|
+
showCodeFrame?: boolean;
|
|
1453
|
+
}
|
|
1454
|
+
type Listener = () => void;
|
|
1455
|
+
declare class Logger {
|
|
1456
|
+
ctx: Vitest;
|
|
1457
|
+
outputStream: NodeJS.WriteStream | Writable;
|
|
1458
|
+
errorStream: NodeJS.WriteStream | Writable;
|
|
1459
|
+
private _clearScreenPending;
|
|
1460
|
+
private _highlights;
|
|
1461
|
+
private cleanupListeners;
|
|
1462
|
+
console: Console;
|
|
1463
|
+
constructor(ctx: Vitest, outputStream?: NodeJS.WriteStream | Writable, errorStream?: NodeJS.WriteStream | Writable);
|
|
1464
|
+
log(...args: any[]): void;
|
|
1465
|
+
error(...args: any[]): void;
|
|
1466
|
+
warn(...args: any[]): void;
|
|
1467
|
+
clearFullScreen(message?: string): void;
|
|
1468
|
+
clearScreen(message: string, force?: boolean): void;
|
|
1469
|
+
private _clearScreen;
|
|
1470
|
+
printError(err: unknown, options?: ErrorOptions): void;
|
|
1471
|
+
deprecate(message: string): void;
|
|
1472
|
+
clearHighlightCache(filename?: string): void;
|
|
1473
|
+
highlight(filename: string, source: string): string;
|
|
1474
|
+
printNoTestFound(filters?: string[]): void;
|
|
1475
|
+
printBanner(): void;
|
|
1476
|
+
printBrowserBanner(project: TestProject): void;
|
|
1477
|
+
printUnhandledErrors(errors: ReadonlyArray<unknown>): void;
|
|
1478
|
+
printSourceTypeErrors(errors: TypeCheckError[]): void;
|
|
1479
|
+
getColumns(): number;
|
|
1480
|
+
onTerminalCleanup(listener: Listener): void;
|
|
1481
|
+
private addCleanupListeners;
|
|
1482
|
+
private registerUnhandledRejection;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1162
1485
|
declare class VitestPackageInstaller {
|
|
1163
1486
|
isPackageExists(name: string, options?: {
|
|
1164
1487
|
paths?: string[];
|
|
@@ -1224,6 +1547,36 @@ declare class StateManager {
|
|
|
1224
1547
|
cancelFiles(files: string[], project: TestProject): void;
|
|
1225
1548
|
}
|
|
1226
1549
|
|
|
1550
|
+
declare class VitestWatcher {
|
|
1551
|
+
private vitest;
|
|
1552
|
+
/**
|
|
1553
|
+
* Modules that will be invalidated on the next run.
|
|
1554
|
+
*/
|
|
1555
|
+
readonly invalidates: Set<string>;
|
|
1556
|
+
/**
|
|
1557
|
+
* Test files that have changed and need to be rerun.
|
|
1558
|
+
*/
|
|
1559
|
+
readonly changedTests: Set<string>;
|
|
1560
|
+
private readonly _onRerun;
|
|
1561
|
+
constructor(vitest: Vitest);
|
|
1562
|
+
unregisterWatcher: () => void;
|
|
1563
|
+
registerWatcher(): this;
|
|
1564
|
+
private scheduleRerun;
|
|
1565
|
+
private getTestFilesFromWatcherTrigger;
|
|
1566
|
+
onFileChange: (id: string) => void;
|
|
1567
|
+
onFileDelete: (id: string) => void;
|
|
1568
|
+
onFileCreate: (id: string) => void;
|
|
1569
|
+
private handleSetupFile;
|
|
1570
|
+
/**
|
|
1571
|
+
* @returns A value indicating whether rerun is needed (changedTests was mutated)
|
|
1572
|
+
*/
|
|
1573
|
+
private handleFileChanged;
|
|
1574
|
+
}
|
|
1575
|
+
interface WatcherTriggerPattern {
|
|
1576
|
+
pattern: RegExp;
|
|
1577
|
+
testsToRun: (file: string, match: RegExpMatchArray) => string[] | string | null | undefined | void;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1227
1580
|
interface VitestOptions {
|
|
1228
1581
|
packageInstaller?: VitestPackageInstaller;
|
|
1229
1582
|
stdin?: NodeJS.ReadStream;
|
|
@@ -1262,16 +1615,24 @@ declare class Vitest {
|
|
|
1262
1615
|
* If projects were filtered with `--project` flag, they won't appear here.
|
|
1263
1616
|
*/
|
|
1264
1617
|
projects: TestProject[];
|
|
1618
|
+
/**
|
|
1619
|
+
* A watcher handler. This is not the file system watcher. The handler only
|
|
1620
|
+
* exposes methods to handle changed files.
|
|
1621
|
+
*
|
|
1622
|
+
* If you have your own watcher, you can use these methods to replicate
|
|
1623
|
+
* Vitest behaviour.
|
|
1624
|
+
*/
|
|
1625
|
+
readonly watcher: VitestWatcher;
|
|
1265
1626
|
private isFirstRun;
|
|
1266
1627
|
private restartsCount;
|
|
1267
1628
|
private readonly specifications;
|
|
1268
|
-
private readonly watcher;
|
|
1269
1629
|
private pool;
|
|
1270
1630
|
private _config?;
|
|
1271
1631
|
private _vite?;
|
|
1272
1632
|
private _state?;
|
|
1273
1633
|
private _cache?;
|
|
1274
1634
|
private _snapshot?;
|
|
1635
|
+
private _coverageProvider?;
|
|
1275
1636
|
constructor(mode: VitestRunMode, cliOptions: UserConfig, options?: VitestOptions);
|
|
1276
1637
|
private _onRestartListeners;
|
|
1277
1638
|
private _onClose;
|
|
@@ -1279,16 +1640,10 @@ declare class Vitest {
|
|
|
1279
1640
|
private _onCancelListeners;
|
|
1280
1641
|
private _onUserTestsRerun;
|
|
1281
1642
|
private _onFilterWatchedSpecification;
|
|
1282
|
-
/** @deprecated will be removed in 4.0, use `onFilterWatchedSpecification` instead */
|
|
1283
|
-
get invalidates(): Set<string>;
|
|
1284
|
-
/** @deprecated will be removed in 4.0, use `onFilterWatchedSpecification` instead */
|
|
1285
|
-
get changedTests(): Set<string>;
|
|
1286
1643
|
/**
|
|
1287
1644
|
* The global config.
|
|
1288
1645
|
*/
|
|
1289
1646
|
get config(): ResolvedConfig;
|
|
1290
|
-
/** @deprecated use `vitest.vite` instead */
|
|
1291
|
-
get server(): ViteDevServer;
|
|
1292
1647
|
/**
|
|
1293
1648
|
* Global Vite's dev server instance.
|
|
1294
1649
|
*/
|
|
@@ -1306,8 +1661,9 @@ declare class Vitest {
|
|
|
1306
1661
|
* Test results and test file stats cache. Primarily used by the sequencer to sort tests.
|
|
1307
1662
|
*/
|
|
1308
1663
|
get cache(): VitestCache;
|
|
1309
|
-
|
|
1310
|
-
|
|
1664
|
+
enableCoverage(): Promise<void>;
|
|
1665
|
+
disableCoverage(): void;
|
|
1666
|
+
private _coverageOverrideCache;
|
|
1311
1667
|
/**
|
|
1312
1668
|
* Inject new test projects into the workspace.
|
|
1313
1669
|
* @param config Glob, config path or a custom config options.
|
|
@@ -1322,22 +1678,20 @@ declare class Vitest {
|
|
|
1322
1678
|
* Get global provided context.
|
|
1323
1679
|
*/
|
|
1324
1680
|
getProvidedContext(): ProvidedContext;
|
|
1325
|
-
/** @deprecated use `getRootProject` instead */
|
|
1326
|
-
getCoreWorkspaceProject(): TestProject;
|
|
1327
1681
|
/**
|
|
1328
1682
|
* Return project that has the root (or "global") config.
|
|
1329
1683
|
*/
|
|
1330
1684
|
getRootProject(): TestProject;
|
|
1331
|
-
/**
|
|
1332
|
-
* @deprecated use Reported Task API instead
|
|
1333
|
-
*/
|
|
1334
|
-
getProjectByTaskId(taskId: string): TestProject;
|
|
1335
1685
|
getProjectByName(name: string): TestProject;
|
|
1336
1686
|
/**
|
|
1337
1687
|
* Import a file using Vite module runner. The file will be transformed by Vite and executed in a separate context.
|
|
1338
1688
|
* @param moduleId The ID of the module in Vite module graph
|
|
1339
1689
|
*/
|
|
1340
1690
|
import<T>(moduleId: string): Promise<T>;
|
|
1691
|
+
/**
|
|
1692
|
+
* Creates a coverage provider if `coverage` is enabled in the config.
|
|
1693
|
+
*/
|
|
1694
|
+
createCoverageProvider(): Promise<CoverageProvider | null>;
|
|
1341
1695
|
private resolveProjects;
|
|
1342
1696
|
/**
|
|
1343
1697
|
* Glob test files in every project and create a TestSpecification for each file and pool.
|
|
@@ -1350,8 +1704,6 @@ declare class Vitest {
|
|
|
1350
1704
|
*/
|
|
1351
1705
|
mergeReports(directory?: string): Promise<TestRunResult>;
|
|
1352
1706
|
collect(filters?: string[]): Promise<TestRunResult>;
|
|
1353
|
-
/** @deprecated use `getRelevantTestSpecifications` instead */
|
|
1354
|
-
listFiles(filters?: string[]): Promise<TestSpecification[]>;
|
|
1355
1707
|
/**
|
|
1356
1708
|
* Returns the list of test files that match the config and filters.
|
|
1357
1709
|
* @param filters String filters to match the test files
|
|
@@ -1372,11 +1724,10 @@ declare class Vitest {
|
|
|
1372
1724
|
*/
|
|
1373
1725
|
init(): Promise<void>;
|
|
1374
1726
|
/**
|
|
1375
|
-
*
|
|
1727
|
+
* If there is a test run happening, returns a promise that will
|
|
1728
|
+
* resolve when the test run is finished.
|
|
1376
1729
|
*/
|
|
1377
|
-
|
|
1378
|
-
/** @deprecated */
|
|
1379
|
-
getFileWorkspaceSpecs(file: string): WorkspaceSpec[];
|
|
1730
|
+
waitForTestRunEnd(): Promise<void>;
|
|
1380
1731
|
/**
|
|
1381
1732
|
* Get test specifications associated with the given module. If module is not a test file, an empty array is returned.
|
|
1382
1733
|
*
|
|
@@ -1401,6 +1752,11 @@ declare class Vitest {
|
|
|
1401
1752
|
*/
|
|
1402
1753
|
rerunTestSpecifications(specifications: TestSpecification[], allTestsRun?: boolean): Promise<TestRunResult>;
|
|
1403
1754
|
private runFiles;
|
|
1755
|
+
experimental_parseSpecifications(specifications: TestSpecification[], options?: {
|
|
1756
|
+
/** @default os.availableParallelism() */
|
|
1757
|
+
concurrency?: number;
|
|
1758
|
+
}): Promise<TestModule[]>;
|
|
1759
|
+
experimental_parseSpecification(specification: TestSpecification): Promise<TestModule>;
|
|
1404
1760
|
/**
|
|
1405
1761
|
* Collect tests in specified modules. Vitest will run the files to collect tests.
|
|
1406
1762
|
* @param specifications A list of specifications to run.
|
|
@@ -1438,14 +1794,11 @@ declare class Vitest {
|
|
|
1438
1794
|
*/
|
|
1439
1795
|
resetGlobalTestNamePattern(): void;
|
|
1440
1796
|
private _rerunTimer;
|
|
1441
|
-
// we can't use a single `triggerId` yet because vscode extension relies on this
|
|
1442
1797
|
private scheduleRerun;
|
|
1443
1798
|
/**
|
|
1444
1799
|
* Invalidate a file in all projects.
|
|
1445
1800
|
*/
|
|
1446
1801
|
invalidateFile(filepath: string): void;
|
|
1447
|
-
/** @deprecated use `invalidateFile` */
|
|
1448
|
-
updateLastChanged(filepath: string): void;
|
|
1449
1802
|
private reportCoverage;
|
|
1450
1803
|
/**
|
|
1451
1804
|
* Closes all projects and their associated resources.
|
|
@@ -1458,16 +1811,6 @@ declare class Vitest {
|
|
|
1458
1811
|
*/
|
|
1459
1812
|
exit(force?: boolean): Promise<void>;
|
|
1460
1813
|
/**
|
|
1461
|
-
* @deprecated use `globTestSpecifications` instead
|
|
1462
|
-
*/
|
|
1463
|
-
globTestSpecs(filters?: string[]): Promise<TestSpecification[]>;
|
|
1464
|
-
/**
|
|
1465
|
-
* @deprecated use `globTestSpecifications` instead
|
|
1466
|
-
*/
|
|
1467
|
-
globTestFiles(filters?: string[]): Promise<TestSpecification[]>;
|
|
1468
|
-
/** @deprecated filter by `this.projects` yourself */
|
|
1469
|
-
getModuleProjects(filepath: string): TestProject[];
|
|
1470
|
-
/**
|
|
1471
1814
|
* Should the server be kept running after the tests are done.
|
|
1472
1815
|
*/
|
|
1473
1816
|
shouldKeepServer(): boolean;
|
|
@@ -1573,182 +1916,78 @@ interface Reporter {
|
|
|
1573
1916
|
/**
|
|
1574
1917
|
* Called after the hook finished running.
|
|
1575
1918
|
*/
|
|
1576
|
-
onHookEnd?: (hook: ReportedHookContext) => Awaitable$1<void>;
|
|
1577
|
-
onCoverage?: (coverage: unknown) => Awaitable$1<void>;
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
interface BaseOptions {
|
|
1581
|
-
isTTY?: boolean;
|
|
1582
|
-
}
|
|
1583
|
-
declare abstract class BaseReporter implements Reporter {
|
|
1584
|
-
start: number;
|
|
1585
|
-
end: number;
|
|
1586
|
-
watchFilters?: string[];
|
|
1587
|
-
failedUnwatchedFiles: TestModule[];
|
|
1588
|
-
isTTY: boolean;
|
|
1589
|
-
ctx: Vitest;
|
|
1590
|
-
renderSucceed: boolean;
|
|
1591
|
-
protected verbose: boolean;
|
|
1592
|
-
private _filesInWatchMode;
|
|
1593
|
-
private _timeStart;
|
|
1594
|
-
constructor(options?: BaseOptions);
|
|
1595
|
-
onInit(ctx: Vitest): void;
|
|
1596
|
-
log(...messages: any): void;
|
|
1597
|
-
error(...messages: any): void;
|
|
1598
|
-
relative(path: string): string;
|
|
1599
|
-
onTestRunEnd(testModules: ReadonlyArray<TestModule>, unhandledErrors: ReadonlyArray<SerializedError>, _reason: TestRunEndReason): void;
|
|
1600
|
-
onTestCaseResult(testCase: TestCase): void;
|
|
1601
|
-
onTestSuiteResult(testSuite: TestSuite): void;
|
|
1602
|
-
onTestModuleEnd(testModule: TestModule): void;
|
|
1603
|
-
private logFailedTask;
|
|
1604
|
-
protected printTestModule(testModule: TestModule): void;
|
|
1605
|
-
protected printTestCase(moduleState: TestModuleState, test: TestCase): void;
|
|
1606
|
-
private getModuleLog;
|
|
1607
|
-
protected printTestSuite(_suite: TestSuite): void;
|
|
1608
|
-
protected getTestName(test: Task, separator?: string): string;
|
|
1609
|
-
protected getFullName(test: Task, separator?: string): string;
|
|
1610
|
-
protected formatShortError(error: TestError): string;
|
|
1611
|
-
protected getTestIndentation(_test: Task): string;
|
|
1612
|
-
protected printAnnotations(test: TestCase, console: "log" | "error", padding?: number): void;
|
|
1613
|
-
protected getDurationPrefix(task: Task): string;
|
|
1614
|
-
onWatcherStart(files?: File[], errors?: unknown[]): void;
|
|
1615
|
-
onWatcherRerun(files: string[], trigger?: string): void;
|
|
1616
|
-
onUserConsoleLog(log: UserConsoleLog, taskState?: TestResult["state"]): void;
|
|
1617
|
-
onTestRemoved(trigger?: string): void;
|
|
1618
|
-
shouldLog(log: UserConsoleLog, taskState?: TestResult["state"]): boolean;
|
|
1619
|
-
onServerRestart(reason?: string): void;
|
|
1620
|
-
reportSummary(files: File[], errors: unknown[]): void;
|
|
1621
|
-
reportTestSummary(files: File[], errors: unknown[]): void;
|
|
1622
|
-
private printErrorsSummary;
|
|
1623
|
-
reportBenchmarkSummary(files: File[]): void;
|
|
1624
|
-
private printTaskErrors;
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
|
-
interface DefaultReporterOptions extends BaseOptions {
|
|
1628
|
-
summary?: boolean;
|
|
1629
|
-
}
|
|
1630
|
-
declare class DefaultReporter extends BaseReporter {
|
|
1631
|
-
private options;
|
|
1632
|
-
private summary?;
|
|
1633
|
-
constructor(options?: DefaultReporterOptions);
|
|
1634
|
-
onTestRunStart(specifications: ReadonlyArray<TestSpecification>): void;
|
|
1635
|
-
onTestRunEnd(testModules: ReadonlyArray<TestModule>, unhandledErrors: ReadonlyArray<SerializedError>, reason: TestRunEndReason): void;
|
|
1636
|
-
onTestModuleQueued(file: TestModule): void;
|
|
1637
|
-
onTestModuleCollected(module: TestModule): void;
|
|
1638
|
-
onTestModuleEnd(module: TestModule): void;
|
|
1639
|
-
onTestCaseReady(test: TestCase): void;
|
|
1640
|
-
onTestCaseResult(test: TestCase): void;
|
|
1641
|
-
onHookStart(hook: ReportedHookContext): void;
|
|
1642
|
-
onHookEnd(hook: ReportedHookContext): void;
|
|
1643
|
-
onInit(ctx: Vitest): void;
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
interface HTMLOptions {
|
|
1647
|
-
outputFile?: string;
|
|
1648
|
-
}
|
|
1649
|
-
|
|
1650
|
-
interface CoverageSummaryData {
|
|
1651
|
-
lines: Totals;
|
|
1652
|
-
statements: Totals;
|
|
1653
|
-
branches: Totals;
|
|
1654
|
-
functions: Totals;
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
declare class CoverageSummary {
|
|
1658
|
-
constructor(data: CoverageSummary | CoverageSummaryData);
|
|
1659
|
-
merge(obj: CoverageSummary): CoverageSummary;
|
|
1660
|
-
toJSON(): CoverageSummaryData;
|
|
1661
|
-
isEmpty(): boolean;
|
|
1662
|
-
data: CoverageSummaryData;
|
|
1663
|
-
lines: Totals;
|
|
1664
|
-
statements: Totals;
|
|
1665
|
-
branches: Totals;
|
|
1666
|
-
functions: Totals;
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
interface CoverageMapData {
|
|
1670
|
-
[key: string]: FileCoverage | FileCoverageData;
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
declare class CoverageMap {
|
|
1674
|
-
constructor(data: CoverageMapData | CoverageMap);
|
|
1675
|
-
addFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): void;
|
|
1676
|
-
files(): string[];
|
|
1677
|
-
fileCoverageFor(filename: string): FileCoverage;
|
|
1678
|
-
filter(callback: (key: string) => boolean): void;
|
|
1679
|
-
getCoverageSummary(): CoverageSummary;
|
|
1680
|
-
merge(data: CoverageMapData | CoverageMap): void;
|
|
1681
|
-
toJSON(): CoverageMapData;
|
|
1682
|
-
data: CoverageMapData;
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
interface Location {
|
|
1686
|
-
line: number;
|
|
1687
|
-
column: number;
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
interface Range {
|
|
1691
|
-
start: Location;
|
|
1692
|
-
end: Location;
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
interface BranchMapping {
|
|
1696
|
-
loc: Range;
|
|
1697
|
-
type: string;
|
|
1698
|
-
locations: Range[];
|
|
1699
|
-
line: number;
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
|
-
interface FunctionMapping {
|
|
1703
|
-
name: string;
|
|
1704
|
-
decl: Range;
|
|
1705
|
-
loc: Range;
|
|
1706
|
-
line: number;
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
interface FileCoverageData {
|
|
1710
|
-
path: string;
|
|
1711
|
-
statementMap: { [key: string]: Range };
|
|
1712
|
-
fnMap: { [key: string]: FunctionMapping };
|
|
1713
|
-
branchMap: { [key: string]: BranchMapping };
|
|
1714
|
-
s: { [key: string]: number };
|
|
1715
|
-
f: { [key: string]: number };
|
|
1716
|
-
b: { [key: string]: number[] };
|
|
1919
|
+
onHookEnd?: (hook: ReportedHookContext) => Awaitable$1<void>;
|
|
1920
|
+
onCoverage?: (coverage: unknown) => Awaitable$1<void>;
|
|
1717
1921
|
}
|
|
1718
1922
|
|
|
1719
|
-
interface
|
|
1720
|
-
|
|
1721
|
-
covered: number;
|
|
1722
|
-
skipped: number;
|
|
1723
|
-
pct: number;
|
|
1923
|
+
interface BaseOptions {
|
|
1924
|
+
isTTY?: boolean;
|
|
1724
1925
|
}
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1926
|
+
declare abstract class BaseReporter implements Reporter {
|
|
1927
|
+
start: number;
|
|
1928
|
+
end: number;
|
|
1929
|
+
watchFilters?: string[];
|
|
1930
|
+
failedUnwatchedFiles: TestModule[];
|
|
1931
|
+
isTTY: boolean;
|
|
1932
|
+
ctx: Vitest;
|
|
1933
|
+
renderSucceed: boolean;
|
|
1934
|
+
protected verbose: boolean;
|
|
1935
|
+
private _filesInWatchMode;
|
|
1936
|
+
private _timeStart;
|
|
1937
|
+
constructor(options?: BaseOptions);
|
|
1938
|
+
onInit(ctx: Vitest): void;
|
|
1939
|
+
log(...messages: any): void;
|
|
1940
|
+
error(...messages: any): void;
|
|
1941
|
+
relative(path: string): string;
|
|
1942
|
+
onTestRunEnd(testModules: ReadonlyArray<TestModule>, unhandledErrors: ReadonlyArray<SerializedError>, _reason: TestRunEndReason): void;
|
|
1943
|
+
onTestCaseResult(testCase: TestCase): void;
|
|
1944
|
+
onTestSuiteResult(testSuite: TestSuite): void;
|
|
1945
|
+
onTestModuleEnd(testModule: TestModule): void;
|
|
1946
|
+
private logFailedTask;
|
|
1947
|
+
protected printTestModule(testModule: TestModule): void;
|
|
1948
|
+
protected printTestCase(moduleState: TestModuleState, test: TestCase): void;
|
|
1949
|
+
private getModuleLog;
|
|
1950
|
+
protected printTestSuite(_suite: TestSuite): void;
|
|
1951
|
+
protected getTestName(test: Task, separator?: string): string;
|
|
1952
|
+
protected getFullName(test: Task, separator?: string): string;
|
|
1953
|
+
protected formatShortError(error: TestError): string;
|
|
1954
|
+
protected getTestIndentation(_test: Task): string;
|
|
1955
|
+
protected printAnnotations(test: TestCase, console: "log" | "error", padding?: number): void;
|
|
1956
|
+
protected getDurationPrefix(task: Task): string;
|
|
1957
|
+
onWatcherStart(files?: File[], errors?: unknown[]): void;
|
|
1958
|
+
onWatcherRerun(files: string[], trigger?: string): void;
|
|
1959
|
+
onUserConsoleLog(log: UserConsoleLog, taskState?: TestResult["state"]): void;
|
|
1960
|
+
onTestRemoved(trigger?: string): void;
|
|
1961
|
+
shouldLog(log: UserConsoleLog, taskState?: TestResult["state"]): boolean;
|
|
1962
|
+
onServerRestart(reason?: string): void;
|
|
1963
|
+
reportSummary(files: File[], errors: unknown[]): void;
|
|
1964
|
+
reportTestSummary(files: File[], errors: unknown[]): void;
|
|
1965
|
+
private printErrorsSummary;
|
|
1966
|
+
reportBenchmarkSummary(files: File[]): void;
|
|
1967
|
+
private printTaskErrors;
|
|
1730
1968
|
}
|
|
1731
1969
|
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1970
|
+
interface DefaultReporterOptions extends BaseOptions {
|
|
1971
|
+
summary?: boolean;
|
|
1972
|
+
}
|
|
1973
|
+
declare class DefaultReporter extends BaseReporter {
|
|
1974
|
+
private options;
|
|
1975
|
+
private summary?;
|
|
1976
|
+
constructor(options?: DefaultReporterOptions);
|
|
1977
|
+
onTestRunStart(specifications: ReadonlyArray<TestSpecification>): void;
|
|
1978
|
+
onTestRunEnd(testModules: ReadonlyArray<TestModule>, unhandledErrors: ReadonlyArray<SerializedError>, reason: TestRunEndReason): void;
|
|
1979
|
+
onTestModuleQueued(file: TestModule): void;
|
|
1980
|
+
onTestModuleCollected(module: TestModule): void;
|
|
1981
|
+
onTestModuleEnd(module: TestModule): void;
|
|
1982
|
+
onTestCaseReady(test: TestCase): void;
|
|
1983
|
+
onTestCaseResult(test: TestCase): void;
|
|
1984
|
+
onHookStart(hook: ReportedHookContext): void;
|
|
1985
|
+
onHookEnd(hook: ReportedHookContext): void;
|
|
1986
|
+
onInit(ctx: Vitest): void;
|
|
1987
|
+
}
|
|
1743
1988
|
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
statementMap: { [key: string]: Range };
|
|
1747
|
-
fnMap: { [key: string]: FunctionMapping };
|
|
1748
|
-
branchMap: { [key: string]: BranchMapping };
|
|
1749
|
-
s: { [key: string]: number };
|
|
1750
|
-
f: { [key: string]: number };
|
|
1751
|
-
b: { [key: string]: number[] };
|
|
1989
|
+
interface HTMLOptions {
|
|
1990
|
+
outputFile?: string;
|
|
1752
1991
|
}
|
|
1753
1992
|
|
|
1754
1993
|
// for compatibility reasons, the reporter produces a JSON similar to the one produced by the Jest JSON reporter
|
|
@@ -1794,15 +2033,15 @@ interface JsonTestResults {
|
|
|
1794
2033
|
snapshot: SnapshotSummary;
|
|
1795
2034
|
coverageMap?: CoverageMap | null | undefined;
|
|
1796
2035
|
}
|
|
1797
|
-
interface JsonOptions
|
|
2036
|
+
interface JsonOptions {
|
|
1798
2037
|
outputFile?: string;
|
|
1799
2038
|
}
|
|
1800
2039
|
declare class JsonReporter implements Reporter {
|
|
1801
2040
|
start: number;
|
|
1802
2041
|
ctx: Vitest;
|
|
1803
|
-
options: JsonOptions
|
|
2042
|
+
options: JsonOptions;
|
|
1804
2043
|
coverageMap?: CoverageMap;
|
|
1805
|
-
constructor(options: JsonOptions
|
|
2044
|
+
constructor(options: JsonOptions);
|
|
1806
2045
|
onInit(ctx: Vitest): void;
|
|
1807
2046
|
onCoverage(coverageMap: unknown): void;
|
|
1808
2047
|
onTestRunEnd(testModules: ReadonlyArray<TestModule>): Promise<void>;
|
|
@@ -1926,391 +2165,107 @@ declare function renderTable(options: {
|
|
|
1926
2165
|
compare?: Record<Task["id"], FormattedBenchmarkResult>;
|
|
1927
2166
|
}): string;
|
|
1928
2167
|
|
|
1929
|
-
declare class BenchmarkReporter extends DefaultReporter {
|
|
1930
|
-
compare?: Parameters<typeof renderTable>[0]["compare"];
|
|
1931
|
-
onInit(ctx: Vitest): Promise<void>;
|
|
1932
|
-
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1933
|
-
onTestSuiteResult(testSuite: TestSuite): void;
|
|
1934
|
-
protected printTestModule(testModule: TestModule): void;
|
|
1935
|
-
private printSuiteTable;
|
|
1936
|
-
onTestRunEnd(testModules: ReadonlyArray<TestModule>, unhandledErrors: ReadonlyArray<SerializedError>, reason: TestRunEndReason): Promise<void>;
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
|
-
declare class VerboseBenchmarkReporter extends BenchmarkReporter {
|
|
1940
|
-
protected verbose: boolean;
|
|
1941
|
-
}
|
|
1942
|
-
|
|
1943
|
-
declare const BenchmarkReportsMap: {
|
|
1944
|
-
default: typeof BenchmarkReporter;
|
|
1945
|
-
verbose: typeof VerboseBenchmarkReporter;
|
|
1946
|
-
};
|
|
1947
|
-
type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
|
|
1948
|
-
|
|
1949
|
-
declare const ReportersMap: {
|
|
1950
|
-
default: typeof DefaultReporter;
|
|
1951
|
-
blob: typeof BlobReporter;
|
|
1952
|
-
verbose: typeof VerboseReporter;
|
|
1953
|
-
dot: typeof DotReporter;
|
|
1954
|
-
json: typeof JsonReporter;
|
|
1955
|
-
tap: typeof TapReporter;
|
|
1956
|
-
"tap-flat": typeof TapFlatReporter;
|
|
1957
|
-
junit: typeof JUnitReporter;
|
|
1958
|
-
"hanging-process": typeof HangingProcessReporter;
|
|
1959
|
-
"github-actions": typeof GithubActionsReporter;
|
|
1960
|
-
};
|
|
1961
|
-
type BuiltinReporters = keyof typeof ReportersMap;
|
|
1962
|
-
interface BuiltinReporterOptions {
|
|
1963
|
-
"default": DefaultReporterOptions;
|
|
1964
|
-
"verbose": DefaultReporterOptions;
|
|
1965
|
-
"dot": BaseOptions;
|
|
1966
|
-
"json": JsonOptions$1;
|
|
1967
|
-
"blob": BlobOptions;
|
|
1968
|
-
"tap": never;
|
|
1969
|
-
"tap-flat": never;
|
|
1970
|
-
"junit": JUnitOptions;
|
|
1971
|
-
"hanging-process": never;
|
|
1972
|
-
"html": HTMLOptions;
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
interface TestSequencer {
|
|
1976
|
-
/**
|
|
1977
|
-
* Slicing tests into shards. Will be run before `sort`.
|
|
1978
|
-
* Only run, if `shard` is defined.
|
|
1979
|
-
*/
|
|
1980
|
-
shard: (files: TestSpecification[]) => Awaitable$1<TestSpecification[]>;
|
|
1981
|
-
sort: (files: TestSpecification[]) => Awaitable$1<TestSpecification[]>;
|
|
1982
|
-
}
|
|
1983
|
-
interface TestSequencerConstructor {
|
|
1984
|
-
new (ctx: Vitest): TestSequencer;
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
|
-
interface WatcherTriggerPattern {
|
|
1988
|
-
pattern: RegExp;
|
|
1989
|
-
testsToRun: (file: string, match: RegExpMatchArray) => string[] | string | null | undefined | void;
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
|
-
interface BenchmarkUserOptions {
|
|
1993
|
-
/**
|
|
1994
|
-
* Include globs for benchmark test files
|
|
1995
|
-
*
|
|
1996
|
-
* @default ['**\/*.{bench,benchmark}.?(c|m)[jt]s?(x)']
|
|
1997
|
-
*/
|
|
1998
|
-
include?: string[];
|
|
1999
|
-
/**
|
|
2000
|
-
* Exclude globs for benchmark test files
|
|
2001
|
-
* @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
|
|
2002
|
-
*/
|
|
2003
|
-
exclude?: string[];
|
|
2004
|
-
/**
|
|
2005
|
-
* Include globs for in-source benchmark test files
|
|
2006
|
-
*
|
|
2007
|
-
* @default []
|
|
2008
|
-
*/
|
|
2009
|
-
includeSource?: string[];
|
|
2010
|
-
/**
|
|
2011
|
-
* Custom reporter for output. Can contain one or more built-in report names, reporter instances,
|
|
2012
|
-
* and/or paths to custom reporters
|
|
2013
|
-
*
|
|
2014
|
-
* @default ['default']
|
|
2015
|
-
*/
|
|
2016
|
-
reporters?: Arrayable<BenchmarkBuiltinReporters | Reporter>;
|
|
2017
|
-
/**
|
|
2018
|
-
* @deprecated Use `benchmark.outputJson` instead
|
|
2019
|
-
*/
|
|
2020
|
-
outputFile?: string | (Partial<Record<BenchmarkBuiltinReporters, string>> & Record<string, string>);
|
|
2021
|
-
/**
|
|
2022
|
-
* benchmark output file to compare against
|
|
2023
|
-
*/
|
|
2024
|
-
compare?: string;
|
|
2025
|
-
/**
|
|
2026
|
-
* benchmark output file
|
|
2027
|
-
*/
|
|
2028
|
-
outputJson?: string;
|
|
2029
|
-
/**
|
|
2030
|
-
* Include `samples` array of benchmark results for API or custom reporter usages.
|
|
2031
|
-
* This is disabled by default to reduce memory usage.
|
|
2032
|
-
* @default false
|
|
2033
|
-
*/
|
|
2034
|
-
includeSamples?: boolean;
|
|
2035
|
-
}
|
|
2036
|
-
|
|
2037
|
-
interface Node {
|
|
2038
|
-
isRoot(): boolean;
|
|
2039
|
-
visit(visitor: Visitor, state: any): void;
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
interface Visitor<N extends Node = Node> {
|
|
2043
|
-
onStart(root: N, state: any): void;
|
|
2044
|
-
onSummary(root: N, state: any): void;
|
|
2045
|
-
onDetail(root: N, state: any): void;
|
|
2046
|
-
onSummaryEnd(root: N, state: any): void;
|
|
2047
|
-
onEnd(root: N, state: any): void;
|
|
2048
|
-
}
|
|
2049
|
-
|
|
2050
|
-
interface FileOptions {
|
|
2051
|
-
file: string;
|
|
2052
|
-
}
|
|
2053
|
-
|
|
2054
|
-
interface ProjectOptions {
|
|
2055
|
-
projectRoot: string;
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
|
-
interface ReportOptions {
|
|
2059
|
-
clover: CloverOptions;
|
|
2060
|
-
cobertura: CoberturaOptions;
|
|
2061
|
-
"html-spa": HtmlSpaOptions;
|
|
2062
|
-
html: HtmlOptions;
|
|
2063
|
-
json: JsonOptions;
|
|
2064
|
-
"json-summary": JsonSummaryOptions;
|
|
2065
|
-
lcov: LcovOptions;
|
|
2066
|
-
lcovonly: LcovOnlyOptions;
|
|
2067
|
-
none: never;
|
|
2068
|
-
teamcity: TeamcityOptions;
|
|
2069
|
-
text: TextOptions;
|
|
2070
|
-
"text-lcov": TextLcovOptions;
|
|
2071
|
-
"text-summary": TextSummaryOptions;
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
|
-
interface CloverOptions extends FileOptions, ProjectOptions {}
|
|
2075
|
-
|
|
2076
|
-
interface CoberturaOptions extends FileOptions, ProjectOptions {}
|
|
2077
|
-
|
|
2078
|
-
interface HtmlSpaOptions extends HtmlOptions {
|
|
2079
|
-
metricsToShow: Array<"lines" | "branches" | "functions" | "statements">;
|
|
2080
|
-
}
|
|
2081
|
-
interface HtmlOptions {
|
|
2082
|
-
verbose: boolean;
|
|
2083
|
-
skipEmpty: boolean;
|
|
2084
|
-
subdir: string;
|
|
2085
|
-
linkMapper: LinkMapper;
|
|
2086
|
-
}
|
|
2087
|
-
|
|
2088
|
-
type JsonOptions = FileOptions;
|
|
2089
|
-
type JsonSummaryOptions = FileOptions;
|
|
2090
|
-
|
|
2091
|
-
interface LcovOptions extends FileOptions, ProjectOptions {}
|
|
2092
|
-
interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
|
|
2093
|
-
|
|
2094
|
-
interface TeamcityOptions extends FileOptions {
|
|
2095
|
-
blockName: string;
|
|
2168
|
+
declare class BenchmarkReporter extends DefaultReporter {
|
|
2169
|
+
compare?: Parameters<typeof renderTable>[0]["compare"];
|
|
2170
|
+
onInit(ctx: Vitest): Promise<void>;
|
|
2171
|
+
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
2172
|
+
onTestSuiteResult(testSuite: TestSuite): void;
|
|
2173
|
+
protected printTestModule(testModule: TestModule): void;
|
|
2174
|
+
private printSuiteTable;
|
|
2175
|
+
onTestRunEnd(testModules: ReadonlyArray<TestModule>, unhandledErrors: ReadonlyArray<SerializedError>, reason: TestRunEndReason): Promise<void>;
|
|
2096
2176
|
}
|
|
2097
2177
|
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
skipEmpty: boolean;
|
|
2101
|
-
skipFull: boolean;
|
|
2178
|
+
declare class VerboseBenchmarkReporter extends BenchmarkReporter {
|
|
2179
|
+
protected verbose: boolean;
|
|
2102
2180
|
}
|
|
2103
|
-
type TextLcovOptions = ProjectOptions;
|
|
2104
|
-
type TextSummaryOptions = FileOptions;
|
|
2105
2181
|
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2182
|
+
declare const BenchmarkReportsMap: {
|
|
2183
|
+
default: typeof BenchmarkReporter;
|
|
2184
|
+
verbose: typeof VerboseBenchmarkReporter;
|
|
2185
|
+
};
|
|
2186
|
+
type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
|
|
2111
2187
|
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
/** Indicates whether all tests were run. False when only specific tests were run. */
|
|
2137
|
-
allTestsRun?: boolean;
|
|
2188
|
+
declare const ReportersMap: {
|
|
2189
|
+
default: typeof DefaultReporter;
|
|
2190
|
+
blob: typeof BlobReporter;
|
|
2191
|
+
verbose: typeof VerboseReporter;
|
|
2192
|
+
dot: typeof DotReporter;
|
|
2193
|
+
json: typeof JsonReporter;
|
|
2194
|
+
tap: typeof TapReporter;
|
|
2195
|
+
"tap-flat": typeof TapFlatReporter;
|
|
2196
|
+
junit: typeof JUnitReporter;
|
|
2197
|
+
"hanging-process": typeof HangingProcessReporter;
|
|
2198
|
+
"github-actions": typeof GithubActionsReporter;
|
|
2199
|
+
};
|
|
2200
|
+
type BuiltinReporters = keyof typeof ReportersMap;
|
|
2201
|
+
interface BuiltinReporterOptions {
|
|
2202
|
+
"default": DefaultReporterOptions;
|
|
2203
|
+
"verbose": DefaultReporterOptions;
|
|
2204
|
+
"dot": BaseOptions;
|
|
2205
|
+
"json": JsonOptions;
|
|
2206
|
+
"blob": BlobOptions;
|
|
2207
|
+
"tap": never;
|
|
2208
|
+
"tap-flat": never;
|
|
2209
|
+
"junit": JUnitOptions;
|
|
2210
|
+
"hanging-process": never;
|
|
2211
|
+
"html": HTMLOptions;
|
|
2138
2212
|
}
|
|
2139
|
-
|
|
2213
|
+
|
|
2214
|
+
interface TestSequencer {
|
|
2140
2215
|
/**
|
|
2141
|
-
*
|
|
2216
|
+
* Slicing tests into shards. Will be run before `sort`.
|
|
2217
|
+
* Only run, if `shard` is defined.
|
|
2142
2218
|
*/
|
|
2143
|
-
|
|
2219
|
+
shard: (files: TestSpecification[]) => Awaitable$1<TestSpecification[]>;
|
|
2220
|
+
sort: (files: TestSpecification[]) => Awaitable$1<TestSpecification[]>;
|
|
2144
2221
|
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
} & CoverageIstanbulOptions : T extends "v8" ? {
|
|
2151
|
-
/**
|
|
2152
|
-
* Provider to use for coverage collection.
|
|
2153
|
-
*
|
|
2154
|
-
* @default 'v8'
|
|
2155
|
-
*/
|
|
2156
|
-
provider: T;
|
|
2157
|
-
} & CoverageV8Options : T extends "custom" ? {
|
|
2158
|
-
provider: T;
|
|
2159
|
-
} & CustomProviderOptions : {
|
|
2160
|
-
provider?: T;
|
|
2161
|
-
} & CoverageV8Options;
|
|
2162
|
-
/** Fields that have default values. Internally these will always be defined. */
|
|
2163
|
-
type FieldsWithDefaultValues = "enabled" | "clean" | "cleanOnRerun" | "reportsDirectory" | "exclude" | "reportOnFailure" | "allowExternal" | "processingConcurrency";
|
|
2164
|
-
type ResolvedCoverageOptions<T extends CoverageProviderName = CoverageProviderName> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
|
|
2165
|
-
reporter: CoverageReporterWithOptions[];
|
|
2166
|
-
};
|
|
2167
|
-
interface BaseCoverageOptions {
|
|
2168
|
-
/**
|
|
2169
|
-
* Enables coverage collection. Can be overridden using `--coverage` CLI option.
|
|
2170
|
-
*
|
|
2171
|
-
* @default false
|
|
2172
|
-
*/
|
|
2173
|
-
enabled?: boolean;
|
|
2222
|
+
interface TestSequencerConstructor {
|
|
2223
|
+
new (ctx: Vitest): TestSequencer;
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
interface BenchmarkUserOptions {
|
|
2174
2227
|
/**
|
|
2175
|
-
*
|
|
2176
|
-
* By default only files covered by tests are included.
|
|
2228
|
+
* Include globs for benchmark test files
|
|
2177
2229
|
*
|
|
2178
|
-
*
|
|
2230
|
+
* @default ['**\/*.{bench,benchmark}.?(c|m)[jt]s?(x)']
|
|
2179
2231
|
*/
|
|
2180
2232
|
include?: string[];
|
|
2181
2233
|
/**
|
|
2182
|
-
*
|
|
2183
|
-
*
|
|
2184
|
-
*
|
|
2185
|
-
* See [Including and excluding files from coverage report](https://vitest.dev/guide/coverage.html#including-and-excluding-files-from-coverage-report) for examples.
|
|
2234
|
+
* Exclude globs for benchmark test files
|
|
2235
|
+
* @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
|
|
2186
2236
|
*/
|
|
2187
2237
|
exclude?: string[];
|
|
2188
2238
|
/**
|
|
2189
|
-
*
|
|
2190
|
-
*
|
|
2191
|
-
* @default true
|
|
2192
|
-
*/
|
|
2193
|
-
clean?: boolean;
|
|
2194
|
-
/**
|
|
2195
|
-
* Clean coverage report on watch rerun
|
|
2196
|
-
*
|
|
2197
|
-
* @default true
|
|
2198
|
-
*/
|
|
2199
|
-
cleanOnRerun?: boolean;
|
|
2200
|
-
/**
|
|
2201
|
-
* Directory to write coverage report to
|
|
2202
|
-
*
|
|
2203
|
-
* @default './coverage'
|
|
2204
|
-
*/
|
|
2205
|
-
reportsDirectory?: string;
|
|
2206
|
-
/**
|
|
2207
|
-
* Coverage reporters to use.
|
|
2208
|
-
* See [istanbul documentation](https://istanbul.js.org/docs/advanced/alternative-reporters/) for detailed list of all reporters.
|
|
2209
|
-
*
|
|
2210
|
-
* @default ['text', 'html', 'clover', 'json']
|
|
2211
|
-
*/
|
|
2212
|
-
reporter?: Arrayable$1<CoverageReporter> | (CoverageReporter | [CoverageReporter] | CoverageReporterWithOptions)[];
|
|
2213
|
-
/**
|
|
2214
|
-
* Do not show files with 100% statement, branch, and function coverage
|
|
2215
|
-
*
|
|
2216
|
-
* @default false
|
|
2217
|
-
*/
|
|
2218
|
-
skipFull?: boolean;
|
|
2219
|
-
/**
|
|
2220
|
-
* Configurations for thresholds
|
|
2221
|
-
*
|
|
2222
|
-
* @example
|
|
2223
|
-
*
|
|
2224
|
-
* ```ts
|
|
2225
|
-
* {
|
|
2226
|
-
* // Thresholds for all files
|
|
2227
|
-
* functions: 95,
|
|
2228
|
-
* branches: 70,
|
|
2229
|
-
* perFile: true,
|
|
2230
|
-
* autoUpdate: true,
|
|
2231
|
-
*
|
|
2232
|
-
* // Thresholds for utilities
|
|
2233
|
-
* 'src/utils/**.ts': {
|
|
2234
|
-
* lines: 100,
|
|
2235
|
-
* statements: 95,
|
|
2236
|
-
* }
|
|
2237
|
-
* }
|
|
2238
|
-
* ```
|
|
2239
|
-
*/
|
|
2240
|
-
thresholds?: Thresholds | ({
|
|
2241
|
-
[glob: string]: Pick<Thresholds, 100 | "statements" | "functions" | "branches" | "lines">;
|
|
2242
|
-
} & Thresholds);
|
|
2243
|
-
/**
|
|
2244
|
-
* Watermarks for statements, lines, branches and functions.
|
|
2245
|
-
*
|
|
2246
|
-
* Default value is `[50,80]` for each property.
|
|
2247
|
-
*/
|
|
2248
|
-
watermarks?: {
|
|
2249
|
-
statements?: [number, number];
|
|
2250
|
-
functions?: [number, number];
|
|
2251
|
-
branches?: [number, number];
|
|
2252
|
-
lines?: [number, number];
|
|
2253
|
-
};
|
|
2254
|
-
/**
|
|
2255
|
-
* Generate coverage report even when tests fail.
|
|
2239
|
+
* Include globs for in-source benchmark test files
|
|
2256
2240
|
*
|
|
2257
|
-
* @default
|
|
2241
|
+
* @default []
|
|
2258
2242
|
*/
|
|
2259
|
-
|
|
2243
|
+
includeSource?: string[];
|
|
2260
2244
|
/**
|
|
2261
|
-
*
|
|
2245
|
+
* Custom reporter for output. Can contain one or more built-in report names, reporter instances,
|
|
2246
|
+
* and/or paths to custom reporters
|
|
2262
2247
|
*
|
|
2263
|
-
* @default
|
|
2248
|
+
* @default ['default']
|
|
2264
2249
|
*/
|
|
2265
|
-
|
|
2250
|
+
reporters?: Arrayable$1<BenchmarkBuiltinReporters | Reporter>;
|
|
2266
2251
|
/**
|
|
2267
|
-
*
|
|
2268
|
-
* This is useful when your source files are transpiled and may contain source maps
|
|
2269
|
-
* of non-source files.
|
|
2270
|
-
*
|
|
2271
|
-
* Use this option when you are seeing files that show up in report even if they
|
|
2272
|
-
* match your `coverage.exclude` patterns.
|
|
2273
|
-
*
|
|
2274
|
-
* @default false
|
|
2252
|
+
* @deprecated Use `benchmark.outputJson` instead
|
|
2275
2253
|
*/
|
|
2276
|
-
|
|
2254
|
+
outputFile?: string | (Partial<Record<BenchmarkBuiltinReporters, string>> & Record<string, string>);
|
|
2277
2255
|
/**
|
|
2278
|
-
*
|
|
2279
|
-
* Defaults to `Math.min(20, os.availableParallelism?.() ?? os.cpus().length)`
|
|
2256
|
+
* benchmark output file to compare against
|
|
2280
2257
|
*/
|
|
2281
|
-
|
|
2258
|
+
compare?: string;
|
|
2282
2259
|
/**
|
|
2283
|
-
*
|
|
2284
|
-
*
|
|
2285
|
-
* @default []
|
|
2260
|
+
* benchmark output file
|
|
2286
2261
|
*/
|
|
2287
|
-
|
|
2288
|
-
}
|
|
2289
|
-
interface CoverageIstanbulOptions extends BaseCoverageOptions {}
|
|
2290
|
-
interface CoverageV8Options extends BaseCoverageOptions {}
|
|
2291
|
-
interface CustomProviderOptions extends Pick<BaseCoverageOptions, FieldsWithDefaultValues> {
|
|
2292
|
-
/** Name of the module or path to a file to load the custom provider from */
|
|
2293
|
-
customProviderModule: string;
|
|
2294
|
-
}
|
|
2295
|
-
interface Thresholds {
|
|
2296
|
-
/** Set global thresholds to `100` */
|
|
2297
|
-
100?: boolean;
|
|
2298
|
-
/** Check thresholds per file. */
|
|
2299
|
-
perFile?: boolean;
|
|
2262
|
+
outputJson?: string;
|
|
2300
2263
|
/**
|
|
2301
|
-
*
|
|
2302
|
-
*
|
|
2264
|
+
* Include `samples` array of benchmark results for API or custom reporter usages.
|
|
2265
|
+
* This is disabled by default to reduce memory usage.
|
|
2303
2266
|
* @default false
|
|
2304
2267
|
*/
|
|
2305
|
-
|
|
2306
|
-
/** Thresholds for statements */
|
|
2307
|
-
statements?: number;
|
|
2308
|
-
/** Thresholds for functions */
|
|
2309
|
-
functions?: number;
|
|
2310
|
-
/** Thresholds for branches */
|
|
2311
|
-
branches?: number;
|
|
2312
|
-
/** Thresholds for lines */
|
|
2313
|
-
lines?: number;
|
|
2268
|
+
includeSamples?: boolean;
|
|
2314
2269
|
}
|
|
2315
2270
|
|
|
2316
2271
|
type BuiltinEnvironment = "node" | "jsdom" | "happy-dom" | "edge-runtime";
|
|
@@ -2578,7 +2533,7 @@ interface InlineConfig {
|
|
|
2578
2533
|
*
|
|
2579
2534
|
* @default []
|
|
2580
2535
|
*/
|
|
2581
|
-
reporters?: Arrayable
|
|
2536
|
+
reporters?: Arrayable<ReporterName | InlineReporter> | ((ReporterName | InlineReporter) | [ReporterName] | ReporterWithOptions)[];
|
|
2582
2537
|
/**
|
|
2583
2538
|
* Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
|
|
2584
2539
|
* Also definable individually per reporter by using an object instead.
|
|
@@ -3172,5 +3127,5 @@ type TestProjectInlineConfiguration = (UserWorkspaceConfig & {
|
|
|
3172
3127
|
});
|
|
3173
3128
|
type TestProjectConfiguration = string | TestProjectInlineConfiguration | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
|
|
3174
3129
|
|
|
3175
|
-
export { CoverageMap as C,
|
|
3176
|
-
export type {
|
|
3130
|
+
export { TestSuite as B, CoverageMap as C, experimental_getRunnerTask as E, Logger as L, TestProject as T, Vitest as V, DefaultReporter as aA, DotReporter as aB, GithubActionsReporter as aC, HangingProcessReporter as aD, JsonReporter as aE, JUnitReporter as aF, ReportersMap as aG, TapFlatReporter as aH, TapReporter as aI, VerboseBenchmarkReporter as aJ, VerboseReporter as aK, BaseReporter as aL, BenchmarkReporter as ay, BenchmarkReportsMap as az, TestSpecification as k, VitestPackageInstaller as n, TestCase as q, TestCollection as r, TestModule as t };
|
|
3131
|
+
export type { BrowserProvider as $, ApiConfig as A, TestSuiteState as D, TestSequencerConstructor as F, BenchmarkUserOptions as G, HTMLOptions as H, InlineConfig as I, JsonOptions as J, BrowserBuiltinProvider as K, ModuleDiagnostic as M, BrowserCommand as N, OnServerRestartHandler as O, Pool as P, BrowserCommandContext as Q, ResolvedCoverageOptions as R, SerializedTestProject as S, UserWorkspaceConfig as U, WatcherTriggerPattern as W, BrowserConfigOptions as X, BrowserInstanceOption as Y, BrowserModuleMocker as Z, BrowserOrchestrator as _, TestProjectConfiguration as a, BrowserProviderInitializationOptions as a0, BrowserProviderModule as a1, BrowserProviderOptions as a2, BrowserScript as a3, BrowserServerState as a4, BrowserServerStateSession as a5, CDPSession as a6, ParentProjectBrowser as a7, ProjectBrowser as a8, ResolvedBrowserOptions as a9, BenchmarkBuiltinReporters as aM, BuiltinReporterOptions as aN, BuiltinReporters as aO, JsonAssertionResult as aP, JsonTestResult as aQ, JsonTestResults as aR, ToMatchScreenshotComparators as aa, ToMatchScreenshotOptions as ab, BuiltinEnvironment as ac, CSSModuleScopeStrategy as ad, DepsOptimizationOptions as ae, EnvironmentOptions as af, PoolOptions as ag, ProjectConfig as ah, ResolvedProjectConfig as ai, ResolveSnapshotPathHandler as aj, ResolveSnapshotPathHandlerContext as ak, TypecheckConfig as al, VitestEnvironment as am, BaseCoverageOptions as an, CoverageIstanbulOptions as ao, CoverageOptions as ap, CoverageProvider as aq, CoverageProviderModule as ar, CoverageReporter as as, CustomProviderOptions as at, TestRunResult as au, ReportedHookContext as av, Reporter as aw, TestRunEndReason as ax, ReportContext as b, CoverageV8Options as c, UserProjectConfigFn as d, UserProjectConfigExport as e, UserConfig as f, TestProjectInlineConfiguration as g, ResolvedConfig as h, VitestRunMode as i, VitestOptions as j, TestSequencer as l, OnTestsRerunHandler as m, JUnitOptions as o, TaskOptions as p, TestDiagnostic as s, TestModuleState as u, TestResult as v, TestResultFailed as w, TestResultPassed as x, TestResultSkipped as y, TestState as z };
|