vitest 1.0.0-beta.1 → 1.0.0-beta.3

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 (48) hide show
  1. package/LICENSE.md +0 -29
  2. package/dist/browser.d.ts +2 -2
  3. package/dist/browser.js +2 -2
  4. package/dist/child.js +9 -4
  5. package/dist/{chunk-api-setup.0aeabd21.js → chunk-api-setup.37a43981.js} +3 -2
  6. package/dist/{chunk-install-pkg.a430b45e.js → chunk-install-pkg.6349b322.js} +22 -21
  7. package/dist/{chunk-integrations-globals.c3c5e678.js → chunk-integrations-globals.9df12d91.js} +2 -3
  8. package/dist/{chunk-node-git.36288174.js → chunk-node-git.6c12e560.js} +1 -1
  9. package/dist/{chunk-runtime-console.ea222ffb.js → chunk-runtime-console.f3263f87.js} +19 -4
  10. package/dist/cli-wrapper.js +1 -1
  11. package/dist/cli.js +14 -18
  12. package/dist/config.cjs +2 -1
  13. package/dist/config.d.ts +3 -3
  14. package/dist/config.js +2 -1
  15. package/dist/coverage.d.ts +1 -1
  16. package/dist/coverage.js +2 -2
  17. package/dist/entry-vm.js +9 -4
  18. package/dist/entry.js +10 -5
  19. package/dist/environments.d.ts +1 -1
  20. package/dist/environments.js +1 -13
  21. package/dist/execute.d.ts +1 -1
  22. package/dist/execute.js +1 -1
  23. package/dist/index.d.ts +6 -5
  24. package/dist/index.js +3 -4
  25. package/dist/node.d.ts +5 -3
  26. package/dist/node.js +14 -13
  27. package/dist/{reporters-7bd09217.d.ts → reporters-1678fe04.d.ts} +84 -47
  28. package/dist/reporters.d.ts +1 -1
  29. package/dist/reporters.js +6 -1
  30. package/dist/runners.d.ts +3 -2
  31. package/dist/runners.js +33 -37
  32. package/dist/{suite-543d56bd.d.ts → suite-0579b50d.d.ts} +1 -1
  33. package/dist/suite.d.ts +2 -2
  34. package/dist/{vendor-environments.e73c5410.js → vendor-environments.dcc4a34e.js} +6 -37
  35. package/dist/{vendor-execute.07d1a420.js → vendor-execute.e6e4e89b.js} +1 -0
  36. package/dist/{vendor-index.d36f5516.js → vendor-index.3d079eea.js} +6 -1
  37. package/dist/{vendor-index.f7fcd5e8.js → vendor-index.68ecee35.js} +1 -1
  38. package/dist/{vendor-index.85fc950a.js → vendor-index.8efe7746.js} +375 -375
  39. package/dist/{vendor-index.0b5b3600.js → vendor-loader.9c966f23.js} +36 -9
  40. package/dist/{vendor-node.bde9fb47.js → vendor-node.327f8f1f.js} +1996 -1984
  41. package/dist/{vendor-reporters.f6975b8d.js → vendor-reporters.b9600369.js} +42 -24
  42. package/dist/vendor-vi.d30b47ae.js +3510 -0
  43. package/dist/vm.js +10 -5
  44. package/dist/worker.js +9 -4
  45. package/package.json +12 -28
  46. package/dist/loader.js +0 -100
  47. package/dist/vendor-index.98139333.js +0 -129
  48. package/dist/vendor-vi.7f2b988f.js +0 -3491
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { TaskPopulated, File, TaskResultPack, CancelReason } from '@vitest/runner';
2
2
  export { Custom, DoneCallback, ExtendedContext, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskContext, TaskCustomOptions, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
3
- export { b as bench } from './suite-543d56bd.js';
3
+ export { b as bench } from './suite-0579b50d.js';
4
4
  import { ExpectStatic } from '@vitest/expect';
5
5
  export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
6
- import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, h as RuntimeConfig, A as AfterSuiteRunMeta, i as UserConsoleLog, R as ResolvedConfig, j as ModuleGraphData, k as Reporter } from './reporters-7bd09217.js';
7
- export { x as ApiConfig, a1 as ArgumentsType, a0 as Arrayable, _ as Awaitable, B as BaseCoverageOptions, af as BenchFunction, ad as Benchmark, ag as BenchmarkAPI, ae as BenchmarkResult, ac as BenchmarkUserOptions, u as BuiltinEnvironment, w as CSSModuleScopeStrategy, n as CollectLineNumbers, o as CollectLines, a3 as Constructable, q as Context, Q as ContextRPC, N as ContextTestEnvironment, aa as CoverageIstanbulOptions, e as CoverageOptions, f as CoverageProvider, g as CoverageProviderModule, a9 as CoverageReporter, C as CoverageV8Options, ab as CustomProviderOptions, D as DepsOptimizationOptions, E as Environment, y as EnvironmentOptions, a5 as EnvironmentReturn, H as HappyDOMOptions, I as InlineConfig, J as JSDOMOptions, a4 as ModuleCache, a2 as MutableArray, $ as Nullable, a7 as OnServerRestartHandler, r as Pool, t as PoolOptions, P as ProjectConfig, l as RawErrsMap, a8 as ReportContext, X as ResolveIdFunction, a as ResolvedCoverageOptions, O as ResolvedTestEnvironment, p as RootAndTarget, L as RunnerRPC, K as RuntimeRPC, z as TransformModePatterns, m as TscErrorInfo, G as TypecheckConfig, U as UserConfig, b as Vitest, v as VitestEnvironment, V as VitestRunMode, a6 as VmEnvironmentReturn, S as WorkerContext, Z as WorkerGlobalState, Y as WorkerRPC } from './reporters-7bd09217.js';
6
+ import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, k as RuntimeConfig, A as AfterSuiteRunMeta, l as UserConsoleLog, R as ResolvedConfig, m as ModuleGraphData, n as Reporter } from './reporters-1678fe04.js';
7
+ export { D as ApiConfig, a4 as ArgumentsType, a3 as Arrayable, a1 as Awaitable, B as BaseCoverageOptions, ai as BenchFunction, ag as Benchmark, aj as BenchmarkAPI, ah as BenchmarkResult, af as BenchmarkUserOptions, x as BuiltinEnvironment, z as CSSModuleScopeStrategy, q as CollectLineNumbers, r as CollectLines, a6 as Constructable, u as Context, Y as ContextRPC, S as ContextTestEnvironment, ad as CoverageIstanbulOptions, b as CoverageOptions, c as CoverageProvider, d as CoverageProviderModule, ac as CoverageReporter, C as CoverageV8Options, ae as CustomProviderOptions, I as DepsOptimizationOptions, E as Environment, G as EnvironmentOptions, a8 as EnvironmentReturn, H as HappyDOMOptions, L as InlineConfig, J as JSDOMOptions, a7 as ModuleCache, a5 as MutableArray, a2 as Nullable, aa as OnServerRestartHandler, v as Pool, w as PoolOptions, P as ProjectConfig, o as RawErrsMap, ab as ReportContext, _ as ResolveIdFunction, a as ResolvedCoverageOptions, X as ResolvedTestEnvironment, t as RootAndTarget, Q as RunnerRPC, O as RuntimeRPC, K as TransformModePatterns, p as TscErrorInfo, N as TypecheckConfig, U as UserConfig, e as Vitest, y as VitestEnvironment, V as VitestRunMode, a9 as VmEnvironmentReturn, Z as WorkerContext, a0 as WorkerGlobalState, $ as WorkerRPC } from './reporters-1678fe04.js';
8
8
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, EnhancedSpy } from '@vitest/spy';
9
9
  export { EnhancedSpy, Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
10
10
  export { SnapshotEnvironment } from '@vitest/snapshot/environment';
@@ -373,13 +373,14 @@ interface VitestUtils {
373
373
  declare const vitest: VitestUtils;
374
374
  declare const vi: VitestUtils;
375
375
 
376
- declare function getRunningMode(): "run" | "watch";
376
+ declare function getRunningMode(): "watch" | "run";
377
377
  declare function isWatchMode(): boolean;
378
378
 
379
379
  interface TransformResultWithSource extends TransformResult {
380
380
  source?: string;
381
381
  }
382
382
  interface WebSocketHandlers {
383
+ onUnhandledError(error: unknown, type: string): Promise<void>;
383
384
  onCollected(files?: File[]): Promise<void>;
384
385
  onTaskUpdate(packs: TaskResultPack[]): void;
385
386
  onAfterSuiteRun(meta: AfterSuiteRunMeta): void;
@@ -407,4 +408,4 @@ interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onFinished' |
407
408
  onCancel(reason: CancelReason): void;
408
409
  }
409
410
 
410
- export { AfterSuiteRunMeta, AssertType, ExpectTypeOf, ModuleGraphData, Reporter, ResolvedConfig, RuntimeConfig, TransformResultWithSource, UserConsoleLog, WebSocketEvents, WebSocketHandlers, assertType, createExpect, globalExpect as expect, expectTypeOf, getRunningMode, isFirstRun, isWatchMode, runOnce, vi, vitest };
411
+ export { AfterSuiteRunMeta, type AssertType, type ExpectTypeOf, ModuleGraphData, Reporter, ResolvedConfig, RuntimeConfig, type TransformResultWithSource, UserConsoleLog, type VitestUtils, type WebSocketEvents, type WebSocketHandlers, assertType, createExpect, globalExpect as expect, expectTypeOf, getRunningMode, isFirstRun, isWatchMode, runOnce, vi, vitest };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
2
  export { b as bench } from './vendor-benchmark.44931cfa.js';
3
3
  export { i as isFirstRun, r as runOnce } from './vendor-run-once.3e5ef7d7.js';
4
- export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor-vi.7f2b988f.js';
5
- import { d as dist } from './vendor-index.f7fcd5e8.js';
6
- export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.f7fcd5e8.js';
4
+ export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor-vi.d30b47ae.js';
5
+ import { d as dist } from './vendor-index.68ecee35.js';
6
+ export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.68ecee35.js';
7
7
  import * as chai from 'chai';
8
8
  export { chai };
9
9
  export { assert, should } from 'chai';
@@ -19,7 +19,6 @@ import '@vitest/snapshot';
19
19
  import '@vitest/utils/error';
20
20
  import './vendor-tasks.f9d75aed.js';
21
21
  import '@vitest/utils/source-map';
22
- import 'util';
23
22
  import './vendor-date.6e993429.js';
24
23
  import '@vitest/spy';
25
24
 
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as VitestRunMode, U as UserConfig, b as Vitest, T as TestSequencer, W as WorkspaceSpec } from './reporters-7bd09217.js';
2
- export { d as TestSequencerConstructor, c as VitestWorkspace, s as startVitest } from './reporters-7bd09217.js';
1
+ import { V as VitestRunMode, U as UserConfig, e as Vitest, T as TestSequencer, W as WorkspaceSpec } from './reporters-1678fe04.js';
2
+ export { i as BrowserProvider, h as BrowserProviderInitializationOptions, j as BrowserProviderOptions, g as TestSequencerConstructor, f as WorkspaceProject, s as startVitest } from './reporters-1678fe04.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
4
  import '@vitest/runner';
5
5
  import 'vite-node';
@@ -29,4 +29,6 @@ declare class BaseSequencer implements TestSequencer {
29
29
  sort(files: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
30
30
  }
31
31
 
32
- export { BaseSequencer, TestSequencer, Vitest, VitestPlugin, WorkspaceSpec, createVitest, registerConsoleShortcuts };
32
+ declare function ensurePackageInstalled(dependency: string, root: string): Promise<boolean>;
33
+
34
+ export { BaseSequencer, TestSequencer, Vitest, VitestPlugin, WorkspaceSpec, createVitest, ensurePackageInstalled, registerConsoleShortcuts };
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor-node.bde9fb47.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, e as ensurePackageInstalled, r as registerConsoleShortcuts, s as startVitest } from './vendor-node.327f8f1f.js';
2
2
  import 'pathe';
3
3
  import 'vite';
4
4
  import 'node:path';
@@ -32,29 +32,30 @@ import 'tinypool';
32
32
  import './vendor-index.1ca68bd5.js';
33
33
  import './vendor-base.9c08bbd0.js';
34
34
  import 'node:worker_threads';
35
- import 'local-pkg';
36
- import './vendor-reporters.f6975b8d.js';
35
+ import 'node:fs/promises';
37
36
  import 'node:perf_hooks';
38
- import './vendor-tasks.f9d75aed.js';
39
- import '@vitest/utils/source-map';
40
- import 'node:module';
41
- import 'node:crypto';
42
- import './vendor-index.85fc950a.js';
37
+ import './vendor-index.8efe7746.js';
43
38
  import 'node:buffer';
44
39
  import 'node:child_process';
45
40
  import 'child_process';
46
41
  import 'assert';
47
42
  import 'buffer';
48
43
  import 'node:util';
49
- import 'node:fs/promises';
44
+ import '@vitest/utils/source-map';
45
+ import 'local-pkg';
50
46
  import 'module';
51
47
  import 'acorn';
52
48
  import 'acorn-walk';
49
+ import './vendor-reporters.b9600369.js';
50
+ import './chunk-runtime-console.f3263f87.js';
51
+ import 'node:stream';
52
+ import 'node:console';
53
+ import './vendor-date.6e993429.js';
54
+ import './vendor-tasks.f9d75aed.js';
55
+ import 'node:module';
56
+ import 'node:crypto';
53
57
  import 'magic-string';
54
58
  import 'strip-literal';
55
- import './vendor-environments.e73c5410.js';
56
- import './vendor-index.0b5b3600.js';
57
- import 'node:assert';
58
- import 'node:console';
59
+ import './vendor-environments.dcc4a34e.js';
59
60
  import 'node:readline';
60
61
  import 'readline';
@@ -316,21 +316,21 @@ declare type Test = (arg0: any) => boolean;
316
316
  * Names of clock methods that may be faked by install.
317
317
  */
318
318
  type FakeMethod =
319
- | 'setTimeout'
320
- | 'clearTimeout'
321
- | 'setImmediate'
322
- | 'clearImmediate'
323
- | 'setInterval'
324
- | 'clearInterval'
325
- | 'Date'
326
- | 'nextTick'
327
- | 'hrtime'
328
- | 'requestAnimationFrame'
329
- | 'cancelAnimationFrame'
330
- | 'requestIdleCallback'
331
- | 'cancelIdleCallback'
332
- | 'performance'
333
- | 'queueMicrotask';
319
+ | "setTimeout"
320
+ | "clearTimeout"
321
+ | "setImmediate"
322
+ | "clearImmediate"
323
+ | "setInterval"
324
+ | "clearInterval"
325
+ | "Date"
326
+ | "nextTick"
327
+ | "hrtime"
328
+ | "requestAnimationFrame"
329
+ | "cancelAnimationFrame"
330
+ | "requestIdleCallback"
331
+ | "cancelIdleCallback"
332
+ | "performance"
333
+ | "queueMicrotask";
334
334
 
335
335
  interface FakeTimerInstallOpts {
336
336
  /**
@@ -402,26 +402,29 @@ declare class TypeCheckError extends Error {
402
402
  name: string;
403
403
  constructor(message: string, stacks: ParsedStack[]);
404
404
  }
405
- interface ErrorsCache {
405
+ interface TypecheckResults {
406
406
  files: File[];
407
407
  sourceErrors: TypeCheckError[];
408
+ time: number;
408
409
  }
409
410
  type Callback<Args extends Array<any> = []> = (...args: Args) => Awaitable<void>;
410
411
  declare class Typechecker {
411
412
  protected ctx: WorkspaceProject;
412
- protected files: string[];
413
413
  private _onParseStart?;
414
414
  private _onParseEnd?;
415
415
  private _onWatcherRerun?;
416
416
  private _result;
417
+ private _startTime;
417
418
  private _output;
418
419
  private _tests;
419
420
  private tempConfigPath?;
420
421
  private allowJs?;
421
422
  private process?;
422
- constructor(ctx: WorkspaceProject, files: string[]);
423
+ protected files: string[];
424
+ constructor(ctx: WorkspaceProject);
425
+ setFiles(files: string[]): void;
423
426
  onParseStart(fn: Callback): void;
424
- onParseEnd(fn: Callback<[ErrorsCache]>): void;
427
+ onParseEnd(fn: Callback<[TypecheckResults]>): void;
425
428
  onWatcherRerun(fn: Callback): void;
426
429
  protected collectFileTests(filepath: string): Promise<FileInformation | null>;
427
430
  protected getFiles(): string[];
@@ -430,6 +433,7 @@ declare class Typechecker {
430
433
  protected prepareResults(output: string): Promise<{
431
434
  files: File[];
432
435
  sourceErrors: TypeCheckError[];
436
+ time: number;
433
437
  }>;
434
438
  protected parseTscLikeOutput(output: string): Promise<Map<string, {
435
439
  error: TypeCheckError;
@@ -442,7 +446,7 @@ declare class Typechecker {
442
446
  getExitCode(): number | false;
443
447
  getOutput(): string;
444
448
  start(): Promise<void>;
445
- getResult(): ErrorsCache;
449
+ getResult(): TypecheckResults;
446
450
  getTestFiles(): File[];
447
451
  getTestPacks(): TaskResultPack[];
448
452
  }
@@ -514,27 +518,30 @@ declare class WorkspaceProject {
514
518
  isInSourceTestFile(code: string): boolean;
515
519
  filterFiles(testFiles: string[], filters: string[] | undefined, dir: string): string[];
516
520
  initBrowserServer(configFile: string | undefined): Promise<void>;
521
+ static createBasicProject(ctx: Vitest): WorkspaceProject;
517
522
  static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
518
523
  setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
519
524
  report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
520
- typecheck(filters?: string[]): Promise<void>;
521
- isBrowserEnabled(): boolean | 0;
525
+ isBrowserEnabled(): boolean;
522
526
  getSerializableConfig(): ResolvedConfig;
523
527
  close(): Promise<unknown>;
524
528
  initBrowserProvider(): Promise<void>;
525
529
  }
526
530
 
527
- interface BrowserProviderOptions {
531
+ interface BrowserProviderInitializationOptions {
528
532
  browser: string;
533
+ options?: BrowserProviderOptions;
529
534
  }
530
535
  interface BrowserProvider {
531
536
  name: string;
532
537
  getSupportedBrowsers(): readonly string[];
533
- initialize(ctx: WorkspaceProject, options: BrowserProviderOptions): Awaitable$1<void>;
538
+ initialize(ctx: WorkspaceProject, options: BrowserProviderInitializationOptions): Awaitable$1<void>;
534
539
  openPage(url: string): Awaitable$1<void>;
535
540
  catchError(cb: (error: Error) => Awaitable$1<void>): () => Awaitable$1<void>;
536
541
  close(): Awaitable$1<void>;
537
542
  }
543
+ interface BrowserProviderOptions {
544
+ }
538
545
  interface BrowserConfigOptions {
539
546
  /**
540
547
  * if running tests in the browser should be the default
@@ -547,11 +554,22 @@ interface BrowserConfigOptions {
547
554
  */
548
555
  name: string;
549
556
  /**
550
- * browser provider
557
+ * Browser provider
551
558
  *
552
559
  * @default 'webdriverio'
553
560
  */
554
561
  provider?: 'webdriverio' | 'playwright' | (string & {});
562
+ /**
563
+ * Options that are passed down to a browser provider.
564
+ * To support type hinting, add one of the types to your tsconfig.json "compilerOptions.types" field:
565
+ *
566
+ * - for webdriverio: `@vitest/browser/providers/webdriverio`
567
+ * - for playwright: `@vitest/browser/providers/playwright`
568
+ *
569
+ * @example
570
+ * { playwright: { launch: { devtools: true } }
571
+ */
572
+ providerOptions?: BrowserProviderOptions;
555
573
  /**
556
574
  * enable headless mode
557
575
  *
@@ -752,18 +770,23 @@ declare class Vitest {
752
770
  private coreWorkspaceProject;
753
771
  projects: WorkspaceProject[];
754
772
  private projectsTestFiles;
773
+ projectFiles: {
774
+ workerPath: string;
775
+ forksPath: string;
776
+ vmPath: string;
777
+ };
755
778
  constructor(mode: VitestRunMode);
756
779
  private _onRestartListeners;
780
+ private _onClose;
757
781
  private _onSetServer;
758
782
  private _onCancelListeners;
759
783
  setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
760
784
  private createCoreProject;
761
- getCoreWorkspaceProject(): WorkspaceProject | null;
785
+ getCoreWorkspaceProject(): WorkspaceProject;
762
786
  getProjectByTaskId(taskId: string): WorkspaceProject;
763
787
  private resolveWorkspace;
764
788
  private initCoverageProvider;
765
789
  private initBrowserProviders;
766
- typecheck(filters?: string[]): Promise<void[]>;
767
790
  start(filters?: string[]): Promise<void>;
768
791
  private getTestDependencies;
769
792
  filterTestsBySource(specs: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
@@ -797,6 +820,7 @@ declare class Vitest {
797
820
  onServerRestart(fn: OnServerRestartHandler): void;
798
821
  onAfterSetServer(fn: OnServerRestartHandler): void;
799
822
  onCancel(fn: (reason: CancelReason) => void): void;
823
+ onClose(fn: () => void): void;
800
824
  }
801
825
 
802
826
  interface TestSequencer {
@@ -822,6 +846,7 @@ declare abstract class BaseReporter implements Reporter {
822
846
  private _lastRunTimer;
823
847
  private _lastRunCount;
824
848
  private _timeStart;
849
+ private _offUnhandledRejection?;
825
850
  constructor();
826
851
  get mode(): VitestRunMode;
827
852
  onInit(ctx: Vitest): void;
@@ -1170,6 +1195,7 @@ interface ResolvedTestEnvironment {
1170
1195
  }
1171
1196
  interface ContextRPC {
1172
1197
  config: ResolvedConfig;
1198
+ projectName: string;
1173
1199
  files: string[];
1174
1200
  invalidates?: string[];
1175
1201
  environment: ContextTestEnvironment;
@@ -1182,6 +1208,8 @@ interface WorkerContext extends ContextRPC {
1182
1208
  type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
1183
1209
  interface AfterSuiteRunMeta {
1184
1210
  coverage?: unknown;
1211
+ transformMode: Environment['transformMode'];
1212
+ projectName?: string;
1185
1213
  }
1186
1214
  type WorkerRPC = BirpcReturn<RuntimeRPC, RunnerRPC>;
1187
1215
  interface WorkerGlobalState {
@@ -1267,7 +1295,7 @@ interface BaseCoverageOptions {
1267
1295
  /**
1268
1296
  * Extensions for files to be included in coverage
1269
1297
  *
1270
- * @default ['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx', '.vue', '.svelte']
1298
+ * @default ['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx', '.vue', '.svelte', '.marko']
1271
1299
  */
1272
1300
  extension?: string | string[];
1273
1301
  /**
@@ -1544,7 +1572,7 @@ type BenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', [
1544
1572
  runIf(condition: any): BenchmarkAPI;
1545
1573
  };
1546
1574
 
1547
- type Pool = 'browser' | 'threads' | 'forks' | 'vmThreads';
1575
+ type Pool = 'browser' | 'threads' | 'forks' | 'vmThreads' | 'typescript';
1548
1576
  interface PoolOptions {
1549
1577
  /**
1550
1578
  * Run tests in `node:worker_threads`.
@@ -1610,7 +1638,7 @@ interface WorkerContextOptions {
1610
1638
  }
1611
1639
  interface VmOptions {
1612
1640
  /**
1613
- * Specifies the memory limit for `worker_thread` or `child_processe` before they are recycled.
1641
+ * Specifies the memory limit for `worker_thread` or `child_process` before they are recycled.
1614
1642
  * If you see memory leaks, try to tinker this value.
1615
1643
  */
1616
1644
  memoryLimit?: string | number;
@@ -1632,7 +1660,7 @@ interface EnvironmentOptions {
1632
1660
  happyDOM?: HappyDOMOptions;
1633
1661
  [x: string]: unknown;
1634
1662
  }
1635
- type VitestRunMode = 'test' | 'benchmark' | 'typecheck';
1663
+ type VitestRunMode = 'test' | 'benchmark';
1636
1664
  interface SequenceOptions {
1637
1665
  /**
1638
1666
  * Class that handles sorting and sharding algorithm.
@@ -1769,12 +1797,6 @@ interface DepsOptions {
1769
1797
  * @deprecated Use `server.deps.fallbackCJS` instead.
1770
1798
  */
1771
1799
  fallbackCJS?: boolean;
1772
- /**
1773
- * Use experimental Node loader to resolve imports inside node_modules using Vite resolve algorithm.
1774
- * @default false
1775
- * @deprecated If you rely on aliases inside external packages, use `deps.optimizer.{web,ssr}.include` instead.
1776
- */
1777
- registerNodeLoader?: boolean;
1778
1800
  /**
1779
1801
  * A list of directories relative to the config file that should be treated as module directories.
1780
1802
  *
@@ -1868,7 +1890,7 @@ interface InlineConfig {
1868
1890
  *
1869
1891
  * @default 'threads'
1870
1892
  */
1871
- pool?: Omit<Pool, 'browser'>;
1893
+ pool?: Exclude<Pool, 'browser'>;
1872
1894
  /**
1873
1895
  * Pool options
1874
1896
  */
@@ -1886,7 +1908,7 @@ interface InlineConfig {
1886
1908
  * // ...
1887
1909
  * ]
1888
1910
  */
1889
- poolMatchGlobs?: [string, Omit<Pool, 'browser'>][];
1911
+ poolMatchGlobs?: [string, Exclude<Pool, 'browser'>][];
1890
1912
  /**
1891
1913
  * Update snapshot
1892
1914
  *
@@ -2072,6 +2094,13 @@ interface InlineConfig {
2072
2094
  * Return `false` to ignore the log.
2073
2095
  */
2074
2096
  onConsoleLog?: (log: string, type: 'stdout' | 'stderr') => false | void;
2097
+ /**
2098
+ * Enable stack trace filtering. If absent, all stack trace frames
2099
+ * will be shown.
2100
+ *
2101
+ * Return `false` to omit the frame.
2102
+ */
2103
+ onStackTrace?: (error: Error, frame: ParsedStack) => boolean | void;
2075
2104
  /**
2076
2105
  * Indicates if CSS files should be processed.
2077
2106
  *
@@ -2157,6 +2186,14 @@ interface InlineConfig {
2157
2186
  retry?: number;
2158
2187
  }
2159
2188
  interface TypecheckConfig {
2189
+ /**
2190
+ * Run typechecking tests alongisde regular tests.
2191
+ */
2192
+ enabled?: boolean;
2193
+ /**
2194
+ * When typechecking is enabled, only run typechecking tests.
2195
+ */
2196
+ only?: boolean;
2160
2197
  /**
2161
2198
  * What tools to use for type checking.
2162
2199
  */
@@ -2219,7 +2256,7 @@ interface UserConfig extends InlineConfig {
2219
2256
  */
2220
2257
  shard?: string;
2221
2258
  }
2222
- interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions'> {
2259
+ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool'> {
2223
2260
  mode: VitestRunMode;
2224
2261
  base?: string;
2225
2262
  config?: string;
@@ -2234,9 +2271,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
2234
2271
  reporters: (Reporter | BuiltinReporters)[];
2235
2272
  defines: Record<string, any>;
2236
2273
  api?: ApiConfig;
2237
- benchmark?: Required<Omit<BenchmarkUserOptions, 'outputFile'>> & {
2238
- outputFile?: BenchmarkUserOptions['outputFile'];
2239
- };
2274
+ benchmark?: Required<Omit<BenchmarkUserOptions, 'outputFile'>> & Pick<BenchmarkUserOptions, 'outputFile'>;
2240
2275
  shard?: {
2241
2276
  index: number;
2242
2277
  count: number;
@@ -2252,12 +2287,14 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
2252
2287
  concurrent?: boolean;
2253
2288
  seed: number;
2254
2289
  };
2255
- typecheck: TypecheckConfig;
2290
+ typecheck: Omit<TypecheckConfig, 'enabled'> & {
2291
+ enabled: boolean;
2292
+ };
2256
2293
  runner?: string;
2257
2294
  }
2258
- type ProjectConfig = Omit<UserConfig, 'sequencer' | 'shard' | 'watch' | 'run' | 'cache' | 'update' | 'reporters' | 'outputFile' | 'pool' | 'poolOptions' | 'teardownTimeout' | 'silent' | 'watchExclude' | 'forceRerunTriggers' | 'testNamePattern' | 'ui' | 'open' | 'uiBase' | 'snapshotFormat' | 'resolveSnapshotPath' | 'passWithNoTests' | 'onConsoleLog' | 'dangerouslyIgnoreUnhandledErrors' | 'slowTestThreshold' | 'inspect' | 'inspectBrk' | 'deps' | 'coverage'> & {
2295
+ type ProjectConfig = Omit<UserConfig, 'sequencer' | 'shard' | 'watch' | 'run' | 'cache' | 'update' | 'reporters' | 'outputFile' | 'pool' | 'poolOptions' | 'teardownTimeout' | 'silent' | 'watchExclude' | 'forceRerunTriggers' | 'testNamePattern' | 'ui' | 'open' | 'uiBase' | 'snapshotFormat' | 'resolveSnapshotPath' | 'passWithNoTests' | 'onConsoleLog' | 'onStackTrace' | 'dangerouslyIgnoreUnhandledErrors' | 'slowTestThreshold' | 'inspect' | 'inspectBrk' | 'deps' | 'coverage'> & {
2259
2296
  sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
2260
- deps?: Omit<DepsOptions, 'registerNodeLoader' | 'moduleDirectories'>;
2297
+ deps?: Omit<DepsOptions, 'moduleDirectories'>;
2261
2298
  };
2262
2299
  type RuntimeConfig = Pick<UserConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency'> & {
2263
2300
  sequence?: {
@@ -2357,4 +2394,4 @@ type Context = RootAndTarget & {
2357
2394
  lastActivePath?: string;
2358
2395
  };
2359
2396
 
2360
- export { Nullable as $, AfterSuiteRunMeta as A, BaseCoverageOptions as B, CoverageV8Options as C, DepsOptimizationOptions as D, Environment as E, FakeTimerInstallOpts as F, TypecheckConfig as G, HappyDOMOptions as H, InlineConfig as I, JSDOMOptions as J, RuntimeRPC as K, RunnerRPC as L, MockFactoryWithHelper as M, ContextTestEnvironment as N, ResolvedTestEnvironment as O, ProjectConfig as P, ContextRPC as Q, ResolvedConfig as R, WorkerContext as S, TestSequencer as T, UserConfig as U, VitestRunMode as V, WorkspaceSpec as W, ResolveIdFunction as X, WorkerRPC as Y, WorkerGlobalState as Z, Awaitable as _, ResolvedCoverageOptions as a, Arrayable as a0, ArgumentsType$1 as a1, MutableArray as a2, Constructable as a3, ModuleCache as a4, EnvironmentReturn as a5, VmEnvironmentReturn as a6, OnServerRestartHandler as a7, ReportContext as a8, CoverageReporter as a9, CoverageIstanbulOptions as aa, CustomProviderOptions as ab, BenchmarkUserOptions as ac, Benchmark as ad, BenchmarkResult as ae, BenchFunction as af, BenchmarkAPI as ag, PendingSuiteMock as ah, MockFactory as ai, MockMap as aj, DefaultReporter as ak, BasicReporter as al, DotReporter as am, JsonReporter$1 as an, VerboseReporter as ao, TapReporter as ap, JUnitReporter as aq, TapFlatReporter as ar, HangingProcessReporter as as, BaseReporter as at, ReportersMap as au, BuiltinReporters as av, BenchmarkReportsMap as aw, BenchmarkBuiltinReporters as ax, Vitest as b, WorkspaceProject as c, TestSequencerConstructor as d, CoverageOptions as e, CoverageProvider as f, CoverageProviderModule as g, RuntimeConfig as h, UserConsoleLog as i, ModuleGraphData as j, Reporter as k, RawErrsMap as l, TscErrorInfo as m, CollectLineNumbers as n, CollectLines as o, RootAndTarget as p, Context as q, Pool as r, startVitest as s, PoolOptions as t, BuiltinEnvironment as u, VitestEnvironment as v, CSSModuleScopeStrategy as w, ApiConfig as x, EnvironmentOptions as y, TransformModePatterns as z };
2397
+ export { type WorkerRPC as $, type AfterSuiteRunMeta as A, type BaseCoverageOptions as B, type CoverageV8Options as C, type ApiConfig as D, type Environment as E, type FakeTimerInstallOpts as F, type EnvironmentOptions as G, type HappyDOMOptions as H, type DepsOptimizationOptions as I, type JSDOMOptions as J, type TransformModePatterns as K, type InlineConfig as L, type MockFactoryWithHelper as M, type TypecheckConfig as N, type RuntimeRPC as O, type ProjectConfig as P, type RunnerRPC as Q, type ResolvedConfig as R, type ContextTestEnvironment as S, type TestSequencer as T, type UserConfig as U, type VitestRunMode as V, type WorkspaceSpec as W, type ResolvedTestEnvironment as X, type ContextRPC as Y, type WorkerContext as Z, type ResolveIdFunction as _, type ResolvedCoverageOptions as a, type WorkerGlobalState as a0, type Awaitable as a1, type Nullable as a2, type Arrayable as a3, type ArgumentsType$1 as a4, type MutableArray as a5, type Constructable as a6, type ModuleCache as a7, type EnvironmentReturn as a8, type VmEnvironmentReturn as a9, type BenchmarkBuiltinReporters as aA, type OnServerRestartHandler as aa, type ReportContext as ab, type CoverageReporter as ac, type CoverageIstanbulOptions as ad, type CustomProviderOptions as ae, type BenchmarkUserOptions as af, type Benchmark as ag, type BenchmarkResult as ah, type BenchFunction as ai, type BenchmarkAPI as aj, type PendingSuiteMock as ak, type MockFactory as al, type MockMap as am, DefaultReporter as an, BasicReporter as ao, DotReporter as ap, JsonReporter$1 as aq, VerboseReporter as ar, TapReporter as as, JUnitReporter as at, TapFlatReporter as au, HangingProcessReporter as av, BaseReporter as aw, ReportersMap as ax, type BuiltinReporters as ay, BenchmarkReportsMap as az, type CoverageOptions as b, type CoverageProvider as c, type CoverageProviderModule as d, Vitest as e, WorkspaceProject as f, type TestSequencerConstructor as g, type BrowserProviderInitializationOptions as h, type BrowserProvider as i, type BrowserProviderOptions as j, type RuntimeConfig as k, type UserConsoleLog as l, type ModuleGraphData as m, type Reporter as n, type RawErrsMap as o, type TscErrorInfo as p, type CollectLineNumbers as q, type CollectLines as r, startVitest as s, type RootAndTarget as t, type Context as u, type Pool as v, type PoolOptions as w, type BuiltinEnvironment as x, type VitestEnvironment as y, type CSSModuleScopeStrategy as z };
@@ -1,4 +1,4 @@
1
- export { at as BaseReporter, al as BasicReporter, ax as BenchmarkBuiltinReporters, aw as BenchmarkReportsMap, av as BuiltinReporters, ak as DefaultReporter, am as DotReporter, as as HangingProcessReporter, aq as JUnitReporter, an as JsonReporter, k as Reporter, au as ReportersMap, ar as TapFlatReporter, ap as TapReporter, ao as VerboseReporter } from './reporters-7bd09217.js';
1
+ export { aw as BaseReporter, ao as BasicReporter, aA as BenchmarkBuiltinReporters, az as BenchmarkReportsMap, ay as BuiltinReporters, an as DefaultReporter, ap as DotReporter, av as HangingProcessReporter, at as JUnitReporter, aq as JsonReporter, n as Reporter, ax as ReportersMap, au as TapFlatReporter, as as TapReporter, ar as VerboseReporter } from './reporters-1678fe04.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 { f as BasicReporter, B as BenchmarkReportsMap, D as DefaultReporter, g as DotReporter, H as HangingProcessReporter, h as JUnitReporter, J as JsonReporter, R as ReportersMap, i as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor-reporters.f6975b8d.js';
1
+ export { f as BasicReporter, B as BenchmarkReportsMap, D as DefaultReporter, g as DotReporter, H as HangingProcessReporter, h as JUnitReporter, J as JsonReporter, R as ReportersMap, i as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor-reporters.b9600369.js';
2
2
  import 'node:perf_hooks';
3
3
  import 'picocolors';
4
4
  import './vendor-index.29282562.js';
@@ -7,6 +7,11 @@ import 'std-env';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import './vendor-global.97e4527c.js';
10
+ import './chunk-runtime-console.f3263f87.js';
11
+ import 'node:stream';
12
+ import 'node:console';
13
+ import 'node:path';
14
+ import './vendor-date.6e993429.js';
10
15
  import './vendor-base.9c08bbd0.js';
11
16
  import './vendor-tasks.f9d75aed.js';
12
17
  import './vendor-_commonjsHelpers.7d1333e8.js';
package/dist/runners.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { VitestRunner, VitestRunnerImportSource, Suite, Test, CancelReason, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
2
- import { R as ResolvedConfig } from './reporters-7bd09217.js';
2
+ import { R as ResolvedConfig } from './reporters-1678fe04.js';
3
+ import * as tinybench from 'tinybench';
3
4
  import 'vite';
4
5
  import 'vite-node';
5
6
  import '@vitest/snapshot';
6
7
  import '@vitest/expect';
7
8
  import '@vitest/runner/utils';
8
9
  import '@vitest/utils';
9
- import 'tinybench';
10
10
  import 'vite-node/client';
11
11
  import '@vitest/snapshot/manager';
12
12
  import 'vite-node/server';
@@ -39,6 +39,7 @@ declare class NodeBenchmarkRunner implements VitestRunner {
39
39
  config: ResolvedConfig;
40
40
  private __vitest_executor;
41
41
  constructor(config: ResolvedConfig);
42
+ importTinybench(): Promise<typeof tinybench>;
42
43
  importFile(filepath: string, source: VitestRunnerImportSource): unknown;
43
44
  runSuite(suite: Suite): Promise<void>;
44
45
  runTask(): Promise<void>;