vitest 1.3.0 → 1.4.0

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 (47) hide show
  1. package/LICENSE.md +1 -2
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/browser.js +1 -1
  4. package/dist/chunks/{integrations-globals.FlQVNhQx.js → integrations-globals.trMeEBob.js} +3 -3
  5. package/dist/chunks/{runtime-console.Iloo9fIt.js → runtime-console.tUKE_2UJ.js} +4 -4
  6. package/dist/chunks/{runtime-runBaseTests.0UwIvo_U.js → runtime-runBaseTests.SKlFOhuq.js} +6 -6
  7. package/dist/cli.js +41 -1373
  8. package/dist/config.d.ts +1 -1
  9. package/dist/coverage.d.ts +6 -6
  10. package/dist/coverage.js +34 -3
  11. package/dist/environments.d.ts +1 -1
  12. package/dist/execute.d.ts +1 -1
  13. package/dist/execute.js +2 -2
  14. package/dist/index.d.ts +5 -3
  15. package/dist/index.js +4 -4
  16. package/dist/node.d.ts +11 -3
  17. package/dist/node.js +21 -13
  18. package/dist/{reporters-QGe8gs4b.d.ts → reporters-P7C2ytIv.d.ts} +230 -173
  19. package/dist/reporters.d.ts +1 -1
  20. package/dist/reporters.js +3 -3
  21. package/dist/runners.d.ts +2 -1
  22. package/dist/runners.js +8 -3
  23. package/dist/{suite-xGC-mxBC.d.ts → suite-a18diDsI.d.ts} +1 -1
  24. package/dist/suite.d.ts +2 -2
  25. package/dist/utils.d.ts +5 -0
  26. package/dist/utils.js +6 -0
  27. package/dist/vendor/{base.knFzp7G3.js → base.Xt0Omgh7.js} +9 -3
  28. package/dist/vendor/{base.RpormaJz.js → base.nhvUBzQY.js} +2 -2
  29. package/dist/vendor/{cli-api.RIYLcWhB.js → cac.RvTIWZBK.js} +6288 -106
  30. package/dist/vendor/{execute.aFSzc0Da.js → execute.2_yoIC01.js} +1 -1
  31. package/dist/vendor/{index.n-Ib4UWN.js → index.BeX1oZht.js} +1 -1
  32. package/dist/vendor/{index.CKbXK54q.js → index.LNWuEnUT.js} +1 -1
  33. package/dist/vendor/{index.QcWmThJv.js → index.e9RDLAeW.js} +43 -25
  34. package/dist/vendor/{setup-common.NSpEdAQm.js → setup-common.vyF1kALR.js} +1 -1
  35. package/dist/vendor/{utils.GbToHGHI.js → utils.w0xgzP1h.js} +15 -10
  36. package/dist/vendor/{vi.-Nr_x6dl.js → vi.JYQecGiw.js} +16 -1
  37. package/dist/vendor/{vm.UmCkcXp-.js → vm.cAHVDF92.js} +2 -2
  38. package/dist/worker.js +20 -5
  39. package/dist/workers/forks.js +5 -5
  40. package/dist/workers/runVmTests.js +5 -5
  41. package/dist/workers/threads.js +4 -4
  42. package/dist/workers/vmForks.js +6 -6
  43. package/dist/workers/vmThreads.js +5 -5
  44. package/dist/workers.d.ts +6 -3
  45. package/dist/workers.js +6 -6
  46. package/package.json +10 -10
  47. package/dist/chunks/api-setup.Xh60JpeM.js +0 -4771
@@ -344,6 +344,113 @@ interface FakeTimerInstallOpts {
344
344
  shouldClearNativeTimers?: boolean | undefined;
345
345
  }
346
346
 
347
+ type BuiltinPool = 'browser' | 'threads' | 'forks' | 'vmThreads' | 'vmForks' | 'typescript';
348
+ type Pool = BuiltinPool | (string & {});
349
+ interface PoolOptions extends Record<string, unknown> {
350
+ /**
351
+ * Run tests in `node:worker_threads`.
352
+ *
353
+ * Test isolation (when enabled) is done by spawning a new thread for each test file.
354
+ *
355
+ * This pool is used by default.
356
+ */
357
+ threads?: ThreadsOptions & WorkerContextOptions;
358
+ /**
359
+ * Run tests in `node:child_process` using [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
360
+ *
361
+ * Test isolation (when enabled) is done by spawning a new child process for each test file.
362
+ */
363
+ forks?: ForksOptions & WorkerContextOptions;
364
+ /**
365
+ * Run tests in isolated `node:vm`.
366
+ * Test files are run parallel using `node:worker_threads`.
367
+ *
368
+ * This makes tests run faster, but VM module is unstable. Your tests might leak memory.
369
+ */
370
+ vmThreads?: ThreadsOptions & VmOptions;
371
+ /**
372
+ * Run tests in isolated `node:vm`.
373
+ *
374
+ * Test files are run parallel using `node:child_process` [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
375
+ *
376
+ * This makes tests run faster, but VM module is unstable. Your tests might leak memory.
377
+ */
378
+ vmForks?: ForksOptions & VmOptions;
379
+ }
380
+ interface ThreadsOptions {
381
+ /** Minimum amount of threads to use */
382
+ minThreads?: number;
383
+ /** Maximum amount of threads to use */
384
+ maxThreads?: number;
385
+ /**
386
+ * Run tests inside a single thread.
387
+ *
388
+ * @default false
389
+ */
390
+ singleThread?: boolean;
391
+ /**
392
+ * Use Atomics to synchronize threads
393
+ *
394
+ * This can improve performance in some cases, but might cause segfault in older Node versions.
395
+ *
396
+ * @default false
397
+ */
398
+ useAtomics?: boolean;
399
+ }
400
+ interface ForksOptions {
401
+ /** Minimum amount of child processes to use */
402
+ minForks?: number;
403
+ /** Maximum amount of child processes to use */
404
+ maxForks?: number;
405
+ /**
406
+ * Run tests inside a single fork.
407
+ *
408
+ * @default false
409
+ */
410
+ singleFork?: boolean;
411
+ }
412
+ interface WorkerContextOptions {
413
+ /**
414
+ * Isolate test environment by recycling `worker_threads` or `child_process` after each test
415
+ *
416
+ * @default true
417
+ */
418
+ isolate?: boolean;
419
+ /**
420
+ * Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
421
+ *
422
+ * See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
423
+ *
424
+ * Set to `process.execArgv` to pass all arguments of the current process.
425
+ *
426
+ * Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
427
+ *
428
+ * @default [] // no execution arguments are passed
429
+ */
430
+ execArgv?: string[];
431
+ }
432
+ interface VmOptions {
433
+ /**
434
+ * Specifies the memory limit for `worker_thread` or `child_process` before they are recycled.
435
+ * If you see memory leaks, try to tinker this value.
436
+ */
437
+ memoryLimit?: string | number;
438
+ /** Isolation is always enabled */
439
+ isolate?: true;
440
+ /**
441
+ * Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
442
+ *
443
+ * See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
444
+ *
445
+ * Set to `process.execArgv` to pass all arguments of the current process.
446
+ *
447
+ * Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
448
+ *
449
+ * @default [] // no execution arguments are passed
450
+ */
451
+ execArgv?: string[];
452
+ }
453
+
347
454
  interface ParsedFile extends File {
348
455
  start: number;
349
456
  end: number;
@@ -463,61 +570,6 @@ declare class Logger {
463
570
  printSourceTypeErrors(errors: TypeCheckError[]): Promise<void>;
464
571
  }
465
572
 
466
- interface InitializeProjectOptions extends UserWorkspaceConfig {
467
- workspaceConfigPath: string;
468
- extends?: string;
469
- }
470
- declare class WorkspaceProject {
471
- path: string | number;
472
- ctx: Vitest;
473
- options?: InitializeProjectOptions | undefined;
474
- configOverride: Partial<ResolvedConfig> | undefined;
475
- config: ResolvedConfig;
476
- server: ViteDevServer;
477
- vitenode: ViteNodeServer;
478
- runner: ViteNodeRunner;
479
- browser?: ViteDevServer;
480
- typechecker?: Typechecker;
481
- closingPromise: Promise<unknown> | undefined;
482
- browserProvider: BrowserProvider | undefined;
483
- browserState: {
484
- files: string[];
485
- resolve: () => void;
486
- reject: (v: unknown) => void;
487
- } | undefined;
488
- testFilesList: string[] | null;
489
- private _globalSetups;
490
- private _provided;
491
- constructor(path: string | number, ctx: Vitest, options?: InitializeProjectOptions | undefined);
492
- getName(): string;
493
- isCore(): boolean;
494
- provide: (key: string, value: unknown) => void;
495
- getProvidedContext(): ProvidedContext;
496
- initializeGlobalSetup(): Promise<void>;
497
- teardownGlobalSetup(): Promise<void>;
498
- get logger(): Logger;
499
- getModulesByFilepath(file: string): Set<vite.ModuleNode>;
500
- getModuleById(id: string): vite.ModuleNode | undefined;
501
- getSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
502
- getBrowserSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
503
- get reporters(): Reporter[];
504
- globTestFiles(filters?: string[]): Promise<string[]>;
505
- globAllTestFiles(include: string[], exclude: string[], includeSource: string[] | undefined, cwd: string): Promise<string[]>;
506
- isTestFile(id: string): boolean | null;
507
- globFiles(include: string[], exclude: string[], cwd: string): Promise<string[]>;
508
- isTargetFile(id: string, source?: string): Promise<boolean>;
509
- isInSourceTestFile(code: string): boolean;
510
- filterFiles(testFiles: string[], filters: string[] | undefined, dir: string): string[];
511
- initBrowserServer(configFile: string | undefined): Promise<void>;
512
- static createBasicProject(ctx: Vitest): WorkspaceProject;
513
- static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
514
- setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
515
- isBrowserEnabled(): boolean;
516
- getSerializableConfig(): ResolvedConfig;
517
- close(): Promise<unknown>;
518
- initBrowserProvider(): Promise<void>;
519
- }
520
-
521
573
  interface BrowserProviderInitializationOptions {
522
574
  browser: string;
523
575
  options?: BrowserProviderOptions;
@@ -599,111 +651,59 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
599
651
  api: ApiConfig;
600
652
  }
601
653
 
602
- type BuiltinPool = 'browser' | 'threads' | 'forks' | 'vmThreads' | 'vmForks' | 'typescript';
603
- type Pool = BuiltinPool | (string & {});
604
- interface PoolOptions extends Record<string, unknown> {
605
- /**
606
- * Run tests in `node:worker_threads`.
607
- *
608
- * Test isolation (when enabled) is done by spawning a new thread for each test file.
609
- *
610
- * This pool is used by default.
611
- */
612
- threads?: ThreadsOptions & WorkerContextOptions;
613
- /**
614
- * Run tests in `node:child_process` using [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
615
- *
616
- * Test isolation (when enabled) is done by spawning a new child process for each test file.
617
- */
618
- forks?: ForksOptions & WorkerContextOptions;
619
- /**
620
- * Run tests in isolated `node:vm`.
621
- * Test files are run parallel using `node:worker_threads`.
622
- *
623
- * This makes tests run faster, but VM module is unstable. Your tests might leak memory.
624
- */
625
- vmThreads?: ThreadsOptions & VmOptions;
626
- /**
627
- * Run tests in isolated `node:vm`.
628
- *
629
- * Test files are run parallel using `node:child_process` [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
630
- *
631
- * This makes tests run faster, but VM module is unstable. Your tests might leak memory.
632
- */
633
- vmForks?: ForksOptions & VmOptions;
634
- }
635
- interface ThreadsOptions {
636
- /** Minimum amount of threads to use */
637
- minThreads?: number;
638
- /** Maximum amount of threads to use */
639
- maxThreads?: number;
640
- /**
641
- * Run tests inside a single thread.
642
- *
643
- * @default false
644
- */
645
- singleThread?: boolean;
646
- /**
647
- * Use Atomics to synchronize threads
648
- *
649
- * This can improve performance in some cases, but might cause segfault in older Node versions.
650
- *
651
- * @default false
652
- */
653
- useAtomics?: boolean;
654
- }
655
- interface ForksOptions {
656
- /** Minimum amount of child processes to use */
657
- minForks?: number;
658
- /** Maximum amount of child processes to use */
659
- maxForks?: number;
660
- /**
661
- * Run tests inside a single fork.
662
- *
663
- * @default false
664
- */
665
- singleFork?: boolean;
666
- }
667
- interface WorkerContextOptions {
668
- /**
669
- * Isolate test environment by recycling `worker_threads` or `child_process` after each test
670
- *
671
- * @default true
672
- */
673
- isolate?: boolean;
674
- /**
675
- * Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
676
- *
677
- * See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
678
- *
679
- * Set to `process.execArgv` to pass all arguments of the current process.
680
- *
681
- * Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
682
- *
683
- * @default [] // no execution arguments are passed
684
- */
685
- execArgv?: string[];
654
+ interface InitializeProjectOptions extends UserWorkspaceConfig {
655
+ workspaceConfigPath: string;
656
+ extends?: string;
686
657
  }
687
- interface VmOptions {
688
- /**
689
- * Specifies the memory limit for `worker_thread` or `child_process` before they are recycled.
690
- * If you see memory leaks, try to tinker this value.
691
- */
692
- memoryLimit?: string | number;
693
- /** Isolation is always enabled */
694
- isolate?: true;
695
- /**
696
- * Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
697
- *
698
- * See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
699
- *
700
- * Set to `process.execArgv` to pass all arguments of the current process.
701
- *
702
- * Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
703
- *
704
- * @default [] // no execution arguments are passed
705
- */
706
- execArgv?: string[];
658
+ declare class WorkspaceProject {
659
+ path: string | number;
660
+ ctx: Vitest;
661
+ options?: InitializeProjectOptions | undefined;
662
+ configOverride: Partial<ResolvedConfig> | undefined;
663
+ config: ResolvedConfig;
664
+ server: ViteDevServer;
665
+ vitenode: ViteNodeServer;
666
+ runner: ViteNodeRunner;
667
+ browser?: ViteDevServer;
668
+ typechecker?: Typechecker;
669
+ closingPromise: Promise<unknown> | undefined;
670
+ browserProvider: BrowserProvider | undefined;
671
+ browserState: {
672
+ files: string[];
673
+ resolve: () => void;
674
+ reject: (v: unknown) => void;
675
+ } | undefined;
676
+ testFilesList: string[] | null;
677
+ private _globalSetups;
678
+ private _provided;
679
+ constructor(path: string | number, ctx: Vitest, options?: InitializeProjectOptions | undefined);
680
+ getName(): string;
681
+ isCore(): boolean;
682
+ provide: (key: string, value: unknown) => void;
683
+ getProvidedContext(): ProvidedContext;
684
+ initializeGlobalSetup(): Promise<void>;
685
+ teardownGlobalSetup(): Promise<void>;
686
+ get logger(): Logger;
687
+ getModulesByFilepath(file: string): Set<vite.ModuleNode>;
688
+ getModuleById(id: string): vite.ModuleNode | undefined;
689
+ getSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
690
+ getBrowserSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
691
+ get reporters(): Reporter[];
692
+ globTestFiles(filters?: string[]): Promise<string[]>;
693
+ globAllTestFiles(include: string[], exclude: string[], includeSource: string[] | undefined, cwd: string): Promise<string[]>;
694
+ isTestFile(id: string): boolean | null;
695
+ globFiles(include: string[], exclude: string[], cwd: string): Promise<string[]>;
696
+ isTargetFile(id: string, source?: string): Promise<boolean>;
697
+ isInSourceTestFile(code: string): boolean;
698
+ filterFiles(testFiles: string[], filters: string[] | undefined, dir: string): string[];
699
+ initBrowserServer(configFile: string | undefined): Promise<void>;
700
+ static createBasicProject(ctx: Vitest): WorkspaceProject;
701
+ static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
702
+ setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
703
+ isBrowserEnabled(): boolean;
704
+ getSerializableConfig(): ResolvedConfig;
705
+ close(): Promise<unknown>;
706
+ initBrowserProvider(): Promise<void>;
707
707
  }
708
708
 
709
709
  type WorkspaceSpec = [project: WorkspaceProject, testFile: string];
@@ -846,7 +846,7 @@ declare class VitestCache {
846
846
  getFileStats(key: string): {
847
847
  size: number;
848
848
  } | undefined;
849
- static resolveCacheDir(root: string, dir: string | undefined, projectName: string | undefined): string;
849
+ static resolveCacheDir(root: string, dir?: string, projectName?: string): string;
850
850
  static clearCache(options: CliOptions): Promise<{
851
851
  dir: string;
852
852
  cleared: boolean;
@@ -870,12 +870,12 @@ declare class Vitest {
870
870
  cache: VitestCache;
871
871
  reporters: Reporter[];
872
872
  coverageProvider: CoverageProvider | null | undefined;
873
- browserProvider: BrowserProvider | undefined;
874
873
  logger: Logger;
875
874
  pool: ProcessPool | undefined;
876
875
  vitenode: ViteNodeServer;
877
876
  invalidates: Set<string>;
878
877
  changedTests: Set<string>;
878
+ watchedTests: Set<string>;
879
879
  filenamePattern?: string;
880
880
  runningPromise?: Promise<void>;
881
881
  closingPromise?: Promise<void>;
@@ -918,6 +918,10 @@ declare class Vitest {
918
918
  private _rerunTimer;
919
919
  private scheduleRerun;
920
920
  getModuleProjects(filepath: string): WorkspaceProject[];
921
+ /**
922
+ * Watch only the specified tests. If no tests are provided, all tests will be watched.
923
+ */
924
+ watchTests(tests: string[]): void;
921
925
  private unregisterWatcher;
922
926
  private registerWatcher;
923
927
  /**
@@ -1496,6 +1500,11 @@ type Provider = 'v8' | 'istanbul' | 'custom' | undefined;
1496
1500
  type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? ({
1497
1501
  provider: T;
1498
1502
  } & CoverageIstanbulOptions) : T extends 'v8' ? ({
1503
+ /**
1504
+ * Provider to use for coverage collection.
1505
+ *
1506
+ * @default 'v8'
1507
+ */
1499
1508
  provider: T;
1500
1509
  } & CoverageV8Options) : T extends 'custom' ? ({
1501
1510
  provider: T;
@@ -1528,12 +1537,14 @@ interface BaseCoverageOptions {
1528
1537
  extension?: string | string[];
1529
1538
  /**
1530
1539
  * List of files excluded from coverage as glob patterns
1540
+ *
1541
+ * @default ['coverage/**', 'dist/**', '**\/[.]**', 'packages/*\/test?(s)/**', '**\/*.d.ts', '**\/virtual:*', '**\/__x00__*', '**\/\x00*', 'cypress/**', 'test?(s)/**', 'test?(-*).?(c|m)[jt]s?(x)', '**\/*{.,-}{test,spec}.?(c|m)[jt]s?(x)', '**\/__tests__/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*', '**\/vitest.{workspace,projects}.[jt]s?(on)', '**\/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}']
1531
1542
  */
1532
1543
  exclude?: string[];
1533
1544
  /**
1534
1545
  * Whether to include all files, including the untested ones into report
1535
1546
  *
1536
- * @default false
1547
+ * @default true
1537
1548
  */
1538
1549
  all?: boolean;
1539
1550
  /**
@@ -1550,6 +1561,8 @@ interface BaseCoverageOptions {
1550
1561
  cleanOnRerun?: boolean;
1551
1562
  /**
1552
1563
  * Directory to write coverage report to
1564
+ *
1565
+ * @default './coverage'
1553
1566
  */
1554
1567
  reportsDirectory?: string;
1555
1568
  /**
@@ -1766,7 +1779,7 @@ interface BenchmarkUserOptions {
1766
1779
  include?: string[];
1767
1780
  /**
1768
1781
  * Exclude globs for benchmark test files
1769
- * @default ['node_modules', 'dist', '.idea', '.git', '.cache']
1782
+ * @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
1770
1783
  */
1771
1784
  exclude?: string[];
1772
1785
  /**
@@ -1778,6 +1791,8 @@ interface BenchmarkUserOptions {
1778
1791
  /**
1779
1792
  * Custom reporter for output. Can contain one or more built-in report names, reporter instances,
1780
1793
  * and/or paths to custom reporters
1794
+ *
1795
+ * @default ['default']
1781
1796
  */
1782
1797
  reporters?: Arrayable$1<BenchmarkBuiltinReporters | Reporter>;
1783
1798
  /**
@@ -1897,10 +1912,22 @@ interface SequenceOptions {
1897
1912
  */
1898
1913
  sequencer?: TestSequencerConstructor;
1899
1914
  /**
1900
- * Should tests run in random order.
1915
+ * Should files and tests run in random order.
1901
1916
  * @default false
1902
1917
  */
1903
- shuffle?: boolean;
1918
+ shuffle?: boolean | {
1919
+ /**
1920
+ * Should files run in random order. Long running tests will not start
1921
+ * earlier if you enable this option.
1922
+ * @default false
1923
+ */
1924
+ files?: boolean;
1925
+ /**
1926
+ * Should tests run in random order.
1927
+ * @default false
1928
+ */
1929
+ tests?: boolean;
1930
+ };
1904
1931
  /**
1905
1932
  * Should tests run in parallel.
1906
1933
  * @default false
@@ -2053,7 +2080,7 @@ interface InlineConfig {
2053
2080
  include?: string[];
2054
2081
  /**
2055
2082
  * Exclude globs for test files
2056
- * @default ['node_modules', 'dist', '.idea', '.git', '.cache']
2083
+ * @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
2057
2084
  */
2058
2085
  exclude?: string[];
2059
2086
  /**
@@ -2175,7 +2202,7 @@ interface InlineConfig {
2175
2202
  /**
2176
2203
  * Watch mode
2177
2204
  *
2178
- * @default true
2205
+ * @default !process.env.CI
2179
2206
  */
2180
2207
  watch?: boolean;
2181
2208
  /**
@@ -2187,6 +2214,8 @@ interface InlineConfig {
2187
2214
  /**
2188
2215
  * Custom reporter for output. Can contain one or more built-in report names, reporter instances,
2189
2216
  * and/or paths to custom reporters.
2217
+ *
2218
+ * @default []
2190
2219
  */
2191
2220
  reporters?: Arrayable<ReporterName | InlineReporter> | ((ReporterName | InlineReporter) | [ReporterName] | ReporterWithOptions)[];
2192
2221
  /**
@@ -2242,7 +2271,7 @@ interface InlineConfig {
2242
2271
  *
2243
2272
  * Useful if you are testing calling CLI commands
2244
2273
  *
2245
- * @default []
2274
+ * @default ['**\/package.json/**', '**\/{vitest,vite}.config.*\/**']
2246
2275
  */
2247
2276
  forceRerunTriggers?: string[];
2248
2277
  /**
@@ -2288,6 +2317,8 @@ interface InlineConfig {
2288
2317
  api?: boolean | number | ApiConfig;
2289
2318
  /**
2290
2319
  * Enable Vitest UI
2320
+ *
2321
+ * @default false
2291
2322
  */
2292
2323
  ui?: boolean;
2293
2324
  /**
@@ -2300,7 +2331,7 @@ interface InlineConfig {
2300
2331
  /**
2301
2332
  * Open UI automatically.
2302
2333
  *
2303
- * @default true
2334
+ * @default !process.env.CI
2304
2335
  */
2305
2336
  open?: boolean;
2306
2337
  /**
@@ -2335,6 +2366,8 @@ interface InlineConfig {
2335
2366
  passWithNoTests?: boolean;
2336
2367
  /**
2337
2368
  * Allow tests and suites that are marked as only
2369
+ *
2370
+ * @default !process.env.CI
2338
2371
  */
2339
2372
  allowOnly?: boolean;
2340
2373
  /**
@@ -2354,7 +2387,7 @@ interface InlineConfig {
2354
2387
  *
2355
2388
  * Return `false` to ignore the log.
2356
2389
  */
2357
- onConsoleLog?: (log: string, type: 'stdout' | 'stderr') => false | void;
2390
+ onConsoleLog?: (log: string, type: 'stdout' | 'stderr') => boolean | void;
2358
2391
  /**
2359
2392
  * Enable stack trace filtering. If absent, all stack trace frames
2360
2393
  * will be shown.
@@ -2383,10 +2416,13 @@ interface InlineConfig {
2383
2416
  maxConcurrency?: number;
2384
2417
  /**
2385
2418
  * Options for configuring cache policy.
2386
- * @default { dir: 'node_modules/.vitest' }
2419
+ * @default { dir: 'node_modules/.vite/vitest' }
2387
2420
  */
2388
2421
  cache?: false | {
2389
- dir?: string;
2422
+ /**
2423
+ * @deprecated Use Vite's "cacheDir" instead if you want to change the cache director. Note caches will be written to "cacheDir\/vitest".
2424
+ */
2425
+ dir: string;
2390
2426
  };
2391
2427
  /**
2392
2428
  * Options for configuring the order of running tests.
@@ -2400,6 +2436,8 @@ interface InlineConfig {
2400
2436
  alias?: AliasOptions;
2401
2437
  /**
2402
2438
  * Ignore any unhandled errors that occur
2439
+ *
2440
+ * @default false
2403
2441
  */
2404
2442
  dangerouslyIgnoreUnhandledErrors?: boolean;
2405
2443
  /**
@@ -2459,6 +2497,12 @@ interface InlineConfig {
2459
2497
  * @default false
2460
2498
  */
2461
2499
  disableConsoleIntercept?: boolean;
2500
+ /**
2501
+ * Include "location" property inside the test definition
2502
+ *
2503
+ * @default false
2504
+ */
2505
+ includeTaskLocation?: boolean;
2462
2506
  }
2463
2507
  interface TypecheckConfig {
2464
2508
  /**
@@ -2471,14 +2515,20 @@ interface TypecheckConfig {
2471
2515
  only?: boolean;
2472
2516
  /**
2473
2517
  * What tools to use for type checking.
2518
+ *
2519
+ * @default 'tsc'
2474
2520
  */
2475
2521
  checker: 'tsc' | 'vue-tsc' | (string & Record<never, never>);
2476
2522
  /**
2477
2523
  * Pattern for files that should be treated as test files
2524
+ *
2525
+ * @default ['**\/*.{test,spec}-d.?(c|m)[jt]s?(x)']
2478
2526
  */
2479
2527
  include: string[];
2480
2528
  /**
2481
2529
  * Pattern for files that should not be treated as test files
2530
+ *
2531
+ * @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
2482
2532
  */
2483
2533
  exclude: string[];
2484
2534
  /**
@@ -2538,6 +2588,10 @@ interface UserConfig extends InlineConfig {
2538
2588
  * Additional exclude patterns
2539
2589
  */
2540
2590
  cliExclude?: string[];
2591
+ /**
2592
+ * Override vite config's clearScreen from cli
2593
+ */
2594
+ clearScreen?: boolean;
2541
2595
  }
2542
2596
  interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool' | 'cliExclude'> {
2543
2597
  mode: VitestRunMode;
@@ -2561,6 +2615,9 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
2561
2615
  count: number;
2562
2616
  };
2563
2617
  cache: {
2618
+ /**
2619
+ * @deprecated
2620
+ */
2564
2621
  dir: string;
2565
2622
  } | false;
2566
2623
  sequence: {
@@ -2687,4 +2744,4 @@ type Context = RootAndTarget & {
2687
2744
  lastActivePath?: string;
2688
2745
  };
2689
2746
 
2690
- export { type ProjectConfig as $, type AfterSuiteRunMeta as A, type BaseCoverageOptions as B, type CoverageOptions as C, type RootAndTarget as D, type Environment as E, type FakeTimerInstallOpts as F, type Context as G, type Pool as H, type PoolOptions as I, type JSDOMOptions as J, type HappyDOMOptions as K, type BuiltinEnvironment as L, type MockFactoryWithHelper as M, type VitestEnvironment as N, type CSSModuleScopeStrategy as O, type ProvidedContext as P, type ApiConfig as Q, type ResolvedConfig as R, type EnvironmentOptions as S, type TestSequencer as T, type UserConfig as U, type VitestRunMode as V, WorkspaceProject as W, type DepsOptimizationOptions as X, type TransformModePatterns as Y, type InlineConfig as Z, type TypecheckConfig as _, type ResolvedCoverageOptions as a, type UserWorkspaceConfig as a0, type RunnerRPC as a1, type ContextTestEnvironment as a2, type ResolvedTestEnvironment as a3, type ResolveIdFunction as a4, type WorkerRPC as a5, type Awaitable as a6, type Nullable as a7, type Arrayable as a8, type ArgumentsType$1 as a9, defineProject as aA, defineWorkspace as aB, configDefaults as aC, defaultInclude as aD, defaultExclude as aE, coverageConfigDefaults as aF, extraInlineDeps as aG, DefaultReporter as aH, BasicReporter as aI, DotReporter as aJ, JsonReporter$1 as aK, VerboseReporter as aL, TapReporter as aM, JUnitReporter as aN, TapFlatReporter as aO, HangingProcessReporter as aP, GithubActionsReporter as aQ, BaseReporter as aR, ReportersMap as aS, type BuiltinReporters as aT, type BuiltinReporterOptions as aU, type JsonAssertionResult as aV, type JsonTestResult as aW, type JsonTestResults as aX, BenchmarkReportsMap as aY, type BenchmarkBuiltinReporters as aZ, type MutableArray as aa, type Constructable as ab, type ModuleCache as ac, type EnvironmentReturn as ad, type VmEnvironmentReturn as ae, type OnServerRestartHandler as af, type ReportContext as ag, type CoverageReporter as ah, type CoverageIstanbulOptions as ai, type CoverageV8Options as aj, type CustomProviderOptions as ak, type BenchmarkUserOptions as al, type Benchmark as am, type BenchmarkResult as an, type BenchFunction as ao, type BenchmarkAPI as ap, type PendingSuiteMock as aq, type MockFactory as ar, type MockMap as as, type UserConfigFnObject as at, type UserConfigFnPromise as au, type UserConfigFn as av, type UserConfigExport as aw, type UserProjectConfigFn as ax, type UserProjectConfigExport as ay, defineConfig as az, type CoverageProvider as b, type CoverageProviderModule as c, type VitestOptions as d, Vitest as e, type RuntimeRPC as f, type WorkspaceSpec as g, type ProcessPool as h, VitestPackageInstaller as i, type TestSequencerConstructor as j, type BrowserProviderInitializationOptions as k, type BrowserProvider as l, type BrowserProviderOptions as m, type BirpcOptions as n, type ContextRPC as o, type WorkerGlobalState as p, type WorkerContext as q, type RuntimeConfig as r, startVitest as s, type UserConsoleLog as t, type ModuleGraphData as u, type Reporter as v, type RawErrsMap as w, type TscErrorInfo as x, type CollectLineNumbers as y, type CollectLines as z };
2747
+ export { type TypecheckConfig as $, type AfterSuiteRunMeta as A, type BaseCoverageOptions as B, type CoverageOptions as C, type CollectLines as D, type Environment as E, type FakeTimerInstallOpts as F, type RootAndTarget as G, type Context as H, type Pool as I, type PoolOptions as J, type JSDOMOptions as K, type HappyDOMOptions as L, type MockFactoryWithHelper as M, type BuiltinEnvironment as N, type VitestEnvironment as O, type ProvidedContext as P, type CSSModuleScopeStrategy as Q, type ResolvedConfig as R, type ApiConfig as S, type TestSequencer as T, type UserConfig as U, type VitestRunMode as V, type WorkerGlobalState as W, type EnvironmentOptions as X, type DepsOptimizationOptions as Y, type TransformModePatterns as Z, type InlineConfig as _, type ResolvedCoverageOptions as a, type ProjectConfig as a0, type UserWorkspaceConfig as a1, type RunnerRPC as a2, type ContextTestEnvironment as a3, type ResolvedTestEnvironment as a4, type ResolveIdFunction as a5, type WorkerRPC as a6, type Awaitable as a7, type Nullable as a8, type Arrayable as a9, defineConfig as aA, defineProject as aB, defineWorkspace as aC, configDefaults as aD, defaultInclude as aE, defaultExclude as aF, coverageConfigDefaults as aG, extraInlineDeps as aH, DefaultReporter as aI, BasicReporter as aJ, DotReporter as aK, JsonReporter$1 as aL, VerboseReporter as aM, TapReporter as aN, JUnitReporter as aO, TapFlatReporter as aP, HangingProcessReporter as aQ, GithubActionsReporter as aR, BaseReporter as aS, ReportersMap as aT, type BuiltinReporters as aU, type BuiltinReporterOptions as aV, type JsonAssertionResult as aW, type JsonTestResult as aX, type JsonTestResults as aY, BenchmarkReportsMap as aZ, type BenchmarkBuiltinReporters as a_, type ArgumentsType$1 as aa, type MutableArray as ab, type Constructable as ac, type ModuleCache as ad, type EnvironmentReturn as ae, type VmEnvironmentReturn as af, type OnServerRestartHandler as ag, type ReportContext as ah, type CoverageReporter as ai, type CoverageIstanbulOptions as aj, type CoverageV8Options as ak, type CustomProviderOptions as al, type BenchmarkUserOptions as am, type Benchmark as an, type BenchmarkResult as ao, type BenchFunction as ap, type BenchmarkAPI as aq, type PendingSuiteMock as ar, type MockFactory as as, type MockMap as at, type UserConfigFnObject as au, type UserConfigFnPromise as av, type UserConfigFn as aw, type UserConfigExport as ax, type UserProjectConfigFn as ay, type UserProjectConfigExport as az, type CoverageProvider as b, type CoverageProviderModule as c, type BirpcOptions as d, type RuntimeRPC as e, type ContextRPC as f, type WorkerContext as g, type VitestOptions as h, Vitest as i, type CliOptions as j, WorkspaceProject as k, type WorkspaceSpec as l, type ProcessPool as m, VitestPackageInstaller as n, type TestSequencerConstructor as o, type BrowserProviderInitializationOptions as p, type BrowserProvider as q, type BrowserProviderOptions as r, startVitest as s, type RuntimeConfig as t, type UserConsoleLog as u, type ModuleGraphData as v, type Reporter as w, type RawErrsMap as x, type TscErrorInfo as y, type CollectLineNumbers as z };
@@ -1,4 +1,4 @@
1
- export { aR as BaseReporter, aI as BasicReporter, aZ as BenchmarkBuiltinReporters, aY as BenchmarkReportsMap, aU as BuiltinReporterOptions, aT as BuiltinReporters, aH as DefaultReporter, aJ as DotReporter, aQ as GithubActionsReporter, aP as HangingProcessReporter, aN as JUnitReporter, aV as JsonAssertionResult, aK as JsonReporter, aW as JsonTestResult, aX as JsonTestResults, v as Reporter, aS as ReportersMap, aO as TapFlatReporter, aM as TapReporter, aL as VerboseReporter } from './reporters-QGe8gs4b.js';
1
+ export { aS as BaseReporter, aJ as BasicReporter, a_ as BenchmarkBuiltinReporters, aZ as BenchmarkReportsMap, aV as BuiltinReporterOptions, aU as BuiltinReporters, aI as DefaultReporter, aK as DotReporter, aR as GithubActionsReporter, aQ as HangingProcessReporter, aO as JUnitReporter, aW as JsonAssertionResult, aL as JsonReporter, aX as JsonTestResult, aY as JsonTestResults, w as Reporter, aT as ReportersMap, aP as TapFlatReporter, aN as TapReporter, aM as VerboseReporter } from './reporters-P7C2ytIv.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
package/dist/reporters.js CHANGED
@@ -1,4 +1,4 @@
1
- export { a as BasicReporter, e as BenchmarkReportsMap, D as DefaultReporter, b as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, c as JUnitReporter, J as JsonReporter, R as ReportersMap, d as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.QcWmThJv.js';
1
+ export { a as BasicReporter, e as BenchmarkReportsMap, D as DefaultReporter, b as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, c as JUnitReporter, J as JsonReporter, R as ReportersMap, d as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.e9RDLAeW.js';
2
2
  import 'node:fs';
3
3
  import 'pathe';
4
4
  import './vendor/index.ir9i0ywP.js';
@@ -8,12 +8,12 @@ import '@vitest/utils';
8
8
  import './vendor/global.CkGT_TMy.js';
9
9
  import 'picocolors';
10
10
  import 'node:perf_hooks';
11
- import './chunks/runtime-console.Iloo9fIt.js';
11
+ import './chunks/runtime-console.tUKE_2UJ.js';
12
12
  import 'node:stream';
13
13
  import 'node:console';
14
14
  import 'node:path';
15
15
  import './vendor/date.Ns1pGd_X.js';
16
- import './vendor/base.knFzp7G3.js';
16
+ import './vendor/base.Xt0Omgh7.js';
17
17
  import './vendor/tasks.IknbGB2n.js';
18
18
  import '@vitest/utils/source-map';
19
19
  import 'node:os';
package/dist/runners.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VitestRunner, VitestRunnerImportSource, Suite, Task, CancelReason, Test, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
2
- import { R as ResolvedConfig } from './reporters-QGe8gs4b.js';
2
+ import { R as ResolvedConfig } from './reporters-P7C2ytIv.js';
3
3
  import * as tinybench from 'tinybench';
4
4
  import 'vite';
5
5
  import 'vite-node';
@@ -23,6 +23,7 @@ declare class VitestTestRunner implements VitestRunner {
23
23
  constructor(config: ResolvedConfig);
24
24
  importFile(filepath: string, source: VitestRunnerImportSource): unknown;
25
25
  onBeforeRunFiles(): void;
26
+ onAfterRunFiles(): void;
26
27
  onAfterRunSuite(suite: Suite): Promise<void>;
27
28
  onAfterRunTask(test: Task): void;
28
29
  onCancel(_reason: CancelReason): void;