vitest 0.22.1 → 0.23.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 (46) hide show
  1. package/LICENSE.md +29 -29
  2. package/dist/browser.d.ts +5 -4
  3. package/dist/browser.mjs +11 -9
  4. package/dist/{chunk-api-setup.377c28aa.mjs → chunk-api-setup.5fc06d1d.mjs} +90 -87
  5. package/dist/{chunk-constants.71e8a211.mjs → chunk-constants.6196597b.mjs} +0 -0
  6. package/dist/{chunk-integrations-coverage.d205bd87.mjs → chunk-env-node.ceb43f1c.mjs} +31 -179
  7. package/dist/{chunk-install-pkg.3aa3eae6.mjs → chunk-install-pkg.e081fc1b.mjs} +3 -3
  8. package/dist/chunk-integrations-coverage.99c020eb.mjs +166 -0
  9. package/dist/{chunk-integrations-globals.60af7da3.mjs → chunk-integrations-globals.ef598c23.mjs} +6 -7
  10. package/dist/{chunk-magic-string.efe26975.mjs → chunk-magic-string.56b2b543.mjs} +30 -10
  11. package/dist/{chunk-mock-date.304e29b1.mjs → chunk-mock-date.0d86eaa5.mjs} +26 -5
  12. package/dist/{chunk-node-git.9a7e3153.mjs → chunk-node-git.6f289b0a.mjs} +18 -12
  13. package/dist/{chunk-runtime-chain.be610650.mjs → chunk-runtime-chain.2af36ddf.mjs} +507 -173
  14. package/dist/{chunk-runtime-error.1104e45a.mjs → chunk-runtime-error.ed9b4f70.mjs} +206 -75
  15. package/dist/{chunk-runtime-hooks.5d7073db.mjs → chunk-runtime-hooks.75ce0575.mjs} +18 -12
  16. package/dist/{chunk-runtime-mocker.49d21aa6.mjs → chunk-runtime-mocker.fc76f21d.mjs} +17 -10
  17. package/dist/{chunk-runtime-rpc.57586b73.mjs → chunk-runtime-rpc.3fe371e9.mjs} +1 -2
  18. package/dist/{chunk-utils-source-map.bbf3ad19.mjs → chunk-utils-source-map.70ee97e1.mjs} +11 -5
  19. package/dist/{chunk-vite-node-client.cddda63d.mjs → chunk-vite-node-client.74ebe3d5.mjs} +55 -13
  20. package/dist/{chunk-vite-node-debug.536c4c5b.mjs → chunk-vite-node-debug.2d8a1dc3.mjs} +1 -1
  21. package/dist/{chunk-vite-node-externalize.c843f497.mjs → chunk-vite-node-externalize.41bf722e.mjs} +483 -197
  22. package/dist/{chunk-vite-node-utils.b432150c.mjs → chunk-vite-node-utils.68573626.mjs} +24 -40
  23. package/dist/cli-wrapper.mjs +21 -17
  24. package/dist/cli.mjs +23 -15
  25. package/dist/config.cjs +2 -2
  26. package/dist/config.d.ts +4 -3
  27. package/dist/config.mjs +2 -2
  28. package/dist/entry.mjs +19 -14
  29. package/dist/environments.d.ts +23 -0
  30. package/dist/environments.mjs +3 -0
  31. package/dist/{global-fe52f84b.d.ts → global-ea084c9f.d.ts} +135 -19
  32. package/dist/{index-ea17aa0c.d.ts → index-5f09f4d0.d.ts} +3 -2
  33. package/dist/index.d.ts +6 -5
  34. package/dist/index.mjs +6 -7
  35. package/dist/loader.mjs +3 -4
  36. package/dist/node.d.ts +5 -4
  37. package/dist/node.mjs +14 -12
  38. package/dist/suite.mjs +5 -6
  39. package/dist/vendor-index.0557b03a.mjs +147 -0
  40. package/dist/{vendor-index.9d9196cc.mjs → vendor-index.13e3bda3.mjs} +0 -0
  41. package/dist/{vendor-index.fbec8a81.mjs → vendor-index.4aeeb598.mjs} +2 -2
  42. package/dist/{vendor-index.2ae8040a.mjs → vendor-index.62ce5c33.mjs} +0 -0
  43. package/dist/{vendor-index.29636037.mjs → vendor-index.731a22f2.mjs} +0 -0
  44. package/dist/worker.mjs +17 -15
  45. package/package.json +17 -10
  46. package/dist/chunk-utils-global.fa20c2f6.mjs +0 -5
@@ -1,6 +1,7 @@
1
1
  import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, CommonServerOptions, AliasOptions } from 'vite';
2
- import { MessagePort } from 'worker_threads';
2
+ import { Options, TaskResult as TaskResult$1, Bench } from 'tinybench';
3
3
  import { Stats } from 'fs';
4
+ import { MessagePort } from 'worker_threads';
4
5
 
5
6
  /**
6
7
  * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
@@ -249,6 +250,10 @@ declare class ModuleCacheMap extends Map<string, ModuleCache$1> {
249
250
  * Invalidate modules that dependent on the given modules, up to the main entry
250
251
  */
251
252
  invalidateDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>;
253
+ /**
254
+ * Invalidate dependency modules of the given modules, down to the bottom-level dependencies
255
+ */
256
+ invalidateSubDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>;
252
257
  }
253
258
  declare class ViteNodeRunner {
254
259
  options: ViteNodeRunnerOptions;
@@ -497,7 +502,7 @@ interface CliOptions extends UserConfig {
497
502
  */
498
503
  run?: boolean;
499
504
  }
500
- declare function startVitest(cliFilters: string[], options: CliOptions, viteOverrides?: UserConfig$1): Promise<boolean>;
505
+ declare function startVitest(mode: VitestRunMode, cliFilters: string[], options: CliOptions, viteOverrides?: UserConfig$1): Promise<boolean>;
501
506
 
502
507
  declare type FileStatsCache = Pick<Stats, 'size'>;
503
508
  declare class FilesStatsCache {
@@ -522,6 +527,7 @@ declare class VitestCache {
522
527
  }
523
528
 
524
529
  declare class Vitest {
530
+ readonly mode: VitestRunMode;
525
531
  config: ResolvedConfig;
526
532
  configOverride: Partial<ResolvedConfig> | undefined;
527
533
  server: ViteDevServer;
@@ -540,7 +546,7 @@ declare class Vitest {
540
546
  isFirstRun: boolean;
541
547
  restartsCount: number;
542
548
  runner: ViteNodeRunner;
543
- constructor();
549
+ constructor(mode: VitestRunMode);
544
550
  private _onRestartListeners;
545
551
  setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
546
552
  initCoverageProvider(): Promise<CoverageProvider | null | undefined>;
@@ -551,6 +557,7 @@ declare class Vitest {
551
557
  runFiles(paths: string[]): Promise<void>;
552
558
  rerunFiles(files?: string[], trigger?: string): Promise<void>;
553
559
  changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
560
+ changeFilenamePattern(pattern: string): Promise<void>;
554
561
  rerunFailed(): Promise<void>;
555
562
  updateSnapshot(files?: string[]): Promise<void>;
556
563
  private _rerunTimer;
@@ -649,7 +656,7 @@ interface Callsite {
649
656
  line: number;
650
657
  column: number;
651
658
  }
652
- declare class JsonReporter implements Reporter {
659
+ declare class JsonReporter$1 implements Reporter {
653
660
  start: number;
654
661
  ctx: Vitest;
655
662
  onInit(ctx: Vitest): void;
@@ -661,7 +668,7 @@ declare class JsonReporter implements Reporter {
661
668
  * @param report
662
669
  */
663
670
  writeReport(report: string): Promise<void>;
664
- protected getFailureLocation(test: Test): Callsite | undefined;
671
+ protected getFailureLocation(test: Task): Promise<Callsite | undefined>;
665
672
  }
666
673
 
667
674
  declare class VerboseReporter extends DefaultReporter {
@@ -697,11 +704,31 @@ declare class TapFlatReporter extends TapReporter {
697
704
  onFinished(files?: File[]): Promise<void>;
698
705
  }
699
706
 
707
+ declare class JsonReporter implements Reporter {
708
+ start: number;
709
+ ctx: Vitest;
710
+ onInit(ctx: Vitest): void;
711
+ protected logTasks(files: File[]): Promise<void>;
712
+ onFinished(files?: File[]): Promise<void>;
713
+ /**
714
+ * Writes the report to an output file if specified in the config,
715
+ * or logs it to the console otherwise.
716
+ * @param report
717
+ */
718
+ writeReport(report: string): Promise<void>;
719
+ }
720
+
721
+ declare const BenchmarkReportsMap: {
722
+ default: typeof VerboseReporter;
723
+ json: typeof JsonReporter;
724
+ };
725
+ declare type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
726
+
700
727
  declare const ReportersMap: {
701
728
  default: typeof DefaultReporter;
702
729
  verbose: typeof VerboseReporter;
703
730
  dot: typeof DotReporter;
704
- json: typeof JsonReporter;
731
+ json: typeof JsonReporter$1;
705
732
  tap: typeof TapReporter;
706
733
  'tap-flat': typeof TapFlatReporter;
707
734
  junit: typeof JUnitReporter;
@@ -996,8 +1023,55 @@ declare type ChainableFunction<T extends string, Args extends any[], R = any, E
996
1023
  (...args: Args): R;
997
1024
  } & {
998
1025
  [x in T]: ChainableFunction<T, Args, R, E>;
1026
+ } & {
1027
+ fn: (this: Record<T, boolean | undefined>, ...args: Args) => R;
999
1028
  } & E;
1000
1029
 
1030
+ interface BenchmarkUserOptions {
1031
+ /**
1032
+ * Include globs for benchmark test files
1033
+ *
1034
+ * @default ['**\/*.{bench,benchmark}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
1035
+ */
1036
+ include?: string[];
1037
+ /**
1038
+ * Exclude globs for benchmark test files
1039
+ * @default ['node_modules', 'dist', '.idea', '.git', '.cache']
1040
+ */
1041
+ exclude?: string[];
1042
+ /**
1043
+ * Include globs for in-source test files
1044
+ *
1045
+ * @default []
1046
+ */
1047
+ includeSource?: string[];
1048
+ /**
1049
+ * Custom reporter for output. Can contain one or more built-in report names, reporter instances,
1050
+ * and/or paths to custom reporters
1051
+ */
1052
+ reporters?: Arrayable<BenchmarkBuiltinReporters | Reporter>;
1053
+ }
1054
+ interface Benchmark extends TaskBase {
1055
+ type: 'benchmark';
1056
+ suite: Suite;
1057
+ result?: TaskResult;
1058
+ fails?: boolean;
1059
+ options: Options;
1060
+ }
1061
+ interface BenchmarkResult extends TaskResult$1 {
1062
+ name: string;
1063
+ rank: number;
1064
+ }
1065
+ declare type BenchFunction = (this: Bench) => Promise<void> | void;
1066
+ declare type BenchmarkAPI = ChainableFunction<'skip', [
1067
+ name: string,
1068
+ fn: BenchFunction,
1069
+ options?: Options
1070
+ ], void> & {
1071
+ skipIf(condition: any): BenchmarkAPI;
1072
+ runIf(condition: any): BenchmarkAPI;
1073
+ };
1074
+
1001
1075
  declare type RunMode = 'run' | 'skip' | 'only' | 'todo';
1002
1076
  declare type TaskState = RunMode | 'pass' | 'fail';
1003
1077
  interface TaskBase {
@@ -1009,6 +1083,7 @@ interface TaskBase {
1009
1083
  suite?: Suite;
1010
1084
  file?: File;
1011
1085
  result?: TaskResult;
1086
+ retry?: number;
1012
1087
  logs?: UserConsoleLog[];
1013
1088
  }
1014
1089
  interface TaskResult {
@@ -1019,12 +1094,15 @@ interface TaskResult {
1019
1094
  error?: ErrorWithDiff;
1020
1095
  htmlError?: string;
1021
1096
  hooks?: Partial<Record<keyof SuiteHooks, TaskState>>;
1097
+ benchmark?: BenchmarkResult;
1098
+ retryCount?: number;
1022
1099
  }
1023
1100
  declare type TaskResultPack = [id: string, result: TaskResult | undefined];
1024
1101
  interface Suite extends TaskBase {
1025
1102
  type: 'suite';
1026
1103
  tasks: Task[];
1027
1104
  filepath?: string;
1105
+ benchmark?: Bench;
1028
1106
  }
1029
1107
  interface File extends Suite {
1030
1108
  filepath: string;
@@ -1038,7 +1116,7 @@ interface Test<ExtraContext = {}> extends TaskBase {
1038
1116
  fails?: boolean;
1039
1117
  context: TestContext & ExtraContext;
1040
1118
  }
1041
- declare type Task = Test | Suite | File;
1119
+ declare type Task = Test | Suite | File | Benchmark;
1042
1120
  declare type DoneCallback = (error?: any) => void;
1043
1121
  declare type TestFunction<ExtraContext = {}> = (context: TestContext & ExtraContext) => Awaitable<any> | void;
1044
1122
  declare type ExtractEachCallbackArgs<T extends ReadonlyArray<any>> = {
@@ -1060,18 +1138,31 @@ interface SuiteEachFunction {
1060
1138
  <T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => Awaitable<void>) => void;
1061
1139
  }
1062
1140
  interface TestEachFunction {
1063
- <T extends any[] | [any]>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T) => Awaitable<void>, timeout?: number) => void;
1064
- <T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (name: string, fn: (...args: ExtractEachCallbackArgs<T>) => Awaitable<void>, timeout?: number) => void;
1065
- <T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => Awaitable<void>, timeout?: number) => void;
1141
+ <T extends any[] | [any]>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T) => Awaitable<void>, options?: number | TestOptions) => void;
1142
+ <T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (name: string, fn: (...args: ExtractEachCallbackArgs<T>) => Awaitable<void>, options?: number | TestOptions) => void;
1143
+ <T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => Awaitable<void>, options?: number | TestOptions) => void;
1066
1144
  }
1067
1145
  declare type ChainableTestAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'fails', [
1068
1146
  name: string,
1069
1147
  fn?: TestFunction<ExtraContext>,
1070
- timeout?: number
1148
+ options?: number | TestOptions
1071
1149
  ], void, {
1072
1150
  each: TestEachFunction;
1073
- <T extends ExtraContext>(name: string, fn?: TestFunction<T>, timeout?: number): void;
1151
+ <T extends ExtraContext>(name: string, fn?: TestFunction<T>, options?: number | TestOptions): void;
1074
1152
  }>;
1153
+ interface TestOptions {
1154
+ /**
1155
+ * Test timeout.
1156
+ */
1157
+ timeout?: number;
1158
+ /**
1159
+ * Times to retry the test if fails. Useful for making flaky tests more stable.
1160
+ * When retries is up, the last test error will be thrown.
1161
+ *
1162
+ * @default 1
1163
+ */
1164
+ retry?: number;
1165
+ }
1075
1166
  declare type TestAPI<ExtraContext = {}> = ChainableTestAPI<ExtraContext> & {
1076
1167
  each: TestEachFunction;
1077
1168
  skipIf(condition: any): ChainableTestAPI<ExtraContext>;
@@ -1102,7 +1193,8 @@ interface SuiteCollector<ExtraContext = {}> {
1102
1193
  readonly mode: RunMode;
1103
1194
  type: 'collector';
1104
1195
  test: TestAPI<ExtraContext>;
1105
- tasks: (Suite | Test | SuiteCollector<ExtraContext>)[];
1196
+ benchmark: BenchmarkAPI;
1197
+ tasks: (Suite | Test | Benchmark | SuiteCollector<ExtraContext>)[];
1106
1198
  collect: (file?: File) => Promise<Suite>;
1107
1199
  clear: () => void;
1108
1200
  on: <T extends keyof SuiteHooks<ExtraContext>>(name: T, ...fn: SuiteHooks<ExtraContext>[T]) => void;
@@ -1271,6 +1363,10 @@ interface BaseCoverageOptions {
1271
1363
  * @default 'text'
1272
1364
  */
1273
1365
  reporter?: Arrayable<CoverageReporter>;
1366
+ /**
1367
+ * List of files included in coverage as glob patterns
1368
+ */
1369
+ include?: string[];
1274
1370
  /**
1275
1371
  * List of files excluded from coverage as glob patterns
1276
1372
  */
@@ -1305,6 +1401,10 @@ interface BaseCoverageOptions {
1305
1401
  * Extensions for files to be included in coverage
1306
1402
  */
1307
1403
  extension?: string | string[];
1404
+ /**
1405
+ * Whether to include all files, including the untested ones into report
1406
+ */
1407
+ all?: boolean;
1308
1408
  }
1309
1409
  interface CoverageIstanbulOptions extends BaseCoverageOptions {
1310
1410
  ignoreClassMethods?: string[];
@@ -1328,8 +1428,6 @@ interface CoverageC8Options extends BaseCoverageOptions {
1328
1428
  * @default true
1329
1429
  */
1330
1430
  excludeNodeModules?: boolean;
1331
- include?: string[];
1332
- all?: boolean;
1333
1431
  src?: string[];
1334
1432
  100?: boolean;
1335
1433
  }
@@ -1428,6 +1526,8 @@ interface Reporter {
1428
1526
  }
1429
1527
 
1430
1528
  declare type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
1529
+ declare type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
1530
+ declare type CSSModuleScopeStrategy = 'stable' | 'scoped' | 'non-scoped';
1431
1531
  declare type ApiConfig = Pick<CommonServerOptions, 'port' | 'strictPort' | 'host'>;
1432
1532
 
1433
1533
  interface EnvironmentOptions {
@@ -1435,8 +1535,16 @@ interface EnvironmentOptions {
1435
1535
  * jsdom options.
1436
1536
  */
1437
1537
  jsdom?: JSDOMOptions;
1538
+ [x: string]: unknown;
1438
1539
  }
1540
+ declare type VitestRunMode = 'test' | 'benchmark';
1439
1541
  interface InlineConfig {
1542
+ /**
1543
+ * Benchmark options.
1544
+ *
1545
+ * @default {}
1546
+ */
1547
+ benchmark?: BenchmarkUserOptions;
1440
1548
  /**
1441
1549
  * Include globs for test files
1442
1550
  *
@@ -1512,9 +1620,11 @@ interface InlineConfig {
1512
1620
  *
1513
1621
  * Supports 'node', 'jsdom', 'happy-dom', 'edge-runtime'
1514
1622
  *
1623
+ * If used unsupported string, will try to load the package `vitest-environment-${env}`
1624
+ *
1515
1625
  * @default 'node'
1516
1626
  */
1517
- environment?: BuiltinEnvironment;
1627
+ environment?: VitestEnvironment;
1518
1628
  /**
1519
1629
  * Environment options.
1520
1630
  */
@@ -1735,11 +1845,14 @@ interface InlineConfig {
1735
1845
  *
1736
1846
  * When excluded, the CSS files will be replaced with empty strings to bypass the subsequent processing.
1737
1847
  *
1738
- * @default { include: [/\.module\./] }
1848
+ * @default { include: [], modules: { classNameStrategy: false } }
1739
1849
  */
1740
1850
  css?: boolean | {
1741
1851
  include?: RegExp | RegExp[];
1742
1852
  exclude?: RegExp | RegExp[];
1853
+ modules?: {
1854
+ classNameStrategy?: CSSModuleScopeStrategy;
1855
+ };
1743
1856
  };
1744
1857
  /**
1745
1858
  * A number of tests that are allowed to run at the same time marked with `test.concurrent`.
@@ -1824,7 +1937,8 @@ interface UserConfig extends InlineConfig {
1824
1937
  */
1825
1938
  shard?: string;
1826
1939
  }
1827
- interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'shard' | 'cache' | 'sequence'> {
1940
+ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence'> {
1941
+ mode: VitestRunMode;
1828
1942
  base?: string;
1829
1943
  config?: string;
1830
1944
  filters?: string[];
@@ -1835,6 +1949,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
1835
1949
  reporters: (Reporter | BuiltinReporters)[];
1836
1950
  defines: Record<string, any>;
1837
1951
  api?: ApiConfig;
1952
+ benchmark?: Required<BenchmarkUserOptions>;
1838
1953
  shard?: {
1839
1954
  index: number;
1840
1955
  count: number;
@@ -1988,6 +2103,7 @@ interface MatcherState {
1988
2103
  isExpectingAssertions?: boolean;
1989
2104
  isExpectingAssertionsError?: Error | null;
1990
2105
  isNot: boolean;
2106
+ environment: VitestEnvironment;
1991
2107
  promise: string;
1992
2108
  snapshotState: SnapshotState;
1993
2109
  suppressedErrors: Array<Error>;
@@ -2109,4 +2225,4 @@ declare global {
2109
2225
  }
2110
2226
  }
2111
2227
 
2112
- export { Environment as $, ApiConfig as A, BuiltinEnvironment as B, WorkerRPC as C, DoneCallback as D, EnvironmentOptions as E, FakeTimerInstallOpts as F, WorkerGlobalState as G, HookListener as H, InlineConfig as I, JSDOMOptions as J, Awaitable as K, Arrayable as L, ModuleGraphData as M, Nullable as N, ArgumentsType$1 as O, MergeInsertions as P, DeepMerge as Q, ResolvedConfig as R, Suite as S, TaskResultPack as T, UserConfig as U, Vitest as V, WorkerContext as W, MutableArray as X, Constructable as Y, ModuleCache as Z, EnvironmentReturn as _, File as a, UserConsoleLog as a0, Position as a1, ParsedStack as a2, ErrorWithDiff as a3, OnServerRestartHandler as a4, CoverageProvider as a5, CoverageProviderModule as a6, CoverageReporter as a7, CoverageOptions as a8, ResolvedCoverageOptions as a9, BaseCoverageOptions as aa, CoverageIstanbulOptions as ab, CoverageC8Options as ac, ModuleCacheMap as ad, ViteNodeRunnerOptions as ae, MockMap as af, ViteNodeRunner as ag, TestSequencer as ah, startVitest as ai, TestSequencerConstructor as aj, Reporter as b, RunMode as c, TaskState as d, TaskBase as e, TaskResult as f, Test as g, Task as h, TestFunction as i, TestAPI as j, SuiteAPI as k, HookCleanupCallback as l, SuiteHooks as m, SuiteCollector as n, SuiteFactory as o, RuntimeContext as p, TestContext as q, SnapshotData as r, SnapshotUpdateState as s, SnapshotStateOptions as t, SnapshotMatchOptions as u, SnapshotResult as v, UncheckedSnapshot as w, SnapshotSummary as x, ResolveIdFunction as y, AfterSuiteRunMeta as z };
2228
+ export { MutableArray as $, ApiConfig as A, BuiltinEnvironment as B, CSSModuleScopeStrategy as C, DoneCallback as D, EnvironmentOptions as E, FakeTimerInstallOpts as F, SnapshotSummary as G, HookListener as H, InlineConfig as I, JSDOMOptions as J, ResolveIdFunction as K, AfterSuiteRunMeta as L, ModuleGraphData as M, WorkerRPC as N, WorkerGlobalState as O, Awaitable as P, Nullable as Q, ResolvedConfig as R, Suite as S, TaskResultPack as T, UserConfig as U, VitestEnvironment as V, WorkerContext as W, Arrayable as X, ArgumentsType$1 as Y, MergeInsertions as Z, DeepMerge as _, File as a, Constructable as a0, ModuleCache as a1, EnvironmentReturn as a2, Environment as a3, UserConsoleLog as a4, Position as a5, ParsedStack as a6, ErrorWithDiff as a7, OnServerRestartHandler as a8, CoverageProvider as a9, CoverageProviderModule as aa, CoverageReporter as ab, CoverageOptions as ac, ResolvedCoverageOptions as ad, BaseCoverageOptions as ae, CoverageIstanbulOptions as af, CoverageC8Options as ag, BenchmarkUserOptions as ah, Benchmark as ai, BenchmarkResult as aj, BenchFunction as ak, BenchmarkAPI as al, ModuleCacheMap as am, ViteNodeRunnerOptions as an, MockMap as ao, ViteNodeRunner as ap, TestSequencer as aq, startVitest as ar, TestSequencerConstructor as as, Reporter as b, VitestRunMode as c, RunMode as d, TaskState as e, TaskBase as f, TaskResult as g, Test as h, Task as i, TestFunction as j, TestOptions as k, TestAPI as l, SuiteAPI as m, HookCleanupCallback as n, SuiteHooks as o, SuiteCollector as p, SuiteFactory as q, RuntimeContext as r, TestContext as s, Vitest as t, SnapshotData as u, SnapshotUpdateState as v, SnapshotStateOptions as w, SnapshotMatchOptions as x, SnapshotResult as y, UncheckedSnapshot as z };
@@ -1,5 +1,5 @@
1
1
  import { SpyImpl } from 'tinyspy';
2
- import { k as SuiteAPI, j as TestAPI, m as SuiteHooks, H as HookListener, q as TestContext, S as Suite, l as HookCleanupCallback, g as Test } from './global-fe52f84b.js';
2
+ import { m as SuiteAPI, l as TestAPI, al as BenchmarkAPI, o as SuiteHooks, H as HookListener, s as TestContext, S as Suite, n as HookCleanupCallback, h as Test } from './global-ea084c9f.js';
3
3
 
4
4
  interface MockResultReturn<T> {
5
5
  type: 'return';
@@ -102,6 +102,7 @@ declare function fn<TArgs extends any[] = any[], R = any>(implementation: (...ar
102
102
 
103
103
  declare const suite: SuiteAPI<{}>;
104
104
  declare const test: TestAPI<{}>;
105
+ declare const bench: BenchmarkAPI;
105
106
  declare const describe: SuiteAPI<{}>;
106
107
  declare const it: TestAPI<{}>;
107
108
 
@@ -113,4 +114,4 @@ declare const afterEach: <ExtraContext = {}>(fn: HookListener<[TestContext & Ext
113
114
  declare function createExpect(test?: Test): Vi.ExpectStatic;
114
115
  declare const globalExpect: Vi.ExpectStatic;
115
116
 
116
- export { EnhancedSpy as E, MaybeMockedDeep as M, SpyInstance as S, MaybeMocked as a, MaybePartiallyMocked as b, MaybePartiallyMockedDeep as c, suite as d, describe as e, fn as f, beforeAll as g, afterAll as h, it as i, beforeEach as j, afterEach as k, globalExpect as l, createExpect as m, MockedFunction as n, MockedObject as o, MockInstance as p, Mock as q, MockContext as r, spyOn as s, test as t, Mocked as u, MockedClass as v };
117
+ export { EnhancedSpy as E, MaybeMockedDeep as M, SpyInstance as S, MaybeMocked as a, MaybePartiallyMocked as b, MaybePartiallyMockedDeep as c, suite as d, describe as e, fn as f, bench as g, beforeAll as h, it as i, afterAll as j, beforeEach as k, afterEach as l, globalExpect as m, createExpect as n, MockedFunction as o, MockedObject as p, MockInstance as q, Mock as r, spyOn as s, test as t, MockContext as u, Mocked as v, MockedClass as w };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,15 @@
1
- import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-ea17aa0c.js';
2
- export { E as EnhancedSpy, q as Mock, r as MockContext, p as MockInstance, u as Mocked, v as MockedClass, n as MockedFunction, o as MockedObject, S as SpyInstance, h as afterAll, k as afterEach, g as beforeAll, j as beforeEach, m as createExpect, e as describe, l as expect, i as it, d as suite, t as test } from './index-ea17aa0c.js';
3
- import { D as DoneCallback, F as FakeTimerInstallOpts, a as File, T as TaskResultPack, R as ResolvedConfig, M as ModuleGraphData, b as Reporter } from './global-fe52f84b.js';
4
- export { z as AfterSuiteRunMeta, A as ApiConfig, O as ArgumentsType, L as Arrayable, K as Awaitable, aa as BaseCoverageOptions, B as BuiltinEnvironment, Y as Constructable, ac as CoverageC8Options, ab as CoverageIstanbulOptions, a8 as CoverageOptions, a5 as CoverageProvider, a6 as CoverageProviderModule, a7 as CoverageReporter, Q as DeepMerge, D as DoneCallback, $ as Environment, E as EnvironmentOptions, _ as EnvironmentReturn, a3 as ErrorWithDiff, a as File, l as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, P as MergeInsertions, Z as ModuleCache, M as ModuleGraphData, X as MutableArray, N as Nullable, a4 as OnServerRestartHandler, a2 as ParsedStack, a1 as Position, b as Reporter, y as ResolveIdFunction, R as ResolvedConfig, a9 as ResolvedCoverageOptions, c as RunMode, p as RuntimeContext, r as SnapshotData, u as SnapshotMatchOptions, v as SnapshotResult, t as SnapshotStateOptions, x as SnapshotSummary, s as SnapshotUpdateState, S as Suite, k as SuiteAPI, n as SuiteCollector, o as SuiteFactory, m as SuiteHooks, h as Task, e as TaskBase, f as TaskResult, T as TaskResultPack, d as TaskState, g as Test, j as TestAPI, q as TestContext, i as TestFunction, w as UncheckedSnapshot, U as UserConfig, a0 as UserConsoleLog, V as Vitest, W as WorkerContext, G as WorkerGlobalState, C as WorkerRPC } from './global-fe52f84b.js';
1
+ import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-5f09f4d0.js';
2
+ export { E as EnhancedSpy, r as Mock, u as MockContext, q as MockInstance, v as Mocked, w as MockedClass, o as MockedFunction, p as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, i as it, d as suite, t as test } from './index-5f09f4d0.js';
3
+ import { D as DoneCallback, F as FakeTimerInstallOpts, a as File, T as TaskResultPack, R as ResolvedConfig, M as ModuleGraphData, b as Reporter } from './global-ea084c9f.js';
4
+ export { L as AfterSuiteRunMeta, A as ApiConfig, Y as ArgumentsType, X as Arrayable, P as Awaitable, ae as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, B as BuiltinEnvironment, C as CSSModuleScopeStrategy, a0 as Constructable, ag as CoverageC8Options, af as CoverageIstanbulOptions, ac as CoverageOptions, a9 as CoverageProvider, aa as CoverageProviderModule, ab as CoverageReporter, _ as DeepMerge, D as DoneCallback, a3 as Environment, E as EnvironmentOptions, a2 as EnvironmentReturn, a7 as ErrorWithDiff, a as File, n as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, Z as MergeInsertions, a1 as ModuleCache, M as ModuleGraphData, $ as MutableArray, Q as Nullable, a8 as OnServerRestartHandler, a6 as ParsedStack, a5 as Position, b as Reporter, K as ResolveIdFunction, R as ResolvedConfig, ad as ResolvedCoverageOptions, d as RunMode, r as RuntimeContext, u as SnapshotData, x as SnapshotMatchOptions, y as SnapshotResult, w as SnapshotStateOptions, G as SnapshotSummary, v as SnapshotUpdateState, S as Suite, m as SuiteAPI, p as SuiteCollector, q as SuiteFactory, o as SuiteHooks, i as Task, f as TaskBase, g as TaskResult, T as TaskResultPack, e as TaskState, h as Test, l as TestAPI, s as TestContext, j as TestFunction, k as TestOptions, z as UncheckedSnapshot, U as UserConfig, a4 as UserConsoleLog, t as Vitest, V as VitestEnvironment, c as VitestRunMode, W as WorkerContext, O as WorkerGlobalState, N as WorkerRPC } from './global-ea084c9f.js';
5
5
  import { TransformResult } from 'vite';
6
6
  import * as chai from 'chai';
7
7
  export { chai };
8
8
  export { assert, should } from 'chai';
9
+ export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
9
10
  import 'tinyspy';
10
- import 'worker_threads';
11
11
  import 'fs';
12
+ import 'worker_threads';
12
13
 
13
14
  /**
14
15
  * A simple wrapper for converting callback style to promise
package/dist/index.mjs CHANGED
@@ -1,20 +1,19 @@
1
- export { c as createExpect, d as describe, b as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.be610650.mjs';
2
- export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, h as getRunningMode, f as isFirstRun, j as isWatchMode, e as runOnce, v as vi, g as vitest, w as withCallback } from './chunk-runtime-hooks.5d7073db.mjs';
1
+ export { b as bench, c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.2af36ddf.mjs';
2
+ export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, h as getRunningMode, f as isFirstRun, j as isWatchMode, e as runOnce, v as vi, g as vitest, w as withCallback } from './chunk-runtime-hooks.75ce0575.mjs';
3
3
  import * as chai from 'chai';
4
4
  export { chai };
5
5
  export { assert, should } from 'chai';
6
6
  import 'util';
7
- import './chunk-mock-date.304e29b1.mjs';
7
+ import './chunk-mock-date.0d86eaa5.mjs';
8
8
  import 'path';
9
- import './chunk-constants.71e8a211.mjs';
9
+ import './chunk-constants.6196597b.mjs';
10
10
  import 'tty';
11
11
  import 'url';
12
12
  import 'local-pkg';
13
13
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
14
- import './chunk-runtime-rpc.57586b73.mjs';
15
- import './chunk-utils-global.fa20c2f6.mjs';
14
+ import './chunk-runtime-rpc.3fe371e9.mjs';
16
15
  import './chunk-utils-timers.b48455ed.mjs';
17
16
  import 'fs';
18
- import './chunk-utils-source-map.bbf3ad19.mjs';
17
+ import './chunk-utils-source-map.70ee97e1.mjs';
19
18
  import './spy.mjs';
20
19
  import 'tinyspy';
package/dist/loader.mjs CHANGED
@@ -1,14 +1,13 @@
1
1
  import { pathToFileURL } from 'url';
2
2
  import { readFile } from 'fs/promises';
3
- import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.b432150c.mjs';
4
- import './chunk-mock-date.304e29b1.mjs';
5
- import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
3
+ import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.68573626.mjs';
4
+ import { g as getWorkerState } from './chunk-mock-date.0d86eaa5.mjs';
6
5
  import 'module';
7
6
  import 'fs';
8
7
  import 'path';
9
8
  import 'assert';
10
9
  import 'util';
11
- import './chunk-constants.71e8a211.mjs';
10
+ import './chunk-constants.6196597b.mjs';
12
11
  import 'tty';
13
12
  import 'local-pkg';
14
13
 
package/dist/node.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { U as UserConfig, V as Vitest, ad as ModuleCacheMap, ae as ViteNodeRunnerOptions, af as MockMap, ag as ViteNodeRunner, ah as TestSequencer } from './global-fe52f84b.js';
2
- export { ah as TestSequencer, aj as TestSequencerConstructor, V as Vitest, ai as startVitest } from './global-fe52f84b.js';
1
+ import { c as VitestRunMode, U as UserConfig, t as Vitest, am as ModuleCacheMap, an as ViteNodeRunnerOptions, ao as MockMap, ap as ViteNodeRunner, aq as TestSequencer } from './global-ea084c9f.js';
2
+ export { aq as TestSequencer, as as TestSequencerConstructor, t as Vitest, ar as startVitest } from './global-ea084c9f.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
- import 'worker_threads';
4
+ import 'tinybench';
5
5
  import 'fs';
6
+ import 'worker_threads';
6
7
 
7
- declare function createVitest(options: UserConfig, viteOverrides?: UserConfig$1): Promise<Vitest>;
8
+ declare function createVitest(mode: VitestRunMode, options: UserConfig, viteOverrides?: UserConfig$1): Promise<Vitest>;
8
9
 
9
10
  declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugin[]>;
10
11
 
package/dist/node.mjs CHANGED
@@ -1,12 +1,14 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.c843f497.mjs';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.49d21aa6.mjs';
3
- import './chunk-constants.71e8a211.mjs';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.41bf722e.mjs';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.fc76f21d.mjs';
3
+ import './chunk-constants.6196597b.mjs';
4
4
  import 'tty';
5
5
  import 'url';
6
6
  import 'path';
7
- import './chunk-integrations-coverage.d205bd87.mjs';
7
+ import './chunk-integrations-coverage.99c020eb.mjs';
8
8
  import 'local-pkg';
9
- import './chunk-mock-date.304e29b1.mjs';
9
+ import './chunk-env-node.ceb43f1c.mjs';
10
+ import 'console';
11
+ import './chunk-mock-date.0d86eaa5.mjs';
10
12
  import 'vite';
11
13
  import 'process';
12
14
  import 'fs';
@@ -15,21 +17,21 @@ import 'util';
15
17
  import 'stream';
16
18
  import 'events';
17
19
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
18
- import './chunk-vite-node-client.cddda63d.mjs';
20
+ import './chunk-vite-node-client.74ebe3d5.mjs';
19
21
  import 'module';
20
22
  import 'vm';
21
- import './chunk-vite-node-utils.b432150c.mjs';
23
+ import './chunk-vite-node-utils.68573626.mjs';
22
24
  import 'assert';
23
25
  import 'debug';
24
26
  import 'perf_hooks';
25
27
  import 'worker_threads';
26
28
  import 'tinypool';
27
- import './chunk-utils-source-map.bbf3ad19.mjs';
29
+ import './chunk-utils-source-map.70ee97e1.mjs';
28
30
  import './chunk-utils-timers.b48455ed.mjs';
29
31
  import 'crypto';
30
- import './vendor-index.9d9196cc.mjs';
31
- import './vendor-index.29636037.mjs';
32
- import './chunk-magic-string.efe26975.mjs';
32
+ import './vendor-index.13e3bda3.mjs';
33
+ import './vendor-index.731a22f2.mjs';
34
+ import './chunk-magic-string.56b2b543.mjs';
35
+ import 'strip-literal';
33
36
  import 'readline';
34
37
  import './vendor-index.ae96af6e.mjs';
35
- import './chunk-utils-global.fa20c2f6.mjs';
package/dist/suite.mjs CHANGED
@@ -1,17 +1,16 @@
1
1
  import 'util';
2
- import './chunk-mock-date.304e29b1.mjs';
3
- export { e as clearCollectorContext, o as createSuiteHooks, f as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.be610650.mjs';
4
- import './chunk-utils-global.fa20c2f6.mjs';
2
+ import './chunk-mock-date.0d86eaa5.mjs';
3
+ export { b as bench, f as clearCollectorContext, q as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.2af36ddf.mjs';
5
4
  import 'path';
6
- import './chunk-constants.71e8a211.mjs';
5
+ import './chunk-constants.6196597b.mjs';
7
6
  import 'tty';
8
7
  import 'url';
9
8
  import 'local-pkg';
10
9
  import 'chai';
11
10
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
12
- import './chunk-runtime-rpc.57586b73.mjs';
11
+ import './chunk-runtime-rpc.3fe371e9.mjs';
13
12
  import './chunk-utils-timers.b48455ed.mjs';
14
13
  import 'fs';
15
- import './chunk-utils-source-map.bbf3ad19.mjs';
14
+ import './chunk-utils-source-map.70ee97e1.mjs';
16
15
  import './spy.mjs';
17
16
  import 'tinyspy';