vitest 0.22.1 → 0.23.2
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.
- package/LICENSE.md +29 -29
- package/dist/browser.d.ts +5 -4
- package/dist/browser.mjs +10 -8
- package/dist/{chunk-api-setup.377c28aa.mjs → chunk-api-setup.11cfd513.mjs} +89 -86
- package/dist/{chunk-integrations-coverage.d205bd87.mjs → chunk-env-node.ceb43f1c.mjs} +31 -179
- package/dist/chunk-integrations-coverage.99c020eb.mjs +166 -0
- package/dist/{chunk-integrations-globals.60af7da3.mjs → chunk-integrations-globals.ad5b1b51.mjs} +5 -6
- package/dist/{chunk-magic-string.efe26975.mjs → chunk-magic-string.56b2b543.mjs} +30 -10
- package/dist/{chunk-mock-date.304e29b1.mjs → chunk-mock-date.2917be60.mjs} +25 -4
- package/dist/{chunk-node-git.9a7e3153.mjs → chunk-node-git.a44b4872.mjs} +14 -8
- package/dist/{chunk-runtime-chain.be610650.mjs → chunk-runtime-chain.7a7f3c3b.mjs} +494 -172
- package/dist/{chunk-runtime-error.1104e45a.mjs → chunk-runtime-error.2723946b.mjs} +219 -75
- package/dist/{chunk-runtime-hooks.5d7073db.mjs → chunk-runtime-hooks.1a0bc3fd.mjs} +18 -12
- package/dist/{chunk-runtime-mocker.49d21aa6.mjs → chunk-runtime-mocker.8d4a2494.mjs} +18 -11
- package/dist/{chunk-runtime-rpc.57586b73.mjs → chunk-runtime-rpc.00a890d2.mjs} +1 -2
- package/dist/{chunk-utils-source-map.bbf3ad19.mjs → chunk-utils-source-map.2be5aa48.mjs} +10 -4
- package/dist/{chunk-vite-node-client.cddda63d.mjs → chunk-vite-node-client.da0a17ff.mjs} +49 -12
- package/dist/{chunk-vite-node-externalize.c843f497.mjs → chunk-vite-node-externalize.f55c4577.mjs} +547 -218
- package/dist/{chunk-vite-node-utils.b432150c.mjs → chunk-vite-node-utils.473cd0b2.mjs} +39 -41
- package/dist/cli-wrapper.mjs +17 -13
- package/dist/cli.mjs +26 -14
- package/dist/config.cjs +2 -2
- package/dist/config.d.ts +4 -3
- package/dist/config.mjs +2 -2
- package/dist/entry.mjs +18 -13
- package/dist/environments.d.ts +23 -0
- package/dist/environments.mjs +3 -0
- package/dist/{global-fe52f84b.d.ts → global-d05ffb3f.d.ts} +140 -19
- package/dist/{index-ea17aa0c.d.ts → index-60e2a8e1.d.ts} +3 -2
- package/dist/index.d.ts +6 -5
- package/dist/index.mjs +5 -6
- package/dist/loader.mjs +5 -6
- package/dist/node.d.ts +5 -4
- package/dist/node.mjs +11 -9
- package/dist/suite.mjs +4 -5
- package/dist/vendor-index.0557b03a.mjs +147 -0
- package/dist/worker.mjs +16 -14
- package/package.json +20 -13
- 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 {
|
|
2
|
+
import { Task as Task$1, 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;
|
|
@@ -596,6 +603,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
596
603
|
private _lastRunCount;
|
|
597
604
|
private _timeStart;
|
|
598
605
|
constructor();
|
|
606
|
+
get mode(): VitestRunMode;
|
|
599
607
|
onInit(ctx: Vitest): void;
|
|
600
608
|
relative(path: string): string;
|
|
601
609
|
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
@@ -607,6 +615,9 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
607
615
|
shouldLog(log: UserConsoleLog): boolean;
|
|
608
616
|
onServerRestart(reason?: string): void;
|
|
609
617
|
reportSummary(files: File[]): Promise<void>;
|
|
618
|
+
reportTestSummary(files: File[]): Promise<void>;
|
|
619
|
+
private printErrorsSummary;
|
|
620
|
+
reportBenchmarkSummary(files: File[]): Promise<void>;
|
|
610
621
|
private printTaskErrors;
|
|
611
622
|
registerUnhandledRejection(): void;
|
|
612
623
|
}
|
|
@@ -649,7 +660,7 @@ interface Callsite {
|
|
|
649
660
|
line: number;
|
|
650
661
|
column: number;
|
|
651
662
|
}
|
|
652
|
-
declare class JsonReporter implements Reporter {
|
|
663
|
+
declare class JsonReporter$1 implements Reporter {
|
|
653
664
|
start: number;
|
|
654
665
|
ctx: Vitest;
|
|
655
666
|
onInit(ctx: Vitest): void;
|
|
@@ -661,7 +672,7 @@ declare class JsonReporter implements Reporter {
|
|
|
661
672
|
* @param report
|
|
662
673
|
*/
|
|
663
674
|
writeReport(report: string): Promise<void>;
|
|
664
|
-
protected getFailureLocation(test:
|
|
675
|
+
protected getFailureLocation(test: Task): Promise<Callsite | undefined>;
|
|
665
676
|
}
|
|
666
677
|
|
|
667
678
|
declare class VerboseReporter extends DefaultReporter {
|
|
@@ -697,11 +708,31 @@ declare class TapFlatReporter extends TapReporter {
|
|
|
697
708
|
onFinished(files?: File[]): Promise<void>;
|
|
698
709
|
}
|
|
699
710
|
|
|
711
|
+
declare class JsonReporter implements Reporter {
|
|
712
|
+
start: number;
|
|
713
|
+
ctx: Vitest;
|
|
714
|
+
onInit(ctx: Vitest): void;
|
|
715
|
+
protected logTasks(files: File[]): Promise<void>;
|
|
716
|
+
onFinished(files?: File[]): Promise<void>;
|
|
717
|
+
/**
|
|
718
|
+
* Writes the report to an output file if specified in the config,
|
|
719
|
+
* or logs it to the console otherwise.
|
|
720
|
+
* @param report
|
|
721
|
+
*/
|
|
722
|
+
writeReport(report: string): Promise<void>;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
declare const BenchmarkReportsMap: {
|
|
726
|
+
default: typeof VerboseReporter;
|
|
727
|
+
json: typeof JsonReporter;
|
|
728
|
+
};
|
|
729
|
+
declare type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
|
|
730
|
+
|
|
700
731
|
declare const ReportersMap: {
|
|
701
732
|
default: typeof DefaultReporter;
|
|
702
733
|
verbose: typeof VerboseReporter;
|
|
703
734
|
dot: typeof DotReporter;
|
|
704
|
-
json: typeof JsonReporter;
|
|
735
|
+
json: typeof JsonReporter$1;
|
|
705
736
|
tap: typeof TapReporter;
|
|
706
737
|
'tap-flat': typeof TapFlatReporter;
|
|
707
738
|
junit: typeof JUnitReporter;
|
|
@@ -996,8 +1027,56 @@ declare type ChainableFunction<T extends string, Args extends any[], R = any, E
|
|
|
996
1027
|
(...args: Args): R;
|
|
997
1028
|
} & {
|
|
998
1029
|
[x in T]: ChainableFunction<T, Args, R, E>;
|
|
1030
|
+
} & {
|
|
1031
|
+
fn: (this: Record<T, boolean | undefined>, ...args: Args) => R;
|
|
999
1032
|
} & E;
|
|
1000
1033
|
|
|
1034
|
+
interface BenchmarkUserOptions {
|
|
1035
|
+
/**
|
|
1036
|
+
* Include globs for benchmark test files
|
|
1037
|
+
*
|
|
1038
|
+
* @default ['**\/*.{bench,benchmark}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
|
|
1039
|
+
*/
|
|
1040
|
+
include?: string[];
|
|
1041
|
+
/**
|
|
1042
|
+
* Exclude globs for benchmark test files
|
|
1043
|
+
* @default ['node_modules', 'dist', '.idea', '.git', '.cache']
|
|
1044
|
+
*/
|
|
1045
|
+
exclude?: string[];
|
|
1046
|
+
/**
|
|
1047
|
+
* Include globs for in-source benchmark test files
|
|
1048
|
+
*
|
|
1049
|
+
* @default []
|
|
1050
|
+
*/
|
|
1051
|
+
includeSource?: string[];
|
|
1052
|
+
/**
|
|
1053
|
+
* Custom reporter for output. Can contain one or more built-in report names, reporter instances,
|
|
1054
|
+
* and/or paths to custom reporters
|
|
1055
|
+
*/
|
|
1056
|
+
reporters?: Arrayable<BenchmarkBuiltinReporters | Reporter>;
|
|
1057
|
+
}
|
|
1058
|
+
interface Benchmark extends TaskBase {
|
|
1059
|
+
type: 'benchmark';
|
|
1060
|
+
suite: Suite;
|
|
1061
|
+
result?: TaskResult;
|
|
1062
|
+
fails?: boolean;
|
|
1063
|
+
task?: Task$1;
|
|
1064
|
+
options: Options;
|
|
1065
|
+
}
|
|
1066
|
+
interface BenchmarkResult extends TaskResult$1 {
|
|
1067
|
+
name: string;
|
|
1068
|
+
rank: number;
|
|
1069
|
+
}
|
|
1070
|
+
declare type BenchFunction = (this: Bench) => Promise<void> | void;
|
|
1071
|
+
declare type BenchmarkAPI = ChainableFunction<'skip', [
|
|
1072
|
+
name: string,
|
|
1073
|
+
fn: BenchFunction,
|
|
1074
|
+
options?: Options
|
|
1075
|
+
], void> & {
|
|
1076
|
+
skipIf(condition: any): BenchmarkAPI;
|
|
1077
|
+
runIf(condition: any): BenchmarkAPI;
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1001
1080
|
declare type RunMode = 'run' | 'skip' | 'only' | 'todo';
|
|
1002
1081
|
declare type TaskState = RunMode | 'pass' | 'fail';
|
|
1003
1082
|
interface TaskBase {
|
|
@@ -1009,6 +1088,7 @@ interface TaskBase {
|
|
|
1009
1088
|
suite?: Suite;
|
|
1010
1089
|
file?: File;
|
|
1011
1090
|
result?: TaskResult;
|
|
1091
|
+
retry?: number;
|
|
1012
1092
|
logs?: UserConsoleLog[];
|
|
1013
1093
|
}
|
|
1014
1094
|
interface TaskResult {
|
|
@@ -1019,12 +1099,15 @@ interface TaskResult {
|
|
|
1019
1099
|
error?: ErrorWithDiff;
|
|
1020
1100
|
htmlError?: string;
|
|
1021
1101
|
hooks?: Partial<Record<keyof SuiteHooks, TaskState>>;
|
|
1102
|
+
benchmark?: BenchmarkResult;
|
|
1103
|
+
retryCount?: number;
|
|
1022
1104
|
}
|
|
1023
1105
|
declare type TaskResultPack = [id: string, result: TaskResult | undefined];
|
|
1024
1106
|
interface Suite extends TaskBase {
|
|
1025
1107
|
type: 'suite';
|
|
1026
1108
|
tasks: Task[];
|
|
1027
1109
|
filepath?: string;
|
|
1110
|
+
benchmark?: Bench;
|
|
1028
1111
|
}
|
|
1029
1112
|
interface File extends Suite {
|
|
1030
1113
|
filepath: string;
|
|
@@ -1038,7 +1121,7 @@ interface Test<ExtraContext = {}> extends TaskBase {
|
|
|
1038
1121
|
fails?: boolean;
|
|
1039
1122
|
context: TestContext & ExtraContext;
|
|
1040
1123
|
}
|
|
1041
|
-
declare type Task = Test | Suite | File;
|
|
1124
|
+
declare type Task = Test | Suite | File | Benchmark;
|
|
1042
1125
|
declare type DoneCallback = (error?: any) => void;
|
|
1043
1126
|
declare type TestFunction<ExtraContext = {}> = (context: TestContext & ExtraContext) => Awaitable<any> | void;
|
|
1044
1127
|
declare type ExtractEachCallbackArgs<T extends ReadonlyArray<any>> = {
|
|
@@ -1060,18 +1143,31 @@ interface SuiteEachFunction {
|
|
|
1060
1143
|
<T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => Awaitable<void>) => void;
|
|
1061
1144
|
}
|
|
1062
1145
|
interface TestEachFunction {
|
|
1063
|
-
<T extends any[] | [any]>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T) => Awaitable<void>,
|
|
1064
|
-
<T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (name: string, fn: (...args: ExtractEachCallbackArgs<T>) => Awaitable<void>,
|
|
1065
|
-
<T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => Awaitable<void>,
|
|
1146
|
+
<T extends any[] | [any]>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
1147
|
+
<T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (name: string, fn: (...args: ExtractEachCallbackArgs<T>) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
1148
|
+
<T>(cases: ReadonlyArray<T>): (name: string, fn: (...args: T[]) => Awaitable<void>, options?: number | TestOptions) => void;
|
|
1066
1149
|
}
|
|
1067
1150
|
declare type ChainableTestAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'fails', [
|
|
1068
1151
|
name: string,
|
|
1069
1152
|
fn?: TestFunction<ExtraContext>,
|
|
1070
|
-
|
|
1153
|
+
options?: number | TestOptions
|
|
1071
1154
|
], void, {
|
|
1072
1155
|
each: TestEachFunction;
|
|
1073
|
-
<T extends ExtraContext>(name: string, fn?: TestFunction<T>,
|
|
1156
|
+
<T extends ExtraContext>(name: string, fn?: TestFunction<T>, options?: number | TestOptions): void;
|
|
1074
1157
|
}>;
|
|
1158
|
+
interface TestOptions {
|
|
1159
|
+
/**
|
|
1160
|
+
* Test timeout.
|
|
1161
|
+
*/
|
|
1162
|
+
timeout?: number;
|
|
1163
|
+
/**
|
|
1164
|
+
* Times to retry the test if fails. Useful for making flaky tests more stable.
|
|
1165
|
+
* When retries is up, the last test error will be thrown.
|
|
1166
|
+
*
|
|
1167
|
+
* @default 1
|
|
1168
|
+
*/
|
|
1169
|
+
retry?: number;
|
|
1170
|
+
}
|
|
1075
1171
|
declare type TestAPI<ExtraContext = {}> = ChainableTestAPI<ExtraContext> & {
|
|
1076
1172
|
each: TestEachFunction;
|
|
1077
1173
|
skipIf(condition: any): ChainableTestAPI<ExtraContext>;
|
|
@@ -1102,7 +1198,8 @@ interface SuiteCollector<ExtraContext = {}> {
|
|
|
1102
1198
|
readonly mode: RunMode;
|
|
1103
1199
|
type: 'collector';
|
|
1104
1200
|
test: TestAPI<ExtraContext>;
|
|
1105
|
-
|
|
1201
|
+
benchmark: BenchmarkAPI;
|
|
1202
|
+
tasks: (Suite | Test | Benchmark | SuiteCollector<ExtraContext>)[];
|
|
1106
1203
|
collect: (file?: File) => Promise<Suite>;
|
|
1107
1204
|
clear: () => void;
|
|
1108
1205
|
on: <T extends keyof SuiteHooks<ExtraContext>>(name: T, ...fn: SuiteHooks<ExtraContext>[T]) => void;
|
|
@@ -1271,6 +1368,10 @@ interface BaseCoverageOptions {
|
|
|
1271
1368
|
* @default 'text'
|
|
1272
1369
|
*/
|
|
1273
1370
|
reporter?: Arrayable<CoverageReporter>;
|
|
1371
|
+
/**
|
|
1372
|
+
* List of files included in coverage as glob patterns
|
|
1373
|
+
*/
|
|
1374
|
+
include?: string[];
|
|
1274
1375
|
/**
|
|
1275
1376
|
* List of files excluded from coverage as glob patterns
|
|
1276
1377
|
*/
|
|
@@ -1305,6 +1406,10 @@ interface BaseCoverageOptions {
|
|
|
1305
1406
|
* Extensions for files to be included in coverage
|
|
1306
1407
|
*/
|
|
1307
1408
|
extension?: string | string[];
|
|
1409
|
+
/**
|
|
1410
|
+
* Whether to include all files, including the untested ones into report
|
|
1411
|
+
*/
|
|
1412
|
+
all?: boolean;
|
|
1308
1413
|
}
|
|
1309
1414
|
interface CoverageIstanbulOptions extends BaseCoverageOptions {
|
|
1310
1415
|
ignoreClassMethods?: string[];
|
|
@@ -1328,8 +1433,6 @@ interface CoverageC8Options extends BaseCoverageOptions {
|
|
|
1328
1433
|
* @default true
|
|
1329
1434
|
*/
|
|
1330
1435
|
excludeNodeModules?: boolean;
|
|
1331
|
-
include?: string[];
|
|
1332
|
-
all?: boolean;
|
|
1333
1436
|
src?: string[];
|
|
1334
1437
|
100?: boolean;
|
|
1335
1438
|
}
|
|
@@ -1428,6 +1531,8 @@ interface Reporter {
|
|
|
1428
1531
|
}
|
|
1429
1532
|
|
|
1430
1533
|
declare type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
|
|
1534
|
+
declare type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
|
|
1535
|
+
declare type CSSModuleScopeStrategy = 'stable' | 'scoped' | 'non-scoped';
|
|
1431
1536
|
declare type ApiConfig = Pick<CommonServerOptions, 'port' | 'strictPort' | 'host'>;
|
|
1432
1537
|
|
|
1433
1538
|
interface EnvironmentOptions {
|
|
@@ -1435,8 +1540,16 @@ interface EnvironmentOptions {
|
|
|
1435
1540
|
* jsdom options.
|
|
1436
1541
|
*/
|
|
1437
1542
|
jsdom?: JSDOMOptions;
|
|
1543
|
+
[x: string]: unknown;
|
|
1438
1544
|
}
|
|
1545
|
+
declare type VitestRunMode = 'test' | 'benchmark';
|
|
1439
1546
|
interface InlineConfig {
|
|
1547
|
+
/**
|
|
1548
|
+
* Benchmark options.
|
|
1549
|
+
*
|
|
1550
|
+
* @default {}
|
|
1551
|
+
*/
|
|
1552
|
+
benchmark?: BenchmarkUserOptions;
|
|
1440
1553
|
/**
|
|
1441
1554
|
* Include globs for test files
|
|
1442
1555
|
*
|
|
@@ -1512,9 +1625,11 @@ interface InlineConfig {
|
|
|
1512
1625
|
*
|
|
1513
1626
|
* Supports 'node', 'jsdom', 'happy-dom', 'edge-runtime'
|
|
1514
1627
|
*
|
|
1628
|
+
* If used unsupported string, will try to load the package `vitest-environment-${env}`
|
|
1629
|
+
*
|
|
1515
1630
|
* @default 'node'
|
|
1516
1631
|
*/
|
|
1517
|
-
environment?:
|
|
1632
|
+
environment?: VitestEnvironment;
|
|
1518
1633
|
/**
|
|
1519
1634
|
* Environment options.
|
|
1520
1635
|
*/
|
|
@@ -1735,11 +1850,14 @@ interface InlineConfig {
|
|
|
1735
1850
|
*
|
|
1736
1851
|
* When excluded, the CSS files will be replaced with empty strings to bypass the subsequent processing.
|
|
1737
1852
|
*
|
|
1738
|
-
* @default { include: [
|
|
1853
|
+
* @default { include: [], modules: { classNameStrategy: false } }
|
|
1739
1854
|
*/
|
|
1740
1855
|
css?: boolean | {
|
|
1741
1856
|
include?: RegExp | RegExp[];
|
|
1742
1857
|
exclude?: RegExp | RegExp[];
|
|
1858
|
+
modules?: {
|
|
1859
|
+
classNameStrategy?: CSSModuleScopeStrategy;
|
|
1860
|
+
};
|
|
1743
1861
|
};
|
|
1744
1862
|
/**
|
|
1745
1863
|
* A number of tests that are allowed to run at the same time marked with `test.concurrent`.
|
|
@@ -1824,7 +1942,8 @@ interface UserConfig extends InlineConfig {
|
|
|
1824
1942
|
*/
|
|
1825
1943
|
shard?: string;
|
|
1826
1944
|
}
|
|
1827
|
-
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'shard' | 'cache' | 'sequence'> {
|
|
1945
|
+
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence'> {
|
|
1946
|
+
mode: VitestRunMode;
|
|
1828
1947
|
base?: string;
|
|
1829
1948
|
config?: string;
|
|
1830
1949
|
filters?: string[];
|
|
@@ -1835,6 +1954,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
1835
1954
|
reporters: (Reporter | BuiltinReporters)[];
|
|
1836
1955
|
defines: Record<string, any>;
|
|
1837
1956
|
api?: ApiConfig;
|
|
1957
|
+
benchmark?: Required<BenchmarkUserOptions>;
|
|
1838
1958
|
shard?: {
|
|
1839
1959
|
index: number;
|
|
1840
1960
|
count: number;
|
|
@@ -1988,6 +2108,7 @@ interface MatcherState {
|
|
|
1988
2108
|
isExpectingAssertions?: boolean;
|
|
1989
2109
|
isExpectingAssertionsError?: Error | null;
|
|
1990
2110
|
isNot: boolean;
|
|
2111
|
+
environment: VitestEnvironment;
|
|
1991
2112
|
promise: string;
|
|
1992
2113
|
snapshotState: SnapshotState;
|
|
1993
2114
|
suppressedErrors: Array<Error>;
|
|
@@ -2109,4 +2230,4 @@ declare global {
|
|
|
2109
2230
|
}
|
|
2110
2231
|
}
|
|
2111
2232
|
|
|
2112
|
-
export {
|
|
2233
|
+
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 {
|
|
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-d05ffb3f.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,
|
|
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-
|
|
2
|
-
export { E as EnhancedSpy,
|
|
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-
|
|
4
|
-
export {
|
|
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-60e2a8e1.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-60e2a8e1.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-d05ffb3f.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-d05ffb3f.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,
|
|
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.
|
|
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.7a7f3c3b.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.1a0bc3fd.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.
|
|
7
|
+
import './chunk-mock-date.2917be60.mjs';
|
|
8
8
|
import 'path';
|
|
9
9
|
import './chunk-constants.71e8a211.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.
|
|
15
|
-
import './chunk-utils-global.fa20c2f6.mjs';
|
|
14
|
+
import './chunk-runtime-rpc.00a890d2.mjs';
|
|
16
15
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
17
16
|
import 'fs';
|
|
18
|
-
import './chunk-utils-source-map.
|
|
17
|
+
import './chunk-utils-source-map.2be5aa48.mjs';
|
|
19
18
|
import './spy.mjs';
|
|
20
19
|
import 'tinyspy';
|
package/dist/loader.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
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.
|
|
4
|
-
import './chunk-mock-date.
|
|
5
|
-
import
|
|
3
|
+
import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.473cd0b2.mjs';
|
|
4
|
+
import { g as getWorkerState } from './chunk-mock-date.2917be60.mjs';
|
|
5
|
+
import './chunk-constants.71e8a211.mjs';
|
|
6
|
+
import 'tty';
|
|
7
|
+
import 'path';
|
|
6
8
|
import 'module';
|
|
7
9
|
import 'fs';
|
|
8
|
-
import 'path';
|
|
9
10
|
import 'assert';
|
|
10
11
|
import 'util';
|
|
11
|
-
import './chunk-constants.71e8a211.mjs';
|
|
12
|
-
import 'tty';
|
|
13
12
|
import 'local-pkg';
|
|
14
13
|
|
|
15
14
|
var ModuleFormat = /* @__PURE__ */ ((ModuleFormat2) => {
|
package/dist/node.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { U as UserConfig,
|
|
2
|
-
export {
|
|
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-d05ffb3f.js';
|
|
2
|
+
export { aq as TestSequencer, as as TestSequencerConstructor, t as Vitest, ar as startVitest } from './global-d05ffb3f.js';
|
|
3
3
|
import { UserConfig as UserConfig$1, Plugin } from 'vite';
|
|
4
|
-
import '
|
|
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.
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.f55c4577.mjs';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.8d4a2494.mjs';
|
|
3
3
|
import './chunk-constants.71e8a211.mjs';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'url';
|
|
6
6
|
import 'path';
|
|
7
|
-
import './chunk-integrations-coverage.
|
|
7
|
+
import './chunk-integrations-coverage.99c020eb.mjs';
|
|
8
8
|
import 'local-pkg';
|
|
9
|
-
import './chunk-
|
|
9
|
+
import './chunk-env-node.ceb43f1c.mjs';
|
|
10
|
+
import 'console';
|
|
11
|
+
import './chunk-mock-date.2917be60.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.
|
|
20
|
+
import './chunk-vite-node-client.da0a17ff.mjs';
|
|
19
21
|
import 'module';
|
|
20
22
|
import 'vm';
|
|
21
|
-
import './chunk-vite-node-utils.
|
|
23
|
+
import './chunk-vite-node-utils.473cd0b2.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.
|
|
29
|
+
import './chunk-utils-source-map.2be5aa48.mjs';
|
|
28
30
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
29
31
|
import 'crypto';
|
|
30
32
|
import './vendor-index.9d9196cc.mjs';
|
|
31
33
|
import './vendor-index.29636037.mjs';
|
|
32
|
-
import './chunk-magic-string.
|
|
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,7 +1,6 @@
|
|
|
1
1
|
import 'util';
|
|
2
|
-
import './chunk-mock-date.
|
|
3
|
-
export {
|
|
4
|
-
import './chunk-utils-global.fa20c2f6.mjs';
|
|
2
|
+
import './chunk-mock-date.2917be60.mjs';
|
|
3
|
+
export { b as bench, f as clearCollectorContext, p as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.7a7f3c3b.mjs';
|
|
5
4
|
import 'path';
|
|
6
5
|
import './chunk-constants.71e8a211.mjs';
|
|
7
6
|
import 'tty';
|
|
@@ -9,9 +8,9 @@ import 'url';
|
|
|
9
8
|
import 'local-pkg';
|
|
10
9
|
import 'chai';
|
|
11
10
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
12
|
-
import './chunk-runtime-rpc.
|
|
11
|
+
import './chunk-runtime-rpc.00a890d2.mjs';
|
|
13
12
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
14
13
|
import 'fs';
|
|
15
|
-
import './chunk-utils-source-map.
|
|
14
|
+
import './chunk-utils-source-map.2be5aa48.mjs';
|
|
16
15
|
import './spy.mjs';
|
|
17
16
|
import 'tinyspy';
|