vitest 2.0.0-beta.9 → 2.0.1
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-BU_vXAUX.d.ts} +216 -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-BRl_IYuM.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.DCg3FnEs.js → cac.BQc6bsef.js} +142 -47
- package/dist/vendor/{cli-api.LMvYagQ5.js → cli-api.BGRtK_Kj.js} +4189 -9537
- 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
|
};
|
|
@@ -1067,6 +993,9 @@ declare class StateManager {
|
|
|
1067
993
|
addProcessTimeoutCause(cause: string): void;
|
|
1068
994
|
getProcessTimeoutCauses(): string[];
|
|
1069
995
|
getPaths(): string[];
|
|
996
|
+
/**
|
|
997
|
+
* Return files that were running or collected.
|
|
998
|
+
*/
|
|
1070
999
|
getFiles(keys?: string[]): File[];
|
|
1071
1000
|
getFilepaths(): string[];
|
|
1072
1001
|
getFailedFilepaths(): string[];
|
|
@@ -1171,6 +1100,7 @@ declare class Vitest {
|
|
|
1171
1100
|
private _onSetServer;
|
|
1172
1101
|
private _onCancelListeners;
|
|
1173
1102
|
setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
|
|
1103
|
+
provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
|
|
1174
1104
|
private createCoreProject;
|
|
1175
1105
|
getCoreWorkspaceProject(): WorkspaceProject;
|
|
1176
1106
|
getProjectByTaskId(taskId: string): WorkspaceProject;
|
|
@@ -1180,6 +1110,10 @@ declare class Vitest {
|
|
|
1180
1110
|
private initCoverageProvider;
|
|
1181
1111
|
private initBrowserProviders;
|
|
1182
1112
|
mergeReports(): Promise<void>;
|
|
1113
|
+
collect(filters?: string[]): Promise<{
|
|
1114
|
+
tests: File[];
|
|
1115
|
+
errors: unknown[];
|
|
1116
|
+
}>;
|
|
1183
1117
|
start(filters?: string[]): Promise<void>;
|
|
1184
1118
|
init(): Promise<void>;
|
|
1185
1119
|
private getTestDependencies;
|
|
@@ -1188,6 +1122,7 @@ declare class Vitest {
|
|
|
1188
1122
|
initializeGlobalSetup(paths: WorkspaceSpec[]): Promise<void>;
|
|
1189
1123
|
private initializeDistPath;
|
|
1190
1124
|
runFiles(specs: WorkspaceSpec[], allTestsRun: boolean): Promise<void>;
|
|
1125
|
+
collectFiles(specs: WorkspaceSpec[]): Promise<void>;
|
|
1191
1126
|
cancelCurrentRun(reason: CancelReason): Promise<void>;
|
|
1192
1127
|
rerunFiles(files?: string[], trigger?: string): Promise<void>;
|
|
1193
1128
|
changeProjectName(pattern: string): Promise<void>;
|
|
@@ -1214,7 +1149,7 @@ declare class Vitest {
|
|
|
1214
1149
|
* Close the thread pool and exit the process
|
|
1215
1150
|
*/
|
|
1216
1151
|
exit(force?: boolean): Promise<void>;
|
|
1217
|
-
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
|
|
1152
|
+
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
|
|
1218
1153
|
getTestFilepaths(): Promise<string[]>;
|
|
1219
1154
|
globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
|
|
1220
1155
|
shouldKeepServer(): boolean;
|
|
@@ -1299,7 +1234,7 @@ interface Reporter {
|
|
|
1299
1234
|
onPathsCollected?: (paths?: string[]) => Awaitable<void>;
|
|
1300
1235
|
onSpecsCollected?: (specs?: SerializableSpec[]) => Awaitable<void>;
|
|
1301
1236
|
onCollected?: (files?: File[]) => Awaitable<void>;
|
|
1302
|
-
onFinished?: (files
|
|
1237
|
+
onFinished?: (files: File[], errors: unknown[], coverage?: unknown) => Awaitable<void>;
|
|
1303
1238
|
onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
|
|
1304
1239
|
onTestRemoved?: (trigger?: string) => Awaitable<void>;
|
|
1305
1240
|
onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
@@ -1309,10 +1244,13 @@ interface Reporter {
|
|
|
1309
1244
|
onProcessTimeout?: () => Awaitable<void>;
|
|
1310
1245
|
}
|
|
1311
1246
|
|
|
1312
|
-
type SerializableSpec = [
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1247
|
+
type SerializableSpec = [
|
|
1248
|
+
project: {
|
|
1249
|
+
name: string | undefined;
|
|
1250
|
+
root: string;
|
|
1251
|
+
},
|
|
1252
|
+
file: string
|
|
1253
|
+
];
|
|
1316
1254
|
|
|
1317
1255
|
interface JUnitOptions {
|
|
1318
1256
|
outputFile?: string;
|
|
@@ -1356,8 +1294,10 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
1356
1294
|
start: number;
|
|
1357
1295
|
end: number;
|
|
1358
1296
|
watchFilters?: string[];
|
|
1297
|
+
failedUnwatchedFiles: Task[];
|
|
1359
1298
|
isTTY: boolean;
|
|
1360
1299
|
ctx: Vitest;
|
|
1300
|
+
protected verbose: boolean;
|
|
1361
1301
|
private _filesInWatchMode;
|
|
1362
1302
|
private _lastRunTimeout;
|
|
1363
1303
|
private _lastRunTimer;
|
|
@@ -1370,6 +1310,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
1370
1310
|
relative(path: string): string;
|
|
1371
1311
|
onFinished(files?: File[], errors?: unknown[]): void;
|
|
1372
1312
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1313
|
+
protected printTask(task: Task): void;
|
|
1373
1314
|
onWatcherStart(files?: File[], errors?: unknown[]): void;
|
|
1374
1315
|
private resetLastRunLog;
|
|
1375
1316
|
onWatcherRerun(files: string[], trigger?: string): void;
|
|
@@ -1385,7 +1326,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
1385
1326
|
}
|
|
1386
1327
|
|
|
1387
1328
|
declare class BasicReporter extends BaseReporter {
|
|
1388
|
-
|
|
1329
|
+
constructor();
|
|
1389
1330
|
reportSummary(files: File[], errors: unknown[]): void;
|
|
1390
1331
|
}
|
|
1391
1332
|
|
|
@@ -1438,6 +1379,7 @@ declare class DotReporter extends BaseReporter {
|
|
|
1438
1379
|
}
|
|
1439
1380
|
|
|
1440
1381
|
declare class VerboseReporter extends DefaultReporter {
|
|
1382
|
+
protected verbose: boolean;
|
|
1441
1383
|
constructor();
|
|
1442
1384
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1443
1385
|
}
|
|
@@ -1626,6 +1568,71 @@ interface LinkMapper {
|
|
|
1626
1568
|
assetPath(node: Node, name: string): string;
|
|
1627
1569
|
}
|
|
1628
1570
|
|
|
1571
|
+
type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
1572
|
+
type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
|
|
1573
|
+
type PromisifyFn<T> = ReturnType$1<T> extends Promise<any> ? T : (...args: ArgumentsType<T>) => Promise<Awaited<ReturnType$1<T>>>;
|
|
1574
|
+
type BirpcResolver = (name: string, resolved: (...args: unknown[]) => unknown) => ((...args: unknown[]) => unknown) | undefined;
|
|
1575
|
+
interface ChannelOptions {
|
|
1576
|
+
/**
|
|
1577
|
+
* Function to post raw message
|
|
1578
|
+
*/
|
|
1579
|
+
post: (data: any, ...extras: any[]) => any | Promise<any>;
|
|
1580
|
+
/**
|
|
1581
|
+
* Listener to receive raw message
|
|
1582
|
+
*/
|
|
1583
|
+
on: (fn: (data: any, ...extras: any[]) => void) => any | Promise<any>;
|
|
1584
|
+
/**
|
|
1585
|
+
* Custom function to serialize data
|
|
1586
|
+
*
|
|
1587
|
+
* by default it passes the data as-is
|
|
1588
|
+
*/
|
|
1589
|
+
serialize?: (data: any) => any;
|
|
1590
|
+
/**
|
|
1591
|
+
* Custom function to deserialize data
|
|
1592
|
+
*
|
|
1593
|
+
* by default it passes the data as-is
|
|
1594
|
+
*/
|
|
1595
|
+
deserialize?: (data: any) => any;
|
|
1596
|
+
}
|
|
1597
|
+
interface EventOptions<Remote> {
|
|
1598
|
+
/**
|
|
1599
|
+
* Names of remote functions that do not need response.
|
|
1600
|
+
*/
|
|
1601
|
+
eventNames?: (keyof Remote)[];
|
|
1602
|
+
/**
|
|
1603
|
+
* Maximum timeout for waiting for response, in milliseconds.
|
|
1604
|
+
*
|
|
1605
|
+
* @default 60_000
|
|
1606
|
+
*/
|
|
1607
|
+
timeout?: number;
|
|
1608
|
+
/**
|
|
1609
|
+
* Custom resolver to resolve function to be called
|
|
1610
|
+
*
|
|
1611
|
+
* For advanced use cases only
|
|
1612
|
+
*/
|
|
1613
|
+
resolver?: BirpcResolver;
|
|
1614
|
+
/**
|
|
1615
|
+
* Custom error handler
|
|
1616
|
+
*/
|
|
1617
|
+
onError?: (error: Error, functionName: string, args: any[]) => boolean | void;
|
|
1618
|
+
/**
|
|
1619
|
+
* Custom error handler for timeouts
|
|
1620
|
+
*/
|
|
1621
|
+
onTimeoutError?: (functionName: string, args: any[]) => boolean | void;
|
|
1622
|
+
}
|
|
1623
|
+
type BirpcOptions<Remote> = EventOptions<Remote> & ChannelOptions;
|
|
1624
|
+
type BirpcFn<T> = PromisifyFn<T> & {
|
|
1625
|
+
/**
|
|
1626
|
+
* Send event without asking for response
|
|
1627
|
+
*/
|
|
1628
|
+
asEvent: (...args: ArgumentsType<T>) => void;
|
|
1629
|
+
};
|
|
1630
|
+
type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
|
|
1631
|
+
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
|
|
1632
|
+
} & {
|
|
1633
|
+
$functions: LocalFunctions;
|
|
1634
|
+
};
|
|
1635
|
+
|
|
1629
1636
|
type MockFactoryWithHelper<M = unknown> = (importOriginal: <T extends M>() => Promise<T>) => any;
|
|
1630
1637
|
type MockFactory = () => any;
|
|
1631
1638
|
type MockMap = Map<string, Record<string, string | null | MockFactory>>;
|
|
@@ -1756,20 +1763,20 @@ interface CoverageProviderModule {
|
|
|
1756
1763
|
type CoverageReporter = keyof ReportOptions | (string & {});
|
|
1757
1764
|
type CoverageReporterWithOptions<ReporterName extends CoverageReporter = CoverageReporter> = ReporterName extends keyof ReportOptions ? ReportOptions[ReporterName] extends never ? [ReporterName, {}] : [ReporterName, Partial<ReportOptions[ReporterName]>] : [ReporterName, Record<string, unknown>];
|
|
1758
1765
|
type Provider = 'v8' | 'istanbul' | 'custom' | undefined;
|
|
1759
|
-
type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ?
|
|
1766
|
+
type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? {
|
|
1760
1767
|
provider: T;
|
|
1761
|
-
} & CoverageIstanbulOptions
|
|
1768
|
+
} & CoverageIstanbulOptions : T extends 'v8' ? {
|
|
1762
1769
|
/**
|
|
1763
1770
|
* Provider to use for coverage collection.
|
|
1764
1771
|
*
|
|
1765
1772
|
* @default 'v8'
|
|
1766
1773
|
*/
|
|
1767
1774
|
provider: T;
|
|
1768
|
-
} & CoverageV8Options
|
|
1775
|
+
} & CoverageV8Options : T extends 'custom' ? {
|
|
1769
1776
|
provider: T;
|
|
1770
|
-
} & CustomProviderOptions
|
|
1777
|
+
} & CustomProviderOptions : {
|
|
1771
1778
|
provider?: T;
|
|
1772
|
-
} &
|
|
1779
|
+
} & CoverageV8Options;
|
|
1773
1780
|
/** Fields that have default values. Internally these will always be defined. */
|
|
1774
1781
|
type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension' | 'reportOnFailure' | 'allowExternal' | 'processingConcurrency';
|
|
1775
1782
|
type ResolvedCoverageOptions<T extends Provider = Provider> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
|
|
@@ -2089,6 +2096,9 @@ type BenchmarkAPI = ChainableBenchmarkAPI & {
|
|
|
2089
2096
|
runIf: (condition: any) => ChainableBenchmarkAPI;
|
|
2090
2097
|
};
|
|
2091
2098
|
|
|
2099
|
+
declare const defaultBrowserPort = 63315;
|
|
2100
|
+
declare const extraInlineDeps: (string | RegExp)[];
|
|
2101
|
+
|
|
2092
2102
|
declare const defaultInclude: string[];
|
|
2093
2103
|
declare const defaultExclude: string[];
|
|
2094
2104
|
declare const coverageConfigDefaults: ResolvedCoverageOptions;
|
|
@@ -2104,8 +2114,6 @@ declare const configDefaults: Readonly<{
|
|
|
2104
2114
|
mockReset: false;
|
|
2105
2115
|
include: string[];
|
|
2106
2116
|
exclude: string[];
|
|
2107
|
-
testTimeout: number;
|
|
2108
|
-
hookTimeout: number;
|
|
2109
2117
|
teardownTimeout: number;
|
|
2110
2118
|
forceRerunTriggers: string[];
|
|
2111
2119
|
update: false;
|
|
@@ -2136,8 +2144,6 @@ declare const configDefaults: Readonly<{
|
|
|
2136
2144
|
disableConsoleIntercept: false;
|
|
2137
2145
|
}>;
|
|
2138
2146
|
|
|
2139
|
-
declare const extraInlineDeps: (string | RegExp)[];
|
|
2140
|
-
|
|
2141
2147
|
interface UserWorkspaceConfig extends UserConfig$1 {
|
|
2142
2148
|
test?: ProjectConfig;
|
|
2143
2149
|
}
|
|
@@ -2153,9 +2159,9 @@ declare function defineConfig(config: Promise<UserConfig$1>): Promise<UserConfig
|
|
|
2153
2159
|
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
2154
2160
|
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
2155
2161
|
declare function defineProject<T extends UserProjectConfigExport>(config: T): T;
|
|
2156
|
-
type Workspace =
|
|
2162
|
+
type Workspace = string | (UserProjectConfigExport & {
|
|
2157
2163
|
extends?: string;
|
|
2158
|
-
})
|
|
2164
|
+
});
|
|
2159
2165
|
declare function defineWorkspace(config: Workspace[]): Workspace[];
|
|
2160
2166
|
|
|
2161
2167
|
type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
|
|
@@ -2423,7 +2429,7 @@ interface InlineConfig {
|
|
|
2423
2429
|
*
|
|
2424
2430
|
* Supports 'threads', 'forks', 'vmThreads'
|
|
2425
2431
|
*
|
|
2426
|
-
* @default '
|
|
2432
|
+
* @default 'forks'
|
|
2427
2433
|
*/
|
|
2428
2434
|
pool?: Exclude<Pool, 'browser'>;
|
|
2429
2435
|
/**
|
|
@@ -2431,13 +2437,13 @@ interface InlineConfig {
|
|
|
2431
2437
|
*/
|
|
2432
2438
|
poolOptions?: PoolOptions;
|
|
2433
2439
|
/**
|
|
2434
|
-
* Maximum number of workers to run tests in. `poolOptions.{threads,vmThreads}.maxThreads`/`poolOptions.forks.maxForks` has higher priority.
|
|
2440
|
+
* Maximum number or percentage of workers to run tests in. `poolOptions.{threads,vmThreads}.maxThreads`/`poolOptions.forks.maxForks` has higher priority.
|
|
2435
2441
|
*/
|
|
2436
|
-
maxWorkers?: number;
|
|
2442
|
+
maxWorkers?: number | string;
|
|
2437
2443
|
/**
|
|
2438
|
-
* Minimum number of workers to run tests in. `poolOptions.{threads,vmThreads}.minThreads`/`poolOptions.forks.minForks` has higher priority.
|
|
2444
|
+
* Minimum number or percentage of workers to run tests in. `poolOptions.{threads,vmThreads}.minThreads`/`poolOptions.forks.minForks` has higher priority.
|
|
2439
2445
|
*/
|
|
2440
|
-
minWorkers?: number;
|
|
2446
|
+
minWorkers?: number | string;
|
|
2441
2447
|
/**
|
|
2442
2448
|
* Should all test files run in parallel. Doesn't affect tests running in the same file.
|
|
2443
2449
|
* Setting this to `false` will override `maxWorkers` and `minWorkers` options to `1`.
|
|
@@ -2626,7 +2632,7 @@ interface InlineConfig {
|
|
|
2626
2632
|
*/
|
|
2627
2633
|
resolveSnapshotPath?: (path: string, extension: string) => string;
|
|
2628
2634
|
/**
|
|
2629
|
-
* Path to a custom snapshot environment module that has a
|
|
2635
|
+
* Path to a custom snapshot environment module that has a default export of `SnapshotEnvironment` object.
|
|
2630
2636
|
*/
|
|
2631
2637
|
snapshotEnvironment?: string;
|
|
2632
2638
|
/**
|
|
@@ -2934,9 +2940,10 @@ interface UserConfig extends InlineConfig {
|
|
|
2934
2940
|
*/
|
|
2935
2941
|
mergeReports?: string;
|
|
2936
2942
|
}
|
|
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'> {
|
|
2943
|
+
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
2944
|
mode: VitestRunMode;
|
|
2939
2945
|
base?: string;
|
|
2946
|
+
diff?: string;
|
|
2940
2947
|
config?: string;
|
|
2941
2948
|
filters?: string[];
|
|
2942
2949
|
testNamePattern?: RegExp;
|
|
@@ -2945,7 +2952,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2945
2952
|
snapshotOptions: SnapshotStateOptions;
|
|
2946
2953
|
browser: ResolvedBrowserOptions;
|
|
2947
2954
|
pool: Pool;
|
|
2948
|
-
poolOptions?:
|
|
2955
|
+
poolOptions?: ResolvedPoolOptions;
|
|
2949
2956
|
reporters: (InlineReporter | ReporterWithOptions)[];
|
|
2950
2957
|
defines: Record<string, any>;
|
|
2951
2958
|
api?: ApiConfig;
|
|
@@ -2973,8 +2980,10 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2973
2980
|
enabled: boolean;
|
|
2974
2981
|
};
|
|
2975
2982
|
runner?: string;
|
|
2983
|
+
maxWorkers: number;
|
|
2984
|
+
minWorkers: number;
|
|
2976
2985
|
}
|
|
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'> & {
|
|
2986
|
+
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
2987
|
sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
|
|
2979
2988
|
deps?: Omit<DepsOptions, 'moduleDirectories'>;
|
|
2980
2989
|
poolOptions?: {
|
|
@@ -3057,6 +3066,7 @@ declare module '@vitest/runner' {
|
|
|
3057
3066
|
interface TaskMeta {
|
|
3058
3067
|
typecheck?: boolean;
|
|
3059
3068
|
benchmark?: boolean;
|
|
3069
|
+
failScreenshotPath?: string;
|
|
3060
3070
|
}
|
|
3061
3071
|
interface File {
|
|
3062
3072
|
prepareDuration?: number;
|
|
@@ -3096,4 +3106,4 @@ type Context = RootAndTarget & {
|
|
|
3096
3106
|
lastActivePath?: string;
|
|
3097
3107
|
};
|
|
3098
3108
|
|
|
3099
|
-
export { type
|
|
3109
|
+
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 };
|