vitest 2.2.0-beta.2 → 3.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/LICENSE.md +75 -0
  2. package/dist/browser.d.ts +3 -3
  3. package/dist/browser.js +1 -1
  4. package/dist/chunks/{RandomSequencer.BPedXEug.js → RandomSequencer.gisBJ77r.js} +11 -4
  5. package/dist/chunks/{base.BS0HhLXd.js → base.CkcgFVQd.js} +8 -3
  6. package/dist/chunks/{cac.Cs06pOqp.js → cac.CWCZimpS.js} +7 -7
  7. package/dist/chunks/{cli-api.CB-jIbYQ.js → cli-api.BKUOv0Nc.js} +186 -83
  8. package/dist/chunks/{config.CPguQ7J1.d.ts → config.BTPBhmK5.d.ts} +1 -1
  9. package/dist/chunks/{creator.IIqd8RWT.js → creator.DcAcUhMD.js} +1 -4
  10. package/dist/chunks/{globals.BCGEw6ON.js → globals.DJTzb7B3.js} +2 -2
  11. package/dist/chunks/{index.DD5eTY2y.js → index.BqHViJW9.js} +1 -1
  12. package/dist/chunks/{index.BjjsHdBb.js → index.CkOJwybT.js} +1 -1
  13. package/dist/chunks/{index.bzFpKeaq.js → index.DKe7vK-G.js} +530 -144
  14. package/dist/chunks/{index.CqYx2Nsr.js → index.DQboAxJm.js} +23 -14
  15. package/dist/chunks/{inspector.70d6emsh.js → inspector.DKLceBVD.js} +1 -1
  16. package/dist/chunks/{reporters.F9D2idOT.d.ts → reporters.BZbwTvrM.d.ts} +249 -258
  17. package/dist/chunks/{resolveConfig.CLnvCvEs.js → resolveConfig.3rGGWga5.js} +81 -49
  18. package/dist/chunks/{runBaseTests.B7hcVT-s.js → runBaseTests.C6huCAng.js} +6 -6
  19. package/dist/chunks/{setup-common.BfGt8K-K.js → setup-common.B5ClyS48.js} +1 -1
  20. package/dist/chunks/{utils.DJONn5B5.js → utils.CMUTX-p8.js} +5 -2
  21. package/dist/chunks/{vi.BlPttogV.js → vi.CZKezqeD.js} +18 -13
  22. package/dist/chunks/{vite.DonA4fvH.d.ts → vite.DIfmneq0.d.ts} +1 -1
  23. package/dist/chunks/{vm.Zr4qWzDJ.js → vm.DGhTouO3.js} +10 -1
  24. package/dist/chunks/{worker.9VY11NZs.d.ts → worker.CmzGeuVD.d.ts} +3 -3
  25. package/dist/chunks/{worker.Qz1UB4Fv.d.ts → worker.umPNbBNk.d.ts} +1 -1
  26. package/dist/cli.js +1 -1
  27. package/dist/config.cjs +1 -10
  28. package/dist/config.d.ts +4 -5
  29. package/dist/config.js +1 -10
  30. package/dist/coverage.d.ts +2 -2
  31. package/dist/coverage.js +4 -4
  32. package/dist/execute.d.ts +3 -3
  33. package/dist/index.d.ts +21 -13
  34. package/dist/index.js +2 -2
  35. package/dist/node.d.ts +9 -22
  36. package/dist/node.js +9 -9
  37. package/dist/reporters.d.ts +2 -2
  38. package/dist/reporters.js +5 -4
  39. package/dist/runners.d.ts +1 -2
  40. package/dist/runners.js +9 -14
  41. package/dist/worker.js +1 -1
  42. package/dist/workers/forks.js +1 -1
  43. package/dist/workers/runVmTests.js +6 -6
  44. package/dist/workers/threads.js +1 -1
  45. package/dist/workers/vmForks.js +1 -1
  46. package/dist/workers/vmThreads.js +1 -1
  47. package/dist/workers.d.ts +3 -3
  48. package/dist/workers.js +3 -3
  49. package/package.json +21 -22
@@ -1,12 +1,12 @@
1
1
  import * as _vitest_runner from '@vitest/runner';
2
- import { File, TaskResultPack, Task, Test, Custom, TaskMeta, Suite, SequenceHooks, SequenceSetupFiles, CancelReason } from '@vitest/runner';
3
- import { b as Awaitable, U as UserConsoleLog, A as AfterSuiteRunMeta, c as Arrayable$1, f as EnvironmentOptions, P as ProvidedContext, d as ArgumentsType, O as OnServerRestartHandler, h as OnTestsRerunHandler } from './environment.CT0jpO-1.js';
2
+ import { File, TaskResultPack, Task, Test, TaskMeta, Suite, SequenceHooks, SequenceSetupFiles, CancelReason } from '@vitest/runner';
3
+ import { b as Awaitable, U as UserConsoleLog, A as AfterSuiteRunMeta, c as Arrayable$1, f as EnvironmentOptions, P as ProvidedContext, h as OnTestsRerunHandler, d as ArgumentsType, O as OnServerRestartHandler } from './environment.CT0jpO-1.js';
4
4
  import { Writable } from 'node:stream';
5
5
  import { TransformResult as TransformResult$1, ServerOptions, DepOptimizationConfig, AliasOptions, UserConfig as UserConfig$1, ConfigEnv, ViteDevServer, ModuleNode } from 'vite';
6
6
  import { TestError, ParsedStack, Arrayable, ErrorWithDiff, Awaitable as Awaitable$1 } from '@vitest/utils';
7
7
  import { RawSourceMap, ViteNodeServerOptions } from 'vite-node';
8
8
  import { StackTraceParserOptions } from '@vitest/utils/source-map';
9
- import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.CPguQ7J1.js';
9
+ import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.BTPBhmK5.js';
10
10
  import { PrettyFormatOptions } from '@vitest/pretty-format';
11
11
  import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
12
12
  import { SerializedDiffOptions } from '@vitest/utils/diff';
@@ -139,7 +139,7 @@ declare class ReportedTaskImplementation {
139
139
  }
140
140
  declare class TestCase extends ReportedTaskImplementation {
141
141
  #private;
142
- readonly task: Test | Custom;
142
+ readonly task: Test;
143
143
  readonly type = "test";
144
144
  /**
145
145
  * Direct reference to the test module where the test or suite is defined.
@@ -157,7 +157,7 @@ declare class TestCase extends ReportedTaskImplementation {
157
157
  * Parent suite. If the test was called directly inside the module, the parent will be the module itself.
158
158
  */
159
159
  readonly parent: TestSuite | TestModule;
160
- protected constructor(task: Test | Custom, project: TestProject);
160
+ protected constructor(task: Test, project: TestProject);
161
161
  /**
162
162
  * Full name of the test including all parent suites separated with `>`.
163
163
  */
@@ -374,248 +374,12 @@ declare class BasicReporter extends BaseReporter {
374
374
  reportSummary(files: File[], errors: unknown[]): void;
375
375
  }
376
376
 
377
- interface ParsedFile extends File {
378
- start: number;
379
- end: number;
380
- }
381
- interface ParsedTest extends Test {
382
- start: number;
383
- end: number;
384
- }
385
- interface ParsedSuite extends Suite {
386
- start: number;
387
- end: number;
388
- }
389
- interface LocalCallDefinition {
390
- start: number;
391
- end: number;
392
- name: string;
393
- type: 'suite' | 'test';
394
- mode: 'run' | 'skip' | 'only' | 'todo';
395
- task: ParsedSuite | ParsedFile | ParsedTest;
396
- }
397
- interface FileInformation {
398
- file: File;
399
- filepath: string;
400
- parsed: string;
401
- map: RawSourceMap | null;
402
- definitions: LocalCallDefinition[];
403
- }
404
-
405
- type RawErrsMap = Map<string, TscErrorInfo[]>;
406
- interface TscErrorInfo {
407
- filePath: string;
408
- errCode: number;
409
- errMsg: string;
410
- line: number;
411
- column: number;
412
- }
413
- interface CollectLineNumbers {
414
- target: number;
415
- next: number;
416
- prev?: number;
417
- }
418
- type CollectLines = {
419
- [key in keyof CollectLineNumbers]: string;
420
- };
421
- interface RootAndTarget {
422
- root: string;
423
- targetAbsPath: string;
424
- }
425
- type Context = RootAndTarget & {
426
- rawErrsMap: RawErrsMap;
427
- openedDirs: Set<string>;
428
- lastActivePath?: string;
429
- };
430
-
431
- declare class TypeCheckError extends Error {
432
- message: string;
433
- stacks: ParsedStack[];
434
- name: string;
435
- constructor(message: string, stacks: ParsedStack[]);
436
- }
437
- interface TypecheckResults {
438
- files: File[];
439
- sourceErrors: TypeCheckError[];
440
- time: number;
441
- }
442
- type Callback<Args extends Array<any> = []> = (...args: Args) => Awaitable<void>;
443
- declare class Typechecker {
444
- protected ctx: TestProject;
445
- private _onParseStart?;
446
- private _onParseEnd?;
447
- private _onWatcherRerun?;
448
- private _result;
449
- private _startTime;
450
- private _output;
451
- private _tests;
452
- private tempConfigPath?;
453
- private allowJs?;
454
- private process?;
455
- protected files: string[];
456
- constructor(ctx: TestProject);
457
- setFiles(files: string[]): void;
458
- onParseStart(fn: Callback): void;
459
- onParseEnd(fn: Callback<[TypecheckResults]>): void;
460
- onWatcherRerun(fn: Callback): void;
461
- protected collectFileTests(filepath: string): Promise<FileInformation | null>;
462
- protected getFiles(): string[];
463
- collectTests(): Promise<Record<string, FileInformation>>;
464
- protected markPassed(file: File): void;
465
- protected prepareResults(output: string): Promise<{
466
- files: File[];
467
- sourceErrors: TypeCheckError[];
468
- time: number;
469
- }>;
470
- protected parseTscLikeOutput(output: string): Promise<Map<string, {
471
- error: TypeCheckError;
472
- originalError: TscErrorInfo;
473
- }[]>>;
474
- clear(): Promise<void>;
475
- stop(): Promise<void>;
476
- protected ensurePackageInstalled(ctx: Vitest, checker: string): Promise<void>;
477
- prepare(): Promise<void>;
478
- getExitCode(): number | false;
479
- getOutput(): string;
480
- start(): Promise<void>;
481
- getResult(): TypecheckResults;
482
- getTestFiles(): File[];
483
- getTestPacks(): TaskResultPack[];
484
- }
485
-
486
- interface PrintErrorResult {
487
- nearest?: ParsedStack;
488
- }
489
-
490
- interface Options {
491
- /**
492
- Show the cursor. This can be useful when a CLI accepts input from a user.
493
-
494
- @example
495
- ```
496
- import {createLogUpdate} from 'log-update';
497
-
498
- // Write output but don't hide the cursor
499
- const log = createLogUpdate(process.stdout, {
500
- showCursor: true
501
- });
502
- ```
503
- */
504
- readonly showCursor?: boolean;
505
- }
506
-
507
- type LogUpdateMethods = {
508
- /**
509
- Clear the logged output.
510
- */
511
- clear(): void;
512
-
513
- /**
514
- Persist the logged output. Useful if you want to start a new log session below the current one.
515
- */
516
- done(): void;
517
- };
518
-
519
- /**
520
- Log to `stdout` by overwriting the previous output in the terminal.
521
-
522
- @param text - The text to log to `stdout`.
523
-
524
- @example
525
- ```
526
- import logUpdate from 'log-update';
527
-
528
- const frames = ['-', '\\', '|', '/'];
529
- let index = 0;
530
-
531
- setInterval(() => {
532
- const frame = frames[index = ++index % frames.length];
533
-
534
- logUpdate(
535
- `
536
- ♥♥
537
- ${frame} unicorns ${frame}
538
- ♥♥
539
- `
540
- );
541
- }, 80);
542
- ```
543
- */
544
- declare const logUpdate: ((...text: string[]) => void) & LogUpdateMethods;
545
-
546
-
547
- /**
548
- Get a `logUpdate` method that logs to the specified stream.
549
-
550
- @param stream - The stream to log to.
551
-
552
- @example
553
- ```
554
- import {createLogUpdate} from 'log-update';
555
-
556
- // Write output but don't hide the cursor
557
- const log = createLogUpdate(process.stdout);
558
- ```
559
- */
560
- declare function createLogUpdate(
561
- stream: NodeJS.WritableStream,
562
- options?: Options
563
- ): typeof logUpdate;
564
-
565
- interface ErrorOptions {
566
- type?: string;
567
- fullStack?: boolean;
568
- project?: TestProject;
569
- verbose?: boolean;
570
- screenshotPaths?: string[];
571
- task?: Task;
572
- showCodeFrame?: boolean;
573
- }
574
- declare class Logger {
575
- ctx: Vitest;
576
- outputStream: NodeJS.WriteStream | Writable;
577
- errorStream: NodeJS.WriteStream | Writable;
578
- logUpdate: ReturnType<typeof createLogUpdate>;
579
- private _clearScreenPending;
580
- private _highlights;
581
- console: Console;
582
- constructor(ctx: Vitest, outputStream?: NodeJS.WriteStream | Writable, errorStream?: NodeJS.WriteStream | Writable);
583
- log(...args: any[]): void;
584
- error(...args: any[]): void;
585
- warn(...args: any[]): void;
586
- clearFullScreen(message?: string): void;
587
- clearScreen(message: string, force?: boolean): void;
588
- private _clearScreen;
589
- printError(err: unknown, options?: ErrorOptions): PrintErrorResult | undefined;
590
- clearHighlightCache(filename?: string): void;
591
- highlight(filename: string, source: string): string;
592
- printNoTestFound(filters?: string[]): void;
593
- printBanner(): void;
594
- printBrowserBanner(project: TestProject): void;
595
- printUnhandledErrors(errors: unknown[]): void;
596
- printSourceTypeErrors(errors: TypeCheckError[]): void;
597
- private registerUnhandledRejection;
598
- }
599
-
600
- interface DotRendererOptions {
601
- logger: Logger;
602
- }
603
- declare function createDotRenderer(_tasks: Task[], options: DotRendererOptions): {
604
- start(): any;
605
- update(_tasks: Task[]): any;
606
- stop(): Promise<any>;
607
- clear(): void;
608
- };
609
-
610
377
  declare class DotReporter extends BaseReporter {
611
- renderer?: ReturnType<typeof createDotRenderer>;
612
- onTaskUpdate(): void;
613
- onCollected(): void;
614
- onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
615
- onWatcherStart(): Promise<void>;
616
- stopListRender(): Promise<void>;
617
- onWatcherRerun(files: string[], trigger?: string): Promise<void>;
618
- onUserConsoleLog(log: UserConsoleLog): void;
378
+ private summary?;
379
+ onInit(ctx: Vitest): void;
380
+ onTaskUpdate(packs: TaskResultPack[]): void;
381
+ onWatcherRerun(files: string[], trigger?: string): void;
382
+ onFinished(files?: File[], errors?: unknown[]): void;
619
383
  }
620
384
 
621
385
  declare class GithubActionsReporter implements Reporter {
@@ -854,6 +618,229 @@ declare class VerboseReporter extends DefaultReporter {
854
618
  onTaskUpdate(packs: TaskResultPack[]): void;
855
619
  }
856
620
 
621
+ interface ParsedFile extends File {
622
+ start: number;
623
+ end: number;
624
+ }
625
+ interface ParsedTest extends Test {
626
+ start: number;
627
+ end: number;
628
+ }
629
+ interface ParsedSuite extends Suite {
630
+ start: number;
631
+ end: number;
632
+ }
633
+ interface LocalCallDefinition {
634
+ start: number;
635
+ end: number;
636
+ name: string;
637
+ type: 'suite' | 'test';
638
+ mode: 'run' | 'skip' | 'only' | 'todo';
639
+ task: ParsedSuite | ParsedFile | ParsedTest;
640
+ }
641
+ interface FileInformation {
642
+ file: File;
643
+ filepath: string;
644
+ parsed: string;
645
+ map: RawSourceMap | null;
646
+ definitions: LocalCallDefinition[];
647
+ }
648
+
649
+ type RawErrsMap = Map<string, TscErrorInfo[]>;
650
+ interface TscErrorInfo {
651
+ filePath: string;
652
+ errCode: number;
653
+ errMsg: string;
654
+ line: number;
655
+ column: number;
656
+ }
657
+ interface CollectLineNumbers {
658
+ target: number;
659
+ next: number;
660
+ prev?: number;
661
+ }
662
+ type CollectLines = {
663
+ [key in keyof CollectLineNumbers]: string;
664
+ };
665
+ interface RootAndTarget {
666
+ root: string;
667
+ targetAbsPath: string;
668
+ }
669
+ type Context = RootAndTarget & {
670
+ rawErrsMap: RawErrsMap;
671
+ openedDirs: Set<string>;
672
+ lastActivePath?: string;
673
+ };
674
+
675
+ declare class TypeCheckError extends Error {
676
+ message: string;
677
+ stacks: ParsedStack[];
678
+ name: string;
679
+ constructor(message: string, stacks: ParsedStack[]);
680
+ }
681
+ interface TypecheckResults {
682
+ files: File[];
683
+ sourceErrors: TypeCheckError[];
684
+ time: number;
685
+ }
686
+ type Callback<Args extends Array<any> = []> = (...args: Args) => Awaitable<void>;
687
+ declare class Typechecker {
688
+ protected ctx: TestProject;
689
+ private _onParseStart?;
690
+ private _onParseEnd?;
691
+ private _onWatcherRerun?;
692
+ private _result;
693
+ private _startTime;
694
+ private _output;
695
+ private _tests;
696
+ private tempConfigPath?;
697
+ private allowJs?;
698
+ private process?;
699
+ protected files: string[];
700
+ constructor(ctx: TestProject);
701
+ setFiles(files: string[]): void;
702
+ onParseStart(fn: Callback): void;
703
+ onParseEnd(fn: Callback<[TypecheckResults]>): void;
704
+ onWatcherRerun(fn: Callback): void;
705
+ protected collectFileTests(filepath: string): Promise<FileInformation | null>;
706
+ protected getFiles(): string[];
707
+ collectTests(): Promise<Record<string, FileInformation>>;
708
+ protected markPassed(file: File): void;
709
+ protected prepareResults(output: string): Promise<{
710
+ files: File[];
711
+ sourceErrors: TypeCheckError[];
712
+ time: number;
713
+ }>;
714
+ protected parseTscLikeOutput(output: string): Promise<Map<string, {
715
+ error: TypeCheckError;
716
+ originalError: TscErrorInfo;
717
+ }[]>>;
718
+ clear(): Promise<void>;
719
+ stop(): Promise<void>;
720
+ protected ensurePackageInstalled(ctx: Vitest, checker: string): Promise<void>;
721
+ prepare(): Promise<void>;
722
+ getExitCode(): number | false;
723
+ getOutput(): string;
724
+ start(): Promise<void>;
725
+ getResult(): TypecheckResults;
726
+ getTestFiles(): File[];
727
+ getTestPacks(): TaskResultPack[];
728
+ }
729
+
730
+ interface PrintErrorResult {
731
+ nearest?: ParsedStack;
732
+ }
733
+
734
+ interface Options {
735
+ /**
736
+ Show the cursor. This can be useful when a CLI accepts input from a user.
737
+
738
+ @example
739
+ ```
740
+ import {createLogUpdate} from 'log-update';
741
+
742
+ // Write output but don't hide the cursor
743
+ const log = createLogUpdate(process.stdout, {
744
+ showCursor: true
745
+ });
746
+ ```
747
+ */
748
+ readonly showCursor?: boolean;
749
+ }
750
+
751
+ type LogUpdateMethods = {
752
+ /**
753
+ Clear the logged output.
754
+ */
755
+ clear(): void;
756
+
757
+ /**
758
+ Persist the logged output. Useful if you want to start a new log session below the current one.
759
+ */
760
+ done(): void;
761
+ };
762
+
763
+ /**
764
+ Log to `stdout` by overwriting the previous output in the terminal.
765
+
766
+ @param text - The text to log to `stdout`.
767
+
768
+ @example
769
+ ```
770
+ import logUpdate from 'log-update';
771
+
772
+ const frames = ['-', '\\', '|', '/'];
773
+ let index = 0;
774
+
775
+ setInterval(() => {
776
+ const frame = frames[index = ++index % frames.length];
777
+
778
+ logUpdate(
779
+ `
780
+ ♥♥
781
+ ${frame} unicorns ${frame}
782
+ ♥♥
783
+ `
784
+ );
785
+ }, 80);
786
+ ```
787
+ */
788
+ declare const logUpdate: ((...text: string[]) => void) & LogUpdateMethods;
789
+
790
+
791
+ /**
792
+ Get a `logUpdate` method that logs to the specified stream.
793
+
794
+ @param stream - The stream to log to.
795
+
796
+ @example
797
+ ```
798
+ import {createLogUpdate} from 'log-update';
799
+
800
+ // Write output but don't hide the cursor
801
+ const log = createLogUpdate(process.stdout);
802
+ ```
803
+ */
804
+ declare function createLogUpdate(
805
+ stream: NodeJS.WritableStream,
806
+ options?: Options
807
+ ): typeof logUpdate;
808
+
809
+ interface ErrorOptions {
810
+ type?: string;
811
+ fullStack?: boolean;
812
+ project?: TestProject;
813
+ verbose?: boolean;
814
+ screenshotPaths?: string[];
815
+ task?: Task;
816
+ showCodeFrame?: boolean;
817
+ }
818
+ declare class Logger {
819
+ ctx: Vitest;
820
+ outputStream: NodeJS.WriteStream | Writable;
821
+ errorStream: NodeJS.WriteStream | Writable;
822
+ logUpdate: ReturnType<typeof createLogUpdate>;
823
+ private _clearScreenPending;
824
+ private _highlights;
825
+ console: Console;
826
+ constructor(ctx: Vitest, outputStream?: NodeJS.WriteStream | Writable, errorStream?: NodeJS.WriteStream | Writable);
827
+ log(...args: any[]): void;
828
+ error(...args: any[]): void;
829
+ warn(...args: any[]): void;
830
+ clearFullScreen(message?: string): void;
831
+ clearScreen(message: string, force?: boolean): void;
832
+ private _clearScreen;
833
+ printError(err: unknown, options?: ErrorOptions): PrintErrorResult | undefined;
834
+ clearHighlightCache(filename?: string): void;
835
+ highlight(filename: string, source: string): string;
836
+ printNoTestFound(filters?: string[]): void;
837
+ printBanner(): void;
838
+ printBrowserBanner(project: TestProject): void;
839
+ printUnhandledErrors(errors: unknown[]): void;
840
+ printSourceTypeErrors(errors: TypeCheckError[]): void;
841
+ private registerUnhandledRejection;
842
+ }
843
+
857
844
  interface TableRendererOptions {
858
845
  renderSucceed?: boolean;
859
846
  logger: Logger;
@@ -862,9 +849,9 @@ interface TableRendererOptions {
862
849
  compare?: FlatBenchmarkReport;
863
850
  }
864
851
  declare function createTableRenderer(_tasks: Task[], options: TableRendererOptions): {
865
- start(): any;
866
- update(_tasks: Task[]): any;
867
- stop(): any;
852
+ start(): /*elided*/ any;
853
+ update(_tasks: Task[]): /*elided*/ any;
854
+ stop(): /*elided*/ any;
868
855
  clear(): void;
869
856
  };
870
857
 
@@ -1656,6 +1643,7 @@ interface InlineConfig {
1656
1643
  *
1657
1644
  * Format: [glob, environment-name]
1658
1645
  *
1646
+ * @deprecated use [`workspace`](https://vitest.dev/config/#environmentmatchglobs) instead
1659
1647
  * @default []
1660
1648
  * @example [
1661
1649
  * // all tests in tests/dom will run in jsdom
@@ -1706,6 +1694,7 @@ interface InlineConfig {
1706
1694
  *
1707
1695
  * Format: [glob, pool-name]
1708
1696
  *
1697
+ * @deprecated use [`workspace`](https://vitest.dev/config/#poolmatchglobs) instead
1709
1698
  * @default []
1710
1699
  * @example [
1711
1700
  * // all tests in "forks" directory will run using "poolOptions.forks" API
@@ -1718,7 +1707,7 @@ interface InlineConfig {
1718
1707
  /**
1719
1708
  * Path to a workspace configuration file
1720
1709
  */
1721
- workspace?: string;
1710
+ workspace?: string | TestProjectConfiguration[];
1722
1711
  /**
1723
1712
  * Update snapshot
1724
1713
  *
@@ -2275,9 +2264,10 @@ type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig
2275
2264
  type TestProjectConfiguration = string | (UserProjectConfigExport & {
2276
2265
  /**
2277
2266
  * Relative path to the extendable config. All other options will be merged with this config.
2267
+ * If `true`, the project will inherit all options from the root config.
2278
2268
  * @example '../vite.config.ts'
2279
2269
  */
2280
- extends?: string;
2270
+ extends?: string | true;
2281
2271
  });
2282
2272
  /** @deprecated use `TestProjectConfiguration` instead */
2283
2273
  type WorkspaceProjectConfiguration = TestProjectConfiguration;
@@ -2526,7 +2516,9 @@ declare class TestSpecification {
2526
2516
  readonly project: TestProject;
2527
2517
  readonly moduleId: string;
2528
2518
  readonly pool: Pool;
2529
- constructor(project: TestProject, moduleId: string, pool: Pool);
2519
+ /** @private */
2520
+ readonly testLocations: number[] | undefined;
2521
+ constructor(project: TestProject, moduleId: string, pool: Pool, testLocations?: number[] | undefined);
2530
2522
  toJSON(): SerializedTestSpecification;
2531
2523
  /**
2532
2524
  * for backwards compatibility
@@ -2577,7 +2569,7 @@ declare class TestProject {
2577
2569
  /**
2578
2570
  * Provide a value to the test context. This value will be available to all tests with `inject`.
2579
2571
  */
2580
- provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
2572
+ provide: <T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]) => void;
2581
2573
  /**
2582
2574
  * Get the provided context. The project context is merged with the global context.
2583
2575
  */
@@ -2586,7 +2578,7 @@ declare class TestProject {
2586
2578
  * Creates a new test specification. Specifications describe how to run tests.
2587
2579
  * @param moduleId The file path
2588
2580
  */
2589
- createSpecification(moduleId: string, pool?: string): TestSpecification;
2581
+ createSpecification(moduleId: string, pool?: string, testLocations?: number[] | undefined): TestSpecification;
2590
2582
  toJSON(): SerializedTestProject;
2591
2583
  /**
2592
2584
  * Vite's dev server instance. Every workspace project has its own server.
@@ -2616,6 +2608,7 @@ declare class TestProject {
2616
2608
  createSpec(moduleId: string, pool: string): WorkspaceSpec;
2617
2609
  /** @deprecated */
2618
2610
  initializeGlobalSetup(): Promise<void>;
2611
+ onTestsRerun(cb: OnTestsRerunHandler): void;
2619
2612
  /** @deprecated */
2620
2613
  teardownGlobalSetup(): Promise<void>;
2621
2614
  /** @deprecated use `vitest.logger` instead */
@@ -2675,7 +2668,7 @@ interface SerializedTestProject {
2675
2668
  context: ProvidedContext;
2676
2669
  }
2677
2670
  interface InitializeProjectOptions extends UserWorkspaceConfig {
2678
- workspaceConfigPath: string;
2671
+ configFile: string | false;
2679
2672
  extends?: string;
2680
2673
  }
2681
2674
 
@@ -2825,8 +2818,6 @@ declare class Vitest {
2825
2818
  private _workspaceConfigPath?;
2826
2819
  /** @deprecated use `_cachedSpecs` */
2827
2820
  projectTestFiles: Map<string, TestSpecification[]>;
2828
- /** @private */
2829
- _browserLastPort: number;
2830
2821
  constructor(mode: VitestRunMode, options?: VitestOptions);
2831
2822
  private _onRestartListeners;
2832
2823
  private _onClose;
@@ -2841,7 +2832,7 @@ declare class Vitest {
2841
2832
  */
2842
2833
  getProjectByTaskId(taskId: string): TestProject;
2843
2834
  getProjectByName(name?: string): TestProject;
2844
- private getWorkspaceConfigPath;
2835
+ private resolveWorkspaceConfigPath;
2845
2836
  private resolveWorkspace;
2846
2837
  private initCoverageProvider;
2847
2838
  mergeReports(): Promise<void>;