vitest 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/browser.d.ts +21 -42
  3. package/dist/browser.js +5 -5
  4. package/dist/{vendor/base.CC6UHsNs.js → chunks/base.CC5R_kgU.js} +3 -3
  5. package/dist/{vendor/base.CTYV4Gnz.js → chunks/base.DSsbfkDg.js} +5 -4
  6. package/dist/{vendor/benchmark.B6pblCp2.js → chunks/benchmark.DDmpNjj-.js} +1 -1
  7. package/dist/chunks/benchmark.puBFxyfE.d.ts +22 -0
  8. package/dist/{vendor/cac.DUiZvzF_.js → chunks/cac.DGgmCKmU.js} +18 -21
  9. package/dist/{vendor/cli-api.CsgSG1Ir.js → chunks/cli-api.OKfd3qJ0.js} +666 -487
  10. package/dist/chunks/config.DCnyCTbs.d.ts +203 -0
  11. package/dist/chunks/{runtime-console.C2L2zykk.js → console.Bgn7_A1x.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.a3OfuIEW.js} +8 -8
  15. package/dist/{vendor/env.2ltrQNq0.js → chunks/env.BU041cs9.js} +2 -3
  16. package/dist/chunks/environment.0M5R1SX_.d.ts +173 -0
  17. package/dist/{vendor/execute.Dx503nGn.js → chunks/execute.Cjlr2CRw.js} +28 -20
  18. package/dist/chunks/globals.BliuJFNR.js +31 -0
  19. package/dist/{vendor/index.Hqvcg1pf.js → chunks/index.BfeNhc0N.js} +43 -43
  20. package/dist/{vendor/index.D6GZqexG.js → chunks/index.CM5UI-4O.js} +2 -2
  21. package/dist/{vendor/index.BJmtb_7W.js → chunks/index.DYufA6CZ.js} +2 -2
  22. package/dist/{vendor/index.BCwvoAaf.js → chunks/index.JbiJutJ_.js} +516 -258
  23. package/dist/{vendor/index.CROIsoiT.js → chunks/index.R1VjssW9.js} +11 -12
  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.DS3zEPa7.js} +2 -2
  27. package/dist/{reporters-BECoY4-b.d.ts → chunks/reporters.C_zwCd4j.d.ts} +850 -1003
  28. package/dist/{vendor/rpc.BGx7q_k2.js → chunks/rpc.B7Mfb-Yf.js} +3 -5
  29. package/dist/{vendor/run-once.Db8Hgq9X.js → chunks/run-once.Sxe67Wng.js} +1 -1
  30. package/dist/chunks/{runtime-runBaseTests.hkIOeriM.js → runBaseTests.CyvqmuC9.js} +35 -27
  31. package/dist/{vendor/setup-common.yHaxjRhz.js → chunks/setup-common.CNzatKMx.js} +2 -2
  32. package/dist/{suite-BWgaIsVn.d.ts → chunks/suite.CcK46U-P.d.ts} +1 -1
  33. package/dist/{vendor/tasks.DhVtQBtW.js → chunks/tasks.BZnCS9aT.js} +2 -3
  34. package/dist/{vendor/utils.DkxLWvS1.js → chunks/utils.C3_cBsyn.js} +3 -4
  35. package/dist/{vendor/global.7bFbnyXl.js → chunks/utils.Ck2hJTRs.js} +1 -1
  36. package/dist/{vendor/utils.DyTe1Nxn.js → chunks/utils.DpP_sDwr.js} +8 -21
  37. package/dist/{vendor/vi.DXACdGTu.js → chunks/vi.fiQ7lMRF.js} +13 -18
  38. package/dist/{vendor/vm.D1T5Rxan.js → chunks/vm.DcSuuaHr.js} +40 -68
  39. package/dist/chunks/worker.C5iHKIaJ.d.ts +144 -0
  40. package/dist/chunks/worker.DKkAC4Qw.d.ts +8 -0
  41. package/dist/cli.js +3 -3
  42. package/dist/config.cjs +6 -9
  43. package/dist/config.d.ts +10 -8
  44. package/dist/config.js +6 -9
  45. package/dist/coverage.d.ts +10 -8
  46. package/dist/coverage.js +11 -7
  47. package/dist/environments.d.ts +3 -19
  48. package/dist/environments.js +1 -1
  49. package/dist/execute.d.ts +8 -17
  50. package/dist/execute.js +2 -2
  51. package/dist/index.d.ts +267 -34
  52. package/dist/index.js +12 -12
  53. package/dist/node.d.ts +15 -9
  54. package/dist/node.js +16 -19
  55. package/dist/reporters.d.ts +10 -8
  56. package/dist/reporters.js +12 -15
  57. package/dist/runners.d.ts +7 -19
  58. package/dist/runners.js +12 -13
  59. package/dist/snapshot.js +3 -3
  60. package/dist/suite.d.ts +2 -16
  61. package/dist/suite.js +4 -4
  62. package/dist/worker.js +7 -8
  63. package/dist/workers/forks.js +5 -5
  64. package/dist/workers/runVmTests.js +32 -23
  65. package/dist/workers/threads.js +5 -5
  66. package/dist/workers/vmForks.js +8 -8
  67. package/dist/workers/vmThreads.js +8 -8
  68. package/dist/workers.d.ts +13 -8
  69. package/dist/workers.js +13 -13
  70. package/package.json +15 -15
  71. package/dist/chunks/integrations-globals.CzYWb38r.js +0 -31
  72. /package/dist/{vendor → chunks}/_commonjsHelpers.BFTU3MAI.js +0 -0
  73. /package/dist/{vendor → chunks}/date.W2xKR2qe.js +0 -0
  74. /package/dist/chunks/{node-git.ZtkbKc8u.js → git.ZtkbKc8u.js} +0 -0
  75. /package/dist/{vendor → chunks}/index.BMmMjLIQ.js +0 -0
  76. /package/dist/{vendor → chunks}/index.BpSiYbpB.js +0 -0
  77. /package/dist/chunks/{install-pkg.DNUmWFkO.js → index.DNUmWFkO.js} +0 -0
  78. /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.DCnyCTbs.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[];
@@ -596,6 +563,51 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
596
563
  width: number;
597
564
  height: number;
598
565
  };
566
+ screenshotFailures: boolean;
567
+ }
568
+
569
+ declare class TestProject {
570
+ /**
571
+ * The global vitest instance.
572
+ * @experimental The public Vitest API is experimental and does not follow semver.
573
+ */
574
+ readonly vitest: Vitest;
575
+ /**
576
+ * The workspace project this test project is associated with.
577
+ * @experimental The public Vitest API is experimental and does not follow semver.
578
+ */
579
+ readonly workspaceProject: WorkspaceProject;
580
+ /**
581
+ * Resolved project configuration.
582
+ */
583
+ readonly config: ResolvedProjectConfig;
584
+ /**
585
+ * Resolved global configuration. If there are no workspace projects, this will be the same as `config`.
586
+ */
587
+ readonly globalConfig: ResolvedConfig;
588
+ /**
589
+ * The name of the project or an empty string if not set.
590
+ */
591
+ readonly name: string;
592
+ constructor(workspaceProject: WorkspaceProject);
593
+ /**
594
+ * Serialized project configuration. This is the config that tests receive.
595
+ */
596
+ get serializedConfig(): SerializedConfig;
597
+ /**
598
+ * Custom context provided to the project.
599
+ */
600
+ context(): ProvidedContext;
601
+ /**
602
+ * Provide a custom serializable context to the project. This context will be available for tests once they run.
603
+ */
604
+ provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
605
+ toJSON(): SerializedTestProject;
606
+ }
607
+ interface SerializedTestProject {
608
+ name: string;
609
+ serializedConfig: SerializedConfig;
610
+ context: ProvidedContext;
599
611
  }
600
612
 
601
613
  interface InitializeProjectOptions extends UserWorkspaceConfig {
@@ -615,6 +627,7 @@ declare class WorkspaceProject {
615
627
  typechecker?: Typechecker;
616
628
  closingPromise: Promise<unknown> | undefined;
617
629
  testFilesList: string[] | null;
630
+ testProject: TestProject;
618
631
  readonly id: string;
619
632
  readonly tmpDir: string;
620
633
  private _globalSetups;
@@ -630,7 +643,6 @@ declare class WorkspaceProject {
630
643
  getModulesByFilepath(file: string): Set<vite.ModuleNode>;
631
644
  getModuleById(id: string): vite.ModuleNode | undefined;
632
645
  getSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
633
- getBrowserSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
634
646
  get reporters(): Reporter[];
635
647
  globTestFiles(filters?: string[]): Promise<string[]>;
636
648
  globAllTestFiles(include: string[], exclude: string[], includeSource: string[] | undefined, cwd: string): Promise<string[]>;
@@ -644,7 +656,7 @@ declare class WorkspaceProject {
644
656
  static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
645
657
  setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
646
658
  isBrowserEnabled(): boolean;
647
- getSerializableConfig(method?: 'run' | 'collect'): ResolvedConfig;
659
+ getSerializableConfig(): SerializedConfig;
648
660
  close(): Promise<unknown>;
649
661
  private clearTmpDir;
650
662
  initBrowserProvider(): Promise<void>;
@@ -660,52 +672,256 @@ interface ProcessPool {
660
672
  }
661
673
  declare function getFilePoolName(project: WorkspaceProject, file: string): Pool;
662
674
 
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;
675
+ declare class ReportedTaskImplementation {
676
+ /**
677
+ * Task instance.
678
+ * @experimental Public runner task API is experimental and does not follow semver.
679
+ */
680
+ readonly task: Task;
681
+ /**
682
+ * The project assosiacted with the test or suite.
683
+ */
684
+ readonly project: TestProject;
685
+ /**
686
+ * Unique identifier.
687
+ * This ID is deterministic and will be the same for the same test across multiple runs.
688
+ * The ID is based on the project name, file path and test position.
689
+ */
690
+ readonly id: string;
691
+ /**
692
+ * Location in the file where the test or suite is defined.
693
+ */
694
+ readonly location: {
695
+ line: number;
696
+ column: number;
697
+ } | undefined;
698
+ protected constructor(task: Task, project: WorkspaceProject);
699
+ /**
700
+ * Creates a new reported task instance and stores it in the project's state for future use.
701
+ */
702
+ static register(task: Task, project: WorkspaceProject): TestCase | TestSuite | TestFile;
672
703
  }
673
- interface ModuleCache {
674
- promise?: Promise<any>;
675
- exports?: any;
676
- code?: string;
704
+ declare class TestCase extends ReportedTaskImplementation {
705
+ #private;
706
+ readonly task: Test | Custom;
707
+ readonly type = "test";
708
+ /**
709
+ * Direct reference to the test file where the test or suite is defined.
710
+ */
711
+ readonly file: TestFile;
712
+ /**
713
+ * Name of the test.
714
+ */
715
+ readonly name: string;
716
+ /**
717
+ * Options that the test was initiated with.
718
+ */
719
+ readonly options: TaskOptions;
720
+ /**
721
+ * Parent suite. If the test was called directly inside the file, the parent will be the file.
722
+ */
723
+ readonly parent: TestSuite | TestFile;
724
+ protected constructor(task: Test | Custom, project: WorkspaceProject);
725
+ /**
726
+ * Full name of the test including all parent suites separated with `>`.
727
+ */
728
+ get fullName(): string;
729
+ /**
730
+ * Test results. Will be `undefined` if test is not finished yet or was just collected.
731
+ */
732
+ result(): TestResult | undefined;
733
+ /**
734
+ * Checks if the test did not fail the suite.
735
+ * If the test is not finished yet or was skipped, it will return `true`.
736
+ */
737
+ ok(): boolean;
738
+ /**
739
+ * Custom metadata that was attached to the test during its execution.
740
+ */
741
+ meta(): TaskMeta;
742
+ /**
743
+ * Useful information about the test like duration, memory usage, etc.
744
+ * Diagnostic is only available after the test has finished.
745
+ */
746
+ diagnostic(): TestDiagnostic | undefined;
677
747
  }
678
- interface EnvironmentReturn {
679
- teardown: (global: any) => Awaitable<void>;
748
+ declare class TestCollection {
749
+ #private;
750
+ constructor(task: Suite | File, project: WorkspaceProject);
751
+ /**
752
+ * Returns the test or suite at a specific index in the array.
753
+ */
754
+ at(index: number): TestCase | TestSuite | undefined;
755
+ /**
756
+ * The number of tests and suites in the collection.
757
+ */
758
+ get size(): number;
759
+ /**
760
+ * Returns the collection in array form for easier manipulation.
761
+ */
762
+ array(): (TestCase | TestSuite)[];
763
+ /**
764
+ * Filters all tests that are part of this collection and its children.
765
+ */
766
+ allTests(state?: TestResult['state'] | 'running'): IterableIterator<TestCase>;
767
+ /**
768
+ * Filters only the tests that are part of this collection.
769
+ */
770
+ tests(state?: TestResult['state'] | 'running'): IterableIterator<TestCase>;
771
+ /**
772
+ * Filters only the suites that are part of this collection.
773
+ */
774
+ suites(): IterableIterator<TestSuite>;
775
+ /**
776
+ * Filters all suites that are part of this collection and its children.
777
+ */
778
+ allSuites(): IterableIterator<TestSuite>;
779
+ [Symbol.iterator](): IterableIterator<TestSuite | TestCase>;
680
780
  }
681
- interface VmEnvironmentReturn {
682
- getVmContext: () => {
683
- [key: string]: any;
684
- };
685
- teardown: () => Awaitable<void>;
781
+
782
+ declare abstract class SuiteImplementation extends ReportedTaskImplementation {
783
+ readonly task: Suite | File;
784
+ /**
785
+ * Collection of suites and tests that are part of this suite.
786
+ */
787
+ readonly children: TestCollection;
788
+ protected constructor(task: Suite | File, project: WorkspaceProject);
686
789
  }
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;
790
+ declare class TestSuite extends SuiteImplementation {
791
+ #private;
792
+ readonly task: Suite;
793
+ readonly type = "suite";
794
+ /**
795
+ * Name of the test or the suite.
796
+ */
797
+ readonly name: string;
798
+ /**
799
+ * Direct reference to the test file where the test or suite is defined.
800
+ */
801
+ readonly file: TestFile;
802
+ /**
803
+ * Parent suite. If suite was called directly inside the file, the parent will be the file.
804
+ */
805
+ readonly parent: TestSuite | TestFile;
806
+ /**
807
+ * Options that suite was initiated with.
808
+ */
809
+ readonly options: TaskOptions;
810
+ protected constructor(task: Suite, project: WorkspaceProject);
811
+ /**
812
+ * Full name of the suite including all parent suites separated with `>`.
813
+ */
814
+ get fullName(): string;
815
+ }
816
+ declare class TestFile extends SuiteImplementation {
817
+ readonly task: File;
818
+ readonly location: undefined;
819
+ readonly type = "file";
820
+ /**
821
+ * This is usually an absolute UNIX file path.
822
+ * It can be a virtual id if the file is not on the disk.
823
+ * This value corresponds to Vite's `ModuleGraph` id.
824
+ */
825
+ readonly moduleId: string;
826
+ protected constructor(task: File, project: WorkspaceProject);
827
+ /**
828
+ * Useful information about the file like duration, memory usage, etc.
829
+ * If the file was not executed yet, all diagnostic values will return `0`.
830
+ */
831
+ diagnostic(): FileDiagnostic;
832
+ }
833
+ interface TaskOptions {
834
+ each: boolean | undefined;
835
+ concurrent: boolean | undefined;
836
+ shuffle: boolean | undefined;
837
+ retry: number | undefined;
838
+ repeats: number | undefined;
839
+ mode: 'run' | 'only' | 'skip' | 'todo';
840
+ }
841
+ type TestResult = TestResultPassed | TestResultFailed | TestResultSkipped;
842
+ interface TestResultPassed {
843
+ /**
844
+ * The test passed successfully.
845
+ */
846
+ state: 'passed';
847
+ /**
848
+ * Errors that were thrown during the test execution.
849
+ *
850
+ * **Note**: If test was retried successfully, errors will still be reported.
851
+ */
852
+ errors: TestError[] | undefined;
853
+ }
854
+ interface TestResultFailed {
855
+ /**
856
+ * The test failed to execute.
857
+ */
858
+ state: 'failed';
859
+ /**
860
+ * Errors that were thrown during the test execution.
861
+ */
862
+ errors: TestError[];
863
+ }
864
+ interface TestResultSkipped {
865
+ /**
866
+ * The test was skipped with `only`, `skip` or `todo` flag.
867
+ * You can see which one was used in the `mode` option.
868
+ */
869
+ state: 'skipped';
870
+ /**
871
+ * Skipped tests have no errors.
872
+ */
873
+ errors: undefined;
701
874
  }
702
- interface ModuleGraphData {
703
- graph: Record<string, string[]>;
704
- externalized: string[];
705
- inlined: string[];
875
+ interface TestDiagnostic {
876
+ /**
877
+ * The amount of memory used by the test in bytes.
878
+ * This value is only available if the test was executed with `logHeapUsage` flag.
879
+ */
880
+ heap: number | undefined;
881
+ /**
882
+ * The time it takes to execute the test in ms.
883
+ */
884
+ duration: number;
885
+ /**
886
+ * The time in ms when the test started.
887
+ */
888
+ startTime: number;
889
+ /**
890
+ * The amount of times the test was retried.
891
+ */
892
+ retryCount: number;
893
+ /**
894
+ * The amount of times the test was repeated as configured by `repeats` option.
895
+ * This value can be lower if the test failed during the repeat and no `retry` is configured.
896
+ */
897
+ repeatCount: number;
898
+ /**
899
+ * If test passed on a second retry.
900
+ */
901
+ flaky: boolean;
706
902
  }
707
- type OnServerRestartHandler = (reason?: string) => Promise<void> | void;
708
- interface ProvidedContext {
903
+ interface FileDiagnostic {
904
+ /**
905
+ * The time it takes to import and initiate an environment.
906
+ */
907
+ environmentSetupDuration: number;
908
+ /**
909
+ * The time it takes Vitest to setup test harness (runner, mocks, etc.).
910
+ */
911
+ prepareDuration: number;
912
+ /**
913
+ * The time it takes to import the test file.
914
+ * This includes importing everything in the file and executing suite callbacks.
915
+ */
916
+ collectDuration: number;
917
+ /**
918
+ * The time it takes to import the setup file.
919
+ */
920
+ setupDuration: number;
921
+ /**
922
+ * Accumulated duration of all tests and hooks in the file.
923
+ */
924
+ duration: number;
709
925
  }
710
926
 
711
927
  declare class StateManager {
@@ -715,6 +931,7 @@ declare class StateManager {
715
931
  taskFileMap: WeakMap<Task, File>;
716
932
  errorsSet: Set<unknown>;
717
933
  processTimeoutCauses: Set<string>;
934
+ reportedTasksMap: WeakMap<Task, TestCase | TestSuite | TestFile>;
718
935
  catchError(err: unknown, type: string): void;
719
936
  clearErrors(): void;
720
937
  getUnhandledErrors(): unknown[];
@@ -728,18 +945,14 @@ declare class StateManager {
728
945
  getFilepaths(): string[];
729
946
  getFailedFilepaths(): string[];
730
947
  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;
948
+ collectFiles(project: WorkspaceProject, files?: File[]): void;
949
+ clearFiles(project: WorkspaceProject, paths?: string[]): void;
950
+ updateId(task: Task, project: WorkspaceProject): void;
951
+ getReportedEntity(task: Task): TestCase | TestSuite | TestFile | undefined;
739
952
  updateTasks(packs: TaskResultPack[]): void;
740
953
  updateUserLog(log: UserConsoleLog): void;
741
954
  getCountOfFailedTests(): number;
742
- cancelFiles(files: string[], root: string, projectName: string): void;
955
+ cancelFiles(files: string[], project: WorkspaceProject): void;
743
956
  }
744
957
 
745
958
  interface SuiteResultCache {
@@ -786,663 +999,79 @@ declare class VitestPackageInstaller {
786
999
  ensureInstalled(dependency: string, root: string): Promise<boolean>;
787
1000
  }
788
1001
 
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;
1002
+ interface Node {
1003
+ isRoot(): boolean;
1004
+ visit(visitor: Visitor, state: any): void;
888
1005
  }
889
1006
 
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;
1007
+ interface Visitor<N extends Node = Node> {
1008
+ onStart(root: N, state: any): void;
1009
+ onSummary(root: N, state: any): void;
1010
+ onDetail(root: N, state: any): void;
1011
+ onSummaryEnd(root: N, state: any): void;
1012
+ onEnd(root: N, state: any): void;
900
1013
  }
901
1014
 
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;
1015
+ interface FileOptions {
1016
+ file: string;
943
1017
  }
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>;
1018
+
1019
+ interface ProjectOptions {
1020
+ projectRoot: string;
958
1021
  }
959
1022
 
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>;
1023
+ interface ReportOptions {
1024
+ clover: CloverOptions;
1025
+ cobertura: CoberturaOptions;
1026
+ "html-spa": HtmlSpaOptions;
1027
+ html: HtmlOptions;
1028
+ json: JsonOptions$1;
1029
+ "json-summary": JsonSummaryOptions;
1030
+ lcov: LcovOptions;
1031
+ lcovonly: LcovOnlyOptions;
1032
+ none: never;
1033
+ teamcity: TeamcityOptions;
1034
+ text: TextOptions;
1035
+ "text-lcov": TextLcovOptions;
1036
+ "text-summary": TextSummaryOptions;
973
1037
  }
974
1038
 
975
- type SerializableSpec = [
976
- project: {
977
- name: string | undefined;
978
- root: string;
979
- },
980
- file: string
981
- ];
1039
+ interface CloverOptions extends FileOptions, ProjectOptions {}
982
1040
 
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;
1041
+ interface CoberturaOptions extends FileOptions, ProjectOptions {}
1042
+
1043
+ interface HtmlSpaOptions extends HtmlOptions {
1044
+ metricsToShow: Array<"lines" | "branches" | "functions" | "statements">;
997
1045
  }
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>;
1046
+ interface HtmlOptions {
1047
+ verbose: boolean;
1048
+ skipEmpty: boolean;
1049
+ subdir: string;
1050
+ linkMapper: LinkMapper;
1012
1051
  }
1013
1052
 
1014
- interface HTMLOptions {
1015
- outputFile?: string;
1016
- }
1053
+ type JsonOptions$1 = FileOptions;
1054
+ type JsonSummaryOptions = FileOptions;
1017
1055
 
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
- }
1056
+ interface LcovOptions extends FileOptions, ProjectOptions {}
1057
+ interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
1055
1058
 
1056
- declare class BasicReporter extends BaseReporter {
1057
- constructor();
1058
- reportSummary(files: File[], errors: unknown[]): void;
1059
+ interface TeamcityOptions extends FileOptions {
1060
+ blockName: string;
1059
1061
  }
1060
1062
 
1061
- interface ListRendererOptions {
1062
- renderSucceed?: boolean;
1063
- logger: Logger;
1064
- showHeap: boolean;
1065
- slowTestThreshold: number;
1066
- mode: VitestRunMode;
1063
+ interface TextOptions extends FileOptions {
1064
+ maxCols: number;
1065
+ skipEmpty: boolean;
1066
+ skipFull: boolean;
1067
1067
  }
1068
- declare function createListRenderer(_tasks: Task[], options: ListRendererOptions): {
1069
- start(): any;
1070
- update(_tasks: Task[]): any;
1071
- stop(): any;
1072
- clear(): void;
1073
- };
1068
+ type TextLcovOptions = ProjectOptions;
1069
+ type TextSummaryOptions = FileOptions;
1074
1070
 
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
- };
1071
+ interface LinkMapper {
1072
+ getPath(node: string | Node): string;
1073
+ relativePath(source: string | Node, target: string | Node): string;
1074
+ assetPath(node: Node, name: string): string;
1446
1075
  }
1447
1076
 
1448
1077
  type TransformResult = string | Partial<TransformResult$1> | undefined | null | void;
@@ -1489,9 +1118,9 @@ interface CoverageProviderModule {
1489
1118
  stopCoverage?: () => unknown | Promise<unknown>;
1490
1119
  }
1491
1120
  type CoverageReporter = keyof ReportOptions | (string & {});
1492
- type CoverageReporterWithOptions<ReporterName extends CoverageReporter = CoverageReporter> = ReporterName extends keyof ReportOptions ? ReportOptions[ReporterName] extends never ? [ReporterName, {}] : [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' ? {
1121
+ type CoverageReporterWithOptions<ReporterName extends CoverageReporter = CoverageReporter> = ReporterName extends keyof ReportOptions ? ReportOptions[ReporterName] extends never ? [ReporterName, object] : [ReporterName, Partial<ReportOptions[ReporterName]>] : [ReporterName, Record<string, unknown>];
1122
+ type CoverageProviderName = 'v8' | 'istanbul' | 'custom' | undefined;
1123
+ type CoverageOptions<T extends CoverageProviderName = CoverageProviderName> = T extends 'istanbul' ? {
1495
1124
  provider: T;
1496
1125
  } & CoverageIstanbulOptions : T extends 'v8' ? {
1497
1126
  /**
@@ -1507,7 +1136,7 @@ type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? {
1507
1136
  } & CoverageV8Options;
1508
1137
  /** Fields that have default values. Internally these will always be defined. */
1509
1138
  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>> & {
1139
+ type ResolvedCoverageOptions<T extends CoverageProviderName = CoverageProviderName> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
1511
1140
  reporter: CoverageReporterWithOptions[];
1512
1141
  };
1513
1142
  interface BaseCoverageOptions {
@@ -1594,7 +1223,7 @@ interface BaseCoverageOptions {
1594
1223
  * ```
1595
1224
  */
1596
1225
  thresholds?: Thresholds | ({
1597
- [glob: string]: Pick<Thresholds, 'statements' | 'functions' | 'branches' | 'lines'>;
1226
+ [glob: string]: Pick<Thresholds, 100 | 'statements' | 'functions' | 'branches' | 'lines'>;
1598
1227
  } & Thresholds);
1599
1228
  /**
1600
1229
  * Watermarks for statements, lines, branches and functions.
@@ -1649,125 +1278,456 @@ interface Thresholds {
1649
1278
  /** Check thresholds per file. */
1650
1279
  perFile?: boolean;
1651
1280
  /**
1652
- * Update threshold values automatically when current coverage is higher than earlier thresholds
1653
- *
1654
- * @default false
1281
+ * Update threshold values automatically when current coverage is higher than earlier thresholds
1282
+ *
1283
+ * @default false
1284
+ */
1285
+ autoUpdate?: boolean;
1286
+ /** Thresholds for statements */
1287
+ statements?: number;
1288
+ /** Thresholds for functions */
1289
+ functions?: number;
1290
+ /** Thresholds for branches */
1291
+ branches?: number;
1292
+ /** Thresholds for lines */
1293
+ lines?: number;
1294
+ }
1295
+
1296
+ interface VitestOptions {
1297
+ packageInstaller?: VitestPackageInstaller;
1298
+ stdin?: NodeJS.ReadStream;
1299
+ stdout?: NodeJS.WriteStream | Writable;
1300
+ stderr?: NodeJS.WriteStream | Writable;
1301
+ }
1302
+ declare class Vitest {
1303
+ readonly mode: VitestRunMode;
1304
+ version: string;
1305
+ config: ResolvedConfig;
1306
+ configOverride: Partial<ResolvedConfig>;
1307
+ server: ViteDevServer;
1308
+ state: StateManager;
1309
+ snapshot: SnapshotManager;
1310
+ cache: VitestCache;
1311
+ reporters: Reporter[];
1312
+ coverageProvider: CoverageProvider | null | undefined;
1313
+ logger: Logger;
1314
+ pool: ProcessPool | undefined;
1315
+ vitenode: ViteNodeServer;
1316
+ invalidates: Set<string>;
1317
+ changedTests: Set<string>;
1318
+ watchedTests: Set<string>;
1319
+ filenamePattern?: string;
1320
+ runningPromise?: Promise<void>;
1321
+ closingPromise?: Promise<void>;
1322
+ isCancelling: boolean;
1323
+ isFirstRun: boolean;
1324
+ restartsCount: number;
1325
+ runner: ViteNodeRunner;
1326
+ packageInstaller: VitestPackageInstaller;
1327
+ private coreWorkspaceProject;
1328
+ private resolvedProjects;
1329
+ projects: WorkspaceProject[];
1330
+ private projectsTestFiles;
1331
+ distPath: string;
1332
+ constructor(mode: VitestRunMode, options?: VitestOptions);
1333
+ private _onRestartListeners;
1334
+ private _onClose;
1335
+ private _onSetServer;
1336
+ private _onCancelListeners;
1337
+ setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
1338
+ provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
1339
+ private createCoreProject;
1340
+ getCoreWorkspaceProject(): WorkspaceProject;
1341
+ getProjectByTaskId(taskId: string): WorkspaceProject;
1342
+ getProjectByName(name?: string): WorkspaceProject;
1343
+ private getWorkspaceConfigPath;
1344
+ private resolveWorkspace;
1345
+ private initCoverageProvider;
1346
+ private initBrowserProviders;
1347
+ mergeReports(): Promise<void>;
1348
+ collect(filters?: string[]): Promise<{
1349
+ tests: File[];
1350
+ errors: unknown[];
1351
+ }>;
1352
+ start(filters?: string[]): Promise<void>;
1353
+ init(): Promise<void>;
1354
+ private getTestDependencies;
1355
+ filterTestsBySource(specs: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
1356
+ getProjectsByTestFile(file: string): WorkspaceSpec[];
1357
+ initializeGlobalSetup(paths: WorkspaceSpec[]): Promise<void>;
1358
+ private initializeDistPath;
1359
+ runFiles(specs: WorkspaceSpec[], allTestsRun: boolean): Promise<void>;
1360
+ collectFiles(specs: WorkspaceSpec[]): Promise<void>;
1361
+ cancelCurrentRun(reason: CancelReason): Promise<void>;
1362
+ rerunFiles(files?: string[], trigger?: string): Promise<void>;
1363
+ changeProjectName(pattern: string): Promise<void>;
1364
+ changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
1365
+ changeFilenamePattern(pattern: string, files?: string[]): Promise<void>;
1366
+ rerunFailed(): Promise<void>;
1367
+ updateSnapshot(files?: string[]): Promise<void>;
1368
+ private _rerunTimer;
1369
+ private scheduleRerun;
1370
+ getModuleProjects(filepath: string): WorkspaceProject[];
1371
+ /**
1372
+ * Watch only the specified tests. If no tests are provided, all tests will be watched.
1373
+ */
1374
+ watchTests(tests: string[]): void;
1375
+ private unregisterWatcher;
1376
+ private registerWatcher;
1377
+ /**
1378
+ * @returns A value indicating whether rerun is needed (changedTests was mutated)
1379
+ */
1380
+ private handleFileChanged;
1381
+ private reportCoverage;
1382
+ close(): Promise<void>;
1383
+ /**
1384
+ * Close the thread pool and exit the process
1385
+ */
1386
+ exit(force?: boolean): Promise<void>;
1387
+ report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
1388
+ getTestFilepaths(): Promise<string[]>;
1389
+ globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
1390
+ shouldKeepServer(): boolean;
1391
+ onServerRestart(fn: OnServerRestartHandler): void;
1392
+ onAfterSetServer(fn: OnServerRestartHandler): void;
1393
+ onCancel(fn: (reason: CancelReason) => void): void;
1394
+ onClose(fn: () => void): void;
1395
+ }
1396
+
1397
+ type SerializedSpec = [
1398
+ project: {
1399
+ name: string | undefined;
1400
+ root: string;
1401
+ },
1402
+ file: string
1403
+ ];
1404
+
1405
+ interface Reporter {
1406
+ onInit?: (ctx: Vitest) => void;
1407
+ onPathsCollected?: (paths?: string[]) => Awaitable<void>;
1408
+ onSpecsCollected?: (specs?: SerializedSpec[]) => Awaitable<void>;
1409
+ onCollected?: (files?: File[]) => Awaitable<void>;
1410
+ onFinished?: (files: File[], errors: unknown[], coverage?: unknown) => Awaitable<void>;
1411
+ onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
1412
+ onTestRemoved?: (trigger?: string) => Awaitable<void>;
1413
+ onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
1414
+ onWatcherRerun?: (files: string[], trigger?: string) => Awaitable<void>;
1415
+ onServerRestart?: (reason?: string) => Awaitable<void>;
1416
+ onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
1417
+ onProcessTimeout?: () => Awaitable<void>;
1418
+ }
1419
+
1420
+ interface BaseOptions {
1421
+ isTTY?: boolean;
1422
+ }
1423
+ declare abstract class BaseReporter implements Reporter {
1424
+ start: number;
1425
+ end: number;
1426
+ watchFilters?: string[];
1427
+ failedUnwatchedFiles: Task[];
1428
+ isTTY: boolean;
1429
+ ctx: Vitest;
1430
+ protected verbose: boolean;
1431
+ private _filesInWatchMode;
1432
+ private _lastRunTimeout;
1433
+ private _lastRunTimer;
1434
+ private _lastRunCount;
1435
+ private _timeStart;
1436
+ private _offUnhandledRejection?;
1437
+ constructor(options?: BaseOptions);
1438
+ get mode(): VitestRunMode;
1439
+ onInit(ctx: Vitest): void;
1440
+ relative(path: string): string;
1441
+ onFinished(files?: File[], errors?: unknown[]): void;
1442
+ onTaskUpdate(packs: TaskResultPack[]): void;
1443
+ protected printTask(task: Task): void;
1444
+ onWatcherStart(files?: File[], errors?: unknown[]): void;
1445
+ private resetLastRunLog;
1446
+ onWatcherRerun(files: string[], trigger?: string): void;
1447
+ onUserConsoleLog(log: UserConsoleLog): void;
1448
+ shouldLog(log: UserConsoleLog): boolean;
1449
+ onServerRestart(reason?: string): void;
1450
+ reportSummary(files: File[], errors: unknown[]): void;
1451
+ reportTestSummary(files: File[], errors: unknown[]): void;
1452
+ private printErrorsSummary;
1453
+ reportBenchmarkSummary(files: File[]): void;
1454
+ private printTaskErrors;
1455
+ registerUnhandledRejection(): void;
1456
+ }
1457
+
1458
+ declare class BasicReporter extends BaseReporter {
1459
+ constructor();
1460
+ reportSummary(files: File[], errors: unknown[]): void;
1461
+ }
1462
+
1463
+ interface ListRendererOptions {
1464
+ renderSucceed?: boolean;
1465
+ logger: Logger;
1466
+ showHeap: boolean;
1467
+ slowTestThreshold: number;
1468
+ mode: VitestRunMode;
1469
+ }
1470
+ declare function createListRenderer(_tasks: Task[], options: ListRendererOptions): {
1471
+ start(): any;
1472
+ update(_tasks: Task[]): any;
1473
+ stop(): any;
1474
+ clear(): void;
1475
+ };
1476
+
1477
+ declare class DefaultReporter extends BaseReporter {
1478
+ renderer?: ReturnType<typeof createListRenderer>;
1479
+ rendererOptions: ListRendererOptions;
1480
+ private renderSucceedDefault?;
1481
+ onPathsCollected(paths?: string[]): void;
1482
+ onTestRemoved(trigger?: string): Promise<void>;
1483
+ onCollected(): void;
1484
+ onFinished(files?: _vitest_runner.File[], errors?: unknown[]): void;
1485
+ onWatcherStart(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
1486
+ stopListRender(): void;
1487
+ onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1488
+ onUserConsoleLog(log: UserConsoleLog): void;
1489
+ }
1490
+
1491
+ interface DotRendererOptions {
1492
+ logger: Logger;
1493
+ }
1494
+ declare function createDotRenderer(_tasks: Task[], options: DotRendererOptions): {
1495
+ start(): any;
1496
+ update(_tasks: Task[]): any;
1497
+ stop(): Promise<any>;
1498
+ clear(): void;
1499
+ };
1500
+
1501
+ declare class DotReporter extends BaseReporter {
1502
+ renderer?: ReturnType<typeof createDotRenderer>;
1503
+ onCollected(): void;
1504
+ onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
1505
+ onWatcherStart(): Promise<void>;
1506
+ stopListRender(): Promise<void>;
1507
+ onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1508
+ onUserConsoleLog(log: UserConsoleLog): void;
1509
+ }
1510
+
1511
+ type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';
1512
+ type Milliseconds = number;
1513
+ interface Callsite {
1514
+ line: number;
1515
+ column: number;
1516
+ }
1517
+ interface JsonAssertionResult {
1518
+ ancestorTitles: Array<string>;
1519
+ fullName: string;
1520
+ status: Status;
1521
+ title: string;
1522
+ meta: TaskMeta;
1523
+ duration?: Milliseconds | null;
1524
+ failureMessages: Array<string> | null;
1525
+ location?: Callsite | null;
1526
+ }
1527
+ interface JsonTestResult {
1528
+ message: string;
1529
+ name: string;
1530
+ status: 'failed' | 'passed';
1531
+ startTime: number;
1532
+ endTime: number;
1533
+ assertionResults: Array<JsonAssertionResult>;
1534
+ }
1535
+ interface JsonTestResults {
1536
+ numFailedTests: number;
1537
+ numFailedTestSuites: number;
1538
+ numPassedTests: number;
1539
+ numPassedTestSuites: number;
1540
+ numPendingTests: number;
1541
+ numPendingTestSuites: number;
1542
+ numTodoTests: number;
1543
+ numTotalTests: number;
1544
+ numTotalTestSuites: number;
1545
+ startTime: number;
1546
+ success: boolean;
1547
+ testResults: Array<JsonTestResult>;
1548
+ snapshot: SnapshotSummary;
1549
+ }
1550
+ interface JsonOptions {
1551
+ outputFile?: string;
1552
+ }
1553
+ declare class JsonReporter implements Reporter {
1554
+ start: number;
1555
+ ctx: Vitest;
1556
+ options: JsonOptions;
1557
+ constructor(options: JsonOptions);
1558
+ onInit(ctx: Vitest): void;
1559
+ protected logTasks(files: File[]): Promise<void>;
1560
+ onFinished(files?: File[]): Promise<void>;
1561
+ /**
1562
+ * Writes the report to an output file if specified in the config,
1563
+ * or logs it to the console otherwise.
1564
+ * @param report
1655
1565
  */
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;
1566
+ writeReport(report: string): Promise<void>;
1665
1567
  }
1666
1568
 
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;
1569
+ declare class VerboseReporter extends DefaultReporter {
1570
+ protected verbose: boolean;
1571
+ constructor();
1572
+ onTaskUpdate(packs: TaskResultPack[]): void;
1573
+ }
1574
+
1575
+ declare class TapReporter implements Reporter {
1576
+ protected ctx: Vitest;
1577
+ private logger;
1578
+ onInit(ctx: Vitest): void;
1579
+ static getComment(task: Task): string;
1580
+ private logErrorDetails;
1581
+ protected logTasks(tasks: Task[]): void;
1582
+ onFinished(files?: _vitest_runner.File[]): void;
1583
+ }
1584
+
1585
+ interface JUnitOptions {
1586
+ outputFile?: string;
1587
+ classname?: string;
1588
+ suiteName?: string;
1714
1589
  /**
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
- *
1590
+ * Write <system-out> and <system-err> for console output
1721
1591
  * @default true
1722
1592
  */
1723
- pretendToBeVisual?: boolean;
1593
+ includeConsoleOutput?: boolean;
1724
1594
  /**
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
- *
1595
+ * Add <testcase file="..."> attribute (validated on CIRCLE CI and GitLab CI)
1731
1596
  * @default false
1732
1597
  */
1733
- includeNodeLocations?: boolean | undefined;
1734
- /**
1735
- * @default 'dangerously'
1736
- */
1737
- runScripts?: 'dangerously' | 'outside-only';
1598
+ addFileAttribute?: boolean;
1599
+ }
1600
+ declare class JUnitReporter implements Reporter {
1601
+ private ctx;
1602
+ private reportFile?;
1603
+ private baseLog;
1604
+ private logger;
1605
+ private _timeStart;
1606
+ private fileFd?;
1607
+ private options;
1608
+ constructor(options: JUnitOptions);
1609
+ onInit(ctx: Vitest): Promise<void>;
1610
+ writeElement(name: string, attrs: Record<string, any>, children: () => Promise<void>): Promise<void>;
1611
+ writeLogs(task: Task, type: 'err' | 'out'): Promise<void>;
1612
+ writeTasks(tasks: Task[], filename: string): Promise<void>;
1613
+ onFinished(files?: _vitest_runner.File[]): Promise<void>;
1614
+ }
1615
+
1616
+ declare class TapFlatReporter extends TapReporter {
1617
+ onInit(ctx: Vitest): void;
1618
+ onFinished(files?: _vitest_runner.File[]): void;
1619
+ }
1620
+
1621
+ declare class HangingProcessReporter implements Reporter {
1622
+ whyRunning: (() => void) | undefined;
1623
+ onInit(): void;
1624
+ onProcessTimeout(): void;
1625
+ }
1626
+
1627
+ declare class GithubActionsReporter implements Reporter {
1628
+ ctx: Vitest;
1629
+ onInit(ctx: Vitest): void;
1630
+ onFinished(files?: File[], errors?: unknown[]): void;
1631
+ }
1632
+
1633
+ interface HTMLOptions {
1634
+ outputFile?: string;
1635
+ }
1636
+
1637
+ interface BlobOptions {
1638
+ outputFile?: string;
1639
+ }
1640
+ declare class BlobReporter implements Reporter {
1641
+ ctx: Vitest;
1642
+ options: BlobOptions;
1643
+ constructor(options: BlobOptions);
1644
+ onInit(ctx: Vitest): void;
1645
+ onFinished(files: File[] | undefined, errors: unknown[] | undefined, coverage: unknown): Promise<void>;
1646
+ }
1647
+
1648
+ interface TableRendererOptions {
1649
+ renderSucceed?: boolean;
1650
+ logger: Logger;
1651
+ showHeap: boolean;
1652
+ slowTestThreshold: number;
1653
+ compare?: FlatBenchmarkReport;
1654
+ }
1655
+ declare function createTableRenderer(_tasks: Task[], options: TableRendererOptions): {
1656
+ start(): any;
1657
+ update(_tasks: Task[]): any;
1658
+ stop(): any;
1659
+ clear(): void;
1660
+ };
1661
+
1662
+ declare class TableReporter extends BaseReporter {
1663
+ renderer?: ReturnType<typeof createTableRenderer>;
1664
+ rendererOptions: TableRendererOptions;
1665
+ onTestRemoved(trigger?: string): void;
1666
+ onCollected(): Promise<void>;
1667
+ onTaskUpdate(packs: TaskResultPack[]): void;
1668
+ onFinished(files?: File[], errors?: unknown[]): Promise<void>;
1669
+ onWatcherStart(): Promise<void>;
1670
+ stopListRender(): void;
1671
+ onWatcherRerun(files: string[], trigger?: string): Promise<void>;
1672
+ onUserConsoleLog(log: UserConsoleLog): void;
1673
+ }
1674
+ interface FlatBenchmarkReport {
1675
+ [id: string]: FormattedBenchmarkResult;
1676
+ }
1677
+ type FormattedBenchmarkResult = Omit<BenchmarkResult, 'samples'> & {
1678
+ id: string;
1679
+ sampleCount: number;
1680
+ median: number;
1681
+ };
1682
+
1683
+ declare const BenchmarkReportsMap: {
1684
+ default: typeof TableReporter;
1685
+ verbose: typeof VerboseReporter;
1686
+ };
1687
+ type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
1688
+
1689
+ declare const ReportersMap: {
1690
+ default: typeof DefaultReporter;
1691
+ basic: typeof BasicReporter;
1692
+ blob: typeof BlobReporter;
1693
+ verbose: typeof VerboseReporter;
1694
+ dot: typeof DotReporter;
1695
+ json: typeof JsonReporter;
1696
+ tap: typeof TapReporter;
1697
+ 'tap-flat': typeof TapFlatReporter;
1698
+ junit: typeof JUnitReporter;
1699
+ 'hanging-process': typeof HangingProcessReporter;
1700
+ 'github-actions': typeof GithubActionsReporter;
1701
+ };
1702
+ type BuiltinReporters = keyof typeof ReportersMap;
1703
+ interface BuiltinReporterOptions {
1704
+ 'default': BaseOptions;
1705
+ 'basic': BaseOptions;
1706
+ 'verbose': never;
1707
+ 'dot': BaseOptions;
1708
+ 'json': JsonOptions;
1709
+ 'blob': BlobOptions;
1710
+ 'tap': never;
1711
+ 'tap-flat': never;
1712
+ 'junit': JUnitOptions;
1713
+ 'hanging-process': never;
1714
+ 'html': HTMLOptions;
1715
+ }
1716
+
1717
+ interface TestSequencer {
1738
1718
  /**
1739
- * Enable CookieJar
1740
- *
1741
- * @default false
1719
+ * Slicing tests into shards. Will be run before `sort`.
1720
+ * Only run, if `shard` is defined.
1742
1721
  */
1743
- cookieJar?: boolean;
1744
- resources?: 'usable' | any;
1722
+ shard: (files: WorkspaceSpec[]) => Awaitable<WorkspaceSpec[]>;
1723
+ sort: (files: WorkspaceSpec[]) => Awaitable<WorkspaceSpec[]>;
1745
1724
  }
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
- };
1725
+ interface TestSequencerConstructor {
1726
+ new (ctx: Vitest): TestSequencer;
1769
1727
  }
1770
1728
 
1729
+ type ChaiConfig = Omit<Partial<typeof chai.config>, 'useProxy' | 'proxyExcludedKeys'>;
1730
+
1771
1731
  interface BenchmarkUserOptions {
1772
1732
  /**
1773
1733
  * Include globs for benchmark test files
@@ -1807,25 +1767,9 @@ interface BenchmarkUserOptions {
1807
1767
  */
1808
1768
  outputJson?: string;
1809
1769
  }
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
1770
 
1827
1771
  declare const defaultBrowserPort = 63315;
1828
- declare const extraInlineDeps: (string | RegExp)[];
1772
+ declare const extraInlineDeps: RegExp[];
1829
1773
 
1830
1774
  declare const defaultInclude: string[];
1831
1775
  declare const defaultExclude: string[];
@@ -1840,6 +1784,8 @@ declare const configDefaults: Readonly<{
1840
1784
  clearMocks: false;
1841
1785
  restoreMocks: false;
1842
1786
  mockReset: false;
1787
+ unstubGlobals: false;
1788
+ unstubEnvs: false;
1843
1789
  include: string[];
1844
1790
  exclude: string[];
1845
1791
  teardownTimeout: number;
@@ -1886,11 +1832,18 @@ declare function defineConfig(config: UserConfig$1): UserConfig$1;
1886
1832
  declare function defineConfig(config: Promise<UserConfig$1>): Promise<UserConfig$1>;
1887
1833
  declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
1888
1834
  declare function defineConfig(config: UserConfigExport): UserConfigExport;
1889
- declare function defineProject<T extends UserProjectConfigExport>(config: T): T;
1890
- type Workspace = string | (UserProjectConfigExport & {
1835
+ declare function defineProject(config: UserWorkspaceConfig): UserWorkspaceConfig;
1836
+ declare function defineProject(config: Promise<UserWorkspaceConfig>): Promise<UserWorkspaceConfig>;
1837
+ declare function defineProject(config: UserProjectConfigFn): UserProjectConfigFn;
1838
+ declare function defineProject(config: UserProjectConfigExport): UserProjectConfigExport;
1839
+ type WorkspaceProjectConfiguration = string | (UserProjectConfigExport & {
1840
+ /**
1841
+ * Relative path to the extendable config. All other options will be merged with this config.
1842
+ * @example '../vite.config.ts'
1843
+ */
1891
1844
  extends?: string;
1892
1845
  });
1893
- declare function defineWorkspace(config: Workspace[]): Workspace[];
1846
+ declare function defineWorkspace(config: WorkspaceProjectConfiguration[]): WorkspaceProjectConfiguration[];
1894
1847
 
1895
1848
  type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
1896
1849
  type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
@@ -1898,14 +1851,6 @@ type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
1898
1851
  type CSSModuleScopeStrategy = 'stable' | 'scoped' | 'non-scoped';
1899
1852
  type ApiConfig = Pick<ServerOptions, 'port' | 'strictPort' | 'host' | 'middlewareMode'>;
1900
1853
 
1901
- interface EnvironmentOptions {
1902
- /**
1903
- * jsdom options.
1904
- */
1905
- jsdom?: JSDOMOptions;
1906
- happyDOM?: HappyDOMOptions;
1907
- [x: string]: unknown;
1908
- }
1909
1854
  type VitestRunMode = 'test' | 'benchmark';
1910
1855
  interface SequenceOptions {
1911
1856
  /**
@@ -2064,7 +2009,7 @@ interface DepsOptions {
2064
2009
  }
2065
2010
  type InlineReporter = Reporter;
2066
2011
  type ReporterName = BuiltinReporters | 'html' | (string & {});
2067
- type ReporterWithOptions<Name extends ReporterName = ReporterName> = Name extends keyof BuiltinReporterOptions ? BuiltinReporterOptions[Name] extends never ? [Name, {}] : [Name, Partial<BuiltinReporterOptions[Name]>] : [Name, Record<string, unknown>];
2012
+ type ReporterWithOptions<Name extends ReporterName = ReporterName> = Name extends keyof BuiltinReporterOptions ? BuiltinReporterOptions[Name] extends never ? [Name, object] : [Name, Partial<BuiltinReporterOptions[Name]>] : [Name, Record<string, unknown>];
2068
2013
  interface InlineConfig {
2069
2014
  /**
2070
2015
  * Name of the project. Will be used to display in the reporter.
@@ -2397,7 +2342,7 @@ interface InlineConfig {
2397
2342
  *
2398
2343
  * Return `false` to omit the frame.
2399
2344
  */
2400
- onStackTrace?: (error: Error, frame: ParsedStack) => boolean | void;
2345
+ onStackTrace?: (error: ErrorWithDiff, frame: ParsedStack) => boolean | void;
2401
2346
  /**
2402
2347
  * Indicates if CSS files should be processed.
2403
2348
  *
@@ -2668,10 +2613,13 @@ interface UserConfig extends InlineConfig {
2668
2613
  */
2669
2614
  mergeReports?: string;
2670
2615
  }
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'> {
2616
+ 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
2617
  mode: VitestRunMode;
2673
2618
  base?: string;
2674
2619
  diff?: string;
2620
+ bail?: number;
2621
+ setupFiles: string[];
2622
+ snapshotEnvironment?: string;
2675
2623
  config?: string;
2676
2624
  filters?: string[];
2677
2625
  testNamePattern?: RegExp;
@@ -2711,7 +2659,8 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
2711
2659
  maxWorkers: number;
2712
2660
  minWorkers: number;
2713
2661
  }
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'> & {
2662
+ 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';
2663
+ type ProjectConfig = Omit<UserConfig, NonProjectOptions | 'sequencer' | 'deps' | 'poolOptions'> & {
2715
2664
  sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
2716
2665
  deps?: Omit<DepsOptions, 'moduleDirectories'>;
2717
2666
  poolOptions?: {
@@ -2720,12 +2669,7 @@ type ProjectConfig = Omit<UserConfig, 'sequencer' | 'shard' | 'watch' | 'run' |
2720
2669
  forks?: Pick<NonNullable<PoolOptions['forks']>, 'singleFork' | 'isolate'>;
2721
2670
  };
2722
2671
  };
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
- };
2672
+ type ResolvedProjectConfig = Omit<ResolvedConfig, NonProjectOptions>;
2729
2673
 
2730
2674
  type VitestInlineConfig = InlineConfig;
2731
2675
  declare module 'vite' {
@@ -2737,101 +2681,4 @@ declare module 'vite' {
2737
2681
  }
2738
2682
  }
2739
2683
 
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 };
2684
+ 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 };