vitest 1.2.2 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +30 -2
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +2 -1
- package/dist/chunks/{integrations-globals.J_6tnlri.js → integrations-globals.THajbSRg.js} +6 -6
- package/dist/chunks/{runtime-runBaseTests.QReNMrJA.js → runtime-runBaseTests.9RbsHRbU.js} +9 -9
- package/dist/cli-wrapper.js +1 -1
- package/dist/cli.js +44 -131
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/coverage.d.ts +6 -6
- package/dist/coverage.js +34 -3
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +1 -1
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +75 -78
- package/dist/index.js +7 -7
- package/dist/node.d.ts +12 -4
- package/dist/node.js +35 -27
- package/dist/{reporters-1evA5lom.d.ts → reporters-MmQN-57K.d.ts} +177 -61
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +20 -6
- package/dist/runners.d.ts +6 -6
- package/dist/runners.js +10 -10
- package/dist/{suite-ghspeorC.d.ts → suite-UrZdHRff.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +2 -2
- package/dist/vendor/{base.QYERqzkH.js → base.N3JkKp7j.js} +1 -1
- package/dist/vendor/{base.Rmxiv35Y.js → base.Z38YsPLm.js} +2 -2
- package/dist/vendor/{benchmark.IlKmJkUU.js → benchmark.eeqk2rd8.js} +1 -1
- package/dist/vendor/{node.Zme77R4t.js → cac.wWT9ELdg.js} +9225 -5219
- package/dist/vendor/{constants.i1PoEnhr.js → constants.K-Wf1PUy.js} +3 -1
- package/dist/vendor/{execute.TxmaEFIQ.js → execute.27Kk4lQF.js} +23 -12
- package/dist/vendor/{index.cAUulNDf.js → index.8bPxjt7g.js} +6 -1
- package/dist/vendor/{index.RDKo8czB.js → index.9hqYxJUw.js} +7 -3
- package/dist/vendor/{environments.sU0TD7wX.js → index.GVFv9dZ0.js} +3 -0
- package/dist/vendor/{index.LgG0iblq.js → index.JZMafwT-.js} +4 -3
- package/dist/vendor/index.c1V_jzyZ.js +4927 -0
- package/dist/vendor/{index.rJjbcrrp.js → index.ir9i0ywP.js} +1 -1
- package/dist/vendor/{rpc.w4v8oCkK.js → rpc.joBhAkyK.js} +10 -1
- package/dist/vendor/setup-common.snyQUvE3.js +45 -0
- package/dist/vendor/{vi.PPwhENHF.js → vi.C5mroSoP.js} +2 -1
- package/dist/vendor/{vm.jVxKtN5R.js → vm.o1IruPAo.js} +25 -8
- package/dist/worker.js +5 -10
- package/dist/workers/forks.js +3 -3
- package/dist/workers/runVmTests.js +13 -9
- package/dist/workers/threads.js +3 -3
- package/dist/workers/vmForks.js +4 -4
- package/dist/workers/vmThreads.js +4 -4
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +8 -8
- package/globals.d.ts +2 -0
- package/jsdom.d.ts +6 -0
- package/package.json +24 -21
- package/dist/chunks/api-setup.srzH0bDf.js +0 -4808
- package/dist/vendor/reporters.cA9x-5v-.js +0 -2664
- package/dist/vendor/setup-common.C2iBd0K0.js +0 -29
|
@@ -480,6 +480,11 @@ declare class WorkspaceProject {
|
|
|
480
480
|
typechecker?: Typechecker;
|
|
481
481
|
closingPromise: Promise<unknown> | undefined;
|
|
482
482
|
browserProvider: BrowserProvider | undefined;
|
|
483
|
+
browserState: {
|
|
484
|
+
files: string[];
|
|
485
|
+
resolve: () => void;
|
|
486
|
+
reject: (v: unknown) => void;
|
|
487
|
+
} | undefined;
|
|
483
488
|
testFilesList: string[] | null;
|
|
484
489
|
private _globalSetups;
|
|
485
490
|
private _provided;
|
|
@@ -519,11 +524,10 @@ interface BrowserProviderInitializationOptions {
|
|
|
519
524
|
}
|
|
520
525
|
interface BrowserProvider {
|
|
521
526
|
name: string;
|
|
522
|
-
getSupportedBrowsers()
|
|
527
|
+
getSupportedBrowsers: () => readonly string[];
|
|
528
|
+
openPage: (url: string) => Awaitable$1<void>;
|
|
529
|
+
close: () => Awaitable$1<void>;
|
|
523
530
|
initialize(ctx: WorkspaceProject, options: BrowserProviderInitializationOptions): Awaitable$1<void>;
|
|
524
|
-
openPage(url: string): Awaitable$1<void>;
|
|
525
|
-
catchError(cb: (error: Error) => Awaitable$1<void>): () => Awaitable$1<void>;
|
|
526
|
-
close(): Awaitable$1<void>;
|
|
527
531
|
}
|
|
528
532
|
interface BrowserProviderOptions {
|
|
529
533
|
}
|
|
@@ -581,6 +585,12 @@ interface BrowserConfigOptions {
|
|
|
581
585
|
* @default true
|
|
582
586
|
*/
|
|
583
587
|
isolate?: boolean;
|
|
588
|
+
/**
|
|
589
|
+
* Run test files in parallel. Fallbacks to `test.fileParallelism`.
|
|
590
|
+
*
|
|
591
|
+
* @default test.fileParallelism
|
|
592
|
+
*/
|
|
593
|
+
fileParallelism?: boolean;
|
|
584
594
|
}
|
|
585
595
|
interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
586
596
|
enabled: boolean;
|
|
@@ -720,19 +730,19 @@ interface ModuleCache {
|
|
|
720
730
|
code?: string;
|
|
721
731
|
}
|
|
722
732
|
interface EnvironmentReturn {
|
|
723
|
-
teardown(global: any)
|
|
733
|
+
teardown: (global: any) => Awaitable<void>;
|
|
724
734
|
}
|
|
725
735
|
interface VmEnvironmentReturn {
|
|
726
|
-
getVmContext()
|
|
736
|
+
getVmContext: () => {
|
|
727
737
|
[key: string]: any;
|
|
728
738
|
};
|
|
729
|
-
teardown()
|
|
739
|
+
teardown: () => Awaitable<void>;
|
|
730
740
|
}
|
|
731
741
|
interface Environment {
|
|
732
742
|
name: string;
|
|
733
743
|
transformMode: 'web' | 'ssr';
|
|
734
|
-
setupVM
|
|
735
|
-
setup(global: any, options: Record<string, any>)
|
|
744
|
+
setupVM?: (options: Record<string, any>) => Awaitable<VmEnvironmentReturn>;
|
|
745
|
+
setup: (global: any, options: Record<string, any>) => Awaitable<EnvironmentReturn>;
|
|
736
746
|
}
|
|
737
747
|
interface UserConsoleLog {
|
|
738
748
|
content: string;
|
|
@@ -753,10 +763,6 @@ interface ProvidedContext {
|
|
|
753
763
|
declare class StateManager {
|
|
754
764
|
filesMap: Map<string, File[]>;
|
|
755
765
|
pathsSet: Set<string>;
|
|
756
|
-
browserTestPromises: Map<string, {
|
|
757
|
-
resolve: (v: unknown) => void;
|
|
758
|
-
reject: (v: unknown) => void;
|
|
759
|
-
}>;
|
|
760
766
|
idMap: Map<string, Task>;
|
|
761
767
|
taskFileMap: WeakMap<Task, File>;
|
|
762
768
|
errorsSet: Set<unknown>;
|
|
@@ -808,6 +814,14 @@ interface CliOptions extends UserConfig {
|
|
|
808
814
|
* Override the watch mode
|
|
809
815
|
*/
|
|
810
816
|
run?: boolean;
|
|
817
|
+
/**
|
|
818
|
+
* Retry the test suite if it crashes due to a segfault (default: true)
|
|
819
|
+
*/
|
|
820
|
+
segfaultRetry?: number;
|
|
821
|
+
/**
|
|
822
|
+
* Removes colors from the console output
|
|
823
|
+
*/
|
|
824
|
+
color?: boolean;
|
|
811
825
|
}
|
|
812
826
|
/**
|
|
813
827
|
* Start Vitest programmatically
|
|
@@ -930,8 +944,8 @@ interface TestSequencer {
|
|
|
930
944
|
* Slicing tests into shards. Will be run before `sort`.
|
|
931
945
|
* Only run, if `shard` is defined.
|
|
932
946
|
*/
|
|
933
|
-
shard(files: WorkspaceSpec[])
|
|
934
|
-
sort(files: WorkspaceSpec[])
|
|
947
|
+
shard: (files: WorkspaceSpec[]) => Awaitable<WorkspaceSpec[]>;
|
|
948
|
+
sort: (files: WorkspaceSpec[]) => Awaitable<WorkspaceSpec[]>;
|
|
935
949
|
}
|
|
936
950
|
interface TestSequencerConstructor {
|
|
937
951
|
new (ctx: Vitest): TestSequencer;
|
|
@@ -1022,13 +1036,51 @@ declare class DotReporter extends BaseReporter {
|
|
|
1022
1036
|
onUserConsoleLog(log: UserConsoleLog): void;
|
|
1023
1037
|
}
|
|
1024
1038
|
|
|
1039
|
+
type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';
|
|
1040
|
+
type Milliseconds = number;
|
|
1025
1041
|
interface Callsite {
|
|
1026
1042
|
line: number;
|
|
1027
1043
|
column: number;
|
|
1028
1044
|
}
|
|
1045
|
+
interface JsonAssertionResult {
|
|
1046
|
+
ancestorTitles: Array<string>;
|
|
1047
|
+
fullName: string;
|
|
1048
|
+
status: Status;
|
|
1049
|
+
title: string;
|
|
1050
|
+
duration?: Milliseconds | null;
|
|
1051
|
+
failureMessages: Array<string>;
|
|
1052
|
+
location?: Callsite | null;
|
|
1053
|
+
}
|
|
1054
|
+
interface JsonTestResult {
|
|
1055
|
+
message: string;
|
|
1056
|
+
name: string;
|
|
1057
|
+
status: 'failed' | 'passed';
|
|
1058
|
+
startTime: number;
|
|
1059
|
+
endTime: number;
|
|
1060
|
+
assertionResults: Array<JsonAssertionResult>;
|
|
1061
|
+
}
|
|
1062
|
+
interface JsonTestResults {
|
|
1063
|
+
numFailedTests: number;
|
|
1064
|
+
numFailedTestSuites: number;
|
|
1065
|
+
numPassedTests: number;
|
|
1066
|
+
numPassedTestSuites: number;
|
|
1067
|
+
numPendingTests: number;
|
|
1068
|
+
numPendingTestSuites: number;
|
|
1069
|
+
numTodoTests: number;
|
|
1070
|
+
numTotalTests: number;
|
|
1071
|
+
numTotalTestSuites: number;
|
|
1072
|
+
startTime: number;
|
|
1073
|
+
success: boolean;
|
|
1074
|
+
testResults: Array<JsonTestResult>;
|
|
1075
|
+
}
|
|
1076
|
+
interface JsonOptions$1 {
|
|
1077
|
+
outputFile?: string;
|
|
1078
|
+
}
|
|
1029
1079
|
declare class JsonReporter$1 implements Reporter {
|
|
1030
1080
|
start: number;
|
|
1031
1081
|
ctx: Vitest;
|
|
1082
|
+
options: JsonOptions$1;
|
|
1083
|
+
constructor(options: JsonOptions$1);
|
|
1032
1084
|
onInit(ctx: Vitest): void;
|
|
1033
1085
|
protected logTasks(files: File[]): Promise<void>;
|
|
1034
1086
|
onFinished(files?: File[]): Promise<void>;
|
|
@@ -1047,7 +1099,7 @@ declare class VerboseReporter extends DefaultReporter {
|
|
|
1047
1099
|
}
|
|
1048
1100
|
|
|
1049
1101
|
interface Reporter {
|
|
1050
|
-
onInit
|
|
1102
|
+
onInit?: (ctx: Vitest) => void;
|
|
1051
1103
|
onPathsCollected?: (paths?: string[]) => Awaitable<void>;
|
|
1052
1104
|
onCollected?: (files?: File[]) => Awaitable<void>;
|
|
1053
1105
|
onFinished?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
@@ -1070,6 +1122,11 @@ declare class TapReporter implements Reporter {
|
|
|
1070
1122
|
onFinished(files?: _vitest_runner.File[]): Promise<void>;
|
|
1071
1123
|
}
|
|
1072
1124
|
|
|
1125
|
+
interface JUnitOptions {
|
|
1126
|
+
outputFile?: string;
|
|
1127
|
+
classname?: string;
|
|
1128
|
+
suiteName?: string;
|
|
1129
|
+
}
|
|
1073
1130
|
declare class JUnitReporter implements Reporter {
|
|
1074
1131
|
private ctx;
|
|
1075
1132
|
private reportFile?;
|
|
@@ -1077,6 +1134,8 @@ declare class JUnitReporter implements Reporter {
|
|
|
1077
1134
|
private logger;
|
|
1078
1135
|
private _timeStart;
|
|
1079
1136
|
private fileFd?;
|
|
1137
|
+
private options;
|
|
1138
|
+
constructor(options: JUnitOptions);
|
|
1080
1139
|
onInit(ctx: Vitest): Promise<void>;
|
|
1081
1140
|
writeElement(name: string, attrs: Record<string, any>, children: () => Promise<void>): Promise<void>;
|
|
1082
1141
|
writeErrorDetails(task: Task, error: ErrorWithDiff): Promise<void>;
|
|
@@ -1096,6 +1155,12 @@ declare class HangingProcessReporter implements Reporter {
|
|
|
1096
1155
|
onProcessTimeout(): void;
|
|
1097
1156
|
}
|
|
1098
1157
|
|
|
1158
|
+
declare class GithubActionsReporter implements Reporter {
|
|
1159
|
+
ctx: Vitest;
|
|
1160
|
+
onInit(ctx: Vitest): void;
|
|
1161
|
+
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1099
1164
|
declare class JsonReporter implements Reporter {
|
|
1100
1165
|
start: number;
|
|
1101
1166
|
ctx: Vitest;
|
|
@@ -1152,8 +1217,23 @@ declare const ReportersMap: {
|
|
|
1152
1217
|
'tap-flat': typeof TapFlatReporter;
|
|
1153
1218
|
junit: typeof JUnitReporter;
|
|
1154
1219
|
'hanging-process': typeof HangingProcessReporter;
|
|
1220
|
+
'github-actions': typeof GithubActionsReporter;
|
|
1155
1221
|
};
|
|
1156
1222
|
type BuiltinReporters = keyof typeof ReportersMap;
|
|
1223
|
+
interface BuiltinReporterOptions {
|
|
1224
|
+
'default': never;
|
|
1225
|
+
'basic': never;
|
|
1226
|
+
'verbose': never;
|
|
1227
|
+
'dot': never;
|
|
1228
|
+
'json': JsonOptions$1;
|
|
1229
|
+
'tap': never;
|
|
1230
|
+
'tap-flat': never;
|
|
1231
|
+
'junit': JUnitOptions;
|
|
1232
|
+
'hanging-process': never;
|
|
1233
|
+
'html': {
|
|
1234
|
+
outputFile?: string;
|
|
1235
|
+
};
|
|
1236
|
+
}
|
|
1157
1237
|
|
|
1158
1238
|
type ChaiConfig = Omit<Partial<typeof chai.config>, 'useProxy' | 'proxyExcludedKeys'>;
|
|
1159
1239
|
|
|
@@ -1279,6 +1359,10 @@ interface EventOptions<Remote> {
|
|
|
1279
1359
|
* Custom error handler
|
|
1280
1360
|
*/
|
|
1281
1361
|
onError?: (error: Error, functionName: string, args: any[]) => boolean | void;
|
|
1362
|
+
/**
|
|
1363
|
+
* Custom error handler for timeouts
|
|
1364
|
+
*/
|
|
1365
|
+
onTimeoutError?: (functionName: string, args: any[]) => boolean | void;
|
|
1282
1366
|
}
|
|
1283
1367
|
type BirpcOptions<Remote> = EventOptions<Remote> & ChannelOptions;
|
|
1284
1368
|
type BirpcFn<T> = PromisifyFn<T> & {
|
|
@@ -1360,7 +1444,7 @@ interface WorkerGlobalState {
|
|
|
1360
1444
|
ctx: ContextRPC;
|
|
1361
1445
|
config: ResolvedConfig;
|
|
1362
1446
|
rpc: WorkerRPC;
|
|
1363
|
-
current?:
|
|
1447
|
+
current?: Task;
|
|
1364
1448
|
filepath?: string;
|
|
1365
1449
|
environment: Environment;
|
|
1366
1450
|
environmentTeardownRun?: boolean;
|
|
@@ -1377,12 +1461,12 @@ interface WorkerGlobalState {
|
|
|
1377
1461
|
type TransformResult = string | Partial<TransformResult$1> | undefined | null | void;
|
|
1378
1462
|
interface CoverageProvider {
|
|
1379
1463
|
name: string;
|
|
1380
|
-
initialize(ctx: Vitest)
|
|
1381
|
-
resolveOptions()
|
|
1382
|
-
clean(clean?: boolean)
|
|
1383
|
-
onAfterSuiteRun(meta: AfterSuiteRunMeta)
|
|
1384
|
-
reportCoverage(reportContext?: ReportContext)
|
|
1385
|
-
onFileTransform
|
|
1464
|
+
initialize: (ctx: Vitest) => Promise<void> | void;
|
|
1465
|
+
resolveOptions: () => ResolvedCoverageOptions;
|
|
1466
|
+
clean: (clean?: boolean) => void | Promise<void>;
|
|
1467
|
+
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void | Promise<void>;
|
|
1468
|
+
reportCoverage: (reportContext?: ReportContext) => void | Promise<void>;
|
|
1469
|
+
onFileTransform?: (sourceCode: string, id: string, pluginCtx: any) => TransformResult | Promise<TransformResult>;
|
|
1386
1470
|
}
|
|
1387
1471
|
interface ReportContext {
|
|
1388
1472
|
/** Indicates whether all tests were run. False when only specific tests were run. */
|
|
@@ -1392,19 +1476,19 @@ interface CoverageProviderModule {
|
|
|
1392
1476
|
/**
|
|
1393
1477
|
* Factory for creating a new coverage provider
|
|
1394
1478
|
*/
|
|
1395
|
-
getProvider()
|
|
1479
|
+
getProvider: () => CoverageProvider | Promise<CoverageProvider>;
|
|
1396
1480
|
/**
|
|
1397
1481
|
* Executed before tests are run in the worker thread.
|
|
1398
1482
|
*/
|
|
1399
|
-
startCoverage
|
|
1483
|
+
startCoverage?: () => unknown | Promise<unknown>;
|
|
1400
1484
|
/**
|
|
1401
1485
|
* Executed on after each run in the worker thread. Possible to return a payload passed to the provider
|
|
1402
1486
|
*/
|
|
1403
|
-
takeCoverage
|
|
1487
|
+
takeCoverage?: () => unknown | Promise<unknown>;
|
|
1404
1488
|
/**
|
|
1405
1489
|
* Executed after all tests have been run in the worker thread.
|
|
1406
1490
|
*/
|
|
1407
|
-
stopCoverage
|
|
1491
|
+
stopCoverage?: () => unknown | Promise<unknown>;
|
|
1408
1492
|
}
|
|
1409
1493
|
type CoverageReporter = keyof ReportOptions | (string & {});
|
|
1410
1494
|
type CoverageReporterWithOptions<ReporterName extends CoverageReporter = CoverageReporter> = ReporterName extends keyof ReportOptions ? ReportOptions[ReporterName] extends never ? [ReporterName, {}] : [ReporterName, Partial<ReportOptions[ReporterName]>] : [ReporterName, Record<string, unknown>];
|
|
@@ -1412,6 +1496,11 @@ type Provider = 'v8' | 'istanbul' | 'custom' | undefined;
|
|
|
1412
1496
|
type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? ({
|
|
1413
1497
|
provider: T;
|
|
1414
1498
|
} & CoverageIstanbulOptions) : T extends 'v8' ? ({
|
|
1499
|
+
/**
|
|
1500
|
+
* Provider to use for coverage collection.
|
|
1501
|
+
*
|
|
1502
|
+
* @default 'v8'
|
|
1503
|
+
*/
|
|
1415
1504
|
provider: T;
|
|
1416
1505
|
} & CoverageV8Options) : T extends 'custom' ? ({
|
|
1417
1506
|
provider: T;
|
|
@@ -1444,12 +1533,14 @@ interface BaseCoverageOptions {
|
|
|
1444
1533
|
extension?: string | string[];
|
|
1445
1534
|
/**
|
|
1446
1535
|
* List of files excluded from coverage as glob patterns
|
|
1536
|
+
*
|
|
1537
|
+
* @default ['coverage/**', 'dist/**', '**\/[.]**', 'packages/*\/test?(s)/**', '**\/*.d.ts', '**\/virtual:*', '**\/__x00__*', '**\/\x00*', 'cypress/**', 'test?(s)/**', 'test?(-*).?(c|m)[jt]s?(x)', '**\/*{.,-}{test,spec}.?(c|m)[jt]s?(x)', '**\/__tests__/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*', '**\/vitest.{workspace,projects}.[jt]s?(on)', '**\/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}']
|
|
1447
1538
|
*/
|
|
1448
1539
|
exclude?: string[];
|
|
1449
1540
|
/**
|
|
1450
1541
|
* Whether to include all files, including the untested ones into report
|
|
1451
1542
|
*
|
|
1452
|
-
* @default
|
|
1543
|
+
* @default true
|
|
1453
1544
|
*/
|
|
1454
1545
|
all?: boolean;
|
|
1455
1546
|
/**
|
|
@@ -1466,6 +1557,8 @@ interface BaseCoverageOptions {
|
|
|
1466
1557
|
cleanOnRerun?: boolean;
|
|
1467
1558
|
/**
|
|
1468
1559
|
* Directory to write coverage report to
|
|
1560
|
+
*
|
|
1561
|
+
* @default './coverage'
|
|
1469
1562
|
*/
|
|
1470
1563
|
reportsDirectory?: string;
|
|
1471
1564
|
/**
|
|
@@ -1682,7 +1775,7 @@ interface BenchmarkUserOptions {
|
|
|
1682
1775
|
include?: string[];
|
|
1683
1776
|
/**
|
|
1684
1777
|
* Exclude globs for benchmark test files
|
|
1685
|
-
* @default ['node_modules', 'dist', '
|
|
1778
|
+
* @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
|
|
1686
1779
|
*/
|
|
1687
1780
|
exclude?: string[];
|
|
1688
1781
|
/**
|
|
@@ -1694,6 +1787,8 @@ interface BenchmarkUserOptions {
|
|
|
1694
1787
|
/**
|
|
1695
1788
|
* Custom reporter for output. Can contain one or more built-in report names, reporter instances,
|
|
1696
1789
|
* and/or paths to custom reporters
|
|
1790
|
+
*
|
|
1791
|
+
* @default ['default']
|
|
1697
1792
|
*/
|
|
1698
1793
|
reporters?: Arrayable$1<BenchmarkBuiltinReporters | Reporter>;
|
|
1699
1794
|
/**
|
|
@@ -1713,14 +1808,10 @@ interface BenchmarkResult extends TaskResult {
|
|
|
1713
1808
|
rank: number;
|
|
1714
1809
|
}
|
|
1715
1810
|
type BenchFunction = (this: Bench) => Promise<void> | void;
|
|
1716
|
-
type ChainableBenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo',
|
|
1717
|
-
name: string | Function,
|
|
1718
|
-
fn?: BenchFunction,
|
|
1719
|
-
options?: Options
|
|
1720
|
-
], void>;
|
|
1811
|
+
type ChainableBenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', (name: string | Function, fn?: BenchFunction, options?: Options) => void>;
|
|
1721
1812
|
type BenchmarkAPI = ChainableBenchmarkAPI & {
|
|
1722
|
-
skipIf(condition: any)
|
|
1723
|
-
runIf(condition: any)
|
|
1813
|
+
skipIf: (condition: any) => ChainableBenchmarkAPI;
|
|
1814
|
+
runIf: (condition: any) => ChainableBenchmarkAPI;
|
|
1724
1815
|
};
|
|
1725
1816
|
|
|
1726
1817
|
declare const defaultInclude: string[];
|
|
@@ -1951,6 +2042,9 @@ interface DepsOptions {
|
|
|
1951
2042
|
*/
|
|
1952
2043
|
moduleDirectories?: string[];
|
|
1953
2044
|
}
|
|
2045
|
+
type InlineReporter = Reporter;
|
|
2046
|
+
type ReporterName = BuiltinReporters | 'html' | (string & {});
|
|
2047
|
+
type ReporterWithOptions<Name extends ReporterName = ReporterName> = Name extends keyof BuiltinReporterOptions ? BuiltinReporterOptions[Name] extends never ? [Name, {}] : [Name, Partial<BuiltinReporterOptions[Name]>] : [Name, Record<string, unknown>];
|
|
1954
2048
|
interface InlineConfig {
|
|
1955
2049
|
/**
|
|
1956
2050
|
* Name of the project. Will be used to display in the reporter.
|
|
@@ -1970,7 +2064,7 @@ interface InlineConfig {
|
|
|
1970
2064
|
include?: string[];
|
|
1971
2065
|
/**
|
|
1972
2066
|
* Exclude globs for test files
|
|
1973
|
-
* @default ['node_modules', 'dist', '
|
|
2067
|
+
* @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
|
|
1974
2068
|
*/
|
|
1975
2069
|
exclude?: string[];
|
|
1976
2070
|
/**
|
|
@@ -2092,7 +2186,7 @@ interface InlineConfig {
|
|
|
2092
2186
|
/**
|
|
2093
2187
|
* Watch mode
|
|
2094
2188
|
*
|
|
2095
|
-
* @default
|
|
2189
|
+
* @default !process.env.CI
|
|
2096
2190
|
*/
|
|
2097
2191
|
watch?: boolean;
|
|
2098
2192
|
/**
|
|
@@ -2104,8 +2198,10 @@ interface InlineConfig {
|
|
|
2104
2198
|
/**
|
|
2105
2199
|
* Custom reporter for output. Can contain one or more built-in report names, reporter instances,
|
|
2106
2200
|
* and/or paths to custom reporters.
|
|
2201
|
+
*
|
|
2202
|
+
* @default []
|
|
2107
2203
|
*/
|
|
2108
|
-
reporters?: Arrayable<
|
|
2204
|
+
reporters?: Arrayable<ReporterName | InlineReporter> | ((ReporterName | InlineReporter) | [ReporterName] | ReporterWithOptions)[];
|
|
2109
2205
|
/**
|
|
2110
2206
|
* Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
|
|
2111
2207
|
* Also definable individually per reporter by using an object instead.
|
|
@@ -2151,6 +2247,7 @@ interface InlineConfig {
|
|
|
2151
2247
|
globalSetup?: string | string[];
|
|
2152
2248
|
/**
|
|
2153
2249
|
* Glob pattern of file paths to be ignore from triggering watch rerun
|
|
2250
|
+
* @deprecated Use server.watch.ignored instead
|
|
2154
2251
|
*/
|
|
2155
2252
|
watchExclude?: string[];
|
|
2156
2253
|
/**
|
|
@@ -2158,7 +2255,7 @@ interface InlineConfig {
|
|
|
2158
2255
|
*
|
|
2159
2256
|
* Useful if you are testing calling CLI commands
|
|
2160
2257
|
*
|
|
2161
|
-
* @default []
|
|
2258
|
+
* @default ['**\/package.json/**', '**\/{vitest,vite}.config.*\/**']
|
|
2162
2259
|
*/
|
|
2163
2260
|
forceRerunTriggers?: string[];
|
|
2164
2261
|
/**
|
|
@@ -2204,6 +2301,8 @@ interface InlineConfig {
|
|
|
2204
2301
|
api?: boolean | number | ApiConfig;
|
|
2205
2302
|
/**
|
|
2206
2303
|
* Enable Vitest UI
|
|
2304
|
+
*
|
|
2305
|
+
* @default false
|
|
2207
2306
|
*/
|
|
2208
2307
|
ui?: boolean;
|
|
2209
2308
|
/**
|
|
@@ -2216,7 +2315,7 @@ interface InlineConfig {
|
|
|
2216
2315
|
/**
|
|
2217
2316
|
* Open UI automatically.
|
|
2218
2317
|
*
|
|
2219
|
-
* @default
|
|
2318
|
+
* @default !process.env.CI
|
|
2220
2319
|
*/
|
|
2221
2320
|
open?: boolean;
|
|
2222
2321
|
/**
|
|
@@ -2237,6 +2336,10 @@ interface InlineConfig {
|
|
|
2237
2336
|
* Path to a module which has a default export of diff config.
|
|
2238
2337
|
*/
|
|
2239
2338
|
diff?: string;
|
|
2339
|
+
/**
|
|
2340
|
+
* Paths to snapshot serializer modules.
|
|
2341
|
+
*/
|
|
2342
|
+
snapshotSerializers?: string[];
|
|
2240
2343
|
/**
|
|
2241
2344
|
* Resolve custom snapshot path
|
|
2242
2345
|
*/
|
|
@@ -2247,6 +2350,8 @@ interface InlineConfig {
|
|
|
2247
2350
|
passWithNoTests?: boolean;
|
|
2248
2351
|
/**
|
|
2249
2352
|
* Allow tests and suites that are marked as only
|
|
2353
|
+
*
|
|
2354
|
+
* @default !process.env.CI
|
|
2250
2355
|
*/
|
|
2251
2356
|
allowOnly?: boolean;
|
|
2252
2357
|
/**
|
|
@@ -2312,6 +2417,8 @@ interface InlineConfig {
|
|
|
2312
2417
|
alias?: AliasOptions;
|
|
2313
2418
|
/**
|
|
2314
2419
|
* Ignore any unhandled errors that occur
|
|
2420
|
+
*
|
|
2421
|
+
* @default false
|
|
2315
2422
|
*/
|
|
2316
2423
|
dangerouslyIgnoreUnhandledErrors?: boolean;
|
|
2317
2424
|
/**
|
|
@@ -2383,14 +2490,20 @@ interface TypecheckConfig {
|
|
|
2383
2490
|
only?: boolean;
|
|
2384
2491
|
/**
|
|
2385
2492
|
* What tools to use for type checking.
|
|
2493
|
+
*
|
|
2494
|
+
* @default 'tsc'
|
|
2386
2495
|
*/
|
|
2387
2496
|
checker: 'tsc' | 'vue-tsc' | (string & Record<never, never>);
|
|
2388
2497
|
/**
|
|
2389
2498
|
* Pattern for files that should be treated as test files
|
|
2499
|
+
*
|
|
2500
|
+
* @default ['**\/*.{test,spec}-d.?(c|m)[jt]s?(x)']
|
|
2390
2501
|
*/
|
|
2391
2502
|
include: string[];
|
|
2392
2503
|
/**
|
|
2393
2504
|
* Pattern for files that should not be treated as test files
|
|
2505
|
+
*
|
|
2506
|
+
* @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
|
|
2394
2507
|
*/
|
|
2395
2508
|
exclude: string[];
|
|
2396
2509
|
/**
|
|
@@ -2463,7 +2576,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2463
2576
|
browser: ResolvedBrowserOptions;
|
|
2464
2577
|
pool: Pool;
|
|
2465
2578
|
poolOptions?: PoolOptions;
|
|
2466
|
-
reporters: (
|
|
2579
|
+
reporters: (InlineReporter | ReporterWithOptions)[];
|
|
2467
2580
|
defines: Record<string, any>;
|
|
2468
2581
|
api?: ApiConfig;
|
|
2469
2582
|
cliExclude?: string[];
|
|
@@ -2517,37 +2630,40 @@ declare module 'vite' {
|
|
|
2517
2630
|
declare global {
|
|
2518
2631
|
namespace Chai {
|
|
2519
2632
|
interface Assertion {
|
|
2520
|
-
containSubset(expected: any)
|
|
2633
|
+
containSubset: (expected: any) => Assertion;
|
|
2521
2634
|
}
|
|
2522
2635
|
interface Assert {
|
|
2523
|
-
containSubset(val: any, exp: any, msg?: string)
|
|
2636
|
+
containSubset: (val: any, exp: any, msg?: string) => void;
|
|
2524
2637
|
}
|
|
2525
2638
|
}
|
|
2526
2639
|
}
|
|
2640
|
+
interface SnapshotMatcher<T> {
|
|
2641
|
+
<U extends {
|
|
2642
|
+
[P in keyof T]: any;
|
|
2643
|
+
}>(snapshot: Partial<U>, message?: string): void;
|
|
2644
|
+
(message?: string): void;
|
|
2645
|
+
}
|
|
2646
|
+
interface InlineSnapshotMatcher<T> {
|
|
2647
|
+
<U extends {
|
|
2648
|
+
[P in keyof T]: any;
|
|
2649
|
+
}>(properties: Partial<U>, snapshot?: string, message?: string): void;
|
|
2650
|
+
(message?: string): void;
|
|
2651
|
+
}
|
|
2527
2652
|
declare module '@vitest/expect' {
|
|
2528
2653
|
interface MatcherState {
|
|
2529
2654
|
environment: VitestEnvironment;
|
|
2530
2655
|
snapshotState: SnapshotState;
|
|
2531
2656
|
}
|
|
2532
2657
|
interface ExpectStatic {
|
|
2533
|
-
addSnapshotSerializer(plugin: Plugin_2)
|
|
2658
|
+
addSnapshotSerializer: (plugin: Plugin_2) => void;
|
|
2534
2659
|
}
|
|
2535
2660
|
interface Assertion<T> {
|
|
2536
|
-
matchSnapshot<
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
}>(snapshot: Partial<U>, message?: string): void;
|
|
2543
|
-
toMatchSnapshot(message?: string): void;
|
|
2544
|
-
toMatchInlineSnapshot<U extends {
|
|
2545
|
-
[P in keyof T]: any;
|
|
2546
|
-
}>(properties: Partial<U>, snapshot?: string, message?: string): void;
|
|
2547
|
-
toMatchInlineSnapshot(snapshot?: string, message?: string): void;
|
|
2548
|
-
toThrowErrorMatchingSnapshot(message?: string): void;
|
|
2549
|
-
toThrowErrorMatchingInlineSnapshot(snapshot?: string, message?: string): void;
|
|
2550
|
-
toMatchFileSnapshot(filepath: string, message?: string): Promise<void>;
|
|
2661
|
+
matchSnapshot: SnapshotMatcher<T>;
|
|
2662
|
+
toMatchSnapshot: SnapshotMatcher<T>;
|
|
2663
|
+
toMatchInlineSnapshot: InlineSnapshotMatcher<T>;
|
|
2664
|
+
toThrowErrorMatchingSnapshot: (message?: string) => void;
|
|
2665
|
+
toThrowErrorMatchingInlineSnapshot: (snapshot?: string, message?: string) => void;
|
|
2666
|
+
toMatchFileSnapshot: (filepath: string, message?: string) => Promise<void>;
|
|
2551
2667
|
}
|
|
2552
2668
|
}
|
|
2553
2669
|
declare module '@vitest/runner' {
|
|
@@ -2596,4 +2712,4 @@ type Context = RootAndTarget & {
|
|
|
2596
2712
|
lastActivePath?: string;
|
|
2597
2713
|
};
|
|
2598
2714
|
|
|
2599
|
-
export { type
|
|
2715
|
+
export { type TypecheckConfig as $, type AfterSuiteRunMeta as A, type BaseCoverageOptions as B, type CoverageOptions as C, type CollectLines as D, type Environment as E, type FakeTimerInstallOpts as F, type RootAndTarget as G, type Context as H, type Pool as I, type PoolOptions as J, type JSDOMOptions as K, type HappyDOMOptions as L, type MockFactoryWithHelper as M, type BuiltinEnvironment as N, type VitestEnvironment as O, type ProvidedContext as P, type CSSModuleScopeStrategy as Q, type ResolvedConfig as R, type ApiConfig as S, type TestSequencer as T, type UserConfig as U, type VitestRunMode as V, type WorkerGlobalState as W, type EnvironmentOptions as X, type DepsOptimizationOptions as Y, type TransformModePatterns as Z, type InlineConfig as _, type ResolvedCoverageOptions as a, type ProjectConfig as a0, type UserWorkspaceConfig as a1, type RunnerRPC as a2, type ContextTestEnvironment as a3, type ResolvedTestEnvironment as a4, type ResolveIdFunction as a5, type WorkerRPC as a6, type Awaitable as a7, type Nullable as a8, type Arrayable as a9, defineConfig as aA, defineProject as aB, defineWorkspace as aC, configDefaults as aD, defaultInclude as aE, defaultExclude as aF, coverageConfigDefaults as aG, extraInlineDeps as aH, DefaultReporter as aI, BasicReporter as aJ, DotReporter as aK, JsonReporter$1 as aL, VerboseReporter as aM, TapReporter as aN, JUnitReporter as aO, TapFlatReporter as aP, HangingProcessReporter as aQ, GithubActionsReporter as aR, BaseReporter as aS, ReportersMap as aT, type BuiltinReporters as aU, type BuiltinReporterOptions as aV, type JsonAssertionResult as aW, type JsonTestResult as aX, type JsonTestResults as aY, BenchmarkReportsMap as aZ, type BenchmarkBuiltinReporters as a_, type ArgumentsType$1 as aa, type MutableArray as ab, type Constructable as ac, type ModuleCache as ad, type EnvironmentReturn as ae, type VmEnvironmentReturn as af, type OnServerRestartHandler as ag, type ReportContext as ah, type CoverageReporter as ai, type CoverageIstanbulOptions as aj, type CoverageV8Options as ak, type CustomProviderOptions as al, type BenchmarkUserOptions as am, type Benchmark as an, type BenchmarkResult as ao, type BenchFunction as ap, type BenchmarkAPI as aq, type PendingSuiteMock as ar, type MockFactory as as, type MockMap as at, type UserConfigFnObject as au, type UserConfigFnPromise as av, type UserConfigFn as aw, type UserConfigExport as ax, type UserProjectConfigFn as ay, type UserProjectConfigExport as az, type CoverageProvider as b, type CoverageProviderModule as c, type BirpcOptions as d, type RuntimeRPC as e, type ContextRPC as f, type WorkerContext as g, type VitestOptions as h, Vitest as i, type CliOptions as j, WorkspaceProject as k, type WorkspaceSpec as l, type ProcessPool as m, VitestPackageInstaller as n, type TestSequencerConstructor as o, type BrowserProviderInitializationOptions as p, type BrowserProvider as q, type BrowserProviderOptions as r, startVitest as s, type RuntimeConfig as t, type UserConsoleLog as u, type ModuleGraphData as v, type Reporter as w, type RawErrsMap as x, type TscErrorInfo as y, type CollectLineNumbers as z };
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aS as BaseReporter, aJ as BasicReporter, a_ as BenchmarkBuiltinReporters, aZ as BenchmarkReportsMap, aV as BuiltinReporterOptions, aU as BuiltinReporters, aI as DefaultReporter, aK as DotReporter, aR as GithubActionsReporter, aQ as HangingProcessReporter, aO as JUnitReporter, aW as JsonAssertionResult, aL as JsonReporter, aX as JsonTestResult, aY as JsonTestResults, w as Reporter, aT as ReportersMap, aP as TapFlatReporter, aN as TapReporter, aM as VerboseReporter } from './reporters-MmQN-57K.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
package/dist/reporters.js
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import 'node:
|
|
3
|
-
import 'picocolors';
|
|
4
|
-
import './vendor/index.rJjbcrrp.js';
|
|
1
|
+
export { a as BasicReporter, e as BenchmarkReportsMap, D as DefaultReporter, b as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, c as JUnitReporter, J as JsonReporter, R as ReportersMap, d as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.c1V_jzyZ.js';
|
|
2
|
+
import 'node:fs';
|
|
5
3
|
import 'pathe';
|
|
4
|
+
import './vendor/index.ir9i0ywP.js';
|
|
6
5
|
import 'std-env';
|
|
7
6
|
import '@vitest/runner/utils';
|
|
8
7
|
import '@vitest/utils';
|
|
9
8
|
import './vendor/global.CkGT_TMy.js';
|
|
9
|
+
import 'picocolors';
|
|
10
|
+
import 'node:perf_hooks';
|
|
10
11
|
import './chunks/runtime-console.Iloo9fIt.js';
|
|
11
12
|
import 'node:stream';
|
|
12
13
|
import 'node:console';
|
|
13
14
|
import 'node:path';
|
|
14
15
|
import './vendor/date.Ns1pGd_X.js';
|
|
15
|
-
import './vendor/base.
|
|
16
|
+
import './vendor/base.N3JkKp7j.js';
|
|
16
17
|
import './vendor/tasks.IknbGB2n.js';
|
|
17
|
-
import 'node:fs';
|
|
18
18
|
import '@vitest/utils/source-map';
|
|
19
19
|
import 'node:os';
|
|
20
20
|
import 'node:module';
|
|
21
|
+
import 'node:fs/promises';
|
|
22
|
+
import 'execa';
|
|
23
|
+
import 'node:url';
|
|
24
|
+
import 'path';
|
|
25
|
+
import 'fs';
|
|
26
|
+
import 'module';
|
|
27
|
+
import 'vite';
|
|
28
|
+
import 'acorn-walk';
|
|
29
|
+
import 'node:process';
|
|
30
|
+
import './vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
31
|
+
import 'assert';
|
|
32
|
+
import 'events';
|
|
33
|
+
import 'node:crypto';
|
|
34
|
+
import 'vite-node/utils';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VitestRunner, VitestRunnerImportSource, Suite,
|
|
2
|
-
import { R as ResolvedConfig } from './reporters-
|
|
1
|
+
import { VitestRunner, VitestRunnerImportSource, Suite, Task, CancelReason, Test, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
|
|
2
|
+
import { R as ResolvedConfig } from './reporters-MmQN-57K.js';
|
|
3
3
|
import * as tinybench from 'tinybench';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
|
@@ -24,12 +24,12 @@ declare class VitestTestRunner implements VitestRunner {
|
|
|
24
24
|
importFile(filepath: string, source: VitestRunnerImportSource): unknown;
|
|
25
25
|
onBeforeRunFiles(): void;
|
|
26
26
|
onAfterRunSuite(suite: Suite): Promise<void>;
|
|
27
|
-
onAfterRunTask(test:
|
|
27
|
+
onAfterRunTask(test: Task): void;
|
|
28
28
|
onCancel(_reason: CancelReason): void;
|
|
29
|
-
onBeforeRunTask(test:
|
|
29
|
+
onBeforeRunTask(test: Task): Promise<void>;
|
|
30
30
|
onBeforeRunSuite(suite: Suite): Promise<void>;
|
|
31
|
-
onBeforeTryTask(test:
|
|
32
|
-
onAfterTryTask(test:
|
|
31
|
+
onBeforeTryTask(test: Task): void;
|
|
32
|
+
onAfterTryTask(test: Task): void;
|
|
33
33
|
extendTaskContext<T extends Test | Custom>(context: TaskContext<T>): ExtendedContext<T>;
|
|
34
34
|
}
|
|
35
35
|
|