vitest 2.0.0-beta.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -22
- package/dist/browser.d.ts +24 -7
- package/dist/browser.js +5 -19
- package/dist/chunks/browser-creator.DSqYDthP.js +673 -0
- package/dist/chunks/{environments-node.39w4gmlF.js → environments-node.XE5FbRPQ.js} +1 -1
- package/dist/chunks/{integrations-globals.BK0Cn4q1.js → integrations-globals.CzYWb38r.js} +10 -9
- package/dist/chunks/{node-git.CCI8evVZ.js → node-git.ZtkbKc8u.js} +14 -15
- package/dist/chunks/{runtime-console.DiVMr5d4.js → runtime-console.O41g23Zj.js} +26 -11
- package/dist/chunks/{runtime-runBaseTests.C-Bkopka.js → runtime-runBaseTests.DX3h28Mp.js} +47 -34
- package/dist/cli.js +3 -3
- package/dist/config.cjs +48 -23
- package/dist/config.d.ts +2 -1
- package/dist/config.js +48 -24
- package/dist/coverage.d.ts +6 -4
- package/dist/coverage.js +102 -38
- package/dist/environments.d.ts +2 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +4 -3
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +1437 -7
- package/dist/index.js +10 -9
- package/dist/node.d.ts +34 -7
- package/dist/node.js +31 -20
- package/dist/path.js +4 -1
- package/dist/{reporters-DaDey3o0.d.ts → reporters-DrhyxxXt.d.ts} +213 -206
- package/dist/reporters.d.ts +2 -1
- package/dist/reporters.js +8 -8
- package/dist/runners.d.ts +3 -1
- package/dist/runners.js +100 -61
- package/dist/snapshot.js +2 -2
- package/dist/{suite-BHSUxUib.d.ts → suite-DCPwkk7G.d.ts} +1 -1
- package/dist/suite.d.ts +3 -2
- package/dist/suite.js +3 -3
- package/dist/utils.d.ts +1 -5
- package/dist/utils.js +1 -6
- package/dist/vendor/{base._gnK9Slw.js → base.CTYV4Gnz.js} +24 -17
- package/dist/vendor/{base.D4XK-wRp.js → base.CdA1i5tB.js} +6 -4
- package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.B6pblCp2.js} +13 -14
- package/dist/vendor/{cac.B8p8r_GP.js → cac.5nBDv26-.js} +142 -47
- package/dist/vendor/{cli-api.AbX6UpUw.js → cli-api.BT4NJtxX.js} +4162 -9514
- package/dist/vendor/{constants.TCjCaw2D.js → constants.CsnA4eRy.js} +5 -23
- package/dist/vendor/{coverage.ChSqD-qS.js → coverage.BhYSDdTT.js} +27 -11
- package/dist/vendor/{date.BKM1wewY.js → date.W2xKR2qe.js} +5 -3
- package/dist/vendor/env.2ltrQNq0.js +8 -0
- package/dist/vendor/{execute.BHj6OMh4.js → execute.Dx503nGn.js} +186 -64
- package/dist/vendor/{index.TBU3GqRP.js → index.3x3MdmUV.js} +1075 -526
- package/dist/vendor/{index._7XLd8Kd.js → index.BJmtb_7W.js} +3 -2
- package/dist/vendor/{index.DP-km6lF.js → index.BMmMjLIQ.js} +64 -51
- package/dist/vendor/{index.DHRpy7zp.js → index.CROIsoiT.js} +18 -10
- package/dist/vendor/{index.DeR1hhfY.js → index.D4nqnQWz.js} +71 -74
- package/dist/vendor/index.D6GZqexG.js +6575 -0
- package/dist/vendor/{index.DwR86H5i.js → index.Hqvcg1pf.js} +4 -27
- package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
- package/dist/vendor/run-once.Db8Hgq9X.js +28 -0
- package/dist/vendor/{setup-common.BhJvzjns.js → setup-common.yHaxjRhz.js} +30 -15
- package/dist/vendor/spy.Cf_4R5Oe.js +22 -0
- package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
- package/dist/vendor/{utils.YuQ3LT2a.js → utils.BVMrsl6E.js} +55 -30
- package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
- package/dist/vendor/{vi.C6AfDXK6.js → vi.DXACdGTu.js} +269 -136
- package/dist/vendor/{vm.Ow-X2mkS.js → vm.BrDS6p7h.js} +157 -90
- package/dist/worker.js +41 -18
- package/dist/workers/forks.js +12 -6
- package/dist/workers/runVmTests.js +22 -16
- package/dist/workers/threads.js +8 -5
- package/dist/workers/vmForks.js +15 -9
- package/dist/workers/vmThreads.js +11 -8
- package/dist/workers.d.ts +8 -5
- package/dist/workers.js +11 -11
- package/package.json +22 -21
- package/suppress-warnings.cjs +2 -4
- package/dist/index-B0dCycbN.d.ts +0 -1571
- package/dist/vendor/env.bmJgw1qP.js +0 -7
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
|
-
import { TransformResult as TransformResult$1,
|
|
2
|
+
import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, ConfigEnv, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
|
|
3
3
|
import * as _vitest_runner from '@vitest/runner';
|
|
4
|
-
import { File, Test as Test$1, Suite, TaskResultPack,
|
|
5
|
-
import { RawSourceMap,
|
|
6
|
-
import {
|
|
4
|
+
import { File, Test as Test$1, Suite, TaskResultPack, Task, CancelReason, TaskMeta, Custom, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
5
|
+
import { RawSourceMap, FetchResult, ViteNodeResolveId, ModuleCacheMap, ViteNodeServerOptions } from 'vite-node';
|
|
6
|
+
import { SnapshotSummary, SnapshotResult, SnapshotStateOptions, SnapshotState } from '@vitest/snapshot';
|
|
7
7
|
import { PromisifyAssertion, Tester, ExpectStatic } from '@vitest/expect';
|
|
8
8
|
import { ChainableFunction } from '@vitest/runner/utils';
|
|
9
|
-
import { ParsedStack, Awaitable as Awaitable$1, Arrayable as Arrayable$1 } from '@vitest/utils';
|
|
9
|
+
import { ParsedStack, Awaitable as Awaitable$1, ErrorWithDiff, Arrayable as Arrayable$1 } from '@vitest/utils';
|
|
10
10
|
import { TaskResult, Bench, Options as Options$1 } from 'tinybench';
|
|
11
11
|
import { Writable } from 'node:stream';
|
|
12
12
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
13
13
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
14
14
|
import { ViteNodeServer } from 'vite-node/server';
|
|
15
15
|
import { MessagePort } from 'node:worker_threads';
|
|
16
|
+
import { StackTraceParserOptions } from '@vitest/utils/source-map';
|
|
16
17
|
import { Stats } from 'node:fs';
|
|
17
18
|
import * as chai from 'chai';
|
|
18
19
|
|
|
@@ -380,11 +381,17 @@ interface PoolOptions extends Record<string, unknown> {
|
|
|
380
381
|
*/
|
|
381
382
|
vmForks?: ForksOptions & VmOptions;
|
|
382
383
|
}
|
|
384
|
+
interface ResolvedPoolOptions extends PoolOptions {
|
|
385
|
+
threads?: ResolvedThreadsOptions & WorkerContextOptions;
|
|
386
|
+
forks?: ResolvedForksOptions & WorkerContextOptions;
|
|
387
|
+
vmThreads?: ResolvedThreadsOptions & VmOptions;
|
|
388
|
+
vmForks?: ResolvedForksOptions & VmOptions;
|
|
389
|
+
}
|
|
383
390
|
interface ThreadsOptions {
|
|
384
391
|
/** Minimum amount of threads to use */
|
|
385
|
-
minThreads?: number;
|
|
392
|
+
minThreads?: number | string;
|
|
386
393
|
/** Maximum amount of threads to use */
|
|
387
|
-
maxThreads?: number;
|
|
394
|
+
maxThreads?: number | string;
|
|
388
395
|
/**
|
|
389
396
|
* Run tests inside a single thread.
|
|
390
397
|
*
|
|
@@ -400,11 +407,15 @@ interface ThreadsOptions {
|
|
|
400
407
|
*/
|
|
401
408
|
useAtomics?: boolean;
|
|
402
409
|
}
|
|
410
|
+
interface ResolvedThreadsOptions extends ThreadsOptions {
|
|
411
|
+
minThreads?: number;
|
|
412
|
+
maxThreads?: number;
|
|
413
|
+
}
|
|
403
414
|
interface ForksOptions {
|
|
404
415
|
/** Minimum amount of child processes to use */
|
|
405
|
-
minForks?: number;
|
|
416
|
+
minForks?: number | string;
|
|
406
417
|
/** Maximum amount of child processes to use */
|
|
407
|
-
maxForks?: number;
|
|
418
|
+
maxForks?: number | string;
|
|
408
419
|
/**
|
|
409
420
|
* Run tests inside a single fork.
|
|
410
421
|
*
|
|
@@ -412,6 +423,10 @@ interface ForksOptions {
|
|
|
412
423
|
*/
|
|
413
424
|
singleFork?: boolean;
|
|
414
425
|
}
|
|
426
|
+
interface ResolvedForksOptions extends ForksOptions {
|
|
427
|
+
minForks?: number;
|
|
428
|
+
maxForks?: number;
|
|
429
|
+
}
|
|
415
430
|
interface WorkerContextOptions {
|
|
416
431
|
/**
|
|
417
432
|
* Isolate test environment by recycling `worker_threads` or `child_process` after each test
|
|
@@ -612,10 +627,18 @@ declare class Typechecker {
|
|
|
612
627
|
getTestPacks(): TaskResultPack[];
|
|
613
628
|
}
|
|
614
629
|
|
|
630
|
+
interface PrintErrorResult {
|
|
631
|
+
nearest?: ParsedStack;
|
|
632
|
+
}
|
|
633
|
+
|
|
615
634
|
interface ErrorOptions {
|
|
616
635
|
type?: string;
|
|
617
636
|
fullStack?: boolean;
|
|
618
637
|
project?: WorkspaceProject;
|
|
638
|
+
verbose?: boolean;
|
|
639
|
+
screenshotPaths?: string[];
|
|
640
|
+
task?: Task;
|
|
641
|
+
showCodeFrame?: boolean;
|
|
619
642
|
}
|
|
620
643
|
declare class Logger {
|
|
621
644
|
ctx: Vitest;
|
|
@@ -632,7 +655,7 @@ declare class Logger {
|
|
|
632
655
|
clearFullScreen(message: string): void;
|
|
633
656
|
clearScreen(message: string, force?: boolean): void;
|
|
634
657
|
private _clearScreen;
|
|
635
|
-
printError(err: unknown, options?: ErrorOptions):
|
|
658
|
+
printError(err: unknown, options?: ErrorOptions): PrintErrorResult | undefined;
|
|
636
659
|
clearHighlightCache(filename?: string): void;
|
|
637
660
|
highlight(filename: string, source: string): string;
|
|
638
661
|
printNoTestFound(filters?: string[]): void;
|
|
@@ -645,15 +668,33 @@ interface BrowserProviderInitializationOptions {
|
|
|
645
668
|
browser: string;
|
|
646
669
|
options?: BrowserProviderOptions;
|
|
647
670
|
}
|
|
671
|
+
interface CDPSession {
|
|
672
|
+
send: (method: string, params?: Record<string, unknown>) => Promise<unknown>;
|
|
673
|
+
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
674
|
+
once: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
675
|
+
off: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
676
|
+
}
|
|
648
677
|
interface BrowserProvider {
|
|
649
678
|
name: string;
|
|
679
|
+
/**
|
|
680
|
+
* @experimental opt-in into file parallelisation
|
|
681
|
+
*/
|
|
682
|
+
supportsParallelism: boolean;
|
|
650
683
|
getSupportedBrowsers: () => readonly string[];
|
|
651
|
-
|
|
684
|
+
beforeCommand?: (command: string, args: unknown[]) => Awaitable$1<void>;
|
|
685
|
+
afterCommand?: (command: string, args: unknown[]) => Awaitable$1<void>;
|
|
686
|
+
getCommandsContext: (contextId: string) => Record<string, unknown>;
|
|
687
|
+
openPage: (contextId: string, url: string) => Promise<void>;
|
|
688
|
+
getCDPSession?: (contextId: string) => Promise<CDPSession>;
|
|
652
689
|
close: () => Awaitable$1<void>;
|
|
653
690
|
initialize(ctx: WorkspaceProject, options: BrowserProviderInitializationOptions): Awaitable$1<void>;
|
|
654
691
|
}
|
|
692
|
+
interface BrowserProviderModule {
|
|
693
|
+
new (): BrowserProvider;
|
|
694
|
+
}
|
|
655
695
|
interface BrowserProviderOptions {
|
|
656
696
|
}
|
|
697
|
+
type BrowserBuiltinProvider = 'webdriverio' | 'playwright' | 'preview';
|
|
657
698
|
interface BrowserConfigOptions {
|
|
658
699
|
/**
|
|
659
700
|
* if running tests in the browser should be the default
|
|
@@ -670,7 +711,7 @@ interface BrowserConfigOptions {
|
|
|
670
711
|
*
|
|
671
712
|
* @default 'preview'
|
|
672
713
|
*/
|
|
673
|
-
provider?:
|
|
714
|
+
provider?: BrowserBuiltinProvider | (string & {});
|
|
674
715
|
/**
|
|
675
716
|
* Options that are passed down to a browser provider.
|
|
676
717
|
* To support type hinting, add one of the types to your tsconfig.json "compilerOptions.types" field:
|
|
@@ -700,6 +741,13 @@ interface BrowserConfigOptions {
|
|
|
700
741
|
* @default true
|
|
701
742
|
*/
|
|
702
743
|
isolate?: boolean;
|
|
744
|
+
/**
|
|
745
|
+
* Run test files in parallel if provider supports this option
|
|
746
|
+
* This option only has effect in headless mode (enabled in CI by default)
|
|
747
|
+
*
|
|
748
|
+
* @default // Same as "test.fileParallelism"
|
|
749
|
+
*/
|
|
750
|
+
fileParallelism?: boolean;
|
|
703
751
|
/**
|
|
704
752
|
* Show Vitest UI
|
|
705
753
|
*
|
|
@@ -721,6 +769,18 @@ interface BrowserConfigOptions {
|
|
|
721
769
|
*/
|
|
722
770
|
height: number;
|
|
723
771
|
};
|
|
772
|
+
/**
|
|
773
|
+
* Directory where screenshots will be saved when page.screenshot() is called
|
|
774
|
+
* If not set, all screenshots are saved to __screenshots__ directory in the same folder as the test file.
|
|
775
|
+
* If this is set, it will be resolved relative to the project root.
|
|
776
|
+
* @default __screenshots__
|
|
777
|
+
*/
|
|
778
|
+
screenshotDirectory?: string;
|
|
779
|
+
/**
|
|
780
|
+
* Should Vitest take screenshots if the test fails
|
|
781
|
+
* @default !browser.ui
|
|
782
|
+
*/
|
|
783
|
+
screenshotFailures?: boolean;
|
|
724
784
|
/**
|
|
725
785
|
* Scripts injected into the tester iframe.
|
|
726
786
|
*/
|
|
@@ -732,7 +792,7 @@ interface BrowserConfigOptions {
|
|
|
732
792
|
/**
|
|
733
793
|
* Commands that will be executed on the server
|
|
734
794
|
* via the browser `import("@vitest/browser/context").commands` API.
|
|
735
|
-
* @see {@link https://vitest.dev/guide/browser
|
|
795
|
+
* @see {@link https://vitest.dev/guide/browser/commands}
|
|
736
796
|
*/
|
|
737
797
|
commands?: Record<string, BrowserCommand<any>>;
|
|
738
798
|
}
|
|
@@ -740,6 +800,31 @@ interface BrowserCommandContext {
|
|
|
740
800
|
testPath: string | undefined;
|
|
741
801
|
provider: BrowserProvider;
|
|
742
802
|
project: WorkspaceProject;
|
|
803
|
+
contextId: string;
|
|
804
|
+
}
|
|
805
|
+
interface BrowserServerStateContext {
|
|
806
|
+
files: string[];
|
|
807
|
+
method: 'run' | 'collect';
|
|
808
|
+
resolve: () => void;
|
|
809
|
+
reject: (v: unknown) => void;
|
|
810
|
+
}
|
|
811
|
+
interface BrowserOrchestrator {
|
|
812
|
+
createTesters: (files: string[]) => Promise<void>;
|
|
813
|
+
onCancel: (reason: CancelReason) => Promise<void>;
|
|
814
|
+
}
|
|
815
|
+
interface BrowserServerState {
|
|
816
|
+
orchestrators: Map<string, BrowserOrchestrator>;
|
|
817
|
+
getContext: (contextId: string) => BrowserServerStateContext | undefined;
|
|
818
|
+
createAsyncContext: (method: 'collect' | 'run', contextId: string, files: string[]) => Promise<void>;
|
|
819
|
+
}
|
|
820
|
+
interface BrowserServer {
|
|
821
|
+
vite: ViteDevServer;
|
|
822
|
+
state: BrowserServerState;
|
|
823
|
+
provider: BrowserProvider;
|
|
824
|
+
close: () => Promise<void>;
|
|
825
|
+
initBrowserProvider: () => Promise<void>;
|
|
826
|
+
parseStacktrace: (stack: string) => ParsedStack[];
|
|
827
|
+
parseErrorStacktrace: (error: ErrorWithDiff, options?: StackTraceParserOptions) => ParsedStack[];
|
|
743
828
|
}
|
|
744
829
|
interface BrowserCommand<Payload extends unknown[]> {
|
|
745
830
|
(context: BrowserCommandContext, ...payload: Payload): Awaitable$1<any>;
|
|
@@ -776,6 +861,7 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
|
776
861
|
enabled: boolean;
|
|
777
862
|
headless: boolean;
|
|
778
863
|
isolate: boolean;
|
|
864
|
+
fileParallelism: boolean;
|
|
779
865
|
api: ApiConfig;
|
|
780
866
|
ui: boolean;
|
|
781
867
|
viewport: {
|
|
@@ -784,156 +870,6 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
|
784
870
|
};
|
|
785
871
|
}
|
|
786
872
|
|
|
787
|
-
declare class VitestBrowserServerMocker {
|
|
788
|
-
#private;
|
|
789
|
-
mocks: Map<string, {
|
|
790
|
-
sessionId: string;
|
|
791
|
-
mock: string | null | undefined;
|
|
792
|
-
}>;
|
|
793
|
-
constructor(project: WorkspaceProject);
|
|
794
|
-
mock(sessionId: string, rawId: string, importer: string, hasFactory: boolean): Promise<string>;
|
|
795
|
-
unmock(rawId: string, importer: string): Promise<string>;
|
|
796
|
-
resolveMock(rawId: string, importer: string, hasFactory: boolean): Promise<{
|
|
797
|
-
type: "factory";
|
|
798
|
-
resolvedId: string;
|
|
799
|
-
mockPath?: undefined;
|
|
800
|
-
} | {
|
|
801
|
-
type: "redirect" | "automock";
|
|
802
|
-
mockPath: string | null;
|
|
803
|
-
resolvedId: string;
|
|
804
|
-
}>;
|
|
805
|
-
invalidateModuleById(id: string): void;
|
|
806
|
-
private resolveId;
|
|
807
|
-
resolveMockPath(mockPath: string, external: string | null): string | null;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
type ArgumentsType$1<T> = T extends (...args: infer A) => any ? A : never;
|
|
811
|
-
type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
|
|
812
|
-
type PromisifyFn<T> = ReturnType$1<T> extends Promise<any> ? T : (...args: ArgumentsType$1<T>) => Promise<Awaited<ReturnType$1<T>>>;
|
|
813
|
-
type BirpcResolver = (name: string, resolved: (...args: unknown[]) => unknown) => ((...args: unknown[]) => unknown) | undefined;
|
|
814
|
-
interface ChannelOptions {
|
|
815
|
-
/**
|
|
816
|
-
* Function to post raw message
|
|
817
|
-
*/
|
|
818
|
-
post: (data: any, ...extras: any[]) => any | Promise<any>;
|
|
819
|
-
/**
|
|
820
|
-
* Listener to receive raw message
|
|
821
|
-
*/
|
|
822
|
-
on: (fn: (data: any, ...extras: any[]) => void) => any | Promise<any>;
|
|
823
|
-
/**
|
|
824
|
-
* Custom function to serialize data
|
|
825
|
-
*
|
|
826
|
-
* by default it passes the data as-is
|
|
827
|
-
*/
|
|
828
|
-
serialize?: (data: any) => any;
|
|
829
|
-
/**
|
|
830
|
-
* Custom function to deserialize data
|
|
831
|
-
*
|
|
832
|
-
* by default it passes the data as-is
|
|
833
|
-
*/
|
|
834
|
-
deserialize?: (data: any) => any;
|
|
835
|
-
}
|
|
836
|
-
interface EventOptions<Remote> {
|
|
837
|
-
/**
|
|
838
|
-
* Names of remote functions that do not need response.
|
|
839
|
-
*/
|
|
840
|
-
eventNames?: (keyof Remote)[];
|
|
841
|
-
/**
|
|
842
|
-
* Maximum timeout for waiting for response, in milliseconds.
|
|
843
|
-
*
|
|
844
|
-
* @default 60_000
|
|
845
|
-
*/
|
|
846
|
-
timeout?: number;
|
|
847
|
-
/**
|
|
848
|
-
* Custom resolver to resolve function to be called
|
|
849
|
-
*
|
|
850
|
-
* For advanced use cases only
|
|
851
|
-
*/
|
|
852
|
-
resolver?: BirpcResolver;
|
|
853
|
-
/**
|
|
854
|
-
* Custom error handler
|
|
855
|
-
*/
|
|
856
|
-
onError?: (error: Error, functionName: string, args: any[]) => boolean | void;
|
|
857
|
-
/**
|
|
858
|
-
* Custom error handler for timeouts
|
|
859
|
-
*/
|
|
860
|
-
onTimeoutError?: (functionName: string, args: any[]) => boolean | void;
|
|
861
|
-
}
|
|
862
|
-
type BirpcOptions<Remote> = EventOptions<Remote> & ChannelOptions;
|
|
863
|
-
type BirpcFn<T> = PromisifyFn<T> & {
|
|
864
|
-
/**
|
|
865
|
-
* Send event without asking for response
|
|
866
|
-
*/
|
|
867
|
-
asEvent: (...args: ArgumentsType$1<T>) => void;
|
|
868
|
-
};
|
|
869
|
-
type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
|
|
870
|
-
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
|
|
871
|
-
} & {
|
|
872
|
-
$functions: LocalFunctions;
|
|
873
|
-
};
|
|
874
|
-
|
|
875
|
-
interface TransformResultWithSource extends TransformResult$1 {
|
|
876
|
-
source?: string;
|
|
877
|
-
}
|
|
878
|
-
interface WebSocketHandlers {
|
|
879
|
-
onCollected: (files?: File[]) => Promise<void>;
|
|
880
|
-
onTaskUpdate: (packs: TaskResultPack[]) => void;
|
|
881
|
-
getFiles: () => File[];
|
|
882
|
-
getTestFiles: () => Promise<[{
|
|
883
|
-
name: string;
|
|
884
|
-
root: string;
|
|
885
|
-
}, file: string][]>;
|
|
886
|
-
getPaths: () => string[];
|
|
887
|
-
getConfig: () => ResolvedConfig;
|
|
888
|
-
getModuleGraph: (projectName: string, id: string, browser?: boolean) => Promise<ModuleGraphData>;
|
|
889
|
-
getTransformResult: (projectName: string, id: string, browser?: boolean) => Promise<TransformResultWithSource | undefined>;
|
|
890
|
-
readTestFile: (id: string) => Promise<string | null>;
|
|
891
|
-
saveTestFile: (id: string, content: string) => Promise<void>;
|
|
892
|
-
rerun: (files: string[]) => Promise<void>;
|
|
893
|
-
updateSnapshot: (file?: File) => Promise<void>;
|
|
894
|
-
getUnhandledErrors: () => unknown[];
|
|
895
|
-
}
|
|
896
|
-
interface WebSocketBrowserHandlers {
|
|
897
|
-
resolveSnapshotPath: (testPath: string) => string;
|
|
898
|
-
resolveSnapshotRawPath: (testPath: string, rawPath: string) => string;
|
|
899
|
-
onUnhandledError: (error: unknown, type: string) => Promise<void>;
|
|
900
|
-
onCollected: (files?: File[]) => Promise<void>;
|
|
901
|
-
onTaskUpdate: (packs: TaskResultPack[]) => void;
|
|
902
|
-
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
|
|
903
|
-
onCancel: (reason: CancelReason) => void;
|
|
904
|
-
getCountOfFailedTests: () => number;
|
|
905
|
-
readSnapshotFile: (id: string) => Promise<string | null>;
|
|
906
|
-
saveSnapshotFile: (id: string, content: string) => Promise<void>;
|
|
907
|
-
removeSnapshotFile: (id: string) => Promise<void>;
|
|
908
|
-
sendLog: (log: UserConsoleLog) => void;
|
|
909
|
-
finishBrowserTests: () => void;
|
|
910
|
-
snapshotSaved: (snapshot: SnapshotResult) => void;
|
|
911
|
-
getBrowserFiles: () => string[];
|
|
912
|
-
debug: (...args: string[]) => void;
|
|
913
|
-
resolveId: (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
|
|
914
|
-
triggerCommand: (command: string, testPath: string | undefined, payload: unknown[]) => Promise<void>;
|
|
915
|
-
queueMock: (id: string, importer: string, hasFactory: boolean) => Promise<string>;
|
|
916
|
-
queueUnmock: (id: string, importer: string) => Promise<string>;
|
|
917
|
-
resolveMock: (id: string, importer: string) => Promise<{
|
|
918
|
-
type: 'factory' | 'redirect' | 'automock';
|
|
919
|
-
mockPath?: string | null;
|
|
920
|
-
resolvedId: string;
|
|
921
|
-
}>;
|
|
922
|
-
invalidateMocks: () => void;
|
|
923
|
-
getBrowserFileSourceMap: (id: string) => Promise<TransformResult$1['map'] | undefined>;
|
|
924
|
-
getProvidedContext: () => ProvidedContext;
|
|
925
|
-
}
|
|
926
|
-
interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onFinished' | 'onTaskUpdate' | 'onUserConsoleLog' | 'onPathsCollected' | 'onSpecsCollected'> {
|
|
927
|
-
onFinishedReportCoverage: () => void;
|
|
928
|
-
}
|
|
929
|
-
interface WebSocketBrowserEvents {
|
|
930
|
-
onCancel: (reason: CancelReason) => void;
|
|
931
|
-
startMocking: (id: string) => Promise<string[]>;
|
|
932
|
-
createTesters: (files: string[]) => Promise<void>;
|
|
933
|
-
}
|
|
934
|
-
type WebSocketRPC = BirpcReturn<WebSocketEvents, WebSocketHandlers>;
|
|
935
|
-
type WebSocketBrowserRPC = BirpcReturn<WebSocketBrowserEvents, WebSocketBrowserHandlers>;
|
|
936
|
-
|
|
937
873
|
interface InitializeProjectOptions extends UserWorkspaceConfig {
|
|
938
874
|
workspaceConfigPath: string;
|
|
939
875
|
extends?: string;
|
|
@@ -947,20 +883,9 @@ declare class WorkspaceProject {
|
|
|
947
883
|
server: ViteDevServer;
|
|
948
884
|
vitenode: ViteNodeServer;
|
|
949
885
|
runner: ViteNodeRunner;
|
|
950
|
-
browser?:
|
|
886
|
+
browser?: BrowserServer;
|
|
951
887
|
typechecker?: Typechecker;
|
|
952
888
|
closingPromise: Promise<unknown> | undefined;
|
|
953
|
-
browserProvider: BrowserProvider | undefined;
|
|
954
|
-
browserMocker: VitestBrowserServerMocker;
|
|
955
|
-
browserRpc: {
|
|
956
|
-
orchestrators: Map<string, WebSocketBrowserRPC>;
|
|
957
|
-
testers: Map<string, WebSocketBrowserRPC>;
|
|
958
|
-
};
|
|
959
|
-
browserState: {
|
|
960
|
-
files: string[];
|
|
961
|
-
resolve: () => void;
|
|
962
|
-
reject: (v: unknown) => void;
|
|
963
|
-
} | undefined;
|
|
964
889
|
testFilesList: string[] | null;
|
|
965
890
|
readonly id: string;
|
|
966
891
|
readonly tmpDir: string;
|
|
@@ -969,7 +894,7 @@ declare class WorkspaceProject {
|
|
|
969
894
|
constructor(path: string | number, ctx: Vitest, options?: InitializeProjectOptions | undefined);
|
|
970
895
|
getName(): string;
|
|
971
896
|
isCore(): boolean;
|
|
972
|
-
provide
|
|
897
|
+
provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
|
|
973
898
|
getProvidedContext(): ProvidedContext;
|
|
974
899
|
initializeGlobalSetup(): Promise<void>;
|
|
975
900
|
teardownGlobalSetup(): Promise<void>;
|
|
@@ -991,7 +916,7 @@ declare class WorkspaceProject {
|
|
|
991
916
|
static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
|
|
992
917
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
993
918
|
isBrowserEnabled(): boolean;
|
|
994
|
-
getSerializableConfig(): ResolvedConfig;
|
|
919
|
+
getSerializableConfig(method?: 'run' | 'collect'): ResolvedConfig;
|
|
995
920
|
close(): Promise<unknown>;
|
|
996
921
|
private clearTmpDir;
|
|
997
922
|
initBrowserProvider(): Promise<void>;
|
|
@@ -1002,6 +927,7 @@ type RunWithFiles = (files: WorkspaceSpec[], invalidates?: string[]) => Awaitabl
|
|
|
1002
927
|
interface ProcessPool {
|
|
1003
928
|
name: string;
|
|
1004
929
|
runTests: RunWithFiles;
|
|
930
|
+
collectTests: RunWithFiles;
|
|
1005
931
|
close?: () => Awaitable$1<void>;
|
|
1006
932
|
}
|
|
1007
933
|
declare function getFilePoolName(project: WorkspaceProject, file: string): Pool;
|
|
@@ -1009,7 +935,7 @@ declare function getFilePoolName(project: WorkspaceProject, file: string): Pool;
|
|
|
1009
935
|
type Awaitable<T> = T | PromiseLike<T>;
|
|
1010
936
|
type Nullable<T> = T | null | undefined;
|
|
1011
937
|
type Arrayable<T> = T | Array<T>;
|
|
1012
|
-
type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
938
|
+
type ArgumentsType$1<T> = T extends (...args: infer U) => any ? U : never;
|
|
1013
939
|
type MutableArray<T extends readonly any[]> = {
|
|
1014
940
|
-readonly [k in keyof T]: T[k];
|
|
1015
941
|
};
|
|
@@ -1171,6 +1097,7 @@ declare class Vitest {
|
|
|
1171
1097
|
private _onSetServer;
|
|
1172
1098
|
private _onCancelListeners;
|
|
1173
1099
|
setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
|
|
1100
|
+
provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
|
|
1174
1101
|
private createCoreProject;
|
|
1175
1102
|
getCoreWorkspaceProject(): WorkspaceProject;
|
|
1176
1103
|
getProjectByTaskId(taskId: string): WorkspaceProject;
|
|
@@ -1180,6 +1107,10 @@ declare class Vitest {
|
|
|
1180
1107
|
private initCoverageProvider;
|
|
1181
1108
|
private initBrowserProviders;
|
|
1182
1109
|
mergeReports(): Promise<void>;
|
|
1110
|
+
collect(filters?: string[]): Promise<{
|
|
1111
|
+
tests: File[];
|
|
1112
|
+
errors: unknown[];
|
|
1113
|
+
}>;
|
|
1183
1114
|
start(filters?: string[]): Promise<void>;
|
|
1184
1115
|
init(): Promise<void>;
|
|
1185
1116
|
private getTestDependencies;
|
|
@@ -1188,6 +1119,7 @@ declare class Vitest {
|
|
|
1188
1119
|
initializeGlobalSetup(paths: WorkspaceSpec[]): Promise<void>;
|
|
1189
1120
|
private initializeDistPath;
|
|
1190
1121
|
runFiles(specs: WorkspaceSpec[], allTestsRun: boolean): Promise<void>;
|
|
1122
|
+
collectFiles(specs: WorkspaceSpec[]): Promise<void>;
|
|
1191
1123
|
cancelCurrentRun(reason: CancelReason): Promise<void>;
|
|
1192
1124
|
rerunFiles(files?: string[], trigger?: string): Promise<void>;
|
|
1193
1125
|
changeProjectName(pattern: string): Promise<void>;
|
|
@@ -1214,7 +1146,7 @@ declare class Vitest {
|
|
|
1214
1146
|
* Close the thread pool and exit the process
|
|
1215
1147
|
*/
|
|
1216
1148
|
exit(force?: boolean): Promise<void>;
|
|
1217
|
-
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
|
|
1149
|
+
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
|
|
1218
1150
|
getTestFilepaths(): Promise<string[]>;
|
|
1219
1151
|
globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
|
|
1220
1152
|
shouldKeepServer(): boolean;
|
|
@@ -1299,7 +1231,7 @@ interface Reporter {
|
|
|
1299
1231
|
onPathsCollected?: (paths?: string[]) => Awaitable<void>;
|
|
1300
1232
|
onSpecsCollected?: (specs?: SerializableSpec[]) => Awaitable<void>;
|
|
1301
1233
|
onCollected?: (files?: File[]) => Awaitable<void>;
|
|
1302
|
-
onFinished?: (files
|
|
1234
|
+
onFinished?: (files: File[], errors: unknown[], coverage?: unknown) => Awaitable<void>;
|
|
1303
1235
|
onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
|
|
1304
1236
|
onTestRemoved?: (trigger?: string) => Awaitable<void>;
|
|
1305
1237
|
onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
@@ -1309,10 +1241,13 @@ interface Reporter {
|
|
|
1309
1241
|
onProcessTimeout?: () => Awaitable<void>;
|
|
1310
1242
|
}
|
|
1311
1243
|
|
|
1312
|
-
type SerializableSpec = [
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1244
|
+
type SerializableSpec = [
|
|
1245
|
+
project: {
|
|
1246
|
+
name: string | undefined;
|
|
1247
|
+
root: string;
|
|
1248
|
+
},
|
|
1249
|
+
file: string
|
|
1250
|
+
];
|
|
1316
1251
|
|
|
1317
1252
|
interface JUnitOptions {
|
|
1318
1253
|
outputFile?: string;
|
|
@@ -1356,8 +1291,10 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
1356
1291
|
start: number;
|
|
1357
1292
|
end: number;
|
|
1358
1293
|
watchFilters?: string[];
|
|
1294
|
+
failedUnwatchedFiles: Task[];
|
|
1359
1295
|
isTTY: boolean;
|
|
1360
1296
|
ctx: Vitest;
|
|
1297
|
+
protected verbose: boolean;
|
|
1361
1298
|
private _filesInWatchMode;
|
|
1362
1299
|
private _lastRunTimeout;
|
|
1363
1300
|
private _lastRunTimer;
|
|
@@ -1370,6 +1307,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
1370
1307
|
relative(path: string): string;
|
|
1371
1308
|
onFinished(files?: File[], errors?: unknown[]): void;
|
|
1372
1309
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1310
|
+
protected printTask(task: Task): void;
|
|
1373
1311
|
onWatcherStart(files?: File[], errors?: unknown[]): void;
|
|
1374
1312
|
private resetLastRunLog;
|
|
1375
1313
|
onWatcherRerun(files: string[], trigger?: string): void;
|
|
@@ -1385,7 +1323,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
1385
1323
|
}
|
|
1386
1324
|
|
|
1387
1325
|
declare class BasicReporter extends BaseReporter {
|
|
1388
|
-
|
|
1326
|
+
constructor();
|
|
1389
1327
|
reportSummary(files: File[], errors: unknown[]): void;
|
|
1390
1328
|
}
|
|
1391
1329
|
|
|
@@ -1438,6 +1376,7 @@ declare class DotReporter extends BaseReporter {
|
|
|
1438
1376
|
}
|
|
1439
1377
|
|
|
1440
1378
|
declare class VerboseReporter extends DefaultReporter {
|
|
1379
|
+
protected verbose: boolean;
|
|
1441
1380
|
constructor();
|
|
1442
1381
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1443
1382
|
}
|
|
@@ -1626,6 +1565,71 @@ interface LinkMapper {
|
|
|
1626
1565
|
assetPath(node: Node, name: string): string;
|
|
1627
1566
|
}
|
|
1628
1567
|
|
|
1568
|
+
type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
1569
|
+
type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
|
|
1570
|
+
type PromisifyFn<T> = ReturnType$1<T> extends Promise<any> ? T : (...args: ArgumentsType<T>) => Promise<Awaited<ReturnType$1<T>>>;
|
|
1571
|
+
type BirpcResolver = (name: string, resolved: (...args: unknown[]) => unknown) => ((...args: unknown[]) => unknown) | undefined;
|
|
1572
|
+
interface ChannelOptions {
|
|
1573
|
+
/**
|
|
1574
|
+
* Function to post raw message
|
|
1575
|
+
*/
|
|
1576
|
+
post: (data: any, ...extras: any[]) => any | Promise<any>;
|
|
1577
|
+
/**
|
|
1578
|
+
* Listener to receive raw message
|
|
1579
|
+
*/
|
|
1580
|
+
on: (fn: (data: any, ...extras: any[]) => void) => any | Promise<any>;
|
|
1581
|
+
/**
|
|
1582
|
+
* Custom function to serialize data
|
|
1583
|
+
*
|
|
1584
|
+
* by default it passes the data as-is
|
|
1585
|
+
*/
|
|
1586
|
+
serialize?: (data: any) => any;
|
|
1587
|
+
/**
|
|
1588
|
+
* Custom function to deserialize data
|
|
1589
|
+
*
|
|
1590
|
+
* by default it passes the data as-is
|
|
1591
|
+
*/
|
|
1592
|
+
deserialize?: (data: any) => any;
|
|
1593
|
+
}
|
|
1594
|
+
interface EventOptions<Remote> {
|
|
1595
|
+
/**
|
|
1596
|
+
* Names of remote functions that do not need response.
|
|
1597
|
+
*/
|
|
1598
|
+
eventNames?: (keyof Remote)[];
|
|
1599
|
+
/**
|
|
1600
|
+
* Maximum timeout for waiting for response, in milliseconds.
|
|
1601
|
+
*
|
|
1602
|
+
* @default 60_000
|
|
1603
|
+
*/
|
|
1604
|
+
timeout?: number;
|
|
1605
|
+
/**
|
|
1606
|
+
* Custom resolver to resolve function to be called
|
|
1607
|
+
*
|
|
1608
|
+
* For advanced use cases only
|
|
1609
|
+
*/
|
|
1610
|
+
resolver?: BirpcResolver;
|
|
1611
|
+
/**
|
|
1612
|
+
* Custom error handler
|
|
1613
|
+
*/
|
|
1614
|
+
onError?: (error: Error, functionName: string, args: any[]) => boolean | void;
|
|
1615
|
+
/**
|
|
1616
|
+
* Custom error handler for timeouts
|
|
1617
|
+
*/
|
|
1618
|
+
onTimeoutError?: (functionName: string, args: any[]) => boolean | void;
|
|
1619
|
+
}
|
|
1620
|
+
type BirpcOptions<Remote> = EventOptions<Remote> & ChannelOptions;
|
|
1621
|
+
type BirpcFn<T> = PromisifyFn<T> & {
|
|
1622
|
+
/**
|
|
1623
|
+
* Send event without asking for response
|
|
1624
|
+
*/
|
|
1625
|
+
asEvent: (...args: ArgumentsType<T>) => void;
|
|
1626
|
+
};
|
|
1627
|
+
type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
|
|
1628
|
+
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
|
|
1629
|
+
} & {
|
|
1630
|
+
$functions: LocalFunctions;
|
|
1631
|
+
};
|
|
1632
|
+
|
|
1629
1633
|
type MockFactoryWithHelper<M = unknown> = (importOriginal: <T extends M>() => Promise<T>) => any;
|
|
1630
1634
|
type MockFactory = () => any;
|
|
1631
1635
|
type MockMap = Map<string, Record<string, string | null | MockFactory>>;
|
|
@@ -1756,20 +1760,20 @@ interface CoverageProviderModule {
|
|
|
1756
1760
|
type CoverageReporter = keyof ReportOptions | (string & {});
|
|
1757
1761
|
type CoverageReporterWithOptions<ReporterName extends CoverageReporter = CoverageReporter> = ReporterName extends keyof ReportOptions ? ReportOptions[ReporterName] extends never ? [ReporterName, {}] : [ReporterName, Partial<ReportOptions[ReporterName]>] : [ReporterName, Record<string, unknown>];
|
|
1758
1762
|
type Provider = 'v8' | 'istanbul' | 'custom' | undefined;
|
|
1759
|
-
type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ?
|
|
1763
|
+
type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? {
|
|
1760
1764
|
provider: T;
|
|
1761
|
-
} & CoverageIstanbulOptions
|
|
1765
|
+
} & CoverageIstanbulOptions : T extends 'v8' ? {
|
|
1762
1766
|
/**
|
|
1763
1767
|
* Provider to use for coverage collection.
|
|
1764
1768
|
*
|
|
1765
1769
|
* @default 'v8'
|
|
1766
1770
|
*/
|
|
1767
1771
|
provider: T;
|
|
1768
|
-
} & CoverageV8Options
|
|
1772
|
+
} & CoverageV8Options : T extends 'custom' ? {
|
|
1769
1773
|
provider: T;
|
|
1770
|
-
} & CustomProviderOptions
|
|
1774
|
+
} & CustomProviderOptions : {
|
|
1771
1775
|
provider?: T;
|
|
1772
|
-
} &
|
|
1776
|
+
} & CoverageV8Options;
|
|
1773
1777
|
/** Fields that have default values. Internally these will always be defined. */
|
|
1774
1778
|
type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension' | 'reportOnFailure' | 'allowExternal' | 'processingConcurrency';
|
|
1775
1779
|
type ResolvedCoverageOptions<T extends Provider = Provider> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
|
|
@@ -2089,6 +2093,9 @@ type BenchmarkAPI = ChainableBenchmarkAPI & {
|
|
|
2089
2093
|
runIf: (condition: any) => ChainableBenchmarkAPI;
|
|
2090
2094
|
};
|
|
2091
2095
|
|
|
2096
|
+
declare const defaultBrowserPort = 63315;
|
|
2097
|
+
declare const extraInlineDeps: (string | RegExp)[];
|
|
2098
|
+
|
|
2092
2099
|
declare const defaultInclude: string[];
|
|
2093
2100
|
declare const defaultExclude: string[];
|
|
2094
2101
|
declare const coverageConfigDefaults: ResolvedCoverageOptions;
|
|
@@ -2104,8 +2111,6 @@ declare const configDefaults: Readonly<{
|
|
|
2104
2111
|
mockReset: false;
|
|
2105
2112
|
include: string[];
|
|
2106
2113
|
exclude: string[];
|
|
2107
|
-
testTimeout: number;
|
|
2108
|
-
hookTimeout: number;
|
|
2109
2114
|
teardownTimeout: number;
|
|
2110
2115
|
forceRerunTriggers: string[];
|
|
2111
2116
|
update: false;
|
|
@@ -2136,8 +2141,6 @@ declare const configDefaults: Readonly<{
|
|
|
2136
2141
|
disableConsoleIntercept: false;
|
|
2137
2142
|
}>;
|
|
2138
2143
|
|
|
2139
|
-
declare const extraInlineDeps: (string | RegExp)[];
|
|
2140
|
-
|
|
2141
2144
|
interface UserWorkspaceConfig extends UserConfig$1 {
|
|
2142
2145
|
test?: ProjectConfig;
|
|
2143
2146
|
}
|
|
@@ -2153,9 +2156,9 @@ declare function defineConfig(config: Promise<UserConfig$1>): Promise<UserConfig
|
|
|
2153
2156
|
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
2154
2157
|
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
2155
2158
|
declare function defineProject<T extends UserProjectConfigExport>(config: T): T;
|
|
2156
|
-
type Workspace =
|
|
2159
|
+
type Workspace = string | (UserProjectConfigExport & {
|
|
2157
2160
|
extends?: string;
|
|
2158
|
-
})
|
|
2161
|
+
});
|
|
2159
2162
|
declare function defineWorkspace(config: Workspace[]): Workspace[];
|
|
2160
2163
|
|
|
2161
2164
|
type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
|
|
@@ -2423,7 +2426,7 @@ interface InlineConfig {
|
|
|
2423
2426
|
*
|
|
2424
2427
|
* Supports 'threads', 'forks', 'vmThreads'
|
|
2425
2428
|
*
|
|
2426
|
-
* @default '
|
|
2429
|
+
* @default 'forks'
|
|
2427
2430
|
*/
|
|
2428
2431
|
pool?: Exclude<Pool, 'browser'>;
|
|
2429
2432
|
/**
|
|
@@ -2431,13 +2434,13 @@ interface InlineConfig {
|
|
|
2431
2434
|
*/
|
|
2432
2435
|
poolOptions?: PoolOptions;
|
|
2433
2436
|
/**
|
|
2434
|
-
* Maximum number of workers to run tests in. `poolOptions.{threads,vmThreads}.maxThreads`/`poolOptions.forks.maxForks` has higher priority.
|
|
2437
|
+
* Maximum number or percentage of workers to run tests in. `poolOptions.{threads,vmThreads}.maxThreads`/`poolOptions.forks.maxForks` has higher priority.
|
|
2435
2438
|
*/
|
|
2436
|
-
maxWorkers?: number;
|
|
2439
|
+
maxWorkers?: number | string;
|
|
2437
2440
|
/**
|
|
2438
|
-
* Minimum number of workers to run tests in. `poolOptions.{threads,vmThreads}.minThreads`/`poolOptions.forks.minForks` has higher priority.
|
|
2441
|
+
* Minimum number or percentage of workers to run tests in. `poolOptions.{threads,vmThreads}.minThreads`/`poolOptions.forks.minForks` has higher priority.
|
|
2439
2442
|
*/
|
|
2440
|
-
minWorkers?: number;
|
|
2443
|
+
minWorkers?: number | string;
|
|
2441
2444
|
/**
|
|
2442
2445
|
* Should all test files run in parallel. Doesn't affect tests running in the same file.
|
|
2443
2446
|
* Setting this to `false` will override `maxWorkers` and `minWorkers` options to `1`.
|
|
@@ -2626,7 +2629,7 @@ interface InlineConfig {
|
|
|
2626
2629
|
*/
|
|
2627
2630
|
resolveSnapshotPath?: (path: string, extension: string) => string;
|
|
2628
2631
|
/**
|
|
2629
|
-
* Path to a custom snapshot environment module that has a
|
|
2632
|
+
* Path to a custom snapshot environment module that has a default export of `SnapshotEnvironment` object.
|
|
2630
2633
|
*/
|
|
2631
2634
|
snapshotEnvironment?: string;
|
|
2632
2635
|
/**
|
|
@@ -2934,9 +2937,10 @@ interface UserConfig extends InlineConfig {
|
|
|
2934
2937
|
*/
|
|
2935
2938
|
mergeReports?: string;
|
|
2936
2939
|
}
|
|
2937
|
-
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool' | 'cliExclude'> {
|
|
2940
|
+
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool' | 'cliExclude' | 'diff'> {
|
|
2938
2941
|
mode: VitestRunMode;
|
|
2939
2942
|
base?: string;
|
|
2943
|
+
diff?: string;
|
|
2940
2944
|
config?: string;
|
|
2941
2945
|
filters?: string[];
|
|
2942
2946
|
testNamePattern?: RegExp;
|
|
@@ -2945,7 +2949,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2945
2949
|
snapshotOptions: SnapshotStateOptions;
|
|
2946
2950
|
browser: ResolvedBrowserOptions;
|
|
2947
2951
|
pool: Pool;
|
|
2948
|
-
poolOptions?:
|
|
2952
|
+
poolOptions?: ResolvedPoolOptions;
|
|
2949
2953
|
reporters: (InlineReporter | ReporterWithOptions)[];
|
|
2950
2954
|
defines: Record<string, any>;
|
|
2951
2955
|
api?: ApiConfig;
|
|
@@ -2973,8 +2977,10 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2973
2977
|
enabled: boolean;
|
|
2974
2978
|
};
|
|
2975
2979
|
runner?: string;
|
|
2980
|
+
maxWorkers: number;
|
|
2981
|
+
minWorkers: number;
|
|
2976
2982
|
}
|
|
2977
|
-
type ProjectConfig = Omit<UserConfig, 'sequencer' | 'shard' | 'watch' | 'run' | 'cache' | 'update' | 'reporters' | 'outputFile' | 'poolOptions' | 'teardownTimeout' | 'silent' | 'forceRerunTriggers' | 'testNamePattern' | 'ui' | 'open' | 'uiBase' | 'snapshotFormat' | 'resolveSnapshotPath' | 'passWithNoTests' | 'onConsoleLog' | 'onStackTrace' | 'dangerouslyIgnoreUnhandledErrors' | 'slowTestThreshold' | 'inspect' | 'inspectBrk' | 'deps' | 'coverage'> & {
|
|
2983
|
+
type ProjectConfig = Omit<UserConfig, 'sequencer' | 'shard' | 'watch' | 'run' | 'cache' | 'update' | 'reporters' | 'outputFile' | 'poolOptions' | 'teardownTimeout' | 'silent' | 'forceRerunTriggers' | 'testNamePattern' | 'ui' | 'open' | 'uiBase' | 'snapshotFormat' | 'resolveSnapshotPath' | 'passWithNoTests' | 'onConsoleLog' | 'onStackTrace' | 'dangerouslyIgnoreUnhandledErrors' | 'slowTestThreshold' | 'inspect' | 'inspectBrk' | 'deps' | 'coverage' | 'maxWorkers' | 'minWorkers' | 'fileParallelism'> & {
|
|
2978
2984
|
sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
|
|
2979
2985
|
deps?: Omit<DepsOptions, 'moduleDirectories'>;
|
|
2980
2986
|
poolOptions?: {
|
|
@@ -3057,6 +3063,7 @@ declare module '@vitest/runner' {
|
|
|
3057
3063
|
interface TaskMeta {
|
|
3058
3064
|
typecheck?: boolean;
|
|
3059
3065
|
benchmark?: boolean;
|
|
3066
|
+
failScreenshotPath?: string;
|
|
3060
3067
|
}
|
|
3061
3068
|
interface File {
|
|
3062
3069
|
prepareDuration?: number;
|
|
@@ -3096,4 +3103,4 @@ type Context = RootAndTarget & {
|
|
|
3096
3103
|
lastActivePath?: string;
|
|
3097
3104
|
};
|
|
3098
3105
|
|
|
3099
|
-
export { type
|
|
3106
|
+
export { type Nullable as $, type ApiConfig as A, type BaseCoverageOptions as B, type CoverageOptions as C, type DepsOptimizationOptions as D, type Environment as E, type FakeTimerInstallOpts as F, type BrowserConfigOptions as G, type HappyDOMOptions as H, type InlineConfig as I, type JSDOMOptions as J, type UserWorkspaceConfig as K, type RunnerRPC as L, type MockFactoryWithHelper as M, type ContextTestEnvironment as N, type ResolvedTestEnvironment as O, type Pool as P, Vitest as Q, type ResolvedConfig as R, type SerializableSpec as S, type TscErrorInfo as T, type UserConfig as U, type VitestEnvironment as V, type WorkerGlobalState as W, type ResolveIdFunction as X, type AfterSuiteRunMeta as Y, type WorkerRPC as Z, type Awaitable as _, type ResolvedCoverageOptions as a, BasicReporter as a$, type Arrayable as a0, type ArgumentsType$1 as a1, type MutableArray as a2, type Constructable as a3, type ModuleCache as a4, type EnvironmentReturn as a5, type VmEnvironmentReturn as a6, type UserConsoleLog as a7, type OnServerRestartHandler as a8, type ReportContext as a9, type BrowserCommandContext as aA, type BrowserServer as aB, type BrowserServerState as aC, type BrowserServerStateContext as aD, type BrowserOrchestrator as aE, type JsonOptions$1 as aF, type JUnitOptions as aG, type HTMLOptions as aH, type PendingSuiteMock as aI, type MockFactory as aJ, type MockMap as aK, type UserConfigFnObject as aL, type UserConfigFnPromise as aM, type UserConfigFn as aN, type UserConfigExport as aO, type UserProjectConfigFn as aP, type UserProjectConfigExport as aQ, defineConfig as aR, defineProject as aS, defineWorkspace as aT, defaultBrowserPort as aU, configDefaults as aV, defaultInclude as aW, defaultExclude as aX, coverageConfigDefaults as aY, extraInlineDeps as aZ, DefaultReporter as a_, type CoverageReporter as aa, type CoverageIstanbulOptions as ab, type CoverageV8Options as ac, type CustomProviderOptions as ad, type BenchmarkUserOptions as ae, type Benchmark as af, type BenchmarkResult as ag, type BenchFunction as ah, type BenchmarkAPI as ai, type VitestOptions as aj, WorkspaceProject as ak, Logger as al, type TestSequencer as am, type WorkspaceSpec as an, type ProcessPool as ao, getFilePoolName as ap, VitestPackageInstaller as aq, type TestSequencerConstructor as ar, type BrowserProviderInitializationOptions as as, type BrowserProvider as at, type CDPSession as au, type BrowserProviderModule as av, type ResolvedBrowserOptions as aw, type BrowserProviderOptions as ax, type BrowserBuiltinProvider as ay, type BrowserCommand as az, type CoverageProvider as b, DotReporter as b0, JsonReporter as b1, VerboseReporter as b2, TapReporter as b3, JUnitReporter as b4, TapFlatReporter as b5, HangingProcessReporter as b6, GithubActionsReporter as b7, BaseReporter as b8, ReportersMap as b9, type BuiltinReporters as ba, type BuiltinReporterOptions as bb, type JsonAssertionResult as bc, type JsonTestResult as bd, type JsonTestResults as be, BenchmarkReportsMap as bf, type BenchmarkBuiltinReporters as bg, type CoverageProviderModule as c, type BirpcOptions as d, type RuntimeRPC as e, type ContextRPC as f, type WorkerContext as g, type RuntimeConfig as h, type ProvidedContext as i, type ModuleGraphData as j, type Reporter as k, type BirpcReturn as l, type RawErrsMap as m, type CollectLineNumbers as n, type CollectLines as o, type RootAndTarget as p, type Context as q, type PoolOptions as r, type BuiltinEnvironment as s, type CSSModuleScopeStrategy as t, type EnvironmentOptions as u, type VitestRunMode as v, type TransformModePatterns as w, type TypecheckConfig as x, type ProjectConfig as y, type BrowserScript as z };
|