vitest 2.0.0-beta.2 → 2.0.0-beta.5
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 +5 -1
- package/dist/browser.js +18 -2
- package/dist/chunks/{integrations-globals.B5Jl0grA.js → integrations-globals.BK0Cn4q1.js} +3 -4
- package/dist/chunks/{runtime-console.CUES-L8X.js → runtime-console.DiVMr5d4.js} +54 -24
- package/dist/chunks/{runtime-runBaseTests._dXkRAZc.js → runtime-runBaseTests.C-Bkopka.js} +5 -6
- package/dist/cli.js +2 -2
- package/dist/config.cjs +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/config.js +2 -2
- package/dist/coverage.d.ts +1 -1
- package/dist/environments.d.ts +1 -1
- package/dist/execute.d.ts +2 -2
- package/dist/execute.js +1 -1
- package/dist/index-C7JhjWOq.d.ts +1565 -0
- package/dist/index.d.ts +6 -1445
- package/dist/index.js +3 -4
- package/dist/node.d.ts +3 -6
- package/dist/node.js +7 -7
- package/dist/{reporters-DFgqsvtL.d.ts → reporters-qky6mwBH.d.ts} +398 -195
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +4 -4
- package/dist/runners.d.ts +4 -2
- package/dist/runners.js +9 -1
- package/dist/{suite-C_sqQjdz.d.ts → suite-B5_jYIf8.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/vendor/{base.VFkIJ66g.js → base.D4XK-wRp.js} +2 -2
- package/dist/vendor/{cac.CtP0aXu-.js → cac.sXjWMctD.js} +58 -20
- package/dist/vendor/{cli-api.B2QW76dQ.js → cli-api.BH9TJcYU.js} +487 -357
- package/dist/vendor/{constants.5SOfHUj0.js → constants.TCjCaw2D.js} +4 -3
- package/dist/vendor/{execute.CLLNVNnK.js → execute.BHj6OMh4.js} +3 -3
- package/dist/vendor/{index.CRxYS9H3.js → index.CyGfDRbW.js} +266 -49
- package/dist/vendor/{index.BfoZyXD1.js → index.DHRpy7zp.js} +1 -1
- package/dist/vendor/{index.CmILuxzC.js → index.DwR86H5i.js} +26 -3
- package/dist/vendor/{setup-common.XeoZAW8t.js → setup-common.BhJvzjns.js} +2 -2
- package/dist/vendor/{utils.D5gGkwyH.js → utils.YuQ3LT2a.js} +1 -1
- package/dist/vendor/{vi.ClD3hi7L.js → vi.C6AfDXK6.js} +97 -46
- package/dist/vendor/{vm.Bi3bljci.js → vm.Ow-X2mkS.js} +2 -2
- package/dist/workers/forks.js +2 -2
- package/dist/workers/runVmTests.js +4 -5
- package/dist/workers/threads.js +2 -2
- package/dist/workers/vmForks.js +3 -3
- package/dist/workers/vmThreads.js +3 -3
- package/dist/workers.d.ts +1 -1
- package/dist/workers.js +4 -4
- package/package.json +10 -10
- package/dist/vendor/run-once.DLomgGUH.js +0 -27
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
|
-
import {
|
|
2
|
+
import { TransformResult as TransformResult$1, ViteDevServer, 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 {
|
|
7
|
-
import { ExpectStatic } from '@vitest/expect';
|
|
4
|
+
import { File, Test as Test$1, Suite, TaskResultPack, CancelReason, Task, Custom, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
5
|
+
import { RawSourceMap, ViteNodeResolveId, FetchResult, ModuleCacheMap, ViteNodeServerOptions } from 'vite-node';
|
|
6
|
+
import { SnapshotResult, SnapshotSummary, SnapshotStateOptions, SnapshotState } from '@vitest/snapshot';
|
|
7
|
+
import { PromisifyAssertion, Tester, ExpectStatic } from '@vitest/expect';
|
|
8
8
|
import { ChainableFunction } from '@vitest/runner/utils';
|
|
9
9
|
import { ParsedStack, Awaitable as Awaitable$1, Arrayable as Arrayable$1 } from '@vitest/utils';
|
|
10
10
|
import { TaskResult, Bench, Options as Options$1 } from 'tinybench';
|
|
@@ -694,14 +694,6 @@ interface BrowserConfigOptions {
|
|
|
694
694
|
* The default port is 63315.
|
|
695
695
|
*/
|
|
696
696
|
api?: ApiConfig | number;
|
|
697
|
-
/**
|
|
698
|
-
* Update ESM imports so they can be spied/stubbed with vi.spyOn.
|
|
699
|
-
* Enabled by default when running in browser.
|
|
700
|
-
*
|
|
701
|
-
* @default false
|
|
702
|
-
* @experimental
|
|
703
|
-
*/
|
|
704
|
-
slowHijackESM?: boolean;
|
|
705
697
|
/**
|
|
706
698
|
* Isolate test environment after each test
|
|
707
699
|
*
|
|
@@ -709,11 +701,26 @@ interface BrowserConfigOptions {
|
|
|
709
701
|
*/
|
|
710
702
|
isolate?: boolean;
|
|
711
703
|
/**
|
|
712
|
-
*
|
|
704
|
+
* Show Vitest UI
|
|
713
705
|
*
|
|
714
|
-
* @default
|
|
706
|
+
* @default !process.env.CI
|
|
715
707
|
*/
|
|
716
|
-
|
|
708
|
+
ui?: boolean;
|
|
709
|
+
/**
|
|
710
|
+
* Default viewport size
|
|
711
|
+
*/
|
|
712
|
+
viewport?: {
|
|
713
|
+
/**
|
|
714
|
+
* Width of the viewport
|
|
715
|
+
* @default 414
|
|
716
|
+
*/
|
|
717
|
+
width: number;
|
|
718
|
+
/**
|
|
719
|
+
* Height of the viewport
|
|
720
|
+
* @default 896
|
|
721
|
+
*/
|
|
722
|
+
height: number;
|
|
723
|
+
};
|
|
717
724
|
/**
|
|
718
725
|
* Scripts injected into the tester iframe.
|
|
719
726
|
*/
|
|
@@ -722,6 +729,20 @@ interface BrowserConfigOptions {
|
|
|
722
729
|
* Scripts injected into the main window.
|
|
723
730
|
*/
|
|
724
731
|
indexScripts?: BrowserScript[];
|
|
732
|
+
/**
|
|
733
|
+
* Commands that will be executed on the server
|
|
734
|
+
* via the browser `import("@vitest/browser/context").commands` API.
|
|
735
|
+
* @see {@link https://vitest.dev/guide/browser#commands}
|
|
736
|
+
*/
|
|
737
|
+
commands?: Record<string, BrowserCommand<any>>;
|
|
738
|
+
}
|
|
739
|
+
interface BrowserCommandContext {
|
|
740
|
+
testPath: string | undefined;
|
|
741
|
+
provider: BrowserProvider;
|
|
742
|
+
project: WorkspaceProject;
|
|
743
|
+
}
|
|
744
|
+
interface BrowserCommand<Payload extends unknown[]> {
|
|
745
|
+
(context: BrowserCommandContext, ...payload: Payload): Awaitable$1<any>;
|
|
725
746
|
}
|
|
726
747
|
interface BrowserScript {
|
|
727
748
|
/**
|
|
@@ -756,7 +777,162 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
|
756
777
|
headless: boolean;
|
|
757
778
|
isolate: boolean;
|
|
758
779
|
api: ApiConfig;
|
|
780
|
+
ui: boolean;
|
|
781
|
+
viewport: {
|
|
782
|
+
width: number;
|
|
783
|
+
height: number;
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
|
|
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: (id: string) => 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>;
|
|
759
933
|
}
|
|
934
|
+
type WebSocketRPC = BirpcReturn<WebSocketEvents, WebSocketHandlers>;
|
|
935
|
+
type WebSocketBrowserRPC = BirpcReturn<WebSocketBrowserEvents, WebSocketBrowserHandlers>;
|
|
760
936
|
|
|
761
937
|
interface InitializeProjectOptions extends UserWorkspaceConfig {
|
|
762
938
|
workspaceConfigPath: string;
|
|
@@ -775,6 +951,11 @@ declare class WorkspaceProject {
|
|
|
775
951
|
typechecker?: Typechecker;
|
|
776
952
|
closingPromise: Promise<unknown> | undefined;
|
|
777
953
|
browserProvider: BrowserProvider | undefined;
|
|
954
|
+
browserMocker: VitestBrowserServerMocker;
|
|
955
|
+
browserRpc: {
|
|
956
|
+
orchestrators: Map<string, WebSocketBrowserRPC>;
|
|
957
|
+
testers: Map<string, WebSocketBrowserRPC>;
|
|
958
|
+
};
|
|
778
959
|
browserState: {
|
|
779
960
|
files: string[];
|
|
780
961
|
resolve: () => void;
|
|
@@ -827,7 +1008,7 @@ interface ProcessPool {
|
|
|
827
1008
|
type Awaitable<T> = T | PromiseLike<T>;
|
|
828
1009
|
type Nullable<T> = T | null | undefined;
|
|
829
1010
|
type Arrayable<T> = T | Array<T>;
|
|
830
|
-
type ArgumentsType
|
|
1011
|
+
type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
831
1012
|
type MutableArray<T extends readonly any[]> = {
|
|
832
1013
|
-readonly [k in keyof T]: T[k];
|
|
833
1014
|
};
|
|
@@ -856,6 +1037,8 @@ interface Environment {
|
|
|
856
1037
|
}
|
|
857
1038
|
interface UserConsoleLog {
|
|
858
1039
|
content: string;
|
|
1040
|
+
origin?: string;
|
|
1041
|
+
browser?: boolean;
|
|
859
1042
|
type: 'stdout' | 'stderr';
|
|
860
1043
|
taskId?: string;
|
|
861
1044
|
time: number;
|
|
@@ -890,7 +1073,8 @@ declare class StateManager {
|
|
|
890
1073
|
collectFiles(files?: File[]): void;
|
|
891
1074
|
clearFiles(_project: {
|
|
892
1075
|
config: {
|
|
893
|
-
name: string;
|
|
1076
|
+
name: string | undefined;
|
|
1077
|
+
root: string;
|
|
894
1078
|
};
|
|
895
1079
|
}, paths?: string[]): void;
|
|
896
1080
|
updateId(task: Task): void;
|
|
@@ -989,10 +1173,12 @@ declare class Vitest {
|
|
|
989
1173
|
private createCoreProject;
|
|
990
1174
|
getCoreWorkspaceProject(): WorkspaceProject;
|
|
991
1175
|
getProjectByTaskId(taskId: string): WorkspaceProject;
|
|
1176
|
+
getProjectByName(name?: string): WorkspaceProject;
|
|
992
1177
|
private getWorkspaceConfigPath;
|
|
993
1178
|
private resolveWorkspace;
|
|
994
1179
|
private initCoverageProvider;
|
|
995
1180
|
private initBrowserProviders;
|
|
1181
|
+
mergeReports(): Promise<void>;
|
|
996
1182
|
start(filters?: string[]): Promise<void>;
|
|
997
1183
|
init(): Promise<void>;
|
|
998
1184
|
private getTestDependencies;
|
|
@@ -1000,7 +1186,7 @@ declare class Vitest {
|
|
|
1000
1186
|
getProjectsByTestFile(file: string): WorkspaceSpec[];
|
|
1001
1187
|
initializeGlobalSetup(paths: WorkspaceSpec[]): Promise<void>;
|
|
1002
1188
|
private initializeDistPath;
|
|
1003
|
-
runFiles(
|
|
1189
|
+
runFiles(specs: WorkspaceSpec[], allTestsRun: boolean): Promise<void>;
|
|
1004
1190
|
cancelCurrentRun(reason: CancelReason): Promise<void>;
|
|
1005
1191
|
rerunFiles(files?: string[], trigger?: string): Promise<void>;
|
|
1006
1192
|
changeProjectName(pattern: string): Promise<void>;
|
|
@@ -1027,7 +1213,7 @@ declare class Vitest {
|
|
|
1027
1213
|
* Close the thread pool and exit the process
|
|
1028
1214
|
*/
|
|
1029
1215
|
exit(force?: boolean): Promise<void>;
|
|
1030
|
-
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType
|
|
1216
|
+
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
|
|
1031
1217
|
getTestFilepaths(): Promise<string[]>;
|
|
1032
1218
|
globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
|
|
1033
1219
|
shouldKeepServer(): boolean;
|
|
@@ -1049,91 +1235,6 @@ interface TestSequencerConstructor {
|
|
|
1049
1235
|
new (ctx: Vitest): TestSequencer;
|
|
1050
1236
|
}
|
|
1051
1237
|
|
|
1052
|
-
declare abstract class BaseReporter implements Reporter {
|
|
1053
|
-
start: number;
|
|
1054
|
-
end: number;
|
|
1055
|
-
watchFilters?: string[];
|
|
1056
|
-
isTTY: boolean;
|
|
1057
|
-
ctx: Vitest;
|
|
1058
|
-
private _filesInWatchMode;
|
|
1059
|
-
private _lastRunTimeout;
|
|
1060
|
-
private _lastRunTimer;
|
|
1061
|
-
private _lastRunCount;
|
|
1062
|
-
private _timeStart;
|
|
1063
|
-
private _offUnhandledRejection?;
|
|
1064
|
-
constructor();
|
|
1065
|
-
get mode(): VitestRunMode;
|
|
1066
|
-
onInit(ctx: Vitest): void;
|
|
1067
|
-
relative(path: string): string;
|
|
1068
|
-
onFinished(files?: File[], errors?: unknown[]): void;
|
|
1069
|
-
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1070
|
-
onWatcherStart(files?: File[], errors?: unknown[]): void;
|
|
1071
|
-
private resetLastRunLog;
|
|
1072
|
-
onWatcherRerun(files: string[], trigger?: string): void;
|
|
1073
|
-
onUserConsoleLog(log: UserConsoleLog): void;
|
|
1074
|
-
shouldLog(log: UserConsoleLog): boolean;
|
|
1075
|
-
onServerRestart(reason?: string): void;
|
|
1076
|
-
reportSummary(files: File[], errors: unknown[]): void;
|
|
1077
|
-
reportTestSummary(files: File[], errors: unknown[]): void;
|
|
1078
|
-
private printErrorsSummary;
|
|
1079
|
-
reportBenchmarkSummary(files: File[]): void;
|
|
1080
|
-
private printTaskErrors;
|
|
1081
|
-
registerUnhandledRejection(): void;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
declare class BasicReporter extends BaseReporter {
|
|
1085
|
-
isTTY: boolean;
|
|
1086
|
-
reportSummary(files: File[], errors: unknown[]): void;
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
interface ListRendererOptions {
|
|
1090
|
-
renderSucceed?: boolean;
|
|
1091
|
-
logger: Logger;
|
|
1092
|
-
showHeap: boolean;
|
|
1093
|
-
slowTestThreshold: number;
|
|
1094
|
-
mode: VitestRunMode;
|
|
1095
|
-
}
|
|
1096
|
-
declare function createListRenderer(_tasks: Task[], options: ListRendererOptions): {
|
|
1097
|
-
start(): any;
|
|
1098
|
-
update(_tasks: Task[]): any;
|
|
1099
|
-
stop(): any;
|
|
1100
|
-
clear(): void;
|
|
1101
|
-
};
|
|
1102
|
-
|
|
1103
|
-
declare class DefaultReporter extends BaseReporter {
|
|
1104
|
-
renderer?: ReturnType<typeof createListRenderer>;
|
|
1105
|
-
rendererOptions: ListRendererOptions;
|
|
1106
|
-
private renderSucceedDefault?;
|
|
1107
|
-
onPathsCollected(paths?: string[]): void;
|
|
1108
|
-
onTestRemoved(trigger?: string): Promise<void>;
|
|
1109
|
-
onCollected(): void;
|
|
1110
|
-
onFinished(files?: _vitest_runner.File[], errors?: unknown[]): void;
|
|
1111
|
-
onWatcherStart(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
|
|
1112
|
-
stopListRender(): void;
|
|
1113
|
-
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
1114
|
-
onUserConsoleLog(log: UserConsoleLog): void;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
interface DotRendererOptions {
|
|
1118
|
-
logger: Logger;
|
|
1119
|
-
}
|
|
1120
|
-
declare function createDotRenderer(_tasks: Task[], options: DotRendererOptions): {
|
|
1121
|
-
start(): any;
|
|
1122
|
-
update(_tasks: Task[]): any;
|
|
1123
|
-
stop(): Promise<any>;
|
|
1124
|
-
clear(): void;
|
|
1125
|
-
};
|
|
1126
|
-
|
|
1127
|
-
declare class DotReporter extends BaseReporter {
|
|
1128
|
-
renderer?: ReturnType<typeof createDotRenderer>;
|
|
1129
|
-
onCollected(): void;
|
|
1130
|
-
onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
|
|
1131
|
-
onWatcherStart(): Promise<void>;
|
|
1132
|
-
stopListRender(): Promise<void>;
|
|
1133
|
-
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
1134
|
-
onUserConsoleLog(log: UserConsoleLog): void;
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
1238
|
type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';
|
|
1138
1239
|
type Milliseconds = number;
|
|
1139
1240
|
interface Callsite {
|
|
@@ -1191,16 +1292,12 @@ declare class JsonReporter implements Reporter {
|
|
|
1191
1292
|
writeReport(report: string): Promise<void>;
|
|
1192
1293
|
}
|
|
1193
1294
|
|
|
1194
|
-
declare class VerboseReporter extends DefaultReporter {
|
|
1195
|
-
constructor();
|
|
1196
|
-
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
1295
|
interface Reporter {
|
|
1200
1296
|
onInit?: (ctx: Vitest) => void;
|
|
1201
1297
|
onPathsCollected?: (paths?: string[]) => Awaitable<void>;
|
|
1298
|
+
onSpecsCollected?: (specs?: SerializableSpec[]) => Awaitable<void>;
|
|
1202
1299
|
onCollected?: (files?: File[]) => Awaitable<void>;
|
|
1203
|
-
onFinished?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
1300
|
+
onFinished?: (files?: File[], errors?: unknown[], coverage?: unknown) => Awaitable<void>;
|
|
1204
1301
|
onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
|
|
1205
1302
|
onTestRemoved?: (trigger?: string) => Awaitable<void>;
|
|
1206
1303
|
onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
@@ -1210,15 +1307,10 @@ interface Reporter {
|
|
|
1210
1307
|
onProcessTimeout?: () => Awaitable<void>;
|
|
1211
1308
|
}
|
|
1212
1309
|
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
static getComment(task: Task): string;
|
|
1218
|
-
private logErrorDetails;
|
|
1219
|
-
protected logTasks(tasks: Task[]): void;
|
|
1220
|
-
onFinished(files?: _vitest_runner.File[]): void;
|
|
1221
|
-
}
|
|
1310
|
+
type SerializableSpec = [project: {
|
|
1311
|
+
name: string | undefined;
|
|
1312
|
+
root: string;
|
|
1313
|
+
}, file: string];
|
|
1222
1314
|
|
|
1223
1315
|
interface JUnitOptions {
|
|
1224
1316
|
outputFile?: string;
|
|
@@ -1251,6 +1343,113 @@ declare class JUnitReporter implements Reporter {
|
|
|
1251
1343
|
onFinished(files?: _vitest_runner.File[]): Promise<void>;
|
|
1252
1344
|
}
|
|
1253
1345
|
|
|
1346
|
+
interface HTMLOptions {
|
|
1347
|
+
outputFile?: string;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
interface BaseOptions {
|
|
1351
|
+
isTTY?: boolean;
|
|
1352
|
+
}
|
|
1353
|
+
declare abstract class BaseReporter implements Reporter {
|
|
1354
|
+
start: number;
|
|
1355
|
+
end: number;
|
|
1356
|
+
watchFilters?: string[];
|
|
1357
|
+
isTTY: boolean;
|
|
1358
|
+
ctx: Vitest;
|
|
1359
|
+
private _filesInWatchMode;
|
|
1360
|
+
private _lastRunTimeout;
|
|
1361
|
+
private _lastRunTimer;
|
|
1362
|
+
private _lastRunCount;
|
|
1363
|
+
private _timeStart;
|
|
1364
|
+
private _offUnhandledRejection?;
|
|
1365
|
+
constructor(options?: BaseOptions);
|
|
1366
|
+
get mode(): VitestRunMode;
|
|
1367
|
+
onInit(ctx: Vitest): void;
|
|
1368
|
+
relative(path: string): string;
|
|
1369
|
+
onFinished(files?: File[], errors?: unknown[]): void;
|
|
1370
|
+
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1371
|
+
onWatcherStart(files?: File[], errors?: unknown[]): void;
|
|
1372
|
+
private resetLastRunLog;
|
|
1373
|
+
onWatcherRerun(files: string[], trigger?: string): void;
|
|
1374
|
+
onUserConsoleLog(log: UserConsoleLog): void;
|
|
1375
|
+
shouldLog(log: UserConsoleLog): boolean;
|
|
1376
|
+
onServerRestart(reason?: string): void;
|
|
1377
|
+
reportSummary(files: File[], errors: unknown[]): void;
|
|
1378
|
+
reportTestSummary(files: File[], errors: unknown[]): void;
|
|
1379
|
+
private printErrorsSummary;
|
|
1380
|
+
reportBenchmarkSummary(files: File[]): void;
|
|
1381
|
+
private printTaskErrors;
|
|
1382
|
+
registerUnhandledRejection(): void;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
declare class BasicReporter extends BaseReporter {
|
|
1386
|
+
isTTY: boolean;
|
|
1387
|
+
reportSummary(files: File[], errors: unknown[]): void;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
interface ListRendererOptions {
|
|
1391
|
+
renderSucceed?: boolean;
|
|
1392
|
+
logger: Logger;
|
|
1393
|
+
showHeap: boolean;
|
|
1394
|
+
slowTestThreshold: number;
|
|
1395
|
+
mode: VitestRunMode;
|
|
1396
|
+
}
|
|
1397
|
+
declare function createListRenderer(_tasks: Task[], options: ListRendererOptions): {
|
|
1398
|
+
start(): any;
|
|
1399
|
+
update(_tasks: Task[]): any;
|
|
1400
|
+
stop(): any;
|
|
1401
|
+
clear(): void;
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1404
|
+
declare class DefaultReporter extends BaseReporter {
|
|
1405
|
+
renderer?: ReturnType<typeof createListRenderer>;
|
|
1406
|
+
rendererOptions: ListRendererOptions;
|
|
1407
|
+
private renderSucceedDefault?;
|
|
1408
|
+
onPathsCollected(paths?: string[]): void;
|
|
1409
|
+
onTestRemoved(trigger?: string): Promise<void>;
|
|
1410
|
+
onCollected(): void;
|
|
1411
|
+
onFinished(files?: _vitest_runner.File[], errors?: unknown[]): void;
|
|
1412
|
+
onWatcherStart(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
|
|
1413
|
+
stopListRender(): void;
|
|
1414
|
+
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
1415
|
+
onUserConsoleLog(log: UserConsoleLog): void;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
interface DotRendererOptions {
|
|
1419
|
+
logger: Logger;
|
|
1420
|
+
}
|
|
1421
|
+
declare function createDotRenderer(_tasks: Task[], options: DotRendererOptions): {
|
|
1422
|
+
start(): any;
|
|
1423
|
+
update(_tasks: Task[]): any;
|
|
1424
|
+
stop(): Promise<any>;
|
|
1425
|
+
clear(): void;
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1428
|
+
declare class DotReporter extends BaseReporter {
|
|
1429
|
+
renderer?: ReturnType<typeof createDotRenderer>;
|
|
1430
|
+
onCollected(): void;
|
|
1431
|
+
onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
|
|
1432
|
+
onWatcherStart(): Promise<void>;
|
|
1433
|
+
stopListRender(): Promise<void>;
|
|
1434
|
+
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
1435
|
+
onUserConsoleLog(log: UserConsoleLog): void;
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
declare class VerboseReporter extends DefaultReporter {
|
|
1439
|
+
constructor();
|
|
1440
|
+
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
declare class TapReporter implements Reporter {
|
|
1444
|
+
protected ctx: Vitest;
|
|
1445
|
+
private logger;
|
|
1446
|
+
onInit(ctx: Vitest): void;
|
|
1447
|
+
static getComment(task: Task): string;
|
|
1448
|
+
private logErrorDetails;
|
|
1449
|
+
protected logTasks(tasks: Task[]): void;
|
|
1450
|
+
onFinished(files?: _vitest_runner.File[]): void;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1254
1453
|
declare class TapFlatReporter extends TapReporter {
|
|
1255
1454
|
onInit(ctx: Vitest): void;
|
|
1256
1455
|
onFinished(files?: _vitest_runner.File[]): void;
|
|
@@ -1268,6 +1467,17 @@ declare class GithubActionsReporter implements Reporter {
|
|
|
1268
1467
|
onFinished(files?: File[], errors?: unknown[]): void;
|
|
1269
1468
|
}
|
|
1270
1469
|
|
|
1470
|
+
interface BlobOptions {
|
|
1471
|
+
outputFile?: string;
|
|
1472
|
+
}
|
|
1473
|
+
declare class BlobReporter implements Reporter {
|
|
1474
|
+
ctx: Vitest;
|
|
1475
|
+
options: BlobOptions;
|
|
1476
|
+
constructor(options: BlobOptions);
|
|
1477
|
+
onInit(ctx: Vitest): void;
|
|
1478
|
+
onFinished(files: File[] | undefined, errors: unknown[] | undefined, coverage: unknown): Promise<void>;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1271
1481
|
interface TableRendererOptions {
|
|
1272
1482
|
renderSucceed?: boolean;
|
|
1273
1483
|
logger: Logger;
|
|
@@ -1300,6 +1510,7 @@ interface FlatBenchmarkReport {
|
|
|
1300
1510
|
type FormattedBenchmarkResult = Omit<BenchmarkResult, 'samples'> & {
|
|
1301
1511
|
id: string;
|
|
1302
1512
|
sampleCount: number;
|
|
1513
|
+
median: number;
|
|
1303
1514
|
};
|
|
1304
1515
|
|
|
1305
1516
|
declare const BenchmarkReportsMap: {
|
|
@@ -1311,6 +1522,7 @@ type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
|
|
|
1311
1522
|
declare const ReportersMap: {
|
|
1312
1523
|
default: typeof DefaultReporter;
|
|
1313
1524
|
basic: typeof BasicReporter;
|
|
1525
|
+
blob: typeof BlobReporter;
|
|
1314
1526
|
verbose: typeof VerboseReporter;
|
|
1315
1527
|
dot: typeof DotReporter;
|
|
1316
1528
|
json: typeof JsonReporter;
|
|
@@ -1322,18 +1534,17 @@ declare const ReportersMap: {
|
|
|
1322
1534
|
};
|
|
1323
1535
|
type BuiltinReporters = keyof typeof ReportersMap;
|
|
1324
1536
|
interface BuiltinReporterOptions {
|
|
1325
|
-
'default':
|
|
1326
|
-
'basic':
|
|
1537
|
+
'default': BaseOptions;
|
|
1538
|
+
'basic': BaseOptions;
|
|
1327
1539
|
'verbose': never;
|
|
1328
|
-
'dot':
|
|
1540
|
+
'dot': BaseOptions;
|
|
1329
1541
|
'json': JsonOptions$1;
|
|
1542
|
+
'blob': BlobOptions;
|
|
1330
1543
|
'tap': never;
|
|
1331
1544
|
'tap-flat': never;
|
|
1332
1545
|
'junit': JUnitOptions;
|
|
1333
1546
|
'hanging-process': never;
|
|
1334
|
-
'html':
|
|
1335
|
-
outputFile?: string;
|
|
1336
|
-
};
|
|
1547
|
+
'html': HTMLOptions;
|
|
1337
1548
|
}
|
|
1338
1549
|
|
|
1339
1550
|
type ChaiConfig = Omit<Partial<typeof chai.config>, 'useProxy' | 'proxyExcludedKeys'>;
|
|
@@ -1413,71 +1624,6 @@ interface LinkMapper {
|
|
|
1413
1624
|
assetPath(node: Node, name: string): string;
|
|
1414
1625
|
}
|
|
1415
1626
|
|
|
1416
|
-
type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
1417
|
-
type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
|
|
1418
|
-
type PromisifyFn<T> = ReturnType$1<T> extends Promise<any> ? T : (...args: ArgumentsType<T>) => Promise<Awaited<ReturnType$1<T>>>;
|
|
1419
|
-
type BirpcResolver = (name: string, resolved: (...args: unknown[]) => unknown) => ((...args: unknown[]) => unknown) | undefined;
|
|
1420
|
-
interface ChannelOptions {
|
|
1421
|
-
/**
|
|
1422
|
-
* Function to post raw message
|
|
1423
|
-
*/
|
|
1424
|
-
post: (data: any, ...extras: any[]) => any | Promise<any>;
|
|
1425
|
-
/**
|
|
1426
|
-
* Listener to receive raw message
|
|
1427
|
-
*/
|
|
1428
|
-
on: (fn: (data: any, ...extras: any[]) => void) => any | Promise<any>;
|
|
1429
|
-
/**
|
|
1430
|
-
* Custom function to serialize data
|
|
1431
|
-
*
|
|
1432
|
-
* by default it passes the data as-is
|
|
1433
|
-
*/
|
|
1434
|
-
serialize?: (data: any) => any;
|
|
1435
|
-
/**
|
|
1436
|
-
* Custom function to deserialize data
|
|
1437
|
-
*
|
|
1438
|
-
* by default it passes the data as-is
|
|
1439
|
-
*/
|
|
1440
|
-
deserialize?: (data: any) => any;
|
|
1441
|
-
}
|
|
1442
|
-
interface EventOptions<Remote> {
|
|
1443
|
-
/**
|
|
1444
|
-
* Names of remote functions that do not need response.
|
|
1445
|
-
*/
|
|
1446
|
-
eventNames?: (keyof Remote)[];
|
|
1447
|
-
/**
|
|
1448
|
-
* Maximum timeout for waiting for response, in milliseconds.
|
|
1449
|
-
*
|
|
1450
|
-
* @default 60_000
|
|
1451
|
-
*/
|
|
1452
|
-
timeout?: number;
|
|
1453
|
-
/**
|
|
1454
|
-
* Custom resolver to resolve function to be called
|
|
1455
|
-
*
|
|
1456
|
-
* For advanced use cases only
|
|
1457
|
-
*/
|
|
1458
|
-
resolver?: BirpcResolver;
|
|
1459
|
-
/**
|
|
1460
|
-
* Custom error handler
|
|
1461
|
-
*/
|
|
1462
|
-
onError?: (error: Error, functionName: string, args: any[]) => boolean | void;
|
|
1463
|
-
/**
|
|
1464
|
-
* Custom error handler for timeouts
|
|
1465
|
-
*/
|
|
1466
|
-
onTimeoutError?: (functionName: string, args: any[]) => boolean | void;
|
|
1467
|
-
}
|
|
1468
|
-
type BirpcOptions<Remote> = EventOptions<Remote> & ChannelOptions;
|
|
1469
|
-
type BirpcFn<T> = PromisifyFn<T> & {
|
|
1470
|
-
/**
|
|
1471
|
-
* Send event without asking for response
|
|
1472
|
-
*/
|
|
1473
|
-
asEvent: (...args: ArgumentsType<T>) => void;
|
|
1474
|
-
};
|
|
1475
|
-
type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
|
|
1476
|
-
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
|
|
1477
|
-
} & {
|
|
1478
|
-
$functions: LocalFunctions;
|
|
1479
|
-
};
|
|
1480
|
-
|
|
1481
1627
|
type MockFactoryWithHelper<M = unknown> = (importOriginal: <T extends M>() => Promise<T>) => any;
|
|
1482
1628
|
type MockFactory = () => any;
|
|
1483
1629
|
type MockMap = Map<string, Record<string, string | null | MockFactory>>;
|
|
@@ -1563,13 +1709,24 @@ interface WorkerGlobalState {
|
|
|
1563
1709
|
}
|
|
1564
1710
|
|
|
1565
1711
|
type TransformResult = string | Partial<TransformResult$1> | undefined | null | void;
|
|
1712
|
+
type CoverageResults = unknown;
|
|
1566
1713
|
interface CoverageProvider {
|
|
1567
1714
|
name: string;
|
|
1715
|
+
/** Called when provider is being initialized before tests run */
|
|
1568
1716
|
initialize: (ctx: Vitest) => Promise<void> | void;
|
|
1717
|
+
/** Called when setting coverage options for Vitest context (`ctx.config.coverage`) */
|
|
1569
1718
|
resolveOptions: () => ResolvedCoverageOptions;
|
|
1719
|
+
/** Callback to clean previous reports */
|
|
1570
1720
|
clean: (clean?: boolean) => void | Promise<void>;
|
|
1721
|
+
/** Called with coverage results after a single test file has been run */
|
|
1571
1722
|
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void | Promise<void>;
|
|
1572
|
-
|
|
1723
|
+
/** Callback to generate final coverage results */
|
|
1724
|
+
generateCoverage: (reportContext: ReportContext) => CoverageResults | Promise<CoverageResults>;
|
|
1725
|
+
/** Callback to convert coverage results to coverage reports. Called with results returned from `generateCoverage` */
|
|
1726
|
+
reportCoverage: (coverage: CoverageResults, reportContext: ReportContext) => void | Promise<void>;
|
|
1727
|
+
/** Callback for `--merge-reports` options. Called with multiple coverage results generated by `generateCoverage`. */
|
|
1728
|
+
mergeReports?: (coverages: CoverageResults[]) => void | Promise<void>;
|
|
1729
|
+
/** Callback called for instrumenting files with coverage counters. */
|
|
1573
1730
|
onFileTransform?: (sourceCode: string, id: string, pluginCtx: any) => TransformResult | Promise<TransformResult>;
|
|
1574
1731
|
}
|
|
1575
1732
|
interface ReportContext {
|
|
@@ -2487,7 +2644,7 @@ interface InlineConfig {
|
|
|
2487
2644
|
/**
|
|
2488
2645
|
* Custom environment variables assigned to `process.env` before running tests.
|
|
2489
2646
|
*/
|
|
2490
|
-
env?:
|
|
2647
|
+
env?: Partial<NodeJS.ProcessEnv>;
|
|
2491
2648
|
/**
|
|
2492
2649
|
* Options for @sinon/fake-timers
|
|
2493
2650
|
*/
|
|
@@ -2599,6 +2756,30 @@ interface InlineConfig {
|
|
|
2599
2756
|
*/
|
|
2600
2757
|
waitForDebugger?: boolean;
|
|
2601
2758
|
};
|
|
2759
|
+
/**
|
|
2760
|
+
* Configuration options for expect() matches.
|
|
2761
|
+
*/
|
|
2762
|
+
expect?: {
|
|
2763
|
+
/**
|
|
2764
|
+
* Throw an error if tests don't have any expect() assertions.
|
|
2765
|
+
*/
|
|
2766
|
+
requireAssertions?: boolean;
|
|
2767
|
+
/**
|
|
2768
|
+
* Default options for expect.poll()
|
|
2769
|
+
*/
|
|
2770
|
+
poll?: {
|
|
2771
|
+
/**
|
|
2772
|
+
* Timeout in milliseconds
|
|
2773
|
+
* @default 1000
|
|
2774
|
+
*/
|
|
2775
|
+
timeout?: number;
|
|
2776
|
+
/**
|
|
2777
|
+
* Polling interval in milliseconds
|
|
2778
|
+
* @default 50
|
|
2779
|
+
*/
|
|
2780
|
+
interval?: number;
|
|
2781
|
+
};
|
|
2782
|
+
};
|
|
2602
2783
|
/**
|
|
2603
2784
|
* Modify default Chai config. Vitest uses Chai for `expect` and `assert` matches.
|
|
2604
2785
|
* https://github.com/chaijs/chai/blob/4.x.x/lib/chai/config.js
|
|
@@ -2628,6 +2809,12 @@ interface InlineConfig {
|
|
|
2628
2809
|
* @default false
|
|
2629
2810
|
*/
|
|
2630
2811
|
disableConsoleIntercept?: boolean;
|
|
2812
|
+
/**
|
|
2813
|
+
* Always print console stack traces.
|
|
2814
|
+
*
|
|
2815
|
+
* @default false
|
|
2816
|
+
*/
|
|
2817
|
+
printConsoleTrace?: boolean;
|
|
2631
2818
|
/**
|
|
2632
2819
|
* Include "location" property inside the test definition
|
|
2633
2820
|
*
|
|
@@ -2739,6 +2926,11 @@ interface UserConfig extends InlineConfig {
|
|
|
2739
2926
|
* benchmark.outputJson option exposed at the top level for cli
|
|
2740
2927
|
*/
|
|
2741
2928
|
outputJson?: string;
|
|
2929
|
+
/**
|
|
2930
|
+
* Directory of blob reports to merge
|
|
2931
|
+
* @default '.vitest-reports'
|
|
2932
|
+
*/
|
|
2933
|
+
mergeReports?: string;
|
|
2742
2934
|
}
|
|
2743
2935
|
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool' | 'cliExclude'> {
|
|
2744
2936
|
mode: VitestRunMode;
|
|
@@ -2789,7 +2981,7 @@ type ProjectConfig = Omit<UserConfig, 'sequencer' | 'shard' | 'watch' | 'run' |
|
|
|
2789
2981
|
forks?: Pick<NonNullable<PoolOptions['forks']>, 'singleFork' | 'isolate'>;
|
|
2790
2982
|
};
|
|
2791
2983
|
};
|
|
2792
|
-
type RuntimeConfig = Pick<UserConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency'> & {
|
|
2984
|
+
type RuntimeConfig = Pick<UserConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency' | 'expect' | 'printConsoleTrace'> & {
|
|
2793
2985
|
sequence?: {
|
|
2794
2986
|
concurrent?: boolean;
|
|
2795
2987
|
hooks?: SequenceHooks;
|
|
@@ -2833,7 +3025,18 @@ declare module '@vitest/expect' {
|
|
|
2833
3025
|
environment: VitestEnvironment;
|
|
2834
3026
|
snapshotState: SnapshotState;
|
|
2835
3027
|
}
|
|
3028
|
+
interface ExpectPollOptions {
|
|
3029
|
+
interval?: number;
|
|
3030
|
+
timeout?: number;
|
|
3031
|
+
message?: string;
|
|
3032
|
+
}
|
|
2836
3033
|
interface ExpectStatic {
|
|
3034
|
+
unreachable: (message?: string) => never;
|
|
3035
|
+
soft: <T>(actual: T, message?: string) => Assertion<T>;
|
|
3036
|
+
poll: <T>(actual: () => T, options?: ExpectPollOptions) => PromisifyAssertion<Awaited<T>>;
|
|
3037
|
+
addEqualityTesters: (testers: Array<Tester>) => void;
|
|
3038
|
+
assertions: (expected: number) => void;
|
|
3039
|
+
hasAssertions: () => void;
|
|
2837
3040
|
addSnapshotSerializer: (plugin: Plugin_2) => void;
|
|
2838
3041
|
}
|
|
2839
3042
|
interface Assertion<T> {
|
|
@@ -2891,4 +3094,4 @@ type Context = RootAndTarget & {
|
|
|
2891
3094
|
lastActivePath?: string;
|
|
2892
3095
|
};
|
|
2893
3096
|
|
|
2894
|
-
export { type
|
|
3097
|
+
export { type CoverageReporter as $, type AfterSuiteRunMeta as A, type BaseCoverageOptions as B, type CoverageOptions as C, type Benchmark as D, type Environment as E, type FakeTimerInstallOpts as F, type BenchmarkAPI as G, type HTMLOptions as H, type BenchmarkResult as I, type JsonOptions$1 as J, type BenchmarkUserOptions as K, type BrowserConfigOptions as L, type MockFactoryWithHelper as M, type BuiltinEnvironment as N, type CSSModuleScopeStrategy as O, type ProvidedContext as P, type CollectLineNumbers as Q, type ResolvedConfig as R, type CollectLines as S, type TestSequencer as T, type UserConfig as U, type VitestRunMode as V, type WorkerGlobalState as W, type Constructable as X, type Context as Y, type ContextTestEnvironment as Z, type CoverageIstanbulOptions as _, type ResolvedCoverageOptions as a, TapFlatReporter as a$, type CoverageV8Options as a0, type CustomProviderOptions as a1, type DepsOptimizationOptions as a2, type EnvironmentOptions as a3, type EnvironmentReturn as a4, type HappyDOMOptions as a5, type InlineConfig as a6, type JSDOMOptions as a7, type ModuleCache as a8, type ModuleGraphData as a9, type WebSocketHandlers as aA, type WebSocketRPC as aB, type WorkerRPC as aC, type PendingSuiteMock as aD, type MockFactory as aE, type MockMap as aF, type UserConfigFnObject as aG, type UserConfigFnPromise as aH, type UserConfigFn as aI, type UserConfigExport as aJ, type UserProjectConfigFn as aK, type UserProjectConfigExport as aL, defineConfig as aM, defineProject as aN, defineWorkspace as aO, configDefaults as aP, defaultInclude as aQ, defaultExclude as aR, coverageConfigDefaults as aS, extraInlineDeps as aT, DefaultReporter as aU, BasicReporter as aV, DotReporter as aW, JsonReporter as aX, VerboseReporter as aY, TapReporter as aZ, JUnitReporter as a_, type MutableArray as aa, type Nullable as ab, type OnServerRestartHandler as ac, type Pool as ad, type PoolOptions as ae, type ProjectConfig as af, type RawErrsMap as ag, type ReportContext as ah, type Reporter as ai, type ResolveIdFunction as aj, type ResolvedTestEnvironment as ak, type RootAndTarget as al, type RunnerRPC as am, type SerializableSpec as an, type TransformModePatterns as ao, type TransformResultWithSource as ap, type TscErrorInfo as aq, type TypecheckConfig as ar, type UserConsoleLog as as, type UserWorkspaceConfig as at, type VitestEnvironment as au, type VmEnvironmentReturn as av, type WebSocketBrowserEvents as aw, type WebSocketBrowserHandlers as ax, type WebSocketBrowserRPC as ay, type WebSocketEvents as az, type CoverageProvider as b, HangingProcessReporter as b0, GithubActionsReporter as b1, BaseReporter as b2, ReportersMap as b3, type BuiltinReporters as b4, type BuiltinReporterOptions as b5, type JsonAssertionResult as b6, type JsonTestResult as b7, type JsonTestResults as b8, BenchmarkReportsMap as b9, type BenchmarkBuiltinReporters as ba, type CoverageProviderModule as c, type BirpcOptions as d, type RuntimeRPC as e, type ContextRPC as f, type WorkerContext as g, type VitestOptions as h, Vitest as i, WorkspaceProject as j, type WorkspaceSpec as k, type ProcessPool as l, VitestPackageInstaller as m, type TestSequencerConstructor as n, type BrowserProviderInitializationOptions as o, type BrowserProvider as p, type BrowserProviderOptions as q, type BrowserScript as r, type BrowserCommand as s, type JUnitOptions as t, type RuntimeConfig as u, type ApiConfig as v, type ArgumentsType as w, type Arrayable as x, type Awaitable as y, type BenchFunction as z };
|