vitest 2.0.4 → 2.1.0-beta.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.
Files changed (80) hide show
  1. package/dist/browser.d.ts +21 -42
  2. package/dist/browser.js +5 -5
  3. package/dist/chunks/RandomSequencer.B4M2ux5b.js +952 -0
  4. package/dist/{vendor/base.DRHPZCCj.js → chunks/base.BH-FAiX7.js} +2 -2
  5. package/dist/{vendor/base.Csk7BT3h.js → chunks/base.BYvKfYzm.js} +3 -3
  6. package/dist/{vendor/benchmark.B6pblCp2.js → chunks/benchmark.C8CRJYG4.js} +1 -1
  7. package/dist/chunks/benchmark.puBFxyfE.d.ts +22 -0
  8. package/dist/{vendor/cac.DFtWvZc2.js → chunks/cac.CaYKA7Wt.js} +19 -21
  9. package/dist/{vendor/cli-api.CTkP2Ier.js → chunks/cli-api.B8LE391_.js} +500 -4615
  10. package/dist/chunks/config.CHuotKvS.d.ts +206 -0
  11. package/dist/chunks/{runtime-console.C2L2zykk.js → console.DI3gHgtH.js} +11 -14
  12. package/dist/{vendor/constants.CsnA4eRy.js → chunks/constants.CaAN7icJ.js} +1 -3
  13. package/dist/{vendor/coverage.BhYSDdTT.js → chunks/coverage.CqfT4xaf.js} +4 -7
  14. package/dist/chunks/{browser-creator.CyaOd8pl.js → creator.GreKbaUc.js} +10 -11
  15. package/dist/chunks/env.CmHVDJnw.js +7 -0
  16. package/dist/chunks/environment.0M5R1SX_.d.ts +173 -0
  17. package/dist/{vendor/execute.jzOWtys_.js → chunks/execute.DT9BA6zp.js} +28 -20
  18. package/dist/chunks/globals.DRPLtPOv.js +31 -0
  19. package/dist/{vendor/index.D6GZqexG.js → chunks/index.CM5UI-4O.js} +2 -2
  20. package/dist/{vendor/index.DI9daj1Q.js → chunks/index.CNZXZ9PJ.js} +43 -43
  21. package/dist/{vendor/index.BJmtb_7W.js → chunks/index.CxRxs566.js} +2 -2
  22. package/dist/{vendor/index.CVqMv71L.js → chunks/index.CxWPpGJz.js} +11 -12
  23. package/dist/{vendor/index.CuuL9y4g.js → chunks/index.YuPJueCg.js} +505 -1185
  24. package/dist/{vendor/index.D4nqnQWz.js → chunks/index.lVXYBqEP.js} +1 -18
  25. package/dist/{vendor/inspector.-FCQUzqR.js → chunks/inspector.70d6emsh.js} +4 -5
  26. package/dist/chunks/{environments-node.XE5FbRPQ.js → node.Bx4JZjMG.js} +2 -2
  27. package/dist/{reporters-B7ebVMkT.d.ts → chunks/reporters.DRZ7ndzr.d.ts} +860 -1000
  28. package/dist/chunks/resolveConfig.CGobt8AB.js +8120 -0
  29. package/dist/{vendor/rpc.BGx7q_k2.js → chunks/rpc.B7Mfb-Yf.js} +3 -5
  30. package/dist/{vendor/run-once.Db8Hgq9X.js → chunks/run-once.Sxe67Wng.js} +1 -1
  31. package/dist/chunks/{runtime-runBaseTests.Dq_sJZq9.js → runBaseTests.BAhL8UH_.js} +21 -23
  32. package/dist/{vendor/setup-common.symvFZPh.js → chunks/setup-common.KBrCO5LJ.js} +2 -2
  33. package/dist/{suite-CRLAhsm0.d.ts → chunks/suite.CcK46U-P.d.ts} +1 -1
  34. package/dist/{vendor/tasks.DhVtQBtW.js → chunks/tasks.BZnCS9aT.js} +2 -3
  35. package/dist/{vendor/utils.DkxLWvS1.js → chunks/utils.C3_cBsyn.js} +3 -4
  36. package/dist/{vendor/global.7bFbnyXl.js → chunks/utils.Ck2hJTRs.js} +1 -1
  37. package/dist/{vendor/utils.BySfPUwy.js → chunks/utils.DO38lwfj.js} +8 -21
  38. package/dist/{vendor/vi.Elqer9-7.js → chunks/vi.B6QZ938s.js} +13 -18
  39. package/dist/{vendor/vm.img-AOox.js → chunks/vm.kl9T_5ai.js} +40 -68
  40. package/dist/chunks/worker.BANO5ak1.d.ts +144 -0
  41. package/dist/chunks/worker.Cx2xE71X.d.ts +8 -0
  42. package/dist/cli.js +3 -3
  43. package/dist/config.cjs +6 -8
  44. package/dist/config.d.ts +10 -8
  45. package/dist/config.js +6 -8
  46. package/dist/coverage.d.ts +10 -8
  47. package/dist/coverage.js +35 -15
  48. package/dist/environments.d.ts +3 -19
  49. package/dist/environments.js +1 -1
  50. package/dist/execute.d.ts +5 -14
  51. package/dist/execute.js +2 -2
  52. package/dist/index.d.ts +267 -34
  53. package/dist/index.js +12 -12
  54. package/dist/node.d.ts +15 -9
  55. package/dist/node.js +26 -28
  56. package/dist/reporters.d.ts +10 -8
  57. package/dist/reporters.js +16 -18
  58. package/dist/runners.d.ts +15 -20
  59. package/dist/runners.js +12 -13
  60. package/dist/snapshot.js +3 -3
  61. package/dist/suite.d.ts +2 -16
  62. package/dist/suite.js +4 -4
  63. package/dist/worker.js +7 -8
  64. package/dist/workers/forks.js +5 -5
  65. package/dist/workers/runVmTests.js +18 -19
  66. package/dist/workers/threads.js +5 -5
  67. package/dist/workers/vmForks.js +8 -8
  68. package/dist/workers/vmThreads.js +8 -8
  69. package/dist/workers.d.ts +13 -8
  70. package/dist/workers.js +13 -13
  71. package/package.json +16 -17
  72. package/dist/chunks/integrations-globals.nDMtdOcn.js +0 -31
  73. package/dist/vendor/env.2ltrQNq0.js +0 -8
  74. package/dist/vendor/index.BMmMjLIQ.js +0 -3975
  75. /package/dist/{vendor → chunks}/_commonjsHelpers.BFTU3MAI.js +0 -0
  76. /package/dist/{vendor → chunks}/date.W2xKR2qe.js +0 -0
  77. /package/dist/chunks/{node-git.ZtkbKc8u.js → git.ZtkbKc8u.js} +0 -0
  78. /package/dist/{vendor → chunks}/index.BpSiYbpB.js +0 -0
  79. /package/dist/chunks/{install-pkg.DNUmWFkO.js → index.DNUmWFkO.js} +0 -0
  80. /package/dist/{vendor → chunks}/spy.Cf_4R5Oe.js +0 -0
@@ -1,80 +1,21 @@
1
+ import * as _vitest_runner from '@vitest/runner';
2
+ import { File, Test, Suite, TaskResultPack, Task, CancelReason, Custom, TaskMeta, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
1
3
  import * as vite from 'vite';
2
4
  import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, ConfigEnv, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
3
- import { PrettyFormatOptions, Plugin } from '@vitest/pretty-format';
4
- import * as _vitest_runner from '@vitest/runner';
5
- import { File, Test, Suite, TaskResultPack, Task, CancelReason, TaskMeta, Custom, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
6
- import { RawSourceMap, FetchResult, ViteNodeResolveId, ModuleCacheMap, ViteNodeServerOptions } from 'vite-node';
7
- import { SnapshotSummary, SnapshotResult, SnapshotStateOptions, SnapshotState } from '@vitest/snapshot';
8
- import { PromisifyAssertion, Tester, ExpectStatic } from '@vitest/expect';
9
- import { ChainableFunction } from '@vitest/runner/utils';
10
- import { ParsedStack, Awaitable as Awaitable$1, ErrorWithDiff, Arrayable as Arrayable$1 } from '@vitest/utils';
11
- import { TaskResult, Bench, Options as Options$1 } from 'tinybench';
5
+ import { PrettyFormatOptions } from '@vitest/pretty-format';
6
+ import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.CHuotKvS.js';
7
+ import { RawSourceMap, ViteNodeServerOptions } from 'vite-node';
8
+ import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
9
+ import { b as Awaitable, P as ProvidedContext, U as UserConsoleLog, A as AfterSuiteRunMeta, c as Arrayable, d as ArgumentsType, O as OnServerRestartHandler, f as EnvironmentOptions } from './environment.0M5R1SX_.js';
12
10
  import { Writable } from 'node:stream';
13
11
  import { ViteNodeRunner } from 'vite-node/client';
14
12
  import { SnapshotManager } from '@vitest/snapshot/manager';
15
13
  import { ViteNodeServer } from 'vite-node/server';
16
- import { MessagePort } from 'node:worker_threads';
14
+ import { ParsedStack, Awaitable as Awaitable$1, ErrorWithDiff, TestError, Arrayable as Arrayable$1 } from '@vitest/utils';
17
15
  import { StackTraceParserOptions } from '@vitest/utils/source-map';
18
16
  import { Stats } from 'node:fs';
19
17
  import * as chai from 'chai';
20
-
21
- /**
22
- * Names of clock methods that may be faked by install.
23
- */
24
- type FakeMethod =
25
- | "setTimeout"
26
- | "clearTimeout"
27
- | "setImmediate"
28
- | "clearImmediate"
29
- | "setInterval"
30
- | "clearInterval"
31
- | "Date"
32
- | "nextTick"
33
- | "hrtime"
34
- | "requestAnimationFrame"
35
- | "cancelAnimationFrame"
36
- | "requestIdleCallback"
37
- | "cancelIdleCallback"
38
- | "performance"
39
- | "queueMicrotask";
40
-
41
- interface FakeTimerInstallOpts {
42
- /**
43
- * Installs fake timers with the specified unix epoch (default: 0)
44
- */
45
- now?: number | Date | undefined;
46
-
47
- /**
48
- * An array with names of global methods and APIs to fake.
49
- * For instance, `vi.useFakeTimer({ toFake: ['setTimeout', 'performance'] })` will fake only `setTimeout()` and `performance.now()`
50
- * @default ['setTimeout', 'clearTimeout', 'setImmediate', 'clearImmediate', 'setInterval', 'clearInterval', 'Date']
51
- */
52
- toFake?: FakeMethod[] | undefined;
53
-
54
- /**
55
- * The maximum number of timers that will be run when calling runAll()
56
- * @default 10000
57
- */
58
- loopLimit?: number | undefined;
59
-
60
- /**
61
- * Tells @sinonjs/fake-timers to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by
62
- * 20ms for every 20ms change in the real system time) (default: false)
63
- */
64
- shouldAdvanceTime?: boolean | undefined;
65
-
66
- /**
67
- * Relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change
68
- * in the real system time (default: 20)
69
- */
70
- advanceTimeDelta?: number | undefined;
71
-
72
- /**
73
- * Tells FakeTimers to clear 'native' (i.e. not fake) timers by delegating to their respective handlers.
74
- * @default true
75
- */
76
- shouldClearNativeTimers?: boolean | undefined;
77
- }
18
+ import { B as BenchmarkResult } from './benchmark.puBFxyfE.js';
78
19
 
79
20
  type BuiltinPool = 'browser' | 'threads' | 'forks' | 'vmThreads' | 'vmForks' | 'typescript';
80
21
  type Pool = BuiltinPool | (string & {});
@@ -300,6 +241,32 @@ interface FileInformation {
300
241
  definitions: LocalCallDefinition[];
301
242
  }
302
243
 
244
+ type RawErrsMap = Map<string, TscErrorInfo[]>;
245
+ interface TscErrorInfo {
246
+ filePath: string;
247
+ errCode: number;
248
+ errMsg: string;
249
+ line: number;
250
+ column: number;
251
+ }
252
+ interface CollectLineNumbers {
253
+ target: number;
254
+ next: number;
255
+ prev?: number;
256
+ }
257
+ type CollectLines = {
258
+ [key in keyof CollectLineNumbers]: string;
259
+ };
260
+ interface RootAndTarget {
261
+ root: string;
262
+ targetAbsPath: string;
263
+ }
264
+ type Context = RootAndTarget & {
265
+ rawErrsMap: RawErrsMap;
266
+ openedDirs: Set<string>;
267
+ lastActivePath?: string;
268
+ };
269
+
303
270
  declare class TypeCheckError extends Error {
304
271
  message: string;
305
272
  stacks: ParsedStack[];
@@ -497,6 +464,16 @@ interface BrowserConfigOptions {
497
464
  */
498
465
  height: number;
499
466
  };
467
+ /**
468
+ * Locator options
469
+ */
470
+ locators?: {
471
+ /**
472
+ * Attribute used to locate elements by test id
473
+ * @default 'data-testid'
474
+ */
475
+ testIdAttribute?: string;
476
+ };
500
477
  /**
501
478
  * Directory where screenshots will be saved when page.screenshot() is called
502
479
  * If not set, all screenshots are saved to __screenshots__ directory in the same folder as the test file.
@@ -596,6 +573,54 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
596
573
  width: number;
597
574
  height: number;
598
575
  };
576
+ screenshotFailures: boolean;
577
+ locators: {
578
+ testIdAttribute: string;
579
+ };
580
+ }
581
+
582
+ declare class TestProject {
583
+ /**
584
+ * The global vitest instance.
585
+ * @experimental The public Vitest API is experimental and does not follow semver.
586
+ */
587
+ readonly vitest: Vitest;
588
+ /**
589
+ * The workspace project this test project is associated with.
590
+ * @experimental The public Vitest API is experimental and does not follow semver.
591
+ */
592
+ readonly workspaceProject: WorkspaceProject;
593
+ /**
594
+ * Resolved project configuration.
595
+ */
596
+ readonly config: ResolvedProjectConfig;
597
+ /**
598
+ * Resolved global configuration. If there are no workspace projects, this will be the same as `config`.
599
+ */
600
+ readonly globalConfig: ResolvedConfig;
601
+ /**
602
+ * The name of the project or an empty string if not set.
603
+ */
604
+ readonly name: string;
605
+ constructor(workspaceProject: WorkspaceProject);
606
+ /**
607
+ * Serialized project configuration. This is the config that tests receive.
608
+ */
609
+ get serializedConfig(): SerializedConfig;
610
+ /**
611
+ * Custom context provided to the project.
612
+ */
613
+ context(): ProvidedContext;
614
+ /**
615
+ * Provide a custom serializable context to the project. This context will be available for tests once they run.
616
+ */
617
+ provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
618
+ toJSON(): SerializedTestProject;
619
+ }
620
+ interface SerializedTestProject {
621
+ name: string;
622
+ serializedConfig: SerializedConfig;
623
+ context: ProvidedContext;
599
624
  }
600
625
 
601
626
  interface InitializeProjectOptions extends UserWorkspaceConfig {
@@ -615,6 +640,7 @@ declare class WorkspaceProject {
615
640
  typechecker?: Typechecker;
616
641
  closingPromise: Promise<unknown> | undefined;
617
642
  testFilesList: string[] | null;
643
+ testProject: TestProject;
618
644
  readonly id: string;
619
645
  readonly tmpDir: string;
620
646
  private _globalSetups;
@@ -630,7 +656,6 @@ declare class WorkspaceProject {
630
656
  getModulesByFilepath(file: string): Set<vite.ModuleNode>;
631
657
  getModuleById(id: string): vite.ModuleNode | undefined;
632
658
  getSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
633
- getBrowserSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
634
659
  get reporters(): Reporter[];
635
660
  globTestFiles(filters?: string[]): Promise<string[]>;
636
661
  globAllTestFiles(include: string[], exclude: string[], includeSource: string[] | undefined, cwd: string): Promise<string[]>;
@@ -644,7 +669,7 @@ declare class WorkspaceProject {
644
669
  static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
645
670
  setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
646
671
  isBrowserEnabled(): boolean;
647
- getSerializableConfig(method?: 'run' | 'collect'): ResolvedConfig;
672
+ getSerializableConfig(): SerializedConfig;
648
673
  close(): Promise<unknown>;
649
674
  private clearTmpDir;
650
675
  initBrowserProvider(): Promise<void>;
@@ -660,52 +685,256 @@ interface ProcessPool {
660
685
  }
661
686
  declare function getFilePoolName(project: WorkspaceProject, file: string): Pool;
662
687
 
663
- type Awaitable<T> = T | PromiseLike<T>;
664
- type Nullable<T> = T | null | undefined;
665
- type Arrayable<T> = T | Array<T>;
666
- type ArgumentsType$1<T> = T extends (...args: infer U) => any ? U : never;
667
- type MutableArray<T extends readonly any[]> = {
668
- -readonly [k in keyof T]: T[k];
669
- };
670
- interface Constructable {
671
- new (...args: any[]): any;
688
+ declare class ReportedTaskImplementation {
689
+ /**
690
+ * Task instance.
691
+ * @experimental Public runner task API is experimental and does not follow semver.
692
+ */
693
+ readonly task: Task;
694
+ /**
695
+ * The project assosiacted with the test or suite.
696
+ */
697
+ readonly project: TestProject;
698
+ /**
699
+ * Unique identifier.
700
+ * This ID is deterministic and will be the same for the same test across multiple runs.
701
+ * The ID is based on the project name, file path and test position.
702
+ */
703
+ readonly id: string;
704
+ /**
705
+ * Location in the file where the test or suite is defined.
706
+ */
707
+ readonly location: {
708
+ line: number;
709
+ column: number;
710
+ } | undefined;
711
+ protected constructor(task: Task, project: WorkspaceProject);
712
+ /**
713
+ * Creates a new reported task instance and stores it in the project's state for future use.
714
+ */
715
+ static register(task: Task, project: WorkspaceProject): TestCase | TestSuite | TestFile;
672
716
  }
673
- interface ModuleCache {
674
- promise?: Promise<any>;
675
- exports?: any;
676
- code?: string;
717
+ declare class TestCase extends ReportedTaskImplementation {
718
+ #private;
719
+ readonly task: Test | Custom;
720
+ readonly type = "test";
721
+ /**
722
+ * Direct reference to the test file where the test or suite is defined.
723
+ */
724
+ readonly file: TestFile;
725
+ /**
726
+ * Name of the test.
727
+ */
728
+ readonly name: string;
729
+ /**
730
+ * Options that the test was initiated with.
731
+ */
732
+ readonly options: TaskOptions;
733
+ /**
734
+ * Parent suite. If the test was called directly inside the file, the parent will be the file.
735
+ */
736
+ readonly parent: TestSuite | TestFile;
737
+ protected constructor(task: Test | Custom, project: WorkspaceProject);
738
+ /**
739
+ * Full name of the test including all parent suites separated with `>`.
740
+ */
741
+ get fullName(): string;
742
+ /**
743
+ * Test results. Will be `undefined` if test is not finished yet or was just collected.
744
+ */
745
+ result(): TestResult | undefined;
746
+ /**
747
+ * Checks if the test did not fail the suite.
748
+ * If the test is not finished yet or was skipped, it will return `true`.
749
+ */
750
+ ok(): boolean;
751
+ /**
752
+ * Custom metadata that was attached to the test during its execution.
753
+ */
754
+ meta(): TaskMeta;
755
+ /**
756
+ * Useful information about the test like duration, memory usage, etc.
757
+ * Diagnostic is only available after the test has finished.
758
+ */
759
+ diagnostic(): TestDiagnostic | undefined;
677
760
  }
678
- interface EnvironmentReturn {
679
- teardown: (global: any) => Awaitable<void>;
761
+ declare class TestCollection {
762
+ #private;
763
+ constructor(task: Suite | File, project: WorkspaceProject);
764
+ /**
765
+ * Returns the test or suite at a specific index in the array.
766
+ */
767
+ at(index: number): TestCase | TestSuite | undefined;
768
+ /**
769
+ * The number of tests and suites in the collection.
770
+ */
771
+ get size(): number;
772
+ /**
773
+ * Returns the collection in array form for easier manipulation.
774
+ */
775
+ array(): (TestCase | TestSuite)[];
776
+ /**
777
+ * Filters all tests that are part of this collection and its children.
778
+ */
779
+ allTests(state?: TestResult['state'] | 'running'): IterableIterator<TestCase>;
780
+ /**
781
+ * Filters only the tests that are part of this collection.
782
+ */
783
+ tests(state?: TestResult['state'] | 'running'): IterableIterator<TestCase>;
784
+ /**
785
+ * Filters only the suites that are part of this collection.
786
+ */
787
+ suites(): IterableIterator<TestSuite>;
788
+ /**
789
+ * Filters all suites that are part of this collection and its children.
790
+ */
791
+ allSuites(): IterableIterator<TestSuite>;
792
+ [Symbol.iterator](): IterableIterator<TestSuite | TestCase>;
680
793
  }
681
- interface VmEnvironmentReturn {
682
- getVmContext: () => {
683
- [key: string]: any;
684
- };
685
- teardown: () => Awaitable<void>;
794
+
795
+ declare abstract class SuiteImplementation extends ReportedTaskImplementation {
796
+ readonly task: Suite | File;
797
+ /**
798
+ * Collection of suites and tests that are part of this suite.
799
+ */
800
+ readonly children: TestCollection;
801
+ protected constructor(task: Suite | File, project: WorkspaceProject);
686
802
  }
687
- interface Environment {
688
- name: string;
689
- transformMode: 'web' | 'ssr';
690
- setupVM?: (options: Record<string, any>) => Awaitable<VmEnvironmentReturn>;
691
- setup: (global: any, options: Record<string, any>) => Awaitable<EnvironmentReturn>;
692
- }
693
- interface UserConsoleLog {
694
- content: string;
695
- origin?: string;
696
- browser?: boolean;
697
- type: 'stdout' | 'stderr';
698
- taskId?: string;
699
- time: number;
700
- size: number;
803
+ declare class TestSuite extends SuiteImplementation {
804
+ #private;
805
+ readonly task: Suite;
806
+ readonly type = "suite";
807
+ /**
808
+ * Name of the test or the suite.
809
+ */
810
+ readonly name: string;
811
+ /**
812
+ * Direct reference to the test file where the test or suite is defined.
813
+ */
814
+ readonly file: TestFile;
815
+ /**
816
+ * Parent suite. If suite was called directly inside the file, the parent will be the file.
817
+ */
818
+ readonly parent: TestSuite | TestFile;
819
+ /**
820
+ * Options that suite was initiated with.
821
+ */
822
+ readonly options: TaskOptions;
823
+ protected constructor(task: Suite, project: WorkspaceProject);
824
+ /**
825
+ * Full name of the suite including all parent suites separated with `>`.
826
+ */
827
+ get fullName(): string;
828
+ }
829
+ declare class TestFile extends SuiteImplementation {
830
+ readonly task: File;
831
+ readonly location: undefined;
832
+ readonly type = "file";
833
+ /**
834
+ * This is usually an absolute UNIX file path.
835
+ * It can be a virtual id if the file is not on the disk.
836
+ * This value corresponds to Vite's `ModuleGraph` id.
837
+ */
838
+ readonly moduleId: string;
839
+ protected constructor(task: File, project: WorkspaceProject);
840
+ /**
841
+ * Useful information about the file like duration, memory usage, etc.
842
+ * If the file was not executed yet, all diagnostic values will return `0`.
843
+ */
844
+ diagnostic(): FileDiagnostic;
845
+ }
846
+ interface TaskOptions {
847
+ each: boolean | undefined;
848
+ concurrent: boolean | undefined;
849
+ shuffle: boolean | undefined;
850
+ retry: number | undefined;
851
+ repeats: number | undefined;
852
+ mode: 'run' | 'only' | 'skip' | 'todo';
853
+ }
854
+ type TestResult = TestResultPassed | TestResultFailed | TestResultSkipped;
855
+ interface TestResultPassed {
856
+ /**
857
+ * The test passed successfully.
858
+ */
859
+ state: 'passed';
860
+ /**
861
+ * Errors that were thrown during the test execution.
862
+ *
863
+ * **Note**: If test was retried successfully, errors will still be reported.
864
+ */
865
+ errors: TestError[] | undefined;
866
+ }
867
+ interface TestResultFailed {
868
+ /**
869
+ * The test failed to execute.
870
+ */
871
+ state: 'failed';
872
+ /**
873
+ * Errors that were thrown during the test execution.
874
+ */
875
+ errors: TestError[];
876
+ }
877
+ interface TestResultSkipped {
878
+ /**
879
+ * The test was skipped with `only`, `skip` or `todo` flag.
880
+ * You can see which one was used in the `mode` option.
881
+ */
882
+ state: 'skipped';
883
+ /**
884
+ * Skipped tests have no errors.
885
+ */
886
+ errors: undefined;
701
887
  }
702
- interface ModuleGraphData {
703
- graph: Record<string, string[]>;
704
- externalized: string[];
705
- inlined: string[];
888
+ interface TestDiagnostic {
889
+ /**
890
+ * The amount of memory used by the test in bytes.
891
+ * This value is only available if the test was executed with `logHeapUsage` flag.
892
+ */
893
+ heap: number | undefined;
894
+ /**
895
+ * The time it takes to execute the test in ms.
896
+ */
897
+ duration: number;
898
+ /**
899
+ * The time in ms when the test started.
900
+ */
901
+ startTime: number;
902
+ /**
903
+ * The amount of times the test was retried.
904
+ */
905
+ retryCount: number;
906
+ /**
907
+ * The amount of times the test was repeated as configured by `repeats` option.
908
+ * This value can be lower if the test failed during the repeat and no `retry` is configured.
909
+ */
910
+ repeatCount: number;
911
+ /**
912
+ * If test passed on a second retry.
913
+ */
914
+ flaky: boolean;
706
915
  }
707
- type OnServerRestartHandler = (reason?: string) => Promise<void> | void;
708
- interface ProvidedContext {
916
+ interface FileDiagnostic {
917
+ /**
918
+ * The time it takes to import and initiate an environment.
919
+ */
920
+ environmentSetupDuration: number;
921
+ /**
922
+ * The time it takes Vitest to setup test harness (runner, mocks, etc.).
923
+ */
924
+ prepareDuration: number;
925
+ /**
926
+ * The time it takes to import the test file.
927
+ * This includes importing everything in the file and executing suite callbacks.
928
+ */
929
+ collectDuration: number;
930
+ /**
931
+ * The time it takes to import the setup file.
932
+ */
933
+ setupDuration: number;
934
+ /**
935
+ * Accumulated duration of all tests and hooks in the file.
936
+ */
937
+ duration: number;
709
938
  }
710
939
 
711
940
  declare class StateManager {
@@ -715,6 +944,7 @@ declare class StateManager {
715
944
  taskFileMap: WeakMap<Task, File>;
716
945
  errorsSet: Set<unknown>;
717
946
  processTimeoutCauses: Set<string>;
947
+ reportedTasksMap: WeakMap<Task, TestCase | TestSuite | TestFile>;
718
948
  catchError(err: unknown, type: string): void;
719
949
  clearErrors(): void;
720
950
  getUnhandledErrors(): unknown[];
@@ -728,18 +958,14 @@ declare class StateManager {
728
958
  getFilepaths(): string[];
729
959
  getFailedFilepaths(): string[];
730
960
  collectPaths(paths?: string[]): void;
731
- collectFiles(files?: File[]): void;
732
- clearFiles(_project: {
733
- config: {
734
- name: string | undefined;
735
- root: string;
736
- };
737
- }, paths?: string[]): void;
738
- updateId(task: Task): void;
961
+ collectFiles(project: WorkspaceProject, files?: File[]): void;
962
+ clearFiles(project: WorkspaceProject, paths?: string[]): void;
963
+ updateId(task: Task, project: WorkspaceProject): void;
964
+ getReportedEntity(task: Task): TestCase | TestSuite | TestFile | undefined;
739
965
  updateTasks(packs: TaskResultPack[]): void;
740
966
  updateUserLog(log: UserConsoleLog): void;
741
967
  getCountOfFailedTests(): number;
742
- cancelFiles(files: string[], root: string, projectName: string): void;
968
+ cancelFiles(files: string[], project: WorkspaceProject): void;
743
969
  }
744
970
 
745
971
  interface SuiteResultCache {
@@ -786,663 +1012,79 @@ declare class VitestPackageInstaller {
786
1012
  ensureInstalled(dependency: string, root: string): Promise<boolean>;
787
1013
  }
788
1014
 
789
- interface VitestOptions {
790
- packageInstaller?: VitestPackageInstaller;
791
- stdin?: NodeJS.ReadStream;
792
- stdout?: NodeJS.WriteStream | Writable;
793
- stderr?: NodeJS.WriteStream | Writable;
794
- }
795
- declare class Vitest {
796
- readonly mode: VitestRunMode;
797
- version: string;
798
- config: ResolvedConfig;
799
- configOverride: Partial<ResolvedConfig>;
800
- server: ViteDevServer;
801
- state: StateManager;
802
- snapshot: SnapshotManager;
803
- cache: VitestCache;
804
- reporters: Reporter[];
805
- coverageProvider: CoverageProvider | null | undefined;
806
- logger: Logger;
807
- pool: ProcessPool | undefined;
808
- vitenode: ViteNodeServer;
809
- invalidates: Set<string>;
810
- changedTests: Set<string>;
811
- watchedTests: Set<string>;
812
- filenamePattern?: string;
813
- runningPromise?: Promise<void>;
814
- closingPromise?: Promise<void>;
815
- isCancelling: boolean;
816
- isFirstRun: boolean;
817
- restartsCount: number;
818
- runner: ViteNodeRunner;
819
- packageInstaller: VitestPackageInstaller;
820
- private coreWorkspaceProject;
821
- private resolvedProjects;
822
- projects: WorkspaceProject[];
823
- private projectsTestFiles;
824
- distPath: string;
825
- constructor(mode: VitestRunMode, options?: VitestOptions);
826
- private _onRestartListeners;
827
- private _onClose;
828
- private _onSetServer;
829
- private _onCancelListeners;
830
- setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
831
- provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
832
- private createCoreProject;
833
- getCoreWorkspaceProject(): WorkspaceProject;
834
- getProjectByTaskId(taskId: string): WorkspaceProject;
835
- getProjectByName(name?: string): WorkspaceProject;
836
- private getWorkspaceConfigPath;
837
- private resolveWorkspace;
838
- private initCoverageProvider;
839
- private initBrowserProviders;
840
- mergeReports(): Promise<void>;
841
- collect(filters?: string[]): Promise<{
842
- tests: File[];
843
- errors: unknown[];
844
- }>;
845
- start(filters?: string[]): Promise<void>;
846
- init(): Promise<void>;
847
- private getTestDependencies;
848
- filterTestsBySource(specs: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
849
- getProjectsByTestFile(file: string): WorkspaceSpec[];
850
- initializeGlobalSetup(paths: WorkspaceSpec[]): Promise<void>;
851
- private initializeDistPath;
852
- runFiles(specs: WorkspaceSpec[], allTestsRun: boolean): Promise<void>;
853
- collectFiles(specs: WorkspaceSpec[]): Promise<void>;
854
- cancelCurrentRun(reason: CancelReason): Promise<void>;
855
- rerunFiles(files?: string[], trigger?: string): Promise<void>;
856
- changeProjectName(pattern: string): Promise<void>;
857
- changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
858
- changeFilenamePattern(pattern: string, files?: string[]): Promise<void>;
859
- rerunFailed(): Promise<void>;
860
- updateSnapshot(files?: string[]): Promise<void>;
861
- private _rerunTimer;
862
- private scheduleRerun;
863
- getModuleProjects(filepath: string): WorkspaceProject[];
864
- /**
865
- * Watch only the specified tests. If no tests are provided, all tests will be watched.
866
- */
867
- watchTests(tests: string[]): void;
868
- private unregisterWatcher;
869
- private registerWatcher;
870
- /**
871
- * @returns A value indicating whether rerun is needed (changedTests was mutated)
872
- */
873
- private handleFileChanged;
874
- private reportCoverage;
875
- close(): Promise<void>;
876
- /**
877
- * Close the thread pool and exit the process
878
- */
879
- exit(force?: boolean): Promise<void>;
880
- report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
881
- getTestFilepaths(): Promise<string[]>;
882
- globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
883
- shouldKeepServer(): boolean;
884
- onServerRestart(fn: OnServerRestartHandler): void;
885
- onAfterSetServer(fn: OnServerRestartHandler): void;
886
- onCancel(fn: (reason: CancelReason) => void): void;
887
- onClose(fn: () => void): void;
1015
+ interface Node {
1016
+ isRoot(): boolean;
1017
+ visit(visitor: Visitor, state: any): void;
888
1018
  }
889
1019
 
890
- interface TestSequencer {
891
- /**
892
- * Slicing tests into shards. Will be run before `sort`.
893
- * Only run, if `shard` is defined.
894
- */
895
- shard: (files: WorkspaceSpec[]) => Awaitable<WorkspaceSpec[]>;
896
- sort: (files: WorkspaceSpec[]) => Awaitable<WorkspaceSpec[]>;
897
- }
898
- interface TestSequencerConstructor {
899
- new (ctx: Vitest): TestSequencer;
1020
+ interface Visitor<N extends Node = Node> {
1021
+ onStart(root: N, state: any): void;
1022
+ onSummary(root: N, state: any): void;
1023
+ onDetail(root: N, state: any): void;
1024
+ onSummaryEnd(root: N, state: any): void;
1025
+ onEnd(root: N, state: any): void;
900
1026
  }
901
1027
 
902
- type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';
903
- type Milliseconds = number;
904
- interface Callsite {
905
- line: number;
906
- column: number;
907
- }
908
- interface JsonAssertionResult {
909
- ancestorTitles: Array<string>;
910
- fullName: string;
911
- status: Status;
912
- title: string;
913
- meta: TaskMeta;
914
- duration?: Milliseconds | null;
915
- failureMessages: Array<string> | null;
916
- location?: Callsite | null;
917
- }
918
- interface JsonTestResult {
919
- message: string;
920
- name: string;
921
- status: 'failed' | 'passed';
922
- startTime: number;
923
- endTime: number;
924
- assertionResults: Array<JsonAssertionResult>;
925
- }
926
- interface JsonTestResults {
927
- numFailedTests: number;
928
- numFailedTestSuites: number;
929
- numPassedTests: number;
930
- numPassedTestSuites: number;
931
- numPendingTests: number;
932
- numPendingTestSuites: number;
933
- numTodoTests: number;
934
- numTotalTests: number;
935
- numTotalTestSuites: number;
936
- startTime: number;
937
- success: boolean;
938
- testResults: Array<JsonTestResult>;
939
- snapshot: SnapshotSummary;
940
- }
941
- interface JsonOptions$1 {
942
- outputFile?: string;
1028
+ interface FileOptions {
1029
+ file: string;
943
1030
  }
944
- declare class JsonReporter implements Reporter {
945
- start: number;
946
- ctx: Vitest;
947
- options: JsonOptions$1;
948
- constructor(options: JsonOptions$1);
949
- onInit(ctx: Vitest): void;
950
- protected logTasks(files: File[]): Promise<void>;
951
- onFinished(files?: File[]): Promise<void>;
952
- /**
953
- * Writes the report to an output file if specified in the config,
954
- * or logs it to the console otherwise.
955
- * @param report
956
- */
957
- writeReport(report: string): Promise<void>;
1031
+
1032
+ interface ProjectOptions {
1033
+ projectRoot: string;
958
1034
  }
959
1035
 
960
- interface Reporter {
961
- onInit?: (ctx: Vitest) => void;
962
- onPathsCollected?: (paths?: string[]) => Awaitable<void>;
963
- onSpecsCollected?: (specs?: SerializableSpec[]) => Awaitable<void>;
964
- onCollected?: (files?: File[]) => Awaitable<void>;
965
- onFinished?: (files: File[], errors: unknown[], coverage?: unknown) => Awaitable<void>;
966
- onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
967
- onTestRemoved?: (trigger?: string) => Awaitable<void>;
968
- onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
969
- onWatcherRerun?: (files: string[], trigger?: string) => Awaitable<void>;
970
- onServerRestart?: (reason?: string) => Awaitable<void>;
971
- onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
972
- onProcessTimeout?: () => Awaitable<void>;
1036
+ interface ReportOptions {
1037
+ clover: CloverOptions;
1038
+ cobertura: CoberturaOptions;
1039
+ "html-spa": HtmlSpaOptions;
1040
+ html: HtmlOptions;
1041
+ json: JsonOptions$1;
1042
+ "json-summary": JsonSummaryOptions;
1043
+ lcov: LcovOptions;
1044
+ lcovonly: LcovOnlyOptions;
1045
+ none: never;
1046
+ teamcity: TeamcityOptions;
1047
+ text: TextOptions;
1048
+ "text-lcov": TextLcovOptions;
1049
+ "text-summary": TextSummaryOptions;
973
1050
  }
974
1051
 
975
- type SerializableSpec = [
976
- project: {
977
- name: string | undefined;
978
- root: string;
979
- },
980
- file: string
981
- ];
1052
+ interface CloverOptions extends FileOptions, ProjectOptions {}
982
1053
 
983
- interface JUnitOptions {
984
- outputFile?: string;
985
- classname?: string;
986
- suiteName?: string;
987
- /**
988
- * Write <system-out> and <system-err> for console output
989
- * @default true
990
- */
991
- includeConsoleOutput?: boolean;
992
- /**
993
- * Add <testcase file="..."> attribute (validated on CIRCLE CI and GitLab CI)
994
- * @default false
995
- */
996
- addFileAttribute?: boolean;
1054
+ interface CoberturaOptions extends FileOptions, ProjectOptions {}
1055
+
1056
+ interface HtmlSpaOptions extends HtmlOptions {
1057
+ metricsToShow: Array<"lines" | "branches" | "functions" | "statements">;
997
1058
  }
998
- declare class JUnitReporter implements Reporter {
999
- private ctx;
1000
- private reportFile?;
1001
- private baseLog;
1002
- private logger;
1003
- private _timeStart;
1004
- private fileFd?;
1005
- private options;
1006
- constructor(options: JUnitOptions);
1007
- onInit(ctx: Vitest): Promise<void>;
1008
- writeElement(name: string, attrs: Record<string, any>, children: () => Promise<void>): Promise<void>;
1009
- writeLogs(task: Task, type: 'err' | 'out'): Promise<void>;
1010
- writeTasks(tasks: Task[], filename: string): Promise<void>;
1011
- onFinished(files?: _vitest_runner.File[]): Promise<void>;
1059
+ interface HtmlOptions {
1060
+ verbose: boolean;
1061
+ skipEmpty: boolean;
1062
+ subdir: string;
1063
+ linkMapper: LinkMapper;
1012
1064
  }
1013
1065
 
1014
- interface HTMLOptions {
1015
- outputFile?: string;
1016
- }
1066
+ type JsonOptions$1 = FileOptions;
1067
+ type JsonSummaryOptions = FileOptions;
1017
1068
 
1018
- interface BaseOptions {
1019
- isTTY?: boolean;
1020
- }
1021
- declare abstract class BaseReporter implements Reporter {
1022
- start: number;
1023
- end: number;
1024
- watchFilters?: string[];
1025
- failedUnwatchedFiles: Task[];
1026
- isTTY: boolean;
1027
- ctx: Vitest;
1028
- protected verbose: boolean;
1029
- private _filesInWatchMode;
1030
- private _lastRunTimeout;
1031
- private _lastRunTimer;
1032
- private _lastRunCount;
1033
- private _timeStart;
1034
- private _offUnhandledRejection?;
1035
- constructor(options?: BaseOptions);
1036
- get mode(): VitestRunMode;
1037
- onInit(ctx: Vitest): void;
1038
- relative(path: string): string;
1039
- onFinished(files?: File[], errors?: unknown[]): void;
1040
- onTaskUpdate(packs: TaskResultPack[]): void;
1041
- protected printTask(task: Task): void;
1042
- onWatcherStart(files?: File[], errors?: unknown[]): void;
1043
- private resetLastRunLog;
1044
- onWatcherRerun(files: string[], trigger?: string): void;
1045
- onUserConsoleLog(log: UserConsoleLog): void;
1046
- shouldLog(log: UserConsoleLog): boolean;
1047
- onServerRestart(reason?: string): void;
1048
- reportSummary(files: File[], errors: unknown[]): void;
1049
- reportTestSummary(files: File[], errors: unknown[]): void;
1050
- private printErrorsSummary;
1051
- reportBenchmarkSummary(files: File[]): void;
1052
- private printTaskErrors;
1053
- registerUnhandledRejection(): void;
1054
- }
1069
+ interface LcovOptions extends FileOptions, ProjectOptions {}
1070
+ interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
1055
1071
 
1056
- declare class BasicReporter extends BaseReporter {
1057
- constructor();
1058
- reportSummary(files: File[], errors: unknown[]): void;
1072
+ interface TeamcityOptions extends FileOptions {
1073
+ blockName: string;
1059
1074
  }
1060
1075
 
1061
- interface ListRendererOptions {
1062
- renderSucceed?: boolean;
1063
- logger: Logger;
1064
- showHeap: boolean;
1065
- slowTestThreshold: number;
1066
- mode: VitestRunMode;
1076
+ interface TextOptions extends FileOptions {
1077
+ maxCols: number;
1078
+ skipEmpty: boolean;
1079
+ skipFull: boolean;
1067
1080
  }
1068
- declare function createListRenderer(_tasks: Task[], options: ListRendererOptions): {
1069
- start(): any;
1070
- update(_tasks: Task[]): any;
1071
- stop(): any;
1072
- clear(): void;
1073
- };
1081
+ type TextLcovOptions = ProjectOptions;
1082
+ type TextSummaryOptions = FileOptions;
1074
1083
 
1075
- declare class DefaultReporter extends BaseReporter {
1076
- renderer?: ReturnType<typeof createListRenderer>;
1077
- rendererOptions: ListRendererOptions;
1078
- private renderSucceedDefault?;
1079
- onPathsCollected(paths?: string[]): void;
1080
- onTestRemoved(trigger?: string): Promise<void>;
1081
- onCollected(): void;
1082
- onFinished(files?: _vitest_runner.File[], errors?: unknown[]): void;
1083
- onWatcherStart(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
1084
- stopListRender(): void;
1085
- onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1086
- onUserConsoleLog(log: UserConsoleLog): void;
1087
- }
1088
-
1089
- interface DotRendererOptions {
1090
- logger: Logger;
1091
- }
1092
- declare function createDotRenderer(_tasks: Task[], options: DotRendererOptions): {
1093
- start(): any;
1094
- update(_tasks: Task[]): any;
1095
- stop(): Promise<any>;
1096
- clear(): void;
1097
- };
1098
-
1099
- declare class DotReporter extends BaseReporter {
1100
- renderer?: ReturnType<typeof createDotRenderer>;
1101
- onCollected(): void;
1102
- onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
1103
- onWatcherStart(): Promise<void>;
1104
- stopListRender(): Promise<void>;
1105
- onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1106
- onUserConsoleLog(log: UserConsoleLog): void;
1107
- }
1108
-
1109
- declare class VerboseReporter extends DefaultReporter {
1110
- protected verbose: boolean;
1111
- constructor();
1112
- onTaskUpdate(packs: TaskResultPack[]): void;
1113
- }
1114
-
1115
- declare class TapReporter implements Reporter {
1116
- protected ctx: Vitest;
1117
- private logger;
1118
- onInit(ctx: Vitest): void;
1119
- static getComment(task: Task): string;
1120
- private logErrorDetails;
1121
- protected logTasks(tasks: Task[]): void;
1122
- onFinished(files?: _vitest_runner.File[]): void;
1123
- }
1124
-
1125
- declare class TapFlatReporter extends TapReporter {
1126
- onInit(ctx: Vitest): void;
1127
- onFinished(files?: _vitest_runner.File[]): void;
1128
- }
1129
-
1130
- declare class HangingProcessReporter implements Reporter {
1131
- whyRunning: (() => void) | undefined;
1132
- onInit(): void;
1133
- onProcessTimeout(): void;
1134
- }
1135
-
1136
- declare class GithubActionsReporter implements Reporter {
1137
- ctx: Vitest;
1138
- onInit(ctx: Vitest): void;
1139
- onFinished(files?: File[], errors?: unknown[]): void;
1140
- }
1141
-
1142
- interface BlobOptions {
1143
- outputFile?: string;
1144
- }
1145
- declare class BlobReporter implements Reporter {
1146
- ctx: Vitest;
1147
- options: BlobOptions;
1148
- constructor(options: BlobOptions);
1149
- onInit(ctx: Vitest): void;
1150
- onFinished(files: File[] | undefined, errors: unknown[] | undefined, coverage: unknown): Promise<void>;
1151
- }
1152
-
1153
- interface TableRendererOptions {
1154
- renderSucceed?: boolean;
1155
- logger: Logger;
1156
- showHeap: boolean;
1157
- slowTestThreshold: number;
1158
- compare?: FlatBenchmarkReport;
1159
- }
1160
- declare function createTableRenderer(_tasks: Task[], options: TableRendererOptions): {
1161
- start(): any;
1162
- update(_tasks: Task[]): any;
1163
- stop(): any;
1164
- clear(): void;
1165
- };
1166
-
1167
- declare class TableReporter extends BaseReporter {
1168
- renderer?: ReturnType<typeof createTableRenderer>;
1169
- rendererOptions: TableRendererOptions;
1170
- onTestRemoved(trigger?: string): void;
1171
- onCollected(): Promise<void>;
1172
- onTaskUpdate(packs: TaskResultPack[]): void;
1173
- onFinished(files?: File[], errors?: unknown[]): Promise<void>;
1174
- onWatcherStart(): Promise<void>;
1175
- stopListRender(): void;
1176
- onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1177
- onUserConsoleLog(log: UserConsoleLog): void;
1178
- }
1179
- interface FlatBenchmarkReport {
1180
- [id: string]: FormattedBenchmarkResult;
1181
- }
1182
- type FormattedBenchmarkResult = Omit<BenchmarkResult, 'samples'> & {
1183
- id: string;
1184
- sampleCount: number;
1185
- median: number;
1186
- };
1187
-
1188
- declare const BenchmarkReportsMap: {
1189
- default: typeof TableReporter;
1190
- verbose: typeof VerboseReporter;
1191
- };
1192
- type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
1193
-
1194
- declare const ReportersMap: {
1195
- default: typeof DefaultReporter;
1196
- basic: typeof BasicReporter;
1197
- blob: typeof BlobReporter;
1198
- verbose: typeof VerboseReporter;
1199
- dot: typeof DotReporter;
1200
- json: typeof JsonReporter;
1201
- tap: typeof TapReporter;
1202
- 'tap-flat': typeof TapFlatReporter;
1203
- junit: typeof JUnitReporter;
1204
- 'hanging-process': typeof HangingProcessReporter;
1205
- 'github-actions': typeof GithubActionsReporter;
1206
- };
1207
- type BuiltinReporters = keyof typeof ReportersMap;
1208
- interface BuiltinReporterOptions {
1209
- 'default': BaseOptions;
1210
- 'basic': BaseOptions;
1211
- 'verbose': never;
1212
- 'dot': BaseOptions;
1213
- 'json': JsonOptions$1;
1214
- 'blob': BlobOptions;
1215
- 'tap': never;
1216
- 'tap-flat': never;
1217
- 'junit': JUnitOptions;
1218
- 'hanging-process': never;
1219
- 'html': HTMLOptions;
1220
- }
1221
-
1222
- type ChaiConfig = Omit<Partial<typeof chai.config>, 'useProxy' | 'proxyExcludedKeys'>;
1223
-
1224
- interface Node {
1225
- isRoot(): boolean;
1226
- visit(visitor: Visitor, state: any): void;
1227
- }
1228
-
1229
- interface Visitor<N extends Node = Node> {
1230
- onStart(root: N, state: any): void;
1231
- onSummary(root: N, state: any): void;
1232
- onDetail(root: N, state: any): void;
1233
- onSummaryEnd(root: N, state: any): void;
1234
- onEnd(root: N, state: any): void;
1235
- }
1236
-
1237
- interface FileOptions {
1238
- file: string;
1239
- }
1240
-
1241
- interface ProjectOptions {
1242
- projectRoot: string;
1243
- }
1244
-
1245
- interface ReportOptions {
1246
- clover: CloverOptions;
1247
- cobertura: CoberturaOptions;
1248
- "html-spa": HtmlSpaOptions;
1249
- html: HtmlOptions;
1250
- json: JsonOptions;
1251
- "json-summary": JsonSummaryOptions;
1252
- lcov: LcovOptions;
1253
- lcovonly: LcovOnlyOptions;
1254
- none: never;
1255
- teamcity: TeamcityOptions;
1256
- text: TextOptions;
1257
- "text-lcov": TextLcovOptions;
1258
- "text-summary": TextSummaryOptions;
1259
- }
1260
-
1261
- interface CloverOptions extends FileOptions, ProjectOptions {}
1262
-
1263
- interface CoberturaOptions extends FileOptions, ProjectOptions {}
1264
-
1265
- interface HtmlSpaOptions extends HtmlOptions {
1266
- metricsToShow: Array<"lines" | "branches" | "functions" | "statements">;
1267
- }
1268
- interface HtmlOptions {
1269
- verbose: boolean;
1270
- skipEmpty: boolean;
1271
- subdir: string;
1272
- linkMapper: LinkMapper;
1273
- }
1274
-
1275
- type JsonOptions = FileOptions;
1276
- type JsonSummaryOptions = FileOptions;
1277
-
1278
- interface LcovOptions extends FileOptions, ProjectOptions {}
1279
- interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
1280
-
1281
- interface TeamcityOptions extends FileOptions {
1282
- blockName: string;
1283
- }
1284
-
1285
- interface TextOptions extends FileOptions {
1286
- maxCols: number;
1287
- skipEmpty: boolean;
1288
- skipFull: boolean;
1289
- }
1290
- type TextLcovOptions = ProjectOptions;
1291
- type TextSummaryOptions = FileOptions;
1292
-
1293
- interface LinkMapper {
1294
- getPath(node: string | Node): string;
1295
- relativePath(source: string | Node, target: string | Node): string;
1296
- assetPath(node: Node, name: string): string;
1297
- }
1298
-
1299
- type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
1300
- type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
1301
- type PromisifyFn<T> = ReturnType$1<T> extends Promise<any> ? T : (...args: ArgumentsType<T>) => Promise<Awaited<ReturnType$1<T>>>;
1302
- type BirpcResolver = (name: string, resolved: (...args: unknown[]) => unknown) => ((...args: unknown[]) => unknown) | undefined;
1303
- interface ChannelOptions {
1304
- /**
1305
- * Function to post raw message
1306
- */
1307
- post: (data: any, ...extras: any[]) => any | Promise<any>;
1308
- /**
1309
- * Listener to receive raw message
1310
- */
1311
- on: (fn: (data: any, ...extras: any[]) => void) => any | Promise<any>;
1312
- /**
1313
- * Custom function to serialize data
1314
- *
1315
- * by default it passes the data as-is
1316
- */
1317
- serialize?: (data: any) => any;
1318
- /**
1319
- * Custom function to deserialize data
1320
- *
1321
- * by default it passes the data as-is
1322
- */
1323
- deserialize?: (data: any) => any;
1324
- }
1325
- interface EventOptions<Remote> {
1326
- /**
1327
- * Names of remote functions that do not need response.
1328
- */
1329
- eventNames?: (keyof Remote)[];
1330
- /**
1331
- * Maximum timeout for waiting for response, in milliseconds.
1332
- *
1333
- * @default 60_000
1334
- */
1335
- timeout?: number;
1336
- /**
1337
- * Custom resolver to resolve function to be called
1338
- *
1339
- * For advanced use cases only
1340
- */
1341
- resolver?: BirpcResolver;
1342
- /**
1343
- * Custom error handler
1344
- */
1345
- onError?: (error: Error, functionName: string, args: any[]) => boolean | void;
1346
- /**
1347
- * Custom error handler for timeouts
1348
- */
1349
- onTimeoutError?: (functionName: string, args: any[]) => boolean | void;
1350
- }
1351
- type BirpcOptions<Remote> = EventOptions<Remote> & ChannelOptions;
1352
- type BirpcFn<T> = PromisifyFn<T> & {
1353
- /**
1354
- * Send event without asking for response
1355
- */
1356
- asEvent: (...args: ArgumentsType<T>) => void;
1357
- };
1358
- type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
1359
- [K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
1360
- } & {
1361
- $functions: LocalFunctions;
1362
- };
1363
-
1364
- type MockFactoryWithHelper<M = unknown> = (importOriginal: <T extends M>() => Promise<T>) => any;
1365
- type MockFactory = () => any;
1366
- type MockMap = Map<string, Record<string, string | null | MockFactory>>;
1367
- interface PendingSuiteMock {
1368
- id: string;
1369
- importer: string;
1370
- type: 'mock' | 'unmock';
1371
- throwIfCached: boolean;
1372
- factory?: MockFactory;
1373
- }
1374
-
1375
- type TransformMode = 'web' | 'ssr';
1376
- interface RuntimeRPC {
1377
- fetch: (id: string, environment: TransformMode) => Promise<{
1378
- externalize?: string;
1379
- id?: string;
1380
- }>;
1381
- transform: (id: string, environment: TransformMode) => Promise<FetchResult>;
1382
- resolveId: (id: string, importer: string | undefined, environment: TransformMode) => Promise<ViteNodeResolveId | null>;
1383
- getSourceMap: (id: string, force?: boolean) => Promise<RawSourceMap | undefined>;
1384
- onFinished: (files: File[], errors?: unknown[]) => void;
1385
- onPathsCollected: (paths: string[]) => void;
1386
- onUserConsoleLog: (log: UserConsoleLog) => void;
1387
- onUnhandledError: (err: unknown, type: string) => void;
1388
- onCollected: (files: File[]) => Promise<void>;
1389
- onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
1390
- onTaskUpdate: (pack: TaskResultPack[]) => Promise<void>;
1391
- onCancel: (reason: CancelReason) => void;
1392
- getCountOfFailedTests: () => number;
1393
- snapshotSaved: (snapshot: SnapshotResult) => void;
1394
- resolveSnapshotPath: (testPath: string) => string;
1395
- }
1396
- interface RunnerRPC {
1397
- onCancel: (reason: CancelReason) => void;
1398
- }
1399
- interface ContextTestEnvironment {
1400
- name: VitestEnvironment;
1401
- transformMode?: TransformMode;
1402
- options: EnvironmentOptions | null;
1403
- }
1404
- interface ResolvedTestEnvironment {
1405
- environment: Environment;
1406
- options: EnvironmentOptions | null;
1407
- }
1408
- interface ContextRPC {
1409
- pool: Pool;
1410
- worker: string;
1411
- workerId: number;
1412
- config: ResolvedConfig;
1413
- projectName: string;
1414
- files: string[];
1415
- environment: ContextTestEnvironment;
1416
- providedContext: Record<string, any>;
1417
- invalidates?: string[];
1418
- }
1419
-
1420
- interface WorkerContext extends ContextRPC {
1421
- port: MessagePort;
1422
- }
1423
- type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
1424
- interface AfterSuiteRunMeta {
1425
- coverage?: unknown;
1426
- transformMode: Environment['transformMode'];
1427
- projectName?: string;
1428
- }
1429
- type WorkerRPC = BirpcReturn<RuntimeRPC, RunnerRPC>;
1430
- interface WorkerGlobalState {
1431
- ctx: ContextRPC;
1432
- config: ResolvedConfig;
1433
- rpc: WorkerRPC;
1434
- current?: Task;
1435
- filepath?: string;
1436
- environment: Environment;
1437
- environmentTeardownRun?: boolean;
1438
- onCancel: Promise<CancelReason>;
1439
- moduleCache: ModuleCacheMap;
1440
- mockMap: MockMap;
1441
- providedContext: Record<string, any>;
1442
- durations: {
1443
- environment: number;
1444
- prepare: number;
1445
- };
1084
+ interface LinkMapper {
1085
+ getPath(node: string | Node): string;
1086
+ relativePath(source: string | Node, target: string | Node): string;
1087
+ assetPath(node: Node, name: string): string;
1446
1088
  }
1447
1089
 
1448
1090
  type TransformResult = string | Partial<TransformResult$1> | undefined | null | void;
@@ -1490,8 +1132,8 @@ interface CoverageProviderModule {
1490
1132
  }
1491
1133
  type CoverageReporter = keyof ReportOptions | (string & {});
1492
1134
  type CoverageReporterWithOptions<ReporterName extends CoverageReporter = CoverageReporter> = ReporterName extends keyof ReportOptions ? ReportOptions[ReporterName] extends never ? [ReporterName, object] : [ReporterName, Partial<ReportOptions[ReporterName]>] : [ReporterName, Record<string, unknown>];
1493
- type Provider = 'v8' | 'istanbul' | 'custom' | undefined;
1494
- type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? {
1135
+ type CoverageProviderName = 'v8' | 'istanbul' | 'custom' | undefined;
1136
+ type CoverageOptions<T extends CoverageProviderName = CoverageProviderName> = T extends 'istanbul' ? {
1495
1137
  provider: T;
1496
1138
  } & CoverageIstanbulOptions : T extends 'v8' ? {
1497
1139
  /**
@@ -1507,7 +1149,7 @@ type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? {
1507
1149
  } & CoverageV8Options;
1508
1150
  /** Fields that have default values. Internally these will always be defined. */
1509
1151
  type FieldsWithDefaultValues = 'enabled' | 'clean' | 'cleanOnRerun' | 'reportsDirectory' | 'exclude' | 'extension' | 'reportOnFailure' | 'allowExternal' | 'processingConcurrency';
1510
- type ResolvedCoverageOptions<T extends Provider = Provider> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
1152
+ type ResolvedCoverageOptions<T extends CoverageProviderName = CoverageProviderName> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
1511
1153
  reporter: CoverageReporterWithOptions[];
1512
1154
  };
1513
1155
  interface BaseCoverageOptions {
@@ -1649,125 +1291,456 @@ interface Thresholds {
1649
1291
  /** Check thresholds per file. */
1650
1292
  perFile?: boolean;
1651
1293
  /**
1652
- * Update threshold values automatically when current coverage is higher than earlier thresholds
1653
- *
1654
- * @default false
1294
+ * Update threshold values automatically when current coverage is higher than earlier thresholds
1295
+ *
1296
+ * @default false
1297
+ */
1298
+ autoUpdate?: boolean;
1299
+ /** Thresholds for statements */
1300
+ statements?: number;
1301
+ /** Thresholds for functions */
1302
+ functions?: number;
1303
+ /** Thresholds for branches */
1304
+ branches?: number;
1305
+ /** Thresholds for lines */
1306
+ lines?: number;
1307
+ }
1308
+
1309
+ interface VitestOptions {
1310
+ packageInstaller?: VitestPackageInstaller;
1311
+ stdin?: NodeJS.ReadStream;
1312
+ stdout?: NodeJS.WriteStream | Writable;
1313
+ stderr?: NodeJS.WriteStream | Writable;
1314
+ }
1315
+ declare class Vitest {
1316
+ readonly mode: VitestRunMode;
1317
+ version: string;
1318
+ config: ResolvedConfig;
1319
+ configOverride: Partial<ResolvedConfig>;
1320
+ server: ViteDevServer;
1321
+ state: StateManager;
1322
+ snapshot: SnapshotManager;
1323
+ cache: VitestCache;
1324
+ reporters: Reporter[];
1325
+ coverageProvider: CoverageProvider | null | undefined;
1326
+ logger: Logger;
1327
+ pool: ProcessPool | undefined;
1328
+ vitenode: ViteNodeServer;
1329
+ invalidates: Set<string>;
1330
+ changedTests: Set<string>;
1331
+ watchedTests: Set<string>;
1332
+ filenamePattern?: string;
1333
+ runningPromise?: Promise<void>;
1334
+ closingPromise?: Promise<void>;
1335
+ isCancelling: boolean;
1336
+ isFirstRun: boolean;
1337
+ restartsCount: number;
1338
+ runner: ViteNodeRunner;
1339
+ packageInstaller: VitestPackageInstaller;
1340
+ private coreWorkspaceProject;
1341
+ private resolvedProjects;
1342
+ projects: WorkspaceProject[];
1343
+ private projectsTestFiles;
1344
+ distPath: string;
1345
+ constructor(mode: VitestRunMode, options?: VitestOptions);
1346
+ private _onRestartListeners;
1347
+ private _onClose;
1348
+ private _onSetServer;
1349
+ private _onCancelListeners;
1350
+ setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
1351
+ provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
1352
+ private createCoreProject;
1353
+ getCoreWorkspaceProject(): WorkspaceProject;
1354
+ getProjectByTaskId(taskId: string): WorkspaceProject;
1355
+ getProjectByName(name?: string): WorkspaceProject;
1356
+ private getWorkspaceConfigPath;
1357
+ private resolveWorkspace;
1358
+ private initCoverageProvider;
1359
+ private initBrowserProviders;
1360
+ mergeReports(): Promise<void>;
1361
+ collect(filters?: string[]): Promise<{
1362
+ tests: File[];
1363
+ errors: unknown[];
1364
+ }>;
1365
+ start(filters?: string[]): Promise<void>;
1366
+ init(): Promise<void>;
1367
+ private getTestDependencies;
1368
+ filterTestsBySource(specs: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
1369
+ getProjectsByTestFile(file: string): WorkspaceSpec[];
1370
+ initializeGlobalSetup(paths: WorkspaceSpec[]): Promise<void>;
1371
+ private initializeDistPath;
1372
+ runFiles(specs: WorkspaceSpec[], allTestsRun: boolean): Promise<void>;
1373
+ collectFiles(specs: WorkspaceSpec[]): Promise<void>;
1374
+ cancelCurrentRun(reason: CancelReason): Promise<void>;
1375
+ rerunFiles(files?: string[], trigger?: string): Promise<void>;
1376
+ changeProjectName(pattern: string): Promise<void>;
1377
+ changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
1378
+ changeFilenamePattern(pattern: string, files?: string[]): Promise<void>;
1379
+ rerunFailed(): Promise<void>;
1380
+ updateSnapshot(files?: string[]): Promise<void>;
1381
+ private _rerunTimer;
1382
+ private scheduleRerun;
1383
+ getModuleProjects(filepath: string): WorkspaceProject[];
1384
+ /**
1385
+ * Watch only the specified tests. If no tests are provided, all tests will be watched.
1386
+ */
1387
+ watchTests(tests: string[]): void;
1388
+ private unregisterWatcher;
1389
+ private registerWatcher;
1390
+ /**
1391
+ * @returns A value indicating whether rerun is needed (changedTests was mutated)
1392
+ */
1393
+ private handleFileChanged;
1394
+ private reportCoverage;
1395
+ close(): Promise<void>;
1396
+ /**
1397
+ * Close the thread pool and exit the process
1398
+ */
1399
+ exit(force?: boolean): Promise<void>;
1400
+ report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
1401
+ getTestFilepaths(): Promise<string[]>;
1402
+ globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
1403
+ shouldKeepServer(): boolean;
1404
+ onServerRestart(fn: OnServerRestartHandler): void;
1405
+ onAfterSetServer(fn: OnServerRestartHandler): void;
1406
+ onCancel(fn: (reason: CancelReason) => void): void;
1407
+ onClose(fn: () => void): void;
1408
+ }
1409
+
1410
+ type SerializedSpec = [
1411
+ project: {
1412
+ name: string | undefined;
1413
+ root: string;
1414
+ },
1415
+ file: string
1416
+ ];
1417
+
1418
+ interface Reporter {
1419
+ onInit?: (ctx: Vitest) => void;
1420
+ onPathsCollected?: (paths?: string[]) => Awaitable<void>;
1421
+ onSpecsCollected?: (specs?: SerializedSpec[]) => Awaitable<void>;
1422
+ onCollected?: (files?: File[]) => Awaitable<void>;
1423
+ onFinished?: (files: File[], errors: unknown[], coverage?: unknown) => Awaitable<void>;
1424
+ onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
1425
+ onTestRemoved?: (trigger?: string) => Awaitable<void>;
1426
+ onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
1427
+ onWatcherRerun?: (files: string[], trigger?: string) => Awaitable<void>;
1428
+ onServerRestart?: (reason?: string) => Awaitable<void>;
1429
+ onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
1430
+ onProcessTimeout?: () => Awaitable<void>;
1431
+ }
1432
+
1433
+ interface BaseOptions {
1434
+ isTTY?: boolean;
1435
+ }
1436
+ declare abstract class BaseReporter implements Reporter {
1437
+ start: number;
1438
+ end: number;
1439
+ watchFilters?: string[];
1440
+ failedUnwatchedFiles: Task[];
1441
+ isTTY: boolean;
1442
+ ctx: Vitest;
1443
+ protected verbose: boolean;
1444
+ private _filesInWatchMode;
1445
+ private _lastRunTimeout;
1446
+ private _lastRunTimer;
1447
+ private _lastRunCount;
1448
+ private _timeStart;
1449
+ private _offUnhandledRejection?;
1450
+ constructor(options?: BaseOptions);
1451
+ get mode(): VitestRunMode;
1452
+ onInit(ctx: Vitest): void;
1453
+ relative(path: string): string;
1454
+ onFinished(files?: File[], errors?: unknown[]): void;
1455
+ onTaskUpdate(packs: TaskResultPack[]): void;
1456
+ protected printTask(task: Task): void;
1457
+ onWatcherStart(files?: File[], errors?: unknown[]): void;
1458
+ private resetLastRunLog;
1459
+ onWatcherRerun(files: string[], trigger?: string): void;
1460
+ onUserConsoleLog(log: UserConsoleLog): void;
1461
+ shouldLog(log: UserConsoleLog): boolean;
1462
+ onServerRestart(reason?: string): void;
1463
+ reportSummary(files: File[], errors: unknown[]): void;
1464
+ reportTestSummary(files: File[], errors: unknown[]): void;
1465
+ private printErrorsSummary;
1466
+ reportBenchmarkSummary(files: File[]): void;
1467
+ private printTaskErrors;
1468
+ registerUnhandledRejection(): void;
1469
+ }
1470
+
1471
+ declare class BasicReporter extends BaseReporter {
1472
+ constructor();
1473
+ reportSummary(files: File[], errors: unknown[]): void;
1474
+ }
1475
+
1476
+ interface ListRendererOptions {
1477
+ renderSucceed?: boolean;
1478
+ logger: Logger;
1479
+ showHeap: boolean;
1480
+ slowTestThreshold: number;
1481
+ mode: VitestRunMode;
1482
+ }
1483
+ declare function createListRenderer(_tasks: Task[], options: ListRendererOptions): {
1484
+ start(): any;
1485
+ update(_tasks: Task[]): any;
1486
+ stop(): any;
1487
+ clear(): void;
1488
+ };
1489
+
1490
+ declare class DefaultReporter extends BaseReporter {
1491
+ renderer?: ReturnType<typeof createListRenderer>;
1492
+ rendererOptions: ListRendererOptions;
1493
+ private renderSucceedDefault?;
1494
+ onPathsCollected(paths?: string[]): void;
1495
+ onTestRemoved(trigger?: string): Promise<void>;
1496
+ onCollected(): void;
1497
+ onFinished(files?: _vitest_runner.File[], errors?: unknown[]): void;
1498
+ onWatcherStart(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
1499
+ stopListRender(): void;
1500
+ onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1501
+ onUserConsoleLog(log: UserConsoleLog): void;
1502
+ }
1503
+
1504
+ interface DotRendererOptions {
1505
+ logger: Logger;
1506
+ }
1507
+ declare function createDotRenderer(_tasks: Task[], options: DotRendererOptions): {
1508
+ start(): any;
1509
+ update(_tasks: Task[]): any;
1510
+ stop(): Promise<any>;
1511
+ clear(): void;
1512
+ };
1513
+
1514
+ declare class DotReporter extends BaseReporter {
1515
+ renderer?: ReturnType<typeof createDotRenderer>;
1516
+ onCollected(): void;
1517
+ onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
1518
+ onWatcherStart(): Promise<void>;
1519
+ stopListRender(): Promise<void>;
1520
+ onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1521
+ onUserConsoleLog(log: UserConsoleLog): void;
1522
+ }
1523
+
1524
+ type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';
1525
+ type Milliseconds = number;
1526
+ interface Callsite {
1527
+ line: number;
1528
+ column: number;
1529
+ }
1530
+ interface JsonAssertionResult {
1531
+ ancestorTitles: Array<string>;
1532
+ fullName: string;
1533
+ status: Status;
1534
+ title: string;
1535
+ meta: TaskMeta;
1536
+ duration?: Milliseconds | null;
1537
+ failureMessages: Array<string> | null;
1538
+ location?: Callsite | null;
1539
+ }
1540
+ interface JsonTestResult {
1541
+ message: string;
1542
+ name: string;
1543
+ status: 'failed' | 'passed';
1544
+ startTime: number;
1545
+ endTime: number;
1546
+ assertionResults: Array<JsonAssertionResult>;
1547
+ }
1548
+ interface JsonTestResults {
1549
+ numFailedTests: number;
1550
+ numFailedTestSuites: number;
1551
+ numPassedTests: number;
1552
+ numPassedTestSuites: number;
1553
+ numPendingTests: number;
1554
+ numPendingTestSuites: number;
1555
+ numTodoTests: number;
1556
+ numTotalTests: number;
1557
+ numTotalTestSuites: number;
1558
+ startTime: number;
1559
+ success: boolean;
1560
+ testResults: Array<JsonTestResult>;
1561
+ snapshot: SnapshotSummary;
1562
+ }
1563
+ interface JsonOptions {
1564
+ outputFile?: string;
1565
+ }
1566
+ declare class JsonReporter implements Reporter {
1567
+ start: number;
1568
+ ctx: Vitest;
1569
+ options: JsonOptions;
1570
+ constructor(options: JsonOptions);
1571
+ onInit(ctx: Vitest): void;
1572
+ protected logTasks(files: File[]): Promise<void>;
1573
+ onFinished(files?: File[]): Promise<void>;
1574
+ /**
1575
+ * Writes the report to an output file if specified in the config,
1576
+ * or logs it to the console otherwise.
1577
+ * @param report
1655
1578
  */
1656
- autoUpdate?: boolean;
1657
- /** Thresholds for statements */
1658
- statements?: number;
1659
- /** Thresholds for functions */
1660
- functions?: number;
1661
- /** Thresholds for branches */
1662
- branches?: number;
1663
- /** Thresholds for lines */
1664
- lines?: number;
1579
+ writeReport(report: string): Promise<void>;
1665
1580
  }
1666
1581
 
1667
- interface JSDOMOptions {
1668
- /**
1669
- * The html content for the test.
1670
- *
1671
- * @default '<!DOCTYPE html>'
1672
- */
1673
- html?: string | Buffer | ArrayBufferLike;
1674
- /**
1675
- * referrer just affects the value read from document.referrer.
1676
- * It defaults to no referrer (which reflects as the empty string).
1677
- */
1678
- referrer?: string;
1679
- /**
1680
- * userAgent affects the value read from navigator.userAgent, as well as the User-Agent header sent while fetching subresources.
1681
- *
1682
- * @default `Mozilla/5.0 (${process.platform}) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/${jsdomVersion}`
1683
- */
1684
- userAgent?: string;
1685
- /**
1686
- * url sets the value returned by window.location, document.URL, and document.documentURI,
1687
- * and affects things like resolution of relative URLs within the document
1688
- * and the same-origin restrictions and referrer used while fetching subresources.
1689
- *
1690
- * @default 'http://localhost:3000'.
1691
- */
1692
- url?: string;
1693
- /**
1694
- * contentType affects the value read from document.contentType, and how the document is parsed: as HTML or as XML.
1695
- * Values that are not "text/html" or an XML mime type will throw.
1696
- *
1697
- * @default 'text/html'.
1698
- */
1699
- contentType?: string;
1700
- /**
1701
- * The maximum size in code units for the separate storage areas used by localStorage and sessionStorage.
1702
- * Attempts to store data larger than this limit will cause a DOMException to be thrown. By default, it is set
1703
- * to 5,000,000 code units per origin, as inspired by the HTML specification.
1704
- *
1705
- * @default 5_000_000
1706
- */
1707
- storageQuota?: number;
1708
- /**
1709
- * Enable console?
1710
- *
1711
- * @default false
1712
- */
1713
- console?: boolean;
1582
+ declare class VerboseReporter extends DefaultReporter {
1583
+ protected verbose: boolean;
1584
+ constructor();
1585
+ onTaskUpdate(packs: TaskResultPack[]): void;
1586
+ }
1587
+
1588
+ declare class TapReporter implements Reporter {
1589
+ protected ctx: Vitest;
1590
+ private logger;
1591
+ onInit(ctx: Vitest): void;
1592
+ static getComment(task: Task): string;
1593
+ private logErrorDetails;
1594
+ protected logTasks(tasks: Task[]): void;
1595
+ onFinished(files?: _vitest_runner.File[]): void;
1596
+ }
1597
+
1598
+ interface JUnitOptions {
1599
+ outputFile?: string;
1600
+ classname?: string;
1601
+ suiteName?: string;
1714
1602
  /**
1715
- * jsdom does not have the capability to render visual content, and will act like a headless browser by default.
1716
- * It provides hints to web pages through APIs such as document.hidden that their content is not visible.
1717
- *
1718
- * When the `pretendToBeVisual` option is set to `true`, jsdom will pretend that it is rendering and displaying
1719
- * content.
1720
- *
1603
+ * Write <system-out> and <system-err> for console output
1721
1604
  * @default true
1722
1605
  */
1723
- pretendToBeVisual?: boolean;
1606
+ includeConsoleOutput?: boolean;
1724
1607
  /**
1725
- * `includeNodeLocations` preserves the location info produced by the HTML parser,
1726
- * allowing you to retrieve it with the nodeLocation() method (described below).
1727
- *
1728
- * It defaults to false to give the best performance,
1729
- * and cannot be used with an XML content type since our XML parser does not support location info.
1730
- *
1608
+ * Add <testcase file="..."> attribute (validated on CIRCLE CI and GitLab CI)
1731
1609
  * @default false
1732
1610
  */
1733
- includeNodeLocations?: boolean | undefined;
1734
- /**
1735
- * @default 'dangerously'
1736
- */
1737
- runScripts?: 'dangerously' | 'outside-only';
1611
+ addFileAttribute?: boolean;
1612
+ }
1613
+ declare class JUnitReporter implements Reporter {
1614
+ private ctx;
1615
+ private reportFile?;
1616
+ private baseLog;
1617
+ private logger;
1618
+ private _timeStart;
1619
+ private fileFd?;
1620
+ private options;
1621
+ constructor(options: JUnitOptions);
1622
+ onInit(ctx: Vitest): Promise<void>;
1623
+ writeElement(name: string, attrs: Record<string, any>, children: () => Promise<void>): Promise<void>;
1624
+ writeLogs(task: Task, type: 'err' | 'out'): Promise<void>;
1625
+ writeTasks(tasks: Task[], filename: string): Promise<void>;
1626
+ onFinished(files?: _vitest_runner.File[]): Promise<void>;
1627
+ }
1628
+
1629
+ declare class TapFlatReporter extends TapReporter {
1630
+ onInit(ctx: Vitest): void;
1631
+ onFinished(files?: _vitest_runner.File[]): void;
1632
+ }
1633
+
1634
+ declare class HangingProcessReporter implements Reporter {
1635
+ whyRunning: (() => void) | undefined;
1636
+ onInit(): void;
1637
+ onProcessTimeout(): void;
1638
+ }
1639
+
1640
+ declare class GithubActionsReporter implements Reporter {
1641
+ ctx: Vitest;
1642
+ onInit(ctx: Vitest): void;
1643
+ onFinished(files?: File[], errors?: unknown[]): void;
1644
+ }
1645
+
1646
+ interface HTMLOptions {
1647
+ outputFile?: string;
1648
+ }
1649
+
1650
+ interface BlobOptions {
1651
+ outputFile?: string;
1652
+ }
1653
+ declare class BlobReporter implements Reporter {
1654
+ ctx: Vitest;
1655
+ options: BlobOptions;
1656
+ constructor(options: BlobOptions);
1657
+ onInit(ctx: Vitest): void;
1658
+ onFinished(files: File[] | undefined, errors: unknown[] | undefined, coverage: unknown): Promise<void>;
1659
+ }
1660
+
1661
+ interface TableRendererOptions {
1662
+ renderSucceed?: boolean;
1663
+ logger: Logger;
1664
+ showHeap: boolean;
1665
+ slowTestThreshold: number;
1666
+ compare?: FlatBenchmarkReport;
1667
+ }
1668
+ declare function createTableRenderer(_tasks: Task[], options: TableRendererOptions): {
1669
+ start(): any;
1670
+ update(_tasks: Task[]): any;
1671
+ stop(): any;
1672
+ clear(): void;
1673
+ };
1674
+
1675
+ declare class TableReporter extends BaseReporter {
1676
+ renderer?: ReturnType<typeof createTableRenderer>;
1677
+ rendererOptions: TableRendererOptions;
1678
+ onTestRemoved(trigger?: string): void;
1679
+ onCollected(): Promise<void>;
1680
+ onTaskUpdate(packs: TaskResultPack[]): void;
1681
+ onFinished(files?: File[], errors?: unknown[]): Promise<void>;
1682
+ onWatcherStart(): Promise<void>;
1683
+ stopListRender(): void;
1684
+ onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1685
+ onUserConsoleLog(log: UserConsoleLog): void;
1686
+ }
1687
+ interface FlatBenchmarkReport {
1688
+ [id: string]: FormattedBenchmarkResult;
1689
+ }
1690
+ type FormattedBenchmarkResult = Omit<BenchmarkResult, 'samples'> & {
1691
+ id: string;
1692
+ sampleCount: number;
1693
+ median: number;
1694
+ };
1695
+
1696
+ declare const BenchmarkReportsMap: {
1697
+ default: typeof TableReporter;
1698
+ verbose: typeof VerboseReporter;
1699
+ };
1700
+ type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
1701
+
1702
+ declare const ReportersMap: {
1703
+ default: typeof DefaultReporter;
1704
+ basic: typeof BasicReporter;
1705
+ blob: typeof BlobReporter;
1706
+ verbose: typeof VerboseReporter;
1707
+ dot: typeof DotReporter;
1708
+ json: typeof JsonReporter;
1709
+ tap: typeof TapReporter;
1710
+ 'tap-flat': typeof TapFlatReporter;
1711
+ junit: typeof JUnitReporter;
1712
+ 'hanging-process': typeof HangingProcessReporter;
1713
+ 'github-actions': typeof GithubActionsReporter;
1714
+ };
1715
+ type BuiltinReporters = keyof typeof ReportersMap;
1716
+ interface BuiltinReporterOptions {
1717
+ 'default': BaseOptions;
1718
+ 'basic': BaseOptions;
1719
+ 'verbose': never;
1720
+ 'dot': BaseOptions;
1721
+ 'json': JsonOptions;
1722
+ 'blob': BlobOptions;
1723
+ 'tap': never;
1724
+ 'tap-flat': never;
1725
+ 'junit': JUnitOptions;
1726
+ 'hanging-process': never;
1727
+ 'html': HTMLOptions;
1728
+ }
1729
+
1730
+ interface TestSequencer {
1738
1731
  /**
1739
- * Enable CookieJar
1740
- *
1741
- * @default false
1732
+ * Slicing tests into shards. Will be run before `sort`.
1733
+ * Only run, if `shard` is defined.
1742
1734
  */
1743
- cookieJar?: boolean;
1744
- resources?: 'usable' | any;
1735
+ shard: (files: WorkspaceSpec[]) => Awaitable<WorkspaceSpec[]>;
1736
+ sort: (files: WorkspaceSpec[]) => Awaitable<WorkspaceSpec[]>;
1745
1737
  }
1746
-
1747
- /**
1748
- * Happy DOM options.
1749
- */
1750
- interface HappyDOMOptions {
1751
- width?: number;
1752
- height?: number;
1753
- url?: string;
1754
- settings?: {
1755
- disableJavaScriptEvaluation?: boolean;
1756
- disableJavaScriptFileLoading?: boolean;
1757
- disableCSSFileLoading?: boolean;
1758
- disableIframePageLoading?: boolean;
1759
- disableComputedStyleRendering?: boolean;
1760
- enableFileSystemHttpRequests?: boolean;
1761
- navigator?: {
1762
- userAgent?: string;
1763
- };
1764
- device?: {
1765
- prefersColorScheme?: string;
1766
- mediaType?: string;
1767
- };
1768
- };
1738
+ interface TestSequencerConstructor {
1739
+ new (ctx: Vitest): TestSequencer;
1769
1740
  }
1770
1741
 
1742
+ type ChaiConfig = Omit<Partial<typeof chai.config>, 'useProxy' | 'proxyExcludedKeys'>;
1743
+
1771
1744
  interface BenchmarkUserOptions {
1772
1745
  /**
1773
1746
  * Include globs for benchmark test files
@@ -1807,25 +1780,9 @@ interface BenchmarkUserOptions {
1807
1780
  */
1808
1781
  outputJson?: string;
1809
1782
  }
1810
- interface Benchmark extends Custom {
1811
- meta: {
1812
- benchmark: true;
1813
- result?: TaskResult;
1814
- };
1815
- }
1816
- interface BenchmarkResult extends TaskResult {
1817
- name: string;
1818
- rank: number;
1819
- }
1820
- type BenchFunction = (this: Bench) => Promise<void> | void;
1821
- type ChainableBenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', (name: string | Function, fn?: BenchFunction, options?: Options$1) => void>;
1822
- type BenchmarkAPI = ChainableBenchmarkAPI & {
1823
- skipIf: (condition: any) => ChainableBenchmarkAPI;
1824
- runIf: (condition: any) => ChainableBenchmarkAPI;
1825
- };
1826
1783
 
1827
1784
  declare const defaultBrowserPort = 63315;
1828
- declare const extraInlineDeps: (string | RegExp)[];
1785
+ declare const extraInlineDeps: RegExp[];
1829
1786
 
1830
1787
  declare const defaultInclude: string[];
1831
1788
  declare const defaultExclude: string[];
@@ -1840,6 +1797,8 @@ declare const configDefaults: Readonly<{
1840
1797
  clearMocks: false;
1841
1798
  restoreMocks: false;
1842
1799
  mockReset: false;
1800
+ unstubGlobals: false;
1801
+ unstubEnvs: false;
1843
1802
  include: string[];
1844
1803
  exclude: string[];
1845
1804
  teardownTimeout: number;
@@ -1886,11 +1845,18 @@ declare function defineConfig(config: UserConfig$1): UserConfig$1;
1886
1845
  declare function defineConfig(config: Promise<UserConfig$1>): Promise<UserConfig$1>;
1887
1846
  declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
1888
1847
  declare function defineConfig(config: UserConfigExport): UserConfigExport;
1889
- declare function defineProject<T extends UserProjectConfigExport>(config: T): T;
1890
- type Workspace = string | (UserProjectConfigExport & {
1848
+ declare function defineProject(config: UserWorkspaceConfig): UserWorkspaceConfig;
1849
+ declare function defineProject(config: Promise<UserWorkspaceConfig>): Promise<UserWorkspaceConfig>;
1850
+ declare function defineProject(config: UserProjectConfigFn): UserProjectConfigFn;
1851
+ declare function defineProject(config: UserProjectConfigExport): UserProjectConfigExport;
1852
+ type WorkspaceProjectConfiguration = string | (UserProjectConfigExport & {
1853
+ /**
1854
+ * Relative path to the extendable config. All other options will be merged with this config.
1855
+ * @example '../vite.config.ts'
1856
+ */
1891
1857
  extends?: string;
1892
1858
  });
1893
- declare function defineWorkspace(config: Workspace[]): Workspace[];
1859
+ declare function defineWorkspace(config: WorkspaceProjectConfiguration[]): WorkspaceProjectConfiguration[];
1894
1860
 
1895
1861
  type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
1896
1862
  type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
@@ -1898,14 +1864,6 @@ type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
1898
1864
  type CSSModuleScopeStrategy = 'stable' | 'scoped' | 'non-scoped';
1899
1865
  type ApiConfig = Pick<ServerOptions, 'port' | 'strictPort' | 'host' | 'middlewareMode'>;
1900
1866
 
1901
- interface EnvironmentOptions {
1902
- /**
1903
- * jsdom options.
1904
- */
1905
- jsdom?: JSDOMOptions;
1906
- happyDOM?: HappyDOMOptions;
1907
- [x: string]: unknown;
1908
- }
1909
1867
  type VitestRunMode = 'test' | 'benchmark';
1910
1868
  interface SequenceOptions {
1911
1869
  /**
@@ -2397,7 +2355,7 @@ interface InlineConfig {
2397
2355
  *
2398
2356
  * Return `false` to omit the frame.
2399
2357
  */
2400
- onStackTrace?: (error: Error, frame: ParsedStack) => boolean | void;
2358
+ onStackTrace?: (error: ErrorWithDiff, frame: ParsedStack) => boolean | void;
2401
2359
  /**
2402
2360
  * Indicates if CSS files should be processed.
2403
2361
  *
@@ -2668,10 +2626,13 @@ interface UserConfig extends InlineConfig {
2668
2626
  */
2669
2627
  mergeReports?: string;
2670
2628
  }
2671
- 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'> {
2629
+ 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' | 'setupFiles' | 'snapshotEnvironment' | 'bail'> {
2672
2630
  mode: VitestRunMode;
2673
2631
  base?: string;
2674
2632
  diff?: string;
2633
+ bail?: number;
2634
+ setupFiles: string[];
2635
+ snapshotEnvironment?: string;
2675
2636
  config?: string;
2676
2637
  filters?: string[];
2677
2638
  testNamePattern?: RegExp;
@@ -2711,7 +2672,8 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
2711
2672
  maxWorkers: number;
2712
2673
  minWorkers: number;
2713
2674
  }
2714
- 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'> & {
2675
+ type NonProjectOptions = 'shard' | 'watch' | 'run' | 'cache' | 'update' | 'reporters' | 'outputFile' | 'teardownTimeout' | 'silent' | 'forceRerunTriggers' | 'testNamePattern' | 'ui' | 'open' | 'uiBase' | 'snapshotFormat' | 'resolveSnapshotPath' | 'passWithNoTests' | 'onConsoleLog' | 'onStackTrace' | 'dangerouslyIgnoreUnhandledErrors' | 'slowTestThreshold' | 'inspect' | 'inspectBrk' | 'coverage' | 'maxWorkers' | 'minWorkers' | 'fileParallelism';
2676
+ type ProjectConfig = Omit<UserConfig, NonProjectOptions | 'sequencer' | 'deps' | 'poolOptions'> & {
2715
2677
  sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
2716
2678
  deps?: Omit<DepsOptions, 'moduleDirectories'>;
2717
2679
  poolOptions?: {
@@ -2720,12 +2682,7 @@ type ProjectConfig = Omit<UserConfig, 'sequencer' | 'shard' | 'watch' | 'run' |
2720
2682
  forks?: Pick<NonNullable<PoolOptions['forks']>, 'singleFork' | 'isolate'>;
2721
2683
  };
2722
2684
  };
2723
- type RuntimeConfig = Pick<UserConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency' | 'expect' | 'printConsoleTrace'> & {
2724
- sequence?: {
2725
- concurrent?: boolean;
2726
- hooks?: SequenceHooks;
2727
- };
2728
- };
2685
+ type ResolvedProjectConfig = Omit<ResolvedConfig, NonProjectOptions>;
2729
2686
 
2730
2687
  type VitestInlineConfig = InlineConfig;
2731
2688
  declare module 'vite' {
@@ -2737,101 +2694,4 @@ declare module 'vite' {
2737
2694
  }
2738
2695
  }
2739
2696
 
2740
- declare global {
2741
- namespace Chai {
2742
- interface Assertion {
2743
- containSubset: (expected: any) => Assertion;
2744
- }
2745
- interface Assert {
2746
- containSubset: (val: any, exp: any, msg?: string) => void;
2747
- }
2748
- }
2749
- }
2750
- interface SnapshotMatcher<T> {
2751
- <U extends {
2752
- [P in keyof T]: any;
2753
- }>(snapshot: Partial<U>, message?: string): void;
2754
- (message?: string): void;
2755
- }
2756
- interface InlineSnapshotMatcher<T> {
2757
- <U extends {
2758
- [P in keyof T]: any;
2759
- }>(properties: Partial<U>, snapshot?: string, message?: string): void;
2760
- (message?: string): void;
2761
- }
2762
- declare module '@vitest/expect' {
2763
- interface MatcherState {
2764
- environment: VitestEnvironment;
2765
- snapshotState: SnapshotState;
2766
- }
2767
- interface ExpectPollOptions {
2768
- interval?: number;
2769
- timeout?: number;
2770
- message?: string;
2771
- }
2772
- interface ExpectStatic {
2773
- unreachable: (message?: string) => never;
2774
- soft: <T>(actual: T, message?: string) => Assertion<T>;
2775
- poll: <T>(actual: () => T, options?: ExpectPollOptions) => PromisifyAssertion<Awaited<T>>;
2776
- addEqualityTesters: (testers: Array<Tester>) => void;
2777
- assertions: (expected: number) => void;
2778
- hasAssertions: () => void;
2779
- addSnapshotSerializer: (plugin: Plugin) => void;
2780
- }
2781
- interface Assertion<T> {
2782
- matchSnapshot: SnapshotMatcher<T>;
2783
- toMatchSnapshot: SnapshotMatcher<T>;
2784
- toMatchInlineSnapshot: InlineSnapshotMatcher<T>;
2785
- toThrowErrorMatchingSnapshot: (message?: string) => void;
2786
- toThrowErrorMatchingInlineSnapshot: (snapshot?: string, message?: string) => void;
2787
- toMatchFileSnapshot: (filepath: string, message?: string) => Promise<void>;
2788
- }
2789
- }
2790
- declare module '@vitest/runner' {
2791
- interface TestContext {
2792
- expect: ExpectStatic;
2793
- }
2794
- interface TaskMeta {
2795
- typecheck?: boolean;
2796
- benchmark?: boolean;
2797
- failScreenshotPath?: string;
2798
- }
2799
- interface File {
2800
- prepareDuration?: number;
2801
- environmentLoad?: number;
2802
- }
2803
- interface TaskBase {
2804
- logs?: UserConsoleLog[];
2805
- }
2806
- interface TaskResult {
2807
- benchmark?: BenchmarkResult;
2808
- }
2809
- }
2810
-
2811
- type RawErrsMap = Map<string, TscErrorInfo[]>;
2812
- interface TscErrorInfo {
2813
- filePath: string;
2814
- errCode: number;
2815
- errMsg: string;
2816
- line: number;
2817
- column: number;
2818
- }
2819
- interface CollectLineNumbers {
2820
- target: number;
2821
- next: number;
2822
- prev?: number;
2823
- }
2824
- type CollectLines = {
2825
- [key in keyof CollectLineNumbers]: string;
2826
- };
2827
- interface RootAndTarget {
2828
- root: string;
2829
- targetAbsPath: string;
2830
- }
2831
- type Context = RootAndTarget & {
2832
- rawErrsMap: RawErrsMap;
2833
- openedDirs: Set<string>;
2834
- lastActivePath?: string;
2835
- };
2836
-
2837
- 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 };
2697
+ export { type BrowserBuiltinProvider as $, type ApiConfig as A, type BaseCoverageOptions as B, type CoverageProvider as C, type DepsOptimizationOptions as D, type BenchmarkUserOptions as E, type VitestOptions as F, type TestSequencer as G, type WorkspaceSpec as H, type InlineConfig as I, type ProcessPool as J, getFilePoolName as K, Logger as L, VitestPackageInstaller as M, type TestSequencerConstructor as N, type BrowserProviderInitializationOptions as O, type Pool as P, type BrowserProvider as Q, type ResolvedCoverageOptions as R, type SerializedSpec as S, type TscErrorInfo as T, type UserConfig as U, type VitestEnvironment as V, WorkspaceProject as W, type CDPSession as X, type BrowserProviderModule as Y, type ResolvedBrowserOptions as Z, type BrowserProviderOptions as _, type CoverageProviderModule as a, type BrowserCommand as a0, type BrowserCommandContext as a1, type BrowserServer as a2, type BrowserServerState as a3, type BrowserServerStateContext as a4, type BrowserOrchestrator as a5, type JsonOptions as a6, type JUnitOptions as a7, type HTMLOptions as a8, TestCase as a9, extraInlineDeps as aA, DefaultReporter as aB, BasicReporter as aC, DotReporter as aD, JsonReporter as aE, VerboseReporter as aF, TapReporter as aG, JUnitReporter as aH, TapFlatReporter as aI, HangingProcessReporter as aJ, GithubActionsReporter as aK, BaseReporter as aL, ReportersMap as aM, type BuiltinReporters as aN, type BuiltinReporterOptions as aO, type JsonAssertionResult as aP, type JsonTestResult as aQ, type JsonTestResults as aR, BenchmarkReportsMap as aS, type BenchmarkBuiltinReporters as aT, TestFile as aa, TestSuite as ab, TestProject as ac, TestCollection as ad, type TaskOptions as ae, type TestDiagnostic as af, type FileDiagnostic as ag, type TestResult as ah, type TestResultPassed as ai, type TestResultFailed as aj, type TestResultSkipped as ak, type ResolvedProjectConfig as al, type UserConfigFnObject as am, type UserConfigFnPromise as an, type UserConfigFn as ao, type UserConfigExport as ap, type UserProjectConfigFn as aq, type UserProjectConfigExport as ar, defineConfig as as, defineProject as at, defineWorkspace as au, defaultBrowserPort as av, configDefaults as aw, defaultInclude as ax, defaultExclude as ay, coverageConfigDefaults as az, type RawErrsMap as b, type CollectLineNumbers as c, type CollectLines as d, type RootAndTarget as e, type Context as f, type ReportContext as g, type CoverageReporter as h, type CoverageProviderName as i, type CoverageOptions as j, type CoverageIstanbulOptions as k, type CoverageV8Options as l, type CustomProviderOptions as m, type Reporter as n, Vitest as o, type BrowserScript as p, type BrowserConfigOptions as q, type BuiltinEnvironment as r, type PoolOptions as s, type CSSModuleScopeStrategy as t, type VitestRunMode as u, type TransformModePatterns as v, type TypecheckConfig as w, type ResolvedConfig as x, type ProjectConfig as y, type UserWorkspaceConfig as z };