vitest 2.1.0-beta.5 → 2.1.0-beta.7

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 (62) hide show
  1. package/LICENSE.md +59 -320
  2. package/dist/browser.d.ts +6 -3
  3. package/dist/browser.js +2 -2
  4. package/dist/chunks/{RandomSequencer.B4M2ux5b.js → RandomSequencer.Bh5-tlNJ.js} +77 -58
  5. package/dist/chunks/{base.BH-FAiX7.js → base.BlXpj3e_.js} +1 -29
  6. package/dist/chunks/{base.BYvKfYzm.js → base.CchlWrnV.js} +2 -4
  7. package/dist/chunks/{cac.DosbLiJg.js → cac.B5XYKv2_.js} +26 -17
  8. package/dist/chunks/{cli-api.D8zgNrBU.js → cli-api.ByZPnilx.js} +7419 -7959
  9. package/dist/chunks/{constants.CaAN7icJ.js → constants.fzPh7AOq.js} +1 -1
  10. package/dist/chunks/{coverage.CqfT4xaf.js → coverage.zlNdAMHK.js} +5 -3
  11. package/dist/chunks/{creator.COdKw_ZN.js → creator.zfBZSJzo.js} +9 -9
  12. package/dist/chunks/{environment.0M5R1SX_.d.ts → environment.C5eAp3K6.d.ts} +1 -1
  13. package/dist/chunks/{execute.DT9BA6zp.js → execute._eQQfgI8.js} +322 -232
  14. package/dist/chunks/{git.ZtkbKc8u.js → git.B5SDxu-n.js} +5 -5
  15. package/dist/chunks/{globals.DRPLtPOv.js → globals.jM7MxN2t.js} +4 -4
  16. package/dist/chunks/{index.CM5UI-4O.js → index.Bn75ITYg.js} +3 -3
  17. package/dist/chunks/index.CPD77dLA.js +133 -0
  18. package/dist/chunks/{index.CxWPpGJz.js → index.CSjyR2-v.js} +2 -2
  19. package/dist/chunks/{index.Dx3f477d.js → index.DpJO1tkB.js} +1110 -1104
  20. package/dist/chunks/{index.CNZXZ9PJ.js → index.xm8OIiKD.js} +1 -1
  21. package/dist/chunks/mocker.cRtM890J.d.ts +17 -0
  22. package/dist/chunks/{reporters.DbwOGCsU.d.ts → reporters.WnPwkmgA.d.ts} +154 -129
  23. package/dist/chunks/{resolveConfig.RHsAM2_Q.js → resolveConfig.-K5hHm0S.js} +56 -34
  24. package/dist/chunks/{runBaseTests.BAhL8UH_.js → runBaseTests.Cztfoflv.js} +7 -7
  25. package/dist/chunks/{setup-common.KBrCO5LJ.js → setup-common.fGBFoQKJ.js} +1 -1
  26. package/dist/chunks/{utils.C3_cBsyn.js → utils.Cn0zI1t3.js} +16 -3
  27. package/dist/chunks/{utils.DO38lwfj.js → utils.Dbnmsfq1.js} +1 -1
  28. package/dist/chunks/{vi.B6QZ938s.js → vi.DGgiNzJE.js} +46 -37
  29. package/dist/chunks/vite.D2yAwzwa.d.ts +11 -0
  30. package/dist/chunks/{vm.kl9T_5ai.js → vm.CPXwWp4C.js} +1 -2
  31. package/dist/chunks/{worker.Cx2xE71X.d.ts → worker.Bws9Zuxu.d.ts} +1 -1
  32. package/dist/chunks/{worker.BANO5ak1.d.ts → worker.CmPmTxgH.d.ts} +2 -14
  33. package/dist/cli.js +3 -3
  34. package/dist/config.cjs +1 -0
  35. package/dist/config.d.ts +70 -2
  36. package/dist/config.js +1 -0
  37. package/dist/coverage.d.ts +4 -3
  38. package/dist/coverage.js +29 -5
  39. package/dist/environments.d.ts +2 -2
  40. package/dist/execute.d.ts +13 -14
  41. package/dist/execute.js +3 -2
  42. package/dist/index.d.ts +23 -16
  43. package/dist/index.js +4 -4
  44. package/dist/mocker.d.ts +1 -0
  45. package/dist/mocker.js +1 -0
  46. package/dist/node.d.ts +27 -9
  47. package/dist/node.js +44 -39
  48. package/dist/reporters.d.ts +2 -2
  49. package/dist/reporters.js +8 -8
  50. package/dist/runners.js +2 -2
  51. package/dist/utils.d.ts +1 -0
  52. package/dist/worker.js +3 -2
  53. package/dist/workers/forks.js +5 -4
  54. package/dist/workers/runVmTests.js +6 -6
  55. package/dist/workers/threads.js +5 -4
  56. package/dist/workers/vmForks.js +4 -4
  57. package/dist/workers/vmThreads.js +4 -4
  58. package/dist/workers.d.ts +4 -16
  59. package/dist/workers.js +6 -5
  60. package/mocker.d.ts +1 -0
  61. package/package.json +22 -17
  62. package/dist/chunks/index.DNUmWFkO.js +0 -319
@@ -1,7 +1,7 @@
1
1
  import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
2
2
  import { b as bench } from './benchmark.C8CRJYG4.js';
3
3
  import { i as isFirstRun, a as runOnce } from './run-once.Sxe67Wng.js';
4
- import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.B6QZ938s.js';
4
+ import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.DGgiNzJE.js';
5
5
  import { g as getWorkerState } from './utils.Ck2hJTRs.js';
6
6
  import * as chai from 'chai';
7
7
  import { assert, should } from 'chai';
@@ -0,0 +1,17 @@
1
+ import { MockedModuleType } from '@vitest/mocker';
2
+
3
+ type Promisable<T> = T | Promise<T>;
4
+ type MockFactoryWithHelper<M = unknown> = (importOriginal: <T extends M = M>() => Promise<T>) => Promisable<Partial<M>>;
5
+ type MockFactory = () => any;
6
+ interface MockOptions {
7
+ spy?: boolean;
8
+ }
9
+ interface PendingSuiteMock {
10
+ id: string;
11
+ importer: string;
12
+ action: 'mock' | 'unmock';
13
+ type?: MockedModuleType;
14
+ factory?: MockFactory;
15
+ }
16
+
17
+ export type { MockFactoryWithHelper as M, PendingSuiteMock as P, MockOptions as a, MockFactory as b };
@@ -1,12 +1,12 @@
1
1
  import * as _vitest_runner from '@vitest/runner';
2
2
  import { File, Test, Suite, TaskResultPack, Task, CancelReason, Custom, TaskMeta, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
3
3
  import * as vite from 'vite';
4
- import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, ConfigEnv, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
4
+ import { ViteDevServer, TransformResult as TransformResult$1, ServerOptions, DepOptimizationConfig, AliasOptions, UserConfig as UserConfig$1, ConfigEnv } from 'vite';
5
5
  import { PrettyFormatOptions } from '@vitest/pretty-format';
6
6
  import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.CHuotKvS.js';
7
7
  import { RawSourceMap, ViteNodeServerOptions } from 'vite-node';
8
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';
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.C5eAp3K6.js';
10
10
  import { Writable } from 'node:stream';
11
11
  import { ViteNodeRunner } from 'vite-node/client';
12
12
  import { SnapshotManager } from '@vitest/snapshot/manager';
@@ -379,7 +379,7 @@ interface BrowserProvider {
379
379
  beforeCommand?: (command: string, args: unknown[]) => Awaitable$1<void>;
380
380
  afterCommand?: (command: string, args: unknown[]) => Awaitable$1<void>;
381
381
  getCommandsContext: (contextId: string) => Record<string, unknown>;
382
- openPage: (contextId: string, url: string) => Promise<void>;
382
+ openPage: (contextId: string, url: string, beforeNavigate?: () => Promise<void>) => Promise<void>;
383
383
  getCDPSession?: (contextId: string) => Promise<CDPSession>;
384
384
  close: () => Awaitable$1<void>;
385
385
  initialize(ctx: WorkspaceProject, options: BrowserProviderInitializationOptions): Awaitable$1<void>;
@@ -640,6 +640,7 @@ declare class WorkspaceProject {
640
640
  typechecker?: Typechecker;
641
641
  closingPromise: Promise<unknown> | undefined;
642
642
  testFilesList: string[] | null;
643
+ typecheckFilesList: string[] | null;
643
644
  testProject: TestProject;
644
645
  readonly id: string;
645
646
  readonly tmpDir: string;
@@ -650,6 +651,7 @@ declare class WorkspaceProject {
650
651
  isCore(): boolean;
651
652
  provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
652
653
  getProvidedContext(): ProvidedContext;
654
+ createSpec(moduleId: string, pool: string): WorkspaceSpec;
653
655
  initializeGlobalSetup(): Promise<void>;
654
656
  teardownGlobalSetup(): Promise<void>;
655
657
  get logger(): Logger;
@@ -657,9 +659,13 @@ declare class WorkspaceProject {
657
659
  getModuleById(id: string): vite.ModuleNode | undefined;
658
660
  getSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
659
661
  get reporters(): Reporter[];
660
- globTestFiles(filters?: string[]): Promise<string[]>;
662
+ globTestFiles(filters?: string[]): Promise<{
663
+ testFiles: string[];
664
+ typecheckTestFiles: string[];
665
+ }>;
661
666
  globAllTestFiles(include: string[], exclude: string[], includeSource: string[] | undefined, cwd: string): Promise<string[]>;
662
667
  isTestFile(id: string): boolean | null;
668
+ isTypecheckFile(id: string): boolean | null;
663
669
  globFiles(include: string[], exclude: string[], cwd: string): Promise<string[]>;
664
670
  isTargetFile(id: string, source?: string): Promise<boolean>;
665
671
  isInSourceTestFile(code: string): boolean;
@@ -675,7 +681,63 @@ declare class WorkspaceProject {
675
681
  initBrowserProvider(): Promise<void>;
676
682
  }
677
683
 
678
- type WorkspaceSpec = [project: WorkspaceProject, testFile: string];
684
+ type SerializedTestSpecification = [
685
+ project: {
686
+ name: string | undefined;
687
+ root: string;
688
+ },
689
+ file: string,
690
+ options: {
691
+ pool: string;
692
+ }
693
+ ];
694
+
695
+ declare class TestSpecification {
696
+ /**
697
+ * @deprecated use `project` instead
698
+ */
699
+ readonly 0: WorkspaceProject;
700
+ /**
701
+ * @deprecated use `moduleId` instead
702
+ */
703
+ readonly 1: string;
704
+ /**
705
+ * @deprecated use `pool` instead
706
+ */
707
+ readonly 2: {
708
+ pool: Pool;
709
+ };
710
+ readonly project: TestProject;
711
+ readonly moduleId: string;
712
+ readonly pool: Pool;
713
+ constructor(workspaceProject: WorkspaceProject, moduleId: string, pool: Pool);
714
+ toJSON(): SerializedTestSpecification;
715
+ /**
716
+ * for backwards compatibility
717
+ * @deprecated
718
+ */
719
+ [Symbol.iterator](): Generator<string | WorkspaceProject, void, unknown>;
720
+ }
721
+
722
+ /**
723
+ * @deprecated use TestSpecification instead
724
+ */
725
+ type WorkspaceSpec = TestSpecification & [
726
+ /**
727
+ * @deprecated use spec.project instead
728
+ */
729
+ project: WorkspaceProject,
730
+ /**
731
+ * @deprecated use spec.moduleId instead
732
+ */
733
+ file: string,
734
+ /**
735
+ * @deprecated use spec.pool instead
736
+ */
737
+ options: {
738
+ pool: Pool;
739
+ }
740
+ ];
679
741
  type RunWithFiles = (files: WorkspaceSpec[], invalidates?: string[]) => Awaitable$1<void>;
680
742
  interface ProcessPool {
681
743
  name: string;
@@ -698,11 +760,11 @@ declare class ReportedTaskImplementation {
698
760
  /**
699
761
  * Unique identifier.
700
762
  * 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.
763
+ * The ID is based on the project name, module url and test position.
702
764
  */
703
765
  readonly id: string;
704
766
  /**
705
- * Location in the file where the test or suite is defined.
767
+ * Location in the module where the test or suite is defined.
706
768
  */
707
769
  readonly location: {
708
770
  line: number;
@@ -712,16 +774,16 @@ declare class ReportedTaskImplementation {
712
774
  /**
713
775
  * Creates a new reported task instance and stores it in the project's state for future use.
714
776
  */
715
- static register(task: Task, project: WorkspaceProject): TestCase | TestSuite | TestFile;
777
+ static register(task: Task, project: WorkspaceProject): TestCase | TestSuite | TestModule;
716
778
  }
717
779
  declare class TestCase extends ReportedTaskImplementation {
718
780
  #private;
719
781
  readonly task: Test | Custom;
720
782
  readonly type = "test";
721
783
  /**
722
- * Direct reference to the test file where the test or suite is defined.
784
+ * Direct reference to the test module where the test or suite is defined.
723
785
  */
724
- readonly file: TestFile;
786
+ readonly module: TestModule;
725
787
  /**
726
788
  * Name of the test.
727
789
  */
@@ -731,9 +793,9 @@ declare class TestCase extends ReportedTaskImplementation {
731
793
  */
732
794
  readonly options: TaskOptions;
733
795
  /**
734
- * Parent suite. If the test was called directly inside the file, the parent will be the file.
796
+ * Parent suite. If the test was called directly inside the module, the parent will be the module itself.
735
797
  */
736
- readonly parent: TestSuite | TestFile;
798
+ readonly parent: TestSuite | TestModule;
737
799
  protected constructor(task: Test | Custom, project: WorkspaceProject);
738
800
  /**
739
801
  * Full name of the test including all parent suites separated with `>`.
@@ -809,13 +871,13 @@ declare class TestSuite extends SuiteImplementation {
809
871
  */
810
872
  readonly name: string;
811
873
  /**
812
- * Direct reference to the test file where the test or suite is defined.
874
+ * Direct reference to the test module where the test or suite is defined.
813
875
  */
814
- readonly file: TestFile;
876
+ readonly module: TestModule;
815
877
  /**
816
- * Parent suite. If suite was called directly inside the file, the parent will be the file.
878
+ * Parent suite. If suite was called directly inside the module, the parent will be the module itself.
817
879
  */
818
- readonly parent: TestSuite | TestFile;
880
+ readonly parent: TestSuite | TestModule;
819
881
  /**
820
882
  * Options that suite was initiated with.
821
883
  */
@@ -826,10 +888,10 @@ declare class TestSuite extends SuiteImplementation {
826
888
  */
827
889
  get fullName(): string;
828
890
  }
829
- declare class TestFile extends SuiteImplementation {
891
+ declare class TestModule extends SuiteImplementation {
830
892
  readonly task: File;
831
893
  readonly location: undefined;
832
- readonly type = "file";
894
+ readonly type = "module";
833
895
  /**
834
896
  * This is usually an absolute UNIX file path.
835
897
  * It can be a virtual id if the file is not on the disk.
@@ -838,10 +900,10 @@ declare class TestFile extends SuiteImplementation {
838
900
  readonly moduleId: string;
839
901
  protected constructor(task: File, project: WorkspaceProject);
840
902
  /**
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`.
903
+ * Useful information about the module like duration, memory usage, etc.
904
+ * If the module was not executed yet, all diagnostic values will return `0`.
843
905
  */
844
- diagnostic(): FileDiagnostic;
906
+ diagnostic(): ModuleDiagnostic;
845
907
  }
846
908
  interface TaskOptions {
847
909
  each: boolean | undefined;
@@ -913,7 +975,7 @@ interface TestDiagnostic {
913
975
  */
914
976
  flaky: boolean;
915
977
  }
916
- interface FileDiagnostic {
978
+ interface ModuleDiagnostic {
917
979
  /**
918
980
  * The time it takes to import and initiate an environment.
919
981
  */
@@ -923,16 +985,16 @@ interface FileDiagnostic {
923
985
  */
924
986
  prepareDuration: number;
925
987
  /**
926
- * The time it takes to import the test file.
927
- * This includes importing everything in the file and executing suite callbacks.
988
+ * The time it takes to import the test module.
989
+ * This includes importing everything in the module and executing suite callbacks.
928
990
  */
929
991
  collectDuration: number;
930
992
  /**
931
- * The time it takes to import the setup file.
993
+ * The time it takes to import the setup module.
932
994
  */
933
995
  setupDuration: number;
934
996
  /**
935
- * Accumulated duration of all tests and hooks in the file.
997
+ * Accumulated duration of all tests and hooks in the module.
936
998
  */
937
999
  duration: number;
938
1000
  }
@@ -944,7 +1006,7 @@ declare class StateManager {
944
1006
  taskFileMap: WeakMap<Task, File>;
945
1007
  errorsSet: Set<unknown>;
946
1008
  processTimeoutCauses: Set<string>;
947
- reportedTasksMap: WeakMap<Task, TestCase | TestSuite | TestFile>;
1009
+ reportedTasksMap: WeakMap<Task, TestCase | TestSuite | TestModule>;
948
1010
  catchError(err: unknown, type: string): void;
949
1011
  clearErrors(): void;
950
1012
  getUnhandledErrors(): unknown[];
@@ -961,7 +1023,7 @@ declare class StateManager {
961
1023
  collectFiles(project: WorkspaceProject, files?: File[]): void;
962
1024
  clearFiles(project: WorkspaceProject, paths?: string[]): void;
963
1025
  updateId(task: Task, project: WorkspaceProject): void;
964
- getReportedEntity(task: Task): TestCase | TestSuite | TestFile | undefined;
1026
+ getReportedEntity(task: Task): TestCase | TestSuite | TestModule | undefined;
965
1027
  updateTasks(packs: TaskResultPack[]): void;
966
1028
  updateUserLog(log: UserConsoleLog): void;
967
1029
  getCountOfFailedTests(): number;
@@ -1261,6 +1323,17 @@ interface BaseCoverageOptions {
1261
1323
  * @default false
1262
1324
  */
1263
1325
  allowExternal?: boolean;
1326
+ /**
1327
+ * Apply exclusions again after coverage has been remapped to original sources.
1328
+ * This is useful when your source files are transpiled and may contain source maps
1329
+ * of non-source files.
1330
+ *
1331
+ * Use this option when you are seeing files that show up in report even if they
1332
+ * match your `coverage.exclude` patterns.
1333
+ *
1334
+ * @default false
1335
+ */
1336
+ excludeAfterRemap?: boolean;
1264
1337
  /**
1265
1338
  * Concurrency limit used when processing the coverage results.
1266
1339
  * Defaults to `Math.min(20, os.availableParallelism?.() ?? os.cpus().length)`
@@ -1340,8 +1413,10 @@ declare class Vitest {
1340
1413
  private coreWorkspaceProject;
1341
1414
  private resolvedProjects;
1342
1415
  projects: WorkspaceProject[];
1343
- private projectsTestFiles;
1344
1416
  distPath: string;
1417
+ private _cachedSpecs;
1418
+ /** @deprecated use `_cachedSpecs` */
1419
+ projectTestFiles: Map<string, WorkspaceSpec[]>;
1345
1420
  constructor(mode: VitestRunMode, options?: VitestOptions);
1346
1421
  private _onRestartListeners;
1347
1422
  private _onClose;
@@ -1349,8 +1424,18 @@ declare class Vitest {
1349
1424
  private _onCancelListeners;
1350
1425
  setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
1351
1426
  provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
1352
- private createCoreProject;
1427
+ /**
1428
+ * @deprecated internal, use `_createCoreProject` instead
1429
+ */
1430
+ createCoreProject(): Promise<WorkspaceProject>;
1431
+ /**
1432
+ * @internal
1433
+ */
1434
+ _createCoreProject(): Promise<WorkspaceProject>;
1353
1435
  getCoreWorkspaceProject(): WorkspaceProject;
1436
+ /**
1437
+ * @deprecated use Reported Task API instead
1438
+ */
1354
1439
  getProjectByTaskId(taskId: string): WorkspaceProject;
1355
1440
  getProjectByName(name?: string): WorkspaceProject;
1356
1441
  private getWorkspaceConfigPath;
@@ -1362,14 +1447,18 @@ declare class Vitest {
1362
1447
  tests: File[];
1363
1448
  errors: unknown[];
1364
1449
  }>;
1450
+ listFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
1365
1451
  start(filters?: string[]): Promise<void>;
1366
1452
  init(): Promise<void>;
1367
1453
  private getTestDependencies;
1368
1454
  filterTestsBySource(specs: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
1455
+ /**
1456
+ * @deprecated remove when vscode extension supports "getFileWorkspaceSpecs"
1457
+ */
1369
1458
  getProjectsByTestFile(file: string): WorkspaceSpec[];
1370
- initializeGlobalSetup(paths: WorkspaceSpec[]): Promise<void>;
1371
- private initializeDistPath;
1372
- runFiles(specs: WorkspaceSpec[], allTestsRun: boolean): Promise<void>;
1459
+ getFileWorkspaceSpecs(file: string): WorkspaceSpec[];
1460
+ initializeGlobalSetup(paths: TestSpecification[]): Promise<void>;
1461
+ runFiles(specs: TestSpecification[], allTestsRun: boolean): Promise<void>;
1373
1462
  collectFiles(specs: WorkspaceSpec[]): Promise<void>;
1374
1463
  cancelCurrentRun(reason: CancelReason): Promise<void>;
1375
1464
  rerunFiles(files?: string[], trigger?: string): Promise<void>;
@@ -1385,6 +1474,10 @@ declare class Vitest {
1385
1474
  * Watch only the specified tests. If no tests are provided, all tests will be watched.
1386
1475
  */
1387
1476
  watchTests(tests: string[]): void;
1477
+ private updateLastChanged;
1478
+ onChange: (id: string) => void;
1479
+ onUnlink: (id: string) => void;
1480
+ onAdd: (id: string) => Promise<void>;
1388
1481
  private unregisterWatcher;
1389
1482
  private registerWatcher;
1390
1483
  /**
@@ -1399,7 +1492,12 @@ declare class Vitest {
1399
1492
  exit(force?: boolean): Promise<void>;
1400
1493
  report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
1401
1494
  getTestFilepaths(): Promise<string[]>;
1495
+ globTestSpecs(filters?: string[]): Promise<WorkspaceSpec[]>;
1496
+ /**
1497
+ * @deprecated use globTestSpecs instead
1498
+ */
1402
1499
  globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
1500
+ private ensureSpecCached;
1403
1501
  shouldKeepServer(): boolean;
1404
1502
  onServerRestart(fn: OnServerRestartHandler): void;
1405
1503
  onAfterSetServer(fn: OnServerRestartHandler): void;
@@ -1407,18 +1505,10 @@ declare class Vitest {
1407
1505
  onClose(fn: () => void): void;
1408
1506
  }
1409
1507
 
1410
- type SerializedSpec = [
1411
- project: {
1412
- name: string | undefined;
1413
- root: string;
1414
- },
1415
- file: string
1416
- ];
1417
-
1418
1508
  interface Reporter {
1419
1509
  onInit?: (ctx: Vitest) => void;
1420
1510
  onPathsCollected?: (paths?: string[]) => Awaitable<void>;
1421
- onSpecsCollected?: (specs?: SerializedSpec[]) => Awaitable<void>;
1511
+ onSpecsCollected?: (specs?: SerializedTestSpecification[]) => Awaitable<void>;
1422
1512
  onCollected?: (files?: File[]) => Awaitable<void>;
1423
1513
  onFinished?: (files: File[], errors: unknown[], coverage?: unknown) => Awaitable<void>;
1424
1514
  onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
@@ -1699,6 +1789,16 @@ declare const BenchmarkReportsMap: {
1699
1789
  };
1700
1790
  type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
1701
1791
 
1792
+ /**
1793
+ * @deprecated Use `TestModule` instead
1794
+ */
1795
+ declare const TestFile: typeof TestModule;
1796
+
1797
+ /**
1798
+ * @deprecated Use `ModuleDiagnostic` instead
1799
+ */
1800
+ type FileDiagnostic = ModuleDiagnostic;
1801
+
1702
1802
  declare const ReportersMap: {
1703
1803
  default: typeof DefaultReporter;
1704
1804
  basic: typeof BasicReporter;
@@ -1781,83 +1881,6 @@ interface BenchmarkUserOptions {
1781
1881
  outputJson?: string;
1782
1882
  }
1783
1883
 
1784
- declare const defaultBrowserPort = 63315;
1785
- declare const extraInlineDeps: RegExp[];
1786
-
1787
- declare const defaultInclude: string[];
1788
- declare const defaultExclude: string[];
1789
- declare const coverageConfigDefaults: ResolvedCoverageOptions;
1790
- declare const configDefaults: Readonly<{
1791
- allowOnly: boolean;
1792
- isolate: true;
1793
- watch: boolean;
1794
- globals: false;
1795
- environment: "node";
1796
- pool: "forks";
1797
- clearMocks: false;
1798
- restoreMocks: false;
1799
- mockReset: false;
1800
- unstubGlobals: false;
1801
- unstubEnvs: false;
1802
- include: string[];
1803
- exclude: string[];
1804
- teardownTimeout: number;
1805
- forceRerunTriggers: string[];
1806
- update: false;
1807
- reporters: never[];
1808
- silent: false;
1809
- hideSkippedTests: false;
1810
- api: false;
1811
- ui: false;
1812
- uiBase: string;
1813
- open: boolean;
1814
- css: {
1815
- include: never[];
1816
- };
1817
- coverage: CoverageV8Options;
1818
- fakeTimers: {
1819
- loopLimit: number;
1820
- shouldClearNativeTimers: true;
1821
- toFake: ("setTimeout" | "setInterval" | "clearInterval" | "clearTimeout" | "setImmediate" | "clearImmediate" | "Date")[];
1822
- };
1823
- maxConcurrency: number;
1824
- dangerouslyIgnoreUnhandledErrors: false;
1825
- typecheck: {
1826
- checker: "tsc";
1827
- include: string[];
1828
- exclude: string[];
1829
- };
1830
- slowTestThreshold: number;
1831
- disableConsoleIntercept: false;
1832
- }>;
1833
-
1834
- interface UserWorkspaceConfig extends UserConfig$1 {
1835
- test?: ProjectConfig;
1836
- }
1837
-
1838
- type UserConfigFnObject = (env: ConfigEnv) => UserConfig$1;
1839
- type UserConfigFnPromise = (env: ConfigEnv) => Promise<UserConfig$1>;
1840
- type UserConfigFn = (env: ConfigEnv) => UserConfig$1 | Promise<UserConfig$1>;
1841
- type UserConfigExport = UserConfig$1 | Promise<UserConfig$1> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
1842
- type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>;
1843
- type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
1844
- declare function defineConfig(config: UserConfig$1): UserConfig$1;
1845
- declare function defineConfig(config: Promise<UserConfig$1>): Promise<UserConfig$1>;
1846
- declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
1847
- declare function defineConfig(config: UserConfigExport): UserConfigExport;
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
- */
1857
- extends?: string;
1858
- });
1859
- declare function defineWorkspace(config: WorkspaceProjectConfiguration[]): WorkspaceProjectConfiguration[];
1860
-
1861
1884
  type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
1862
1885
  type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
1863
1886
 
@@ -2703,15 +2726,17 @@ type ProjectConfig = Omit<UserConfig, NonProjectOptions | 'sequencer' | 'deps' |
2703
2726
  };
2704
2727
  };
2705
2728
  type ResolvedProjectConfig = Omit<ResolvedConfig, NonProjectOptions>;
2706
-
2707
- type VitestInlineConfig = InlineConfig;
2708
- declare module 'vite' {
2709
- interface UserConfig {
2710
- /**
2711
- * Options for Vitest
2712
- */
2713
- test?: VitestInlineConfig;
2714
- }
2729
+ interface UserWorkspaceConfig extends UserConfig$1 {
2730
+ test?: ProjectConfig;
2715
2731
  }
2732
+ type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>;
2733
+ type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
2734
+ type WorkspaceProjectConfiguration = string | (UserProjectConfigExport & {
2735
+ /**
2736
+ * Relative path to the extendable config. All other options will be merged with this config.
2737
+ * @example '../vite.config.ts'
2738
+ */
2739
+ extends?: string;
2740
+ });
2716
2741
 
2717
- 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 };
2742
+ export { type BrowserProviderInitializationOptions as $, type ApiConfig as A, type BaseCoverageOptions as B, type CoverageProvider as C, type DepsOptimizationOptions as D, type ResolvedConfig as E, type ProjectConfig as F, type BenchmarkUserOptions as G, type VitestOptions as H, type InlineConfig as I, WorkspaceProject as J, type TestSequencer as K, Logger as L, type WorkspaceSpec as M, TestModule as N, type ModuleDiagnostic as O, type Pool as P, type ProcessPool as Q, type ResolvedCoverageOptions as R, type SerializedTestSpecification as S, type TscErrorInfo as T, type UserWorkspaceConfig as U, Vitest as V, type WorkspaceProjectConfiguration as W, getFilePoolName as X, VitestPackageInstaller as Y, TestSpecification as Z, type TestSequencerConstructor as _, type CoverageProviderModule as a, type BrowserProvider as a0, type CDPSession as a1, type BrowserProviderModule as a2, type ResolvedBrowserOptions as a3, type BrowserProviderOptions as a4, type BrowserBuiltinProvider as a5, type BrowserCommand as a6, type BrowserCommandContext as a7, type BrowserServer as a8, type BrowserServerState as a9, BaseReporter as aA, TestFile as aB, type FileDiagnostic as aC, ReportersMap as aD, type BuiltinReporters as aE, type BuiltinReporterOptions as aF, type JsonAssertionResult as aG, type JsonTestResult as aH, type JsonTestResults as aI, BenchmarkReportsMap as aJ, type BenchmarkBuiltinReporters as aK, type BrowserServerStateContext as aa, type BrowserOrchestrator as ab, type JsonOptions as ac, type JUnitOptions as ad, type HTMLOptions as ae, TestCase as af, TestSuite as ag, TestProject as ah, TestCollection as ai, type TaskOptions as aj, type TestDiagnostic as ak, type TestResult as al, type TestResultPassed as am, type TestResultFailed as an, type TestResultSkipped as ao, type ResolvedProjectConfig as ap, DefaultReporter as aq, BasicReporter as ar, DotReporter as as, JsonReporter as at, VerboseReporter as au, TapReporter as av, JUnitReporter as aw, TapFlatReporter as ax, HangingProcessReporter as ay, GithubActionsReporter as az, type CoverageV8Options as b, type UserProjectConfigFn as c, type UserProjectConfigExport as d, type VitestEnvironment as e, type RawErrsMap as f, type CollectLineNumbers as g, type CollectLines as h, type RootAndTarget as i, type Context as j, type ReportContext as k, type CoverageReporter as l, type CoverageProviderName as m, type CoverageOptions as n, type CoverageIstanbulOptions as o, type CustomProviderOptions as p, type Reporter as q, type BrowserScript as r, type BrowserConfigOptions as s, type BuiltinEnvironment as t, type PoolOptions as u, type CSSModuleScopeStrategy as v, type VitestRunMode as w, type TransformModePatterns as x, type TypecheckConfig as y, type UserConfig as z };