vitest 2.0.0-beta.10 → 2.0.0-beta.12

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.
Files changed (70) hide show
  1. package/dist/browser.d.ts +1 -1
  2. package/dist/browser.js +3 -3
  3. package/dist/chunks/browser-creator.Bw94IHrL.js +673 -0
  4. package/dist/chunks/{environments-node.39w4gmlF.js → environments-node.XE5FbRPQ.js} +1 -1
  5. package/dist/chunks/{integrations-globals.C6Ah-pUW.js → integrations-globals.DSNOaUHv.js} +10 -10
  6. package/dist/chunks/{node-git.CCI8evVZ.js → node-git.ZtkbKc8u.js} +14 -15
  7. package/dist/chunks/{runtime-console.DiVMr5d4.js → runtime-console.O41g23Zj.js} +26 -11
  8. package/dist/chunks/{runtime-runBaseTests.Cukyr5-I.js → runtime-runBaseTests.BDt9gQFB.js} +41 -33
  9. package/dist/cli.js +3 -3
  10. package/dist/config.cjs +45 -21
  11. package/dist/config.d.ts +1 -1
  12. package/dist/config.js +45 -22
  13. package/dist/coverage.d.ts +5 -4
  14. package/dist/coverage.js +100 -37
  15. package/dist/environments.d.ts +1 -1
  16. package/dist/environments.js +1 -1
  17. package/dist/execute.d.ts +1 -1
  18. package/dist/execute.js +2 -2
  19. package/dist/index.d.ts +37 -11
  20. package/dist/index.js +10 -10
  21. package/dist/node.d.ts +20 -7
  22. package/dist/node.js +29 -20
  23. package/dist/path.js +4 -1
  24. package/dist/{reporters-CYVC6LOl.d.ts → reporters-Cd1vkLMZ.d.ts} +134 -182
  25. package/dist/reporters.d.ts +1 -1
  26. package/dist/reporters.js +8 -8
  27. package/dist/runners.d.ts +1 -1
  28. package/dist/runners.js +99 -61
  29. package/dist/snapshot.js +2 -2
  30. package/dist/{suite-Dpu9EC_k.d.ts → suite-BS2CV79a.d.ts} +1 -1
  31. package/dist/suite.d.ts +2 -2
  32. package/dist/suite.js +3 -3
  33. package/dist/utils.d.ts +1 -5
  34. package/dist/utils.js +1 -6
  35. package/dist/vendor/{base._gnK9Slw.js → base.CTYV4Gnz.js} +24 -17
  36. package/dist/vendor/{base.Dln9yllP.js → base.Cy97mmVC.js} +4 -3
  37. package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.B6pblCp2.js} +13 -14
  38. package/dist/vendor/{cac.CtYFkoSJ.js → cac.DRNUX42m.js} +82 -38
  39. package/dist/vendor/{cli-api.CUtJc4r3.js → cli-api.Bu-PSdzx.js} +5908 -13271
  40. package/dist/vendor/{constants.TCjCaw2D.js → constants.BWsVtsAj.js} +5 -22
  41. package/dist/vendor/{coverage.ChSqD-qS.js → coverage.BhYSDdTT.js} +27 -11
  42. package/dist/vendor/{date.BKM1wewY.js → date.W2xKR2qe.js} +5 -3
  43. package/dist/vendor/env.2ltrQNq0.js +8 -0
  44. package/dist/vendor/{execute.BHj6OMh4.js → execute.T3gg2ZK6.js} +174 -60
  45. package/dist/vendor/{index.B5SKBLvV.js → index.B7pSlOSa.js} +18 -10
  46. package/dist/vendor/{index._7XLd8Kd.js → index.BJmtb_7W.js} +3 -2
  47. package/dist/vendor/{index.CThipSqB.js → index.BMmMjLIQ.js} +2540 -2540
  48. package/dist/vendor/{index.kpsSqFiz.js → index.D4nqnQWz.js} +69 -73
  49. package/dist/vendor/index.D6GZqexG.js +6575 -0
  50. package/dist/vendor/{index.D3hs2WiI.js → index.Hqvcg1pf.js} +3 -3
  51. package/dist/vendor/{index.BOMEjpjj.js → index.ZtQtNPP2.js} +962 -471
  52. package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
  53. package/dist/vendor/{run-once.DLomgGUH.js → run-once.Db8Hgq9X.js} +2 -1
  54. package/dist/vendor/{setup-common.DAu7t7mY.js → setup-common.CWnv_2-5.js} +30 -15
  55. package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
  56. package/dist/vendor/{utils.YuQ3LT2a.js → utils.DSO2UK15.js} +40 -25
  57. package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
  58. package/dist/vendor/{vi.hATFzZbX.js → vi.DXACdGTu.js} +267 -138
  59. package/dist/vendor/{vm.Ow-X2mkS.js → vm.D9wVR14y.js} +152 -87
  60. package/dist/worker.js +31 -15
  61. package/dist/workers/forks.js +4 -4
  62. package/dist/workers/runVmTests.js +15 -14
  63. package/dist/workers/threads.js +4 -4
  64. package/dist/workers/vmForks.js +7 -7
  65. package/dist/workers/vmThreads.js +7 -7
  66. package/dist/workers.d.ts +2 -2
  67. package/dist/workers.js +10 -10
  68. package/package.json +11 -11
  69. package/suppress-warnings.cjs +1 -4
  70. package/dist/vendor/env.bmJgw1qP.js +0 -7
@@ -1,9 +1,9 @@
1
1
  import * as vite from 'vite';
2
- import { TransformResult as TransformResult$1, ViteDevServer, UserConfig as UserConfig$1, ConfigEnv, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
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
4
  import { File, Test as Test$1, Suite, TaskResultPack, CancelReason, Task, TaskMeta, 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';
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
9
  import { ParsedStack, Awaitable as Awaitable$1, Arrayable as Arrayable$1 } from '@vitest/utils';
@@ -616,6 +616,7 @@ interface ErrorOptions {
616
616
  type?: string;
617
617
  fullStack?: boolean;
618
618
  project?: WorkspaceProject;
619
+ verbose?: boolean;
619
620
  }
620
621
  declare class Logger {
621
622
  ctx: Vitest;
@@ -645,6 +646,12 @@ interface BrowserProviderInitializationOptions {
645
646
  browser: string;
646
647
  options?: BrowserProviderOptions;
647
648
  }
649
+ interface CDPSession {
650
+ send: (method: string, params?: Record<string, unknown>) => Promise<unknown>;
651
+ on: (event: string, listener: (...args: unknown[]) => void) => void;
652
+ once: (event: string, listener: (...args: unknown[]) => void) => void;
653
+ off: (event: string, listener: (...args: unknown[]) => void) => void;
654
+ }
648
655
  interface BrowserProvider {
649
656
  name: string;
650
657
  /**
@@ -656,11 +663,16 @@ interface BrowserProvider {
656
663
  afterCommand?: (command: string, args: unknown[]) => Awaitable$1<void>;
657
664
  getCommandsContext: (contextId: string) => Record<string, unknown>;
658
665
  openPage: (contextId: string, url: string) => Promise<void>;
666
+ getCDPSession?: (contextId: string) => Promise<CDPSession>;
659
667
  close: () => Awaitable$1<void>;
660
668
  initialize(ctx: WorkspaceProject, options: BrowserProviderInitializationOptions): Awaitable$1<void>;
661
669
  }
670
+ interface BrowserProviderModule {
671
+ new (): BrowserProvider;
672
+ }
662
673
  interface BrowserProviderOptions {
663
674
  }
675
+ type BrowserBuiltinProvider = 'webdriverio' | 'playwright' | 'preview';
664
676
  interface BrowserConfigOptions {
665
677
  /**
666
678
  * if running tests in the browser should be the default
@@ -677,7 +689,7 @@ interface BrowserConfigOptions {
677
689
  *
678
690
  * @default 'preview'
679
691
  */
680
- provider?: 'webdriverio' | 'playwright' | 'preview' | (string & {});
692
+ provider?: BrowserBuiltinProvider | (string & {});
681
693
  /**
682
694
  * Options that are passed down to a browser provider.
683
695
  * To support type hinting, add one of the types to your tsconfig.json "compilerOptions.types" field:
@@ -742,6 +754,11 @@ interface BrowserConfigOptions {
742
754
  * @default __screenshots__
743
755
  */
744
756
  screenshotDirectory?: string;
757
+ /**
758
+ * Should Vitest take screenshots if the test fails
759
+ * @default !browser.ui
760
+ */
761
+ screenshotFailures?: boolean;
745
762
  /**
746
763
  * Scripts injected into the tester iframe.
747
764
  */
@@ -763,6 +780,27 @@ interface BrowserCommandContext {
763
780
  project: WorkspaceProject;
764
781
  contextId: string;
765
782
  }
783
+ interface BrowserServerStateContext {
784
+ files: string[];
785
+ resolve: () => void;
786
+ reject: (v: unknown) => void;
787
+ }
788
+ interface BrowserOrchestrator {
789
+ createTesters: (files: string[]) => Promise<void>;
790
+ onCancel: (reason: CancelReason) => Promise<void>;
791
+ }
792
+ interface BrowserServerState {
793
+ orchestrators: Map<string, BrowserOrchestrator>;
794
+ getContext: (contextId: string) => BrowserServerStateContext | undefined;
795
+ createAsyncContext: (contextId: string, files: string[]) => Promise<void>;
796
+ }
797
+ interface BrowserServer {
798
+ vite: ViteDevServer;
799
+ state: BrowserServerState;
800
+ provider: BrowserProvider;
801
+ close: () => Promise<void>;
802
+ initBrowserProvider: () => Promise<void>;
803
+ }
766
804
  interface BrowserCommand<Payload extends unknown[]> {
767
805
  (context: BrowserCommandContext, ...payload: Payload): Awaitable$1<any>;
768
806
  }
@@ -807,151 +845,6 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
807
845
  };
808
846
  }
809
847
 
810
- declare class VitestBrowserServerMocker {
811
- #private;
812
- mocks: Map<string, {
813
- sessionId: string;
814
- mock: string | null | undefined;
815
- }>;
816
- constructor(project: WorkspaceProject);
817
- resolveMock(rawId: string, importer: string, hasFactory: boolean): Promise<{
818
- type: "factory";
819
- resolvedId: string;
820
- mockPath?: undefined;
821
- } | {
822
- type: "redirect" | "automock";
823
- mockPath: string | null;
824
- resolvedId: string;
825
- }>;
826
- private resolveId;
827
- resolveMockPath(mockPath: string, external: string | null): string | null;
828
- }
829
-
830
- type ArgumentsType$1<T> = T extends (...args: infer A) => any ? A : never;
831
- type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
832
- type PromisifyFn<T> = ReturnType$1<T> extends Promise<any> ? T : (...args: ArgumentsType$1<T>) => Promise<Awaited<ReturnType$1<T>>>;
833
- type BirpcResolver = (name: string, resolved: (...args: unknown[]) => unknown) => ((...args: unknown[]) => unknown) | undefined;
834
- interface ChannelOptions {
835
- /**
836
- * Function to post raw message
837
- */
838
- post: (data: any, ...extras: any[]) => any | Promise<any>;
839
- /**
840
- * Listener to receive raw message
841
- */
842
- on: (fn: (data: any, ...extras: any[]) => void) => any | Promise<any>;
843
- /**
844
- * Custom function to serialize data
845
- *
846
- * by default it passes the data as-is
847
- */
848
- serialize?: (data: any) => any;
849
- /**
850
- * Custom function to deserialize data
851
- *
852
- * by default it passes the data as-is
853
- */
854
- deserialize?: (data: any) => any;
855
- }
856
- interface EventOptions<Remote> {
857
- /**
858
- * Names of remote functions that do not need response.
859
- */
860
- eventNames?: (keyof Remote)[];
861
- /**
862
- * Maximum timeout for waiting for response, in milliseconds.
863
- *
864
- * @default 60_000
865
- */
866
- timeout?: number;
867
- /**
868
- * Custom resolver to resolve function to be called
869
- *
870
- * For advanced use cases only
871
- */
872
- resolver?: BirpcResolver;
873
- /**
874
- * Custom error handler
875
- */
876
- onError?: (error: Error, functionName: string, args: any[]) => boolean | void;
877
- /**
878
- * Custom error handler for timeouts
879
- */
880
- onTimeoutError?: (functionName: string, args: any[]) => boolean | void;
881
- }
882
- type BirpcOptions<Remote> = EventOptions<Remote> & ChannelOptions;
883
- type BirpcFn<T> = PromisifyFn<T> & {
884
- /**
885
- * Send event without asking for response
886
- */
887
- asEvent: (...args: ArgumentsType$1<T>) => void;
888
- };
889
- type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
890
- [K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
891
- } & {
892
- $functions: LocalFunctions;
893
- };
894
-
895
- interface TransformResultWithSource extends TransformResult$1 {
896
- source?: string;
897
- }
898
- interface WebSocketHandlers {
899
- onCollected: (files?: File[]) => Promise<void>;
900
- onTaskUpdate: (packs: TaskResultPack[]) => void;
901
- getFiles: () => File[];
902
- getTestFiles: () => Promise<[{
903
- name: string;
904
- root: string;
905
- }, file: string][]>;
906
- getPaths: () => string[];
907
- getConfig: () => ResolvedConfig;
908
- getModuleGraph: (projectName: string, id: string, browser?: boolean) => Promise<ModuleGraphData>;
909
- getTransformResult: (projectName: string, id: string, browser?: boolean) => Promise<TransformResultWithSource | undefined>;
910
- readTestFile: (id: string) => Promise<string | null>;
911
- saveTestFile: (id: string, content: string) => Promise<void>;
912
- rerun: (files: string[]) => Promise<void>;
913
- updateSnapshot: (file?: File) => Promise<void>;
914
- getUnhandledErrors: () => unknown[];
915
- }
916
- interface WebSocketBrowserHandlers {
917
- resolveSnapshotPath: (testPath: string) => string;
918
- resolveSnapshotRawPath: (testPath: string, rawPath: string) => string;
919
- onUnhandledError: (error: unknown, type: string) => Promise<void>;
920
- onCollected: (files?: File[]) => Promise<void>;
921
- onTaskUpdate: (packs: TaskResultPack[]) => void;
922
- onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
923
- onCancel: (reason: CancelReason) => void;
924
- getCountOfFailedTests: () => number;
925
- readSnapshotFile: (id: string) => Promise<string | null>;
926
- saveSnapshotFile: (id: string, content: string) => Promise<void>;
927
- removeSnapshotFile: (id: string) => Promise<void>;
928
- sendLog: (log: UserConsoleLog) => void;
929
- finishBrowserTests: (contextId: string) => void;
930
- snapshotSaved: (snapshot: SnapshotResult) => void;
931
- debug: (...args: string[]) => void;
932
- resolveId: (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
933
- triggerCommand: <T>(contextId: string, command: string, testPath: string | undefined, payload: unknown[]) => Promise<T>;
934
- resolveMock: (id: string, importer: string, hasFactory: boolean) => Promise<{
935
- type: 'factory' | 'redirect' | 'automock';
936
- mockPath?: string | null;
937
- resolvedId: string;
938
- }>;
939
- automock: (id: string) => Promise<string>;
940
- invalidate: (ids: string[]) => void;
941
- getBrowserFileSourceMap: (id: string) => Promise<TransformResult$1['map'] | undefined>;
942
- getProvidedContext: () => ProvidedContext;
943
- }
944
- interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onFinished' | 'onTaskUpdate' | 'onUserConsoleLog' | 'onPathsCollected' | 'onSpecsCollected'> {
945
- onFinishedReportCoverage: () => void;
946
- }
947
- interface WebSocketBrowserEvents {
948
- onCancel: (reason: CancelReason) => void;
949
- startMocking: (id: string) => Promise<string[]>;
950
- createTesters: (files: string[]) => Promise<void>;
951
- }
952
- type WebSocketRPC = BirpcReturn<WebSocketEvents, WebSocketHandlers>;
953
- type WebSocketBrowserRPC = BirpcReturn<WebSocketBrowserEvents, WebSocketBrowserHandlers>;
954
-
955
848
  interface InitializeProjectOptions extends UserWorkspaceConfig {
956
849
  workspaceConfigPath: string;
957
850
  extends?: string;
@@ -965,20 +858,9 @@ declare class WorkspaceProject {
965
858
  server: ViteDevServer;
966
859
  vitenode: ViteNodeServer;
967
860
  runner: ViteNodeRunner;
968
- browser?: ViteDevServer;
861
+ browser?: BrowserServer;
969
862
  typechecker?: Typechecker;
970
863
  closingPromise: Promise<unknown> | undefined;
971
- browserProvider: BrowserProvider | undefined;
972
- browserMocker: VitestBrowserServerMocker;
973
- browserRpc: {
974
- orchestrators: Map<string, WebSocketBrowserRPC>;
975
- testers: Map<string, WebSocketBrowserRPC>;
976
- };
977
- browserState: Map<string, {
978
- files: string[];
979
- resolve: () => void;
980
- reject: (v: unknown) => void;
981
- }>;
982
864
  testFilesList: string[] | null;
983
865
  readonly id: string;
984
866
  readonly tmpDir: string;
@@ -987,7 +869,7 @@ declare class WorkspaceProject {
987
869
  constructor(path: string | number, ctx: Vitest, options?: InitializeProjectOptions | undefined);
988
870
  getName(): string;
989
871
  isCore(): boolean;
990
- provide: <T extends never>(key: T, value: ProvidedContext[T]) => void;
872
+ provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
991
873
  getProvidedContext(): ProvidedContext;
992
874
  initializeGlobalSetup(): Promise<void>;
993
875
  teardownGlobalSetup(): Promise<void>;
@@ -1027,7 +909,7 @@ declare function getFilePoolName(project: WorkspaceProject, file: string): Pool;
1027
909
  type Awaitable<T> = T | PromiseLike<T>;
1028
910
  type Nullable<T> = T | null | undefined;
1029
911
  type Arrayable<T> = T | Array<T>;
1030
- type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
912
+ type ArgumentsType$1<T> = T extends (...args: infer U) => any ? U : never;
1031
913
  type MutableArray<T extends readonly any[]> = {
1032
914
  -readonly [k in keyof T]: T[k];
1033
915
  };
@@ -1189,6 +1071,7 @@ declare class Vitest {
1189
1071
  private _onSetServer;
1190
1072
  private _onCancelListeners;
1191
1073
  setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
1074
+ provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
1192
1075
  private createCoreProject;
1193
1076
  getCoreWorkspaceProject(): WorkspaceProject;
1194
1077
  getProjectByTaskId(taskId: string): WorkspaceProject;
@@ -1232,7 +1115,7 @@ declare class Vitest {
1232
1115
  * Close the thread pool and exit the process
1233
1116
  */
1234
1117
  exit(force?: boolean): Promise<void>;
1235
- report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
1118
+ report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
1236
1119
  getTestFilepaths(): Promise<string[]>;
1237
1120
  globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
1238
1121
  shouldKeepServer(): boolean;
@@ -1327,10 +1210,13 @@ interface Reporter {
1327
1210
  onProcessTimeout?: () => Awaitable<void>;
1328
1211
  }
1329
1212
 
1330
- type SerializableSpec = [project: {
1331
- name: string | undefined;
1332
- root: string;
1333
- }, file: string];
1213
+ type SerializableSpec = [
1214
+ project: {
1215
+ name: string | undefined;
1216
+ root: string;
1217
+ },
1218
+ file: string
1219
+ ];
1334
1220
 
1335
1221
  interface JUnitOptions {
1336
1222
  outputFile?: string;
@@ -1376,6 +1262,7 @@ declare abstract class BaseReporter implements Reporter {
1376
1262
  watchFilters?: string[];
1377
1263
  isTTY: boolean;
1378
1264
  ctx: Vitest;
1265
+ protected verbose: boolean;
1379
1266
  private _filesInWatchMode;
1380
1267
  private _lastRunTimeout;
1381
1268
  private _lastRunTimer;
@@ -1456,6 +1343,7 @@ declare class DotReporter extends BaseReporter {
1456
1343
  }
1457
1344
 
1458
1345
  declare class VerboseReporter extends DefaultReporter {
1346
+ protected verbose: boolean;
1459
1347
  constructor();
1460
1348
  onTaskUpdate(packs: TaskResultPack[]): void;
1461
1349
  }
@@ -1644,6 +1532,71 @@ interface LinkMapper {
1644
1532
  assetPath(node: Node, name: string): string;
1645
1533
  }
1646
1534
 
1535
+ type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
1536
+ type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
1537
+ type PromisifyFn<T> = ReturnType$1<T> extends Promise<any> ? T : (...args: ArgumentsType<T>) => Promise<Awaited<ReturnType$1<T>>>;
1538
+ type BirpcResolver = (name: string, resolved: (...args: unknown[]) => unknown) => ((...args: unknown[]) => unknown) | undefined;
1539
+ interface ChannelOptions {
1540
+ /**
1541
+ * Function to post raw message
1542
+ */
1543
+ post: (data: any, ...extras: any[]) => any | Promise<any>;
1544
+ /**
1545
+ * Listener to receive raw message
1546
+ */
1547
+ on: (fn: (data: any, ...extras: any[]) => void) => any | Promise<any>;
1548
+ /**
1549
+ * Custom function to serialize data
1550
+ *
1551
+ * by default it passes the data as-is
1552
+ */
1553
+ serialize?: (data: any) => any;
1554
+ /**
1555
+ * Custom function to deserialize data
1556
+ *
1557
+ * by default it passes the data as-is
1558
+ */
1559
+ deserialize?: (data: any) => any;
1560
+ }
1561
+ interface EventOptions<Remote> {
1562
+ /**
1563
+ * Names of remote functions that do not need response.
1564
+ */
1565
+ eventNames?: (keyof Remote)[];
1566
+ /**
1567
+ * Maximum timeout for waiting for response, in milliseconds.
1568
+ *
1569
+ * @default 60_000
1570
+ */
1571
+ timeout?: number;
1572
+ /**
1573
+ * Custom resolver to resolve function to be called
1574
+ *
1575
+ * For advanced use cases only
1576
+ */
1577
+ resolver?: BirpcResolver;
1578
+ /**
1579
+ * Custom error handler
1580
+ */
1581
+ onError?: (error: Error, functionName: string, args: any[]) => boolean | void;
1582
+ /**
1583
+ * Custom error handler for timeouts
1584
+ */
1585
+ onTimeoutError?: (functionName: string, args: any[]) => boolean | void;
1586
+ }
1587
+ type BirpcOptions<Remote> = EventOptions<Remote> & ChannelOptions;
1588
+ type BirpcFn<T> = PromisifyFn<T> & {
1589
+ /**
1590
+ * Send event without asking for response
1591
+ */
1592
+ asEvent: (...args: ArgumentsType<T>) => void;
1593
+ };
1594
+ type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
1595
+ [K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
1596
+ } & {
1597
+ $functions: LocalFunctions;
1598
+ };
1599
+
1647
1600
  type MockFactoryWithHelper<M = unknown> = (importOriginal: <T extends M>() => Promise<T>) => any;
1648
1601
  type MockFactory = () => any;
1649
1602
  type MockMap = Map<string, Record<string, string | null | MockFactory>>;
@@ -1774,20 +1727,20 @@ interface CoverageProviderModule {
1774
1727
  type CoverageReporter = keyof ReportOptions | (string & {});
1775
1728
  type CoverageReporterWithOptions<ReporterName extends CoverageReporter = CoverageReporter> = ReporterName extends keyof ReportOptions ? ReportOptions[ReporterName] extends never ? [ReporterName, {}] : [ReporterName, Partial<ReportOptions[ReporterName]>] : [ReporterName, Record<string, unknown>];
1776
1729
  type Provider = 'v8' | 'istanbul' | 'custom' | undefined;
1777
- type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? ({
1730
+ type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? {
1778
1731
  provider: T;
1779
- } & CoverageIstanbulOptions) : T extends 'v8' ? ({
1732
+ } & CoverageIstanbulOptions : T extends 'v8' ? {
1780
1733
  /**
1781
1734
  * Provider to use for coverage collection.
1782
1735
  *
1783
1736
  * @default 'v8'
1784
1737
  */
1785
1738
  provider: T;
1786
- } & CoverageV8Options) : T extends 'custom' ? ({
1739
+ } & CoverageV8Options : T extends 'custom' ? {
1787
1740
  provider: T;
1788
- } & CustomProviderOptions) : ({
1741
+ } & CustomProviderOptions : {
1789
1742
  provider?: T;
1790
- } & (CoverageV8Options));
1743
+ } & CoverageV8Options;
1791
1744
  /** Fields that have default values. Internally these will always be defined. */
1792
1745
  type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension' | 'reportOnFailure' | 'allowExternal' | 'processingConcurrency';
1793
1746
  type ResolvedCoverageOptions<T extends Provider = Provider> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
@@ -2107,6 +2060,9 @@ type BenchmarkAPI = ChainableBenchmarkAPI & {
2107
2060
  runIf: (condition: any) => ChainableBenchmarkAPI;
2108
2061
  };
2109
2062
 
2063
+ declare const defaultBrowserPort = 63315;
2064
+ declare const extraInlineDeps: (string | RegExp)[];
2065
+
2110
2066
  declare const defaultInclude: string[];
2111
2067
  declare const defaultExclude: string[];
2112
2068
  declare const coverageConfigDefaults: ResolvedCoverageOptions;
@@ -2122,8 +2078,6 @@ declare const configDefaults: Readonly<{
2122
2078
  mockReset: false;
2123
2079
  include: string[];
2124
2080
  exclude: string[];
2125
- testTimeout: number;
2126
- hookTimeout: number;
2127
2081
  teardownTimeout: number;
2128
2082
  forceRerunTriggers: string[];
2129
2083
  update: false;
@@ -2154,8 +2108,6 @@ declare const configDefaults: Readonly<{
2154
2108
  disableConsoleIntercept: false;
2155
2109
  }>;
2156
2110
 
2157
- declare const extraInlineDeps: (string | RegExp)[];
2158
-
2159
2111
  interface UserWorkspaceConfig extends UserConfig$1 {
2160
2112
  test?: ProjectConfig;
2161
2113
  }
@@ -2171,9 +2123,9 @@ declare function defineConfig(config: Promise<UserConfig$1>): Promise<UserConfig
2171
2123
  declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
2172
2124
  declare function defineConfig(config: UserConfigExport): UserConfigExport;
2173
2125
  declare function defineProject<T extends UserProjectConfigExport>(config: T): T;
2174
- type Workspace = (string | (UserProjectConfigExport & {
2126
+ type Workspace = string | (UserProjectConfigExport & {
2175
2127
  extends?: string;
2176
- }));
2128
+ });
2177
2129
  declare function defineWorkspace(config: Workspace[]): Workspace[];
2178
2130
 
2179
2131
  type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
@@ -2644,7 +2596,7 @@ interface InlineConfig {
2644
2596
  */
2645
2597
  resolveSnapshotPath?: (path: string, extension: string) => string;
2646
2598
  /**
2647
- * Path to a custom snapshot environment module that has a defualt export of `SnapshotEnvironment` object.
2599
+ * Path to a custom snapshot environment module that has a default export of `SnapshotEnvironment` object.
2648
2600
  */
2649
2601
  snapshotEnvironment?: string;
2650
2602
  /**
@@ -2992,7 +2944,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
2992
2944
  };
2993
2945
  runner?: string;
2994
2946
  }
2995
- 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'> & {
2947
+ 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'> & {
2996
2948
  sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
2997
2949
  deps?: Omit<DepsOptions, 'moduleDirectories'>;
2998
2950
  poolOptions?: {
@@ -3114,4 +3066,4 @@ type Context = RootAndTarget & {
3114
3066
  lastActivePath?: string;
3115
3067
  };
3116
3068
 
3117
- export { type ArgumentsType 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 ContextTestEnvironment as G, type HappyDOMOptions as H, type InlineConfig as I, type JSDOMOptions as J, type ResolvedTestEnvironment as K, Vitest as L, type MockFactoryWithHelper as M, type Reporter as N, type ResolveIdFunction as O, type ProvidedContext as P, type AfterSuiteRunMeta 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 WorkerRPC as X, type Awaitable as Y, type Nullable as Z, type Arrayable as _, type ResolvedCoverageOptions as a, TapReporter as a$, type MutableArray as a0, type Constructable as a1, type ModuleCache as a2, type EnvironmentReturn as a3, type VmEnvironmentReturn as a4, type UserConsoleLog as a5, type ModuleGraphData as a6, type OnServerRestartHandler as a7, type ReportContext as a8, type CoverageReporter as a9, type BrowserCommand as aA, type BrowserCommandContext as aB, type JsonOptions$1 as aC, type JUnitOptions as aD, type HTMLOptions as aE, type PendingSuiteMock as aF, type MockFactory as aG, type MockMap as aH, type UserConfigFnObject as aI, type UserConfigFnPromise as aJ, type UserConfigFn as aK, type UserConfigExport as aL, type UserProjectConfigFn as aM, type UserProjectConfigExport as aN, defineConfig as aO, defineProject as aP, defineWorkspace as aQ, configDefaults as aR, defaultInclude as aS, defaultExclude as aT, coverageConfigDefaults as aU, extraInlineDeps as aV, DefaultReporter as aW, BasicReporter as aX, DotReporter as aY, JsonReporter as aZ, VerboseReporter as a_, type CoverageIstanbulOptions as aa, type CoverageV8Options as ab, type CustomProviderOptions as ac, type BenchmarkUserOptions as ad, type Benchmark as ae, type BenchmarkResult as af, type BenchFunction as ag, type BenchmarkAPI as ah, type TransformResultWithSource as ai, type WebSocketHandlers as aj, type WebSocketBrowserHandlers as ak, type WebSocketEvents as al, type WebSocketBrowserEvents as am, type WebSocketRPC as an, type WebSocketBrowserRPC as ao, type VitestOptions as ap, WorkspaceProject as aq, type TestSequencer as ar, type WorkspaceSpec as as, type ProcessPool as at, getFilePoolName as au, VitestPackageInstaller as av, type TestSequencerConstructor as aw, type BrowserProviderInitializationOptions as ax, type BrowserProvider as ay, type BrowserProviderOptions as az, type CoverageProvider as b, JUnitReporter as b0, TapFlatReporter as b1, HangingProcessReporter as b2, GithubActionsReporter as b3, BaseReporter as b4, ReportersMap as b5, type BuiltinReporters as b6, type BuiltinReporterOptions as b7, type JsonAssertionResult as b8, type JsonTestResult as b9, type JsonTestResults as ba, BenchmarkReportsMap as bb, type BenchmarkBuiltinReporters as bc, 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 RawErrsMap as i, type CollectLineNumbers as j, type CollectLines as k, type RootAndTarget as l, type Context as m, type Pool as n, type PoolOptions as o, type BuiltinEnvironment as p, type CSSModuleScopeStrategy as q, type EnvironmentOptions as r, type VitestRunMode as s, type TransformModePatterns as t, type TypecheckConfig as u, type ProjectConfig as v, type BrowserScript as w, type BrowserConfigOptions as x, type UserWorkspaceConfig as y, type RunnerRPC as z };
3069
+ 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 ProvidedContext 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 ModuleGraphData as i, type Reporter as j, type BirpcReturn as k, type RawErrsMap as l, type CollectLineNumbers as m, type CollectLines as n, type RootAndTarget as o, type Context as p, type Pool 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 };
@@ -1,4 +1,4 @@
1
- export { b4 as BaseReporter, aX as BasicReporter, bc as BenchmarkBuiltinReporters, bb as BenchmarkReportsMap, b7 as BuiltinReporterOptions, b6 as BuiltinReporters, aW as DefaultReporter, aY as DotReporter, b3 as GithubActionsReporter, b2 as HangingProcessReporter, b0 as JUnitReporter, b8 as JsonAssertionResult, aZ as JsonReporter, b9 as JsonTestResult, ba as JsonTestResults, N as Reporter, b5 as ReportersMap, b1 as TapFlatReporter, a$ as TapReporter, a_ as VerboseReporter } from './reporters-CYVC6LOl.js';
1
+ export { b8 as BaseReporter, a$ as BasicReporter, bg as BenchmarkBuiltinReporters, bf as BenchmarkReportsMap, bb as BuiltinReporterOptions, ba as BuiltinReporters, a_ as DefaultReporter, b0 as DotReporter, b7 as GithubActionsReporter, b6 as HangingProcessReporter, b4 as JUnitReporter, bc as JsonAssertionResult, b1 as JsonReporter, bd as JsonTestResult, be as JsonTestResults, j as Reporter, b9 as ReportersMap, b5 as TapFlatReporter, b3 as TapReporter, b2 as VerboseReporter } from './reporters-Cd1vkLMZ.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
package/dist/reporters.js CHANGED
@@ -1,23 +1,23 @@
1
- export { a as BasicReporter, e as BenchmarkReportsMap, D as DefaultReporter, b as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, c as JUnitReporter, J as JsonReporter, R as ReportersMap, d as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.BOMEjpjj.js';
1
+ export { B as BasicReporter, d as BenchmarkReportsMap, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, c as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.ZtQtNPP2.js';
2
2
  import 'node:fs';
3
3
  import 'picocolors';
4
4
  import 'pathe';
5
- import './vendor/tasks.WC7M-K-v.js';
5
+ import './vendor/tasks.DhVtQBtW.js';
6
6
  import '@vitest/runner/utils';
7
7
  import '@vitest/utils';
8
- import './vendor/env.bmJgw1qP.js';
8
+ import './vendor/env.2ltrQNq0.js';
9
9
  import 'std-env';
10
- import './vendor/utils.YuQ3LT2a.js';
11
- import './vendor/base._gnK9Slw.js';
10
+ import './vendor/utils.DSO2UK15.js';
11
+ import './vendor/base.CTYV4Gnz.js';
12
12
  import 'node:perf_hooks';
13
13
  import '@vitest/utils/source-map';
14
- import './vendor/index._7XLd8Kd.js';
14
+ import './vendor/index.BJmtb_7W.js';
15
15
  import './vendor/global.7bFbnyXl.js';
16
- import './chunks/runtime-console.DiVMr5d4.js';
16
+ import './chunks/runtime-console.O41g23Zj.js';
17
17
  import 'node:stream';
18
18
  import 'node:console';
19
19
  import 'node:path';
20
- import './vendor/date.BKM1wewY.js';
20
+ import './vendor/date.W2xKR2qe.js';
21
21
  import 'node:os';
22
22
  import 'node:fs/promises';
23
23
  import 'execa';
package/dist/runners.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VitestRunner, VitestRunnerImportSource, File, Suite, Task, CancelReason, Test, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
2
- import { R as ResolvedConfig } from './reporters-CYVC6LOl.js';
2
+ import { R as ResolvedConfig } from './reporters-Cd1vkLMZ.js';
3
3
  import * as tinybench from 'tinybench';
4
4
  import 'vite';
5
5
  import 'vite-node';