vitest 2.1.0-beta.4 → 2.1.0-beta.6

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 (46) hide show
  1. package/LICENSE.md +29 -0
  2. package/dist/browser.d.ts +4 -3
  3. package/dist/browser.js +2 -2
  4. package/dist/chunks/{RandomSequencer.B4M2ux5b.js → RandomSequencer.CjkAy_bL.js} +67 -21
  5. package/dist/chunks/{base.BYvKfYzm.js → base.B-9RAXb6.js} +1 -1
  6. package/dist/chunks/{cac.C8rwFluK.js → cac.BZlOqtiQ.js} +7 -6
  7. package/dist/chunks/{cli-api.Bej3bUwz.js → cli-api.B-2f6g4d.js} +7541 -7357
  8. package/dist/chunks/{constants.CaAN7icJ.js → constants.fzPh7AOq.js} +1 -1
  9. package/dist/chunks/{coverage.CqfT4xaf.js → coverage.zlNdAMHK.js} +5 -3
  10. package/dist/chunks/{creator.GreKbaUc.js → creator.D0TxjnLa.js} +27 -22
  11. package/dist/chunks/{environment.0M5R1SX_.d.ts → environment.C5eAp3K6.d.ts} +1 -1
  12. package/dist/chunks/{globals.DRPLtPOv.js → globals.Br36EZIp.js} +3 -3
  13. package/dist/chunks/{index.YuPJueCg.js → index.C4LZENmc.js} +4446 -4416
  14. package/dist/chunks/index.CWhwfxXK.js +835 -0
  15. package/dist/chunks/{index.CxWPpGJz.js → index.dWDhoZDV.js} +2 -2
  16. package/dist/chunks/{index.CNZXZ9PJ.js → index.m3Xip5Zz.js} +1 -1
  17. package/dist/chunks/{reporters.DRZ7ndzr.d.ts → reporters.B0Ao6Zu1.d.ts} +154 -117
  18. package/dist/chunks/{resolveConfig.CGobt8AB.js → resolveConfig.C0vpvVRF.js} +43 -33
  19. package/dist/chunks/{runBaseTests.BAhL8UH_.js → runBaseTests.Cf8lGnUq.js} +5 -5
  20. package/dist/chunks/{setup-common.KBrCO5LJ.js → setup-common.B7uEQsGB.js} +1 -1
  21. package/dist/chunks/{vi.B6QZ938s.js → vi.DBepMgvg.js} +9 -0
  22. package/dist/chunks/vite.Bvz2vSw0.d.ts +11 -0
  23. package/dist/chunks/{worker.BANO5ak1.d.ts → worker.CTdJUeeB.d.ts} +3 -2
  24. package/dist/chunks/{worker.Cx2xE71X.d.ts → worker.DTM-0OlZ.d.ts} +1 -1
  25. package/dist/cli.js +2 -2
  26. package/dist/config.cjs +1 -0
  27. package/dist/config.d.ts +70 -2
  28. package/dist/config.js +1 -0
  29. package/dist/coverage.d.ts +4 -3
  30. package/dist/coverage.js +27 -3
  31. package/dist/environments.d.ts +2 -2
  32. package/dist/execute.d.ts +2 -2
  33. package/dist/index.d.ts +11 -6
  34. package/dist/index.js +3 -3
  35. package/dist/node.d.ts +17 -7
  36. package/dist/node.js +39 -36
  37. package/dist/reporters.d.ts +2 -2
  38. package/dist/reporters.js +5 -5
  39. package/dist/runners.js +1 -1
  40. package/dist/workers/forks.js +1 -1
  41. package/dist/workers/runVmTests.js +5 -5
  42. package/dist/workers/threads.js +1 -1
  43. package/dist/workers.d.ts +4 -16
  44. package/dist/workers.js +1 -1
  45. package/package.json +12 -12
  46. package/dist/chunks/index.DNUmWFkO.js +0 -319
@@ -3,8 +3,8 @@ import { resolve } from 'pathe';
3
3
  import { distDir } from '../path.js';
4
4
  import { g as getWorkerState } from './utils.Ck2hJTRs.js';
5
5
  import { r as rpc } from './rpc.B7Mfb-Yf.js';
6
- import { t as takeCoverageInsideWorker } from './coverage.CqfT4xaf.js';
7
- import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.KBrCO5LJ.js';
6
+ import { t as takeCoverageInsideWorker } from './coverage.zlNdAMHK.js';
7
+ import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.B7uEQsGB.js';
8
8
 
9
9
  function setupChaiConfig(config) {
10
10
  Object.assign(chai.config, config);
@@ -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.DBepMgvg.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';
@@ -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';
@@ -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,48 @@ declare class WorkspaceProject {
675
681
  initBrowserProvider(): Promise<void>;
676
682
  }
677
683
 
678
- type WorkspaceSpec = [project: WorkspaceProject, testFile: string];
684
+ declare class WorkspaceSpec$1 {
685
+ /**
686
+ * @deprecated
687
+ */
688
+ readonly 0: WorkspaceProject;
689
+ /**
690
+ * @deprecated
691
+ */
692
+ readonly 1: string;
693
+ /**
694
+ * @deprecated
695
+ */
696
+ readonly 2: {
697
+ pool: Pool;
698
+ };
699
+ readonly project: TestProject;
700
+ readonly moduleId: string;
701
+ readonly pool: Pool;
702
+ constructor(workspaceProject: WorkspaceProject, moduleId: string, pool: Pool);
703
+ /**
704
+ * for backwards compatibility
705
+ * @deprecated
706
+ */
707
+ [Symbol.iterator](): Generator<string | WorkspaceProject, void, unknown>;
708
+ }
709
+
710
+ type WorkspaceSpec = WorkspaceSpec$1 & [
711
+ /**
712
+ * @deprecated use spec.project instead
713
+ */
714
+ project: WorkspaceProject,
715
+ /**
716
+ * @deprecated use spec.moduleId instead
717
+ */
718
+ file: string,
719
+ /**
720
+ * @deprecated use spec.pool instead
721
+ */
722
+ options: {
723
+ pool: Pool;
724
+ }
725
+ ];
679
726
  type RunWithFiles = (files: WorkspaceSpec[], invalidates?: string[]) => Awaitable$1<void>;
680
727
  interface ProcessPool {
681
728
  name: string;
@@ -698,11 +745,11 @@ declare class ReportedTaskImplementation {
698
745
  /**
699
746
  * Unique identifier.
700
747
  * 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.
748
+ * The ID is based on the project name, module url and test position.
702
749
  */
703
750
  readonly id: string;
704
751
  /**
705
- * Location in the file where the test or suite is defined.
752
+ * Location in the module where the test or suite is defined.
706
753
  */
707
754
  readonly location: {
708
755
  line: number;
@@ -712,16 +759,16 @@ declare class ReportedTaskImplementation {
712
759
  /**
713
760
  * Creates a new reported task instance and stores it in the project's state for future use.
714
761
  */
715
- static register(task: Task, project: WorkspaceProject): TestCase | TestSuite | TestFile;
762
+ static register(task: Task, project: WorkspaceProject): TestCase | TestSuite | TestModule;
716
763
  }
717
764
  declare class TestCase extends ReportedTaskImplementation {
718
765
  #private;
719
766
  readonly task: Test | Custom;
720
767
  readonly type = "test";
721
768
  /**
722
- * Direct reference to the test file where the test or suite is defined.
769
+ * Direct reference to the test module where the test or suite is defined.
723
770
  */
724
- readonly file: TestFile;
771
+ readonly module: TestModule;
725
772
  /**
726
773
  * Name of the test.
727
774
  */
@@ -731,9 +778,9 @@ declare class TestCase extends ReportedTaskImplementation {
731
778
  */
732
779
  readonly options: TaskOptions;
733
780
  /**
734
- * Parent suite. If the test was called directly inside the file, the parent will be the file.
781
+ * Parent suite. If the test was called directly inside the module, the parent will be the module itself.
735
782
  */
736
- readonly parent: TestSuite | TestFile;
783
+ readonly parent: TestSuite | TestModule;
737
784
  protected constructor(task: Test | Custom, project: WorkspaceProject);
738
785
  /**
739
786
  * Full name of the test including all parent suites separated with `>`.
@@ -809,13 +856,13 @@ declare class TestSuite extends SuiteImplementation {
809
856
  */
810
857
  readonly name: string;
811
858
  /**
812
- * Direct reference to the test file where the test or suite is defined.
859
+ * Direct reference to the test module where the test or suite is defined.
813
860
  */
814
- readonly file: TestFile;
861
+ readonly module: TestModule;
815
862
  /**
816
- * Parent suite. If suite was called directly inside the file, the parent will be the file.
863
+ * Parent suite. If suite was called directly inside the module, the parent will be the module itself.
817
864
  */
818
- readonly parent: TestSuite | TestFile;
865
+ readonly parent: TestSuite | TestModule;
819
866
  /**
820
867
  * Options that suite was initiated with.
821
868
  */
@@ -826,10 +873,10 @@ declare class TestSuite extends SuiteImplementation {
826
873
  */
827
874
  get fullName(): string;
828
875
  }
829
- declare class TestFile extends SuiteImplementation {
876
+ declare class TestModule extends SuiteImplementation {
830
877
  readonly task: File;
831
878
  readonly location: undefined;
832
- readonly type = "file";
879
+ readonly type = "module";
833
880
  /**
834
881
  * This is usually an absolute UNIX file path.
835
882
  * It can be a virtual id if the file is not on the disk.
@@ -838,10 +885,10 @@ declare class TestFile extends SuiteImplementation {
838
885
  readonly moduleId: string;
839
886
  protected constructor(task: File, project: WorkspaceProject);
840
887
  /**
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`.
888
+ * Useful information about the module like duration, memory usage, etc.
889
+ * If the module was not executed yet, all diagnostic values will return `0`.
843
890
  */
844
- diagnostic(): FileDiagnostic;
891
+ diagnostic(): ModuleDiagnostic;
845
892
  }
846
893
  interface TaskOptions {
847
894
  each: boolean | undefined;
@@ -913,7 +960,7 @@ interface TestDiagnostic {
913
960
  */
914
961
  flaky: boolean;
915
962
  }
916
- interface FileDiagnostic {
963
+ interface ModuleDiagnostic {
917
964
  /**
918
965
  * The time it takes to import and initiate an environment.
919
966
  */
@@ -923,16 +970,16 @@ interface FileDiagnostic {
923
970
  */
924
971
  prepareDuration: number;
925
972
  /**
926
- * The time it takes to import the test file.
927
- * This includes importing everything in the file and executing suite callbacks.
973
+ * The time it takes to import the test module.
974
+ * This includes importing everything in the module and executing suite callbacks.
928
975
  */
929
976
  collectDuration: number;
930
977
  /**
931
- * The time it takes to import the setup file.
978
+ * The time it takes to import the setup module.
932
979
  */
933
980
  setupDuration: number;
934
981
  /**
935
- * Accumulated duration of all tests and hooks in the file.
982
+ * Accumulated duration of all tests and hooks in the module.
936
983
  */
937
984
  duration: number;
938
985
  }
@@ -944,7 +991,7 @@ declare class StateManager {
944
991
  taskFileMap: WeakMap<Task, File>;
945
992
  errorsSet: Set<unknown>;
946
993
  processTimeoutCauses: Set<string>;
947
- reportedTasksMap: WeakMap<Task, TestCase | TestSuite | TestFile>;
994
+ reportedTasksMap: WeakMap<Task, TestCase | TestSuite | TestModule>;
948
995
  catchError(err: unknown, type: string): void;
949
996
  clearErrors(): void;
950
997
  getUnhandledErrors(): unknown[];
@@ -961,7 +1008,7 @@ declare class StateManager {
961
1008
  collectFiles(project: WorkspaceProject, files?: File[]): void;
962
1009
  clearFiles(project: WorkspaceProject, paths?: string[]): void;
963
1010
  updateId(task: Task, project: WorkspaceProject): void;
964
- getReportedEntity(task: Task): TestCase | TestSuite | TestFile | undefined;
1011
+ getReportedEntity(task: Task): TestCase | TestSuite | TestModule | undefined;
965
1012
  updateTasks(packs: TaskResultPack[]): void;
966
1013
  updateUserLog(log: UserConsoleLog): void;
967
1014
  getCountOfFailedTests(): number;
@@ -1261,6 +1308,17 @@ interface BaseCoverageOptions {
1261
1308
  * @default false
1262
1309
  */
1263
1310
  allowExternal?: boolean;
1311
+ /**
1312
+ * Apply exclusions again after coverage has been remapped to original sources.
1313
+ * This is useful when your source files are transpiled and may contain source maps
1314
+ * of non-source files.
1315
+ *
1316
+ * Use this option when you are seeing files that show up in report even if they
1317
+ * match your `coverage.exclude` patterns.
1318
+ *
1319
+ * @default false
1320
+ */
1321
+ excludeAfterRemap?: boolean;
1264
1322
  /**
1265
1323
  * Concurrency limit used when processing the coverage results.
1266
1324
  * Defaults to `Math.min(20, os.availableParallelism?.() ?? os.cpus().length)`
@@ -1340,8 +1398,10 @@ declare class Vitest {
1340
1398
  private coreWorkspaceProject;
1341
1399
  private resolvedProjects;
1342
1400
  projects: WorkspaceProject[];
1343
- private projectsTestFiles;
1344
1401
  distPath: string;
1402
+ private _cachedSpecs;
1403
+ /** @deprecated use `_cachedSpecs` */
1404
+ projectTestFiles: Map<string, WorkspaceSpec[]>;
1345
1405
  constructor(mode: VitestRunMode, options?: VitestOptions);
1346
1406
  private _onRestartListeners;
1347
1407
  private _onClose;
@@ -1349,8 +1409,18 @@ declare class Vitest {
1349
1409
  private _onCancelListeners;
1350
1410
  setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
1351
1411
  provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
1352
- private createCoreProject;
1412
+ /**
1413
+ * @deprecated internal, use `_createCoreProject` instead
1414
+ */
1415
+ createCoreProject(): Promise<WorkspaceProject>;
1416
+ /**
1417
+ * @internal
1418
+ */
1419
+ _createCoreProject(): Promise<WorkspaceProject>;
1353
1420
  getCoreWorkspaceProject(): WorkspaceProject;
1421
+ /**
1422
+ * @deprecated use Reported Task API instead
1423
+ */
1354
1424
  getProjectByTaskId(taskId: string): WorkspaceProject;
1355
1425
  getProjectByName(name?: string): WorkspaceProject;
1356
1426
  private getWorkspaceConfigPath;
@@ -1366,7 +1436,11 @@ declare class Vitest {
1366
1436
  init(): Promise<void>;
1367
1437
  private getTestDependencies;
1368
1438
  filterTestsBySource(specs: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
1439
+ /**
1440
+ * @deprecated remove when vscode extension supports "getFileWorkspaceSpecs"
1441
+ */
1369
1442
  getProjectsByTestFile(file: string): WorkspaceSpec[];
1443
+ getFileWorkspaceSpecs(file: string): WorkspaceSpec[];
1370
1444
  initializeGlobalSetup(paths: WorkspaceSpec[]): Promise<void>;
1371
1445
  private initializeDistPath;
1372
1446
  runFiles(specs: WorkspaceSpec[], allTestsRun: boolean): Promise<void>;
@@ -1399,7 +1473,12 @@ declare class Vitest {
1399
1473
  exit(force?: boolean): Promise<void>;
1400
1474
  report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
1401
1475
  getTestFilepaths(): Promise<string[]>;
1476
+ globTestSpecs(filters?: string[]): Promise<WorkspaceSpec[]>;
1477
+ /**
1478
+ * @deprecated use globTestSpecs instead
1479
+ */
1402
1480
  globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
1481
+ private ensureSpecCached;
1403
1482
  shouldKeepServer(): boolean;
1404
1483
  onServerRestart(fn: OnServerRestartHandler): void;
1405
1484
  onAfterSetServer(fn: OnServerRestartHandler): void;
@@ -1412,7 +1491,10 @@ type SerializedSpec = [
1412
1491
  name: string | undefined;
1413
1492
  root: string;
1414
1493
  },
1415
- file: string
1494
+ file: string,
1495
+ options: {
1496
+ pool: string;
1497
+ }
1416
1498
  ];
1417
1499
 
1418
1500
  interface Reporter {
@@ -1699,6 +1781,16 @@ declare const BenchmarkReportsMap: {
1699
1781
  };
1700
1782
  type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
1701
1783
 
1784
+ /**
1785
+ * @deprecated Use `TestModule` instead
1786
+ */
1787
+ declare const TestFile: typeof TestModule;
1788
+
1789
+ /**
1790
+ * @deprecated Use `ModuleDiagnostic` instead
1791
+ */
1792
+ type FileDiagnostic = ModuleDiagnostic;
1793
+
1702
1794
  declare const ReportersMap: {
1703
1795
  default: typeof DefaultReporter;
1704
1796
  basic: typeof BasicReporter;
@@ -1781,83 +1873,6 @@ interface BenchmarkUserOptions {
1781
1873
  outputJson?: string;
1782
1874
  }
1783
1875
 
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
1876
  type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
1862
1877
  type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
1863
1878
 
@@ -2450,6 +2465,26 @@ interface InlineConfig {
2450
2465
  */
2451
2466
  waitForDebugger?: boolean;
2452
2467
  };
2468
+ /**
2469
+ * Define variables that will be returned from `inject` in the test environment.
2470
+ * @example
2471
+ * ```ts
2472
+ * // vitest.config.ts
2473
+ * export default defineConfig({
2474
+ * test: {
2475
+ * provide: {
2476
+ * someKey: 'someValue'
2477
+ * }
2478
+ * }
2479
+ * })
2480
+ * ```
2481
+ * ```ts
2482
+ * // test file
2483
+ * import { inject } from 'vitest'
2484
+ * const value = inject('someKey') // 'someValue'
2485
+ * ```
2486
+ */
2487
+ provide?: Partial<ProvidedContext>;
2453
2488
  /**
2454
2489
  * Configuration options for expect() matches.
2455
2490
  */
@@ -2683,15 +2718,17 @@ type ProjectConfig = Omit<UserConfig, NonProjectOptions | 'sequencer' | 'deps' |
2683
2718
  };
2684
2719
  };
2685
2720
  type ResolvedProjectConfig = Omit<ResolvedConfig, NonProjectOptions>;
2686
-
2687
- type VitestInlineConfig = InlineConfig;
2688
- declare module 'vite' {
2689
- interface UserConfig {
2690
- /**
2691
- * Options for Vitest
2692
- */
2693
- test?: VitestInlineConfig;
2694
- }
2721
+ interface UserWorkspaceConfig extends UserConfig$1 {
2722
+ test?: ProjectConfig;
2695
2723
  }
2724
+ type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>;
2725
+ type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
2726
+ type WorkspaceProjectConfiguration = string | (UserProjectConfigExport & {
2727
+ /**
2728
+ * Relative path to the extendable config. All other options will be merged with this config.
2729
+ * @example '../vite.config.ts'
2730
+ */
2731
+ extends?: string;
2732
+ });
2696
2733
 
2697
- export { type BrowserBuiltinProvider as $, type ApiConfig as A, type BaseCoverageOptions as B, type CoverageProvider as C, type DepsOptimizationOptions as D, type BenchmarkUserOptions as E, type VitestOptions as F, type TestSequencer as G, type WorkspaceSpec as H, type InlineConfig as I, type ProcessPool as J, getFilePoolName as K, Logger as L, VitestPackageInstaller as M, type TestSequencerConstructor as N, type BrowserProviderInitializationOptions as O, type Pool as P, type BrowserProvider as Q, type ResolvedCoverageOptions as R, type SerializedSpec as S, type TscErrorInfo as T, type UserConfig as U, type VitestEnvironment as V, WorkspaceProject as W, type CDPSession as X, type BrowserProviderModule as Y, type ResolvedBrowserOptions as Z, type BrowserProviderOptions as _, type CoverageProviderModule as a, type BrowserCommand as a0, type BrowserCommandContext as a1, type BrowserServer as a2, type BrowserServerState as a3, type BrowserServerStateContext as a4, type BrowserOrchestrator as a5, type JsonOptions as a6, type JUnitOptions as a7, type HTMLOptions as a8, TestCase as a9, extraInlineDeps as aA, DefaultReporter as aB, BasicReporter as aC, DotReporter as aD, JsonReporter as aE, VerboseReporter as aF, TapReporter as aG, JUnitReporter as aH, TapFlatReporter as aI, HangingProcessReporter as aJ, GithubActionsReporter as aK, BaseReporter as aL, ReportersMap as aM, type BuiltinReporters as aN, type BuiltinReporterOptions as aO, type JsonAssertionResult as aP, type JsonTestResult as aQ, type JsonTestResults as aR, BenchmarkReportsMap as aS, type BenchmarkBuiltinReporters as aT, TestFile as aa, TestSuite as ab, TestProject as ac, TestCollection as ad, type TaskOptions as ae, type TestDiagnostic as af, type FileDiagnostic as ag, type TestResult as ah, type TestResultPassed as ai, type TestResultFailed as aj, type TestResultSkipped as ak, type ResolvedProjectConfig as al, type UserConfigFnObject as am, type UserConfigFnPromise as an, type UserConfigFn as ao, type UserConfigExport as ap, type UserProjectConfigFn as aq, type UserProjectConfigExport as ar, defineConfig as as, defineProject as at, defineWorkspace as au, defaultBrowserPort as av, configDefaults as aw, defaultInclude as ax, defaultExclude as ay, coverageConfigDefaults as az, type RawErrsMap as b, type CollectLineNumbers as c, type CollectLines as d, type RootAndTarget as e, type Context as f, type ReportContext as g, type CoverageReporter as h, type CoverageProviderName as i, type CoverageOptions as j, type CoverageIstanbulOptions as k, type CoverageV8Options as l, type CustomProviderOptions as m, type Reporter as n, Vitest as o, type BrowserScript as p, type BrowserConfigOptions as q, type BuiltinEnvironment as r, type PoolOptions as s, type CSSModuleScopeStrategy as t, type VitestRunMode as u, type TransformModePatterns as v, type TypecheckConfig as w, type ResolvedConfig as x, type ProjectConfig as y, type UserWorkspaceConfig as z };
2734
+ export { type BrowserProvider 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 SerializedSpec as S, type TscErrorInfo as T, type UserWorkspaceConfig as U, Vitest as V, type WorkspaceProjectConfiguration as W, getFilePoolName as X, VitestPackageInstaller as Y, type TestSequencerConstructor as Z, type BrowserProviderInitializationOptions as _, type CoverageProviderModule as a, type CDPSession as a0, type BrowserProviderModule as a1, type ResolvedBrowserOptions as a2, type BrowserProviderOptions as a3, type BrowserBuiltinProvider as a4, type BrowserCommand as a5, type BrowserCommandContext as a6, type BrowserServer as a7, type BrowserServerState as a8, type BrowserServerStateContext as a9, TestFile as aA, type FileDiagnostic as aB, ReportersMap as aC, type BuiltinReporters as aD, type BuiltinReporterOptions as aE, type JsonAssertionResult as aF, type JsonTestResult as aG, type JsonTestResults as aH, BenchmarkReportsMap as aI, type BenchmarkBuiltinReporters as aJ, type BrowserOrchestrator as aa, type JsonOptions as ab, type JUnitOptions as ac, type HTMLOptions as ad, TestCase as ae, TestSuite as af, TestProject as ag, TestCollection as ah, type TaskOptions as ai, type TestDiagnostic as aj, type TestResult as ak, type TestResultPassed as al, type TestResultFailed as am, type TestResultSkipped as an, type ResolvedProjectConfig as ao, DefaultReporter as ap, BasicReporter as aq, DotReporter as ar, JsonReporter as as, VerboseReporter as at, TapReporter as au, JUnitReporter as av, TapFlatReporter as aw, HangingProcessReporter as ax, GithubActionsReporter as ay, BaseReporter 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 };