vitest 1.5.2 → 1.6.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.
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/chunks/environments-node.vcoXCoKs.js +19 -0
- package/dist/chunks/{integrations-globals.k0N5-dd1.js → integrations-globals.kw4co3rx.js} +7 -6
- package/dist/chunks/{runtime-console.kbFEN7E-.js → runtime-console.EO5ha7qv.js} +3 -3
- package/dist/chunks/{runtime-runBaseTests.-x-nNuJ_.js → runtime-runBaseTests.oAvMKtQC.js} +16 -16
- package/dist/cli.js +2 -2
- package/dist/config.cjs +3 -2
- package/dist/config.d.ts +1 -1
- package/dist/config.js +3 -2
- package/dist/coverage.d.ts +1 -1
- package/dist/environments.d.ts +1 -1
- package/dist/execute.d.ts +6 -4
- package/dist/execute.js +3 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +8 -7
- package/dist/node.d.ts +2 -2
- package/dist/node.js +12 -11
- package/dist/{reporters-xEmem8D4.d.ts → reporters-yx5ZTtEV.d.ts} +101 -26
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +11 -10
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +8 -7
- package/dist/snapshot.d.ts +9 -0
- package/dist/snapshot.js +8 -0
- package/dist/{suite-HPAKvIxA.d.ts → suite-IbNSsUWN.d.ts} +1 -1
- package/dist/suite.d.ts +3 -3
- package/dist/suite.js +5 -4
- package/dist/vendor/{base.Xt0Omgh7.js → base.5NT-gWu5.js} +9 -1
- package/dist/vendor/{base.gAwDs8Jc.js → base.Ybri3C14.js} +2 -2
- package/dist/vendor/{benchmark.eeqk2rd8.js → benchmark.yGkUTKnC.js} +1 -1
- package/dist/vendor/{cac.8mXc9Oj6.js → cac.EdDItJD-.js} +38 -15
- package/dist/vendor/{cli-api._n4_Wp_j.js → cli-api.E07AF1Yq.js} +155 -46
- package/dist/vendor/env.AtSIuHFg.js +7 -0
- package/dist/vendor/{execute.2_yoIC01.js → execute.fL3szUAI.js} +8 -3
- package/dist/vendor/{index.gHZzsRJQ.js → index.DpVgvm2P.js} +17 -18
- package/dist/vendor/{index.GlXSU9xI.js → index.Q04MCqDO.js} +690 -645
- package/dist/vendor/{index.ir9i0ywP.js → index.SMVOaj7F.js} +2 -6
- package/dist/vendor/{index.0RrMQKD8.js → index.dI9lHwVn.js} +2 -2
- package/dist/vendor/{setup-common.7SXMSI--.js → setup-common.8nJLd4ay.js} +1 -1
- package/dist/vendor/{utils.VYmeMh-u.js → utils.dEtNIEgr.js} +1 -1
- package/dist/vendor/{vi.Y_w82WR8.js → vi.YFlodzP_.js} +1 -1
- package/dist/vendor/{vm.I_IsyNig.js → vm.QEE48c0T.js} +135 -43
- package/dist/worker.js +8 -2
- package/dist/workers/forks.js +4 -4
- package/dist/workers/runVmTests.js +13 -10
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +7 -7
- package/dist/workers/vmThreads.js +7 -7
- package/dist/workers.d.ts +1 -1
- package/dist/workers.js +8 -8
- package/package.json +13 -9
- package/snapshot.d.ts +1 -0
|
@@ -6,7 +6,7 @@ import { RawSourceMap, FetchResult, ViteNodeResolveId, ModuleCacheMap, ViteNodeS
|
|
|
6
6
|
import { SnapshotResult, SnapshotStateOptions, SnapshotState } from '@vitest/snapshot';
|
|
7
7
|
import { ExpectStatic } from '@vitest/expect';
|
|
8
8
|
import { ChainableFunction } from '@vitest/runner/utils';
|
|
9
|
-
import { ParsedStack, Awaitable as Awaitable$1,
|
|
9
|
+
import { ParsedStack, Awaitable as Awaitable$1, Arrayable as Arrayable$1 } from '@vitest/utils';
|
|
10
10
|
import { TaskResult, Bench, Options as Options$1 } from 'tinybench';
|
|
11
11
|
import { Writable } from 'node:stream';
|
|
12
12
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
@@ -714,6 +714,42 @@ interface BrowserConfigOptions {
|
|
|
714
714
|
* @default test.fileParallelism
|
|
715
715
|
*/
|
|
716
716
|
fileParallelism?: boolean;
|
|
717
|
+
/**
|
|
718
|
+
* Scripts injected into the tester iframe.
|
|
719
|
+
*/
|
|
720
|
+
testerScripts?: BrowserScript[];
|
|
721
|
+
/**
|
|
722
|
+
* Scripts injected into the main window.
|
|
723
|
+
*/
|
|
724
|
+
indexScripts?: BrowserScript[];
|
|
725
|
+
}
|
|
726
|
+
interface BrowserScript {
|
|
727
|
+
/**
|
|
728
|
+
* If "content" is provided and type is "module", this will be its identifier.
|
|
729
|
+
*
|
|
730
|
+
* If you are using TypeScript, you can add `.ts` extension here for example.
|
|
731
|
+
* @default `injected-${index}.js`
|
|
732
|
+
*/
|
|
733
|
+
id?: string;
|
|
734
|
+
/**
|
|
735
|
+
* JavaScript content to be injected. This string is processed by Vite plugins if type is "module".
|
|
736
|
+
*
|
|
737
|
+
* You can use `id` to give Vite a hint about the file extension.
|
|
738
|
+
*/
|
|
739
|
+
content?: string;
|
|
740
|
+
/**
|
|
741
|
+
* Path to the script. This value is resolved by Vite so it can be a node module or a file path.
|
|
742
|
+
*/
|
|
743
|
+
src?: string;
|
|
744
|
+
/**
|
|
745
|
+
* If the script should be loaded asynchronously.
|
|
746
|
+
*/
|
|
747
|
+
async?: boolean;
|
|
748
|
+
/**
|
|
749
|
+
* Script type.
|
|
750
|
+
* @default 'module'
|
|
751
|
+
*/
|
|
752
|
+
type?: string;
|
|
717
753
|
}
|
|
718
754
|
interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
719
755
|
enabled: boolean;
|
|
@@ -745,6 +781,8 @@ declare class WorkspaceProject {
|
|
|
745
781
|
reject: (v: unknown) => void;
|
|
746
782
|
} | undefined;
|
|
747
783
|
testFilesList: string[] | null;
|
|
784
|
+
readonly id: string;
|
|
785
|
+
readonly tmpDir: string;
|
|
748
786
|
private _globalSetups;
|
|
749
787
|
private _provided;
|
|
750
788
|
constructor(path: string | number, ctx: Vitest, options?: InitializeProjectOptions | undefined);
|
|
@@ -774,6 +812,7 @@ declare class WorkspaceProject {
|
|
|
774
812
|
isBrowserEnabled(): boolean;
|
|
775
813
|
getSerializableConfig(): ResolvedConfig;
|
|
776
814
|
close(): Promise<unknown>;
|
|
815
|
+
private clearTmpDir;
|
|
777
816
|
initBrowserProvider(): Promise<void>;
|
|
778
817
|
}
|
|
779
818
|
|
|
@@ -952,16 +991,18 @@ declare class Vitest {
|
|
|
952
991
|
private initCoverageProvider;
|
|
953
992
|
private initBrowserProviders;
|
|
954
993
|
start(filters?: string[]): Promise<void>;
|
|
994
|
+
init(): Promise<void>;
|
|
955
995
|
private getTestDependencies;
|
|
956
996
|
filterTestsBySource(specs: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
|
|
957
997
|
getProjectsByTestFile(file: string): WorkspaceSpec[];
|
|
958
998
|
initializeGlobalSetup(paths: WorkspaceSpec[]): Promise<void>;
|
|
999
|
+
private initializeDistPath;
|
|
959
1000
|
runFiles(paths: WorkspaceSpec[], allTestsRun: boolean): Promise<void>;
|
|
960
1001
|
cancelCurrentRun(reason: CancelReason): Promise<void>;
|
|
961
1002
|
rerunFiles(files?: string[], trigger?: string): Promise<void>;
|
|
962
1003
|
changeProjectName(pattern: string): Promise<void>;
|
|
963
1004
|
changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
|
|
964
|
-
changeFilenamePattern(pattern: string): Promise<void>;
|
|
1005
|
+
changeFilenamePattern(pattern: string, files?: string[]): Promise<void>;
|
|
965
1006
|
rerunFailed(): Promise<void>;
|
|
966
1007
|
updateSnapshot(files?: string[]): Promise<void>;
|
|
967
1008
|
private _rerunTimer;
|
|
@@ -984,6 +1025,7 @@ declare class Vitest {
|
|
|
984
1025
|
*/
|
|
985
1026
|
exit(force?: boolean): Promise<void>;
|
|
986
1027
|
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
|
|
1028
|
+
getTestFilepaths(): Promise<string[]>;
|
|
987
1029
|
globTestFiles(filters?: string[]): Promise<WorkspaceSpec[]>;
|
|
988
1030
|
shouldKeepServer(): boolean;
|
|
989
1031
|
onServerRestart(fn: OnServerRestartHandler): void;
|
|
@@ -1129,7 +1171,7 @@ interface JsonTestResults {
|
|
|
1129
1171
|
interface JsonOptions$1 {
|
|
1130
1172
|
outputFile?: string;
|
|
1131
1173
|
}
|
|
1132
|
-
declare class JsonReporter
|
|
1174
|
+
declare class JsonReporter implements Reporter {
|
|
1133
1175
|
start: number;
|
|
1134
1176
|
ctx: Vitest;
|
|
1135
1177
|
options: JsonOptions$1;
|
|
@@ -1179,6 +1221,16 @@ interface JUnitOptions {
|
|
|
1179
1221
|
outputFile?: string;
|
|
1180
1222
|
classname?: string;
|
|
1181
1223
|
suiteName?: string;
|
|
1224
|
+
/**
|
|
1225
|
+
* Write <system-out> and <system-err> for console output
|
|
1226
|
+
* @default true
|
|
1227
|
+
*/
|
|
1228
|
+
includeConsoleOutput?: boolean;
|
|
1229
|
+
/**
|
|
1230
|
+
* Add <testcase file="..."> attribute (validated on CIRCLE CI and GitLab CI)
|
|
1231
|
+
* @default false
|
|
1232
|
+
*/
|
|
1233
|
+
addFileAttribute?: boolean;
|
|
1182
1234
|
}
|
|
1183
1235
|
declare class JUnitReporter implements Reporter {
|
|
1184
1236
|
private ctx;
|
|
@@ -1191,7 +1243,6 @@ declare class JUnitReporter implements Reporter {
|
|
|
1191
1243
|
constructor(options: JUnitOptions);
|
|
1192
1244
|
onInit(ctx: Vitest): Promise<void>;
|
|
1193
1245
|
writeElement(name: string, attrs: Record<string, any>, children: () => Promise<void>): Promise<void>;
|
|
1194
|
-
writeErrorDetails(task: Task, error: ErrorWithDiff): Promise<void>;
|
|
1195
1246
|
writeLogs(task: Task, type: 'err' | 'out'): Promise<void>;
|
|
1196
1247
|
writeTasks(tasks: Task[], filename: string): Promise<void>;
|
|
1197
1248
|
onFinished(files?: _vitest_runner.File[]): Promise<void>;
|
|
@@ -1214,25 +1265,12 @@ declare class GithubActionsReporter implements Reporter {
|
|
|
1214
1265
|
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
1215
1266
|
}
|
|
1216
1267
|
|
|
1217
|
-
declare class JsonReporter implements Reporter {
|
|
1218
|
-
start: number;
|
|
1219
|
-
ctx: Vitest;
|
|
1220
|
-
onInit(ctx: Vitest): void;
|
|
1221
|
-
protected logTasks(files: File[]): Promise<void>;
|
|
1222
|
-
onFinished(files?: File[]): Promise<void>;
|
|
1223
|
-
/**
|
|
1224
|
-
* Writes the report to an output file if specified in the config,
|
|
1225
|
-
* or logs it to the console otherwise.
|
|
1226
|
-
* @param report
|
|
1227
|
-
*/
|
|
1228
|
-
writeReport(report: string): Promise<void>;
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
1268
|
interface TableRendererOptions {
|
|
1232
1269
|
renderSucceed?: boolean;
|
|
1233
1270
|
logger: Logger;
|
|
1234
1271
|
showHeap: boolean;
|
|
1235
1272
|
slowTestThreshold: number;
|
|
1273
|
+
compare?: FlatBenchmarkReport;
|
|
1236
1274
|
}
|
|
1237
1275
|
declare function createTableRenderer(_tasks: Task[], options: TableRendererOptions): {
|
|
1238
1276
|
start(): any;
|
|
@@ -1245,19 +1283,25 @@ declare class TableReporter extends BaseReporter {
|
|
|
1245
1283
|
renderer?: ReturnType<typeof createTableRenderer>;
|
|
1246
1284
|
rendererOptions: TableRendererOptions;
|
|
1247
1285
|
onTestRemoved(trigger?: string): Promise<void>;
|
|
1248
|
-
onCollected(): void
|
|
1286
|
+
onCollected(): Promise<void>;
|
|
1249
1287
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1250
|
-
onFinished(files?:
|
|
1288
|
+
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
1251
1289
|
onWatcherStart(): Promise<void>;
|
|
1252
1290
|
stopListRender(): Promise<void>;
|
|
1253
1291
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
1254
1292
|
onUserConsoleLog(log: UserConsoleLog): void;
|
|
1255
1293
|
}
|
|
1294
|
+
interface FlatBenchmarkReport {
|
|
1295
|
+
[id: string]: FormattedBenchmarkResult;
|
|
1296
|
+
}
|
|
1297
|
+
type FormattedBenchmarkResult = Omit<BenchmarkResult, 'samples'> & {
|
|
1298
|
+
id: string;
|
|
1299
|
+
sampleCount: number;
|
|
1300
|
+
};
|
|
1256
1301
|
|
|
1257
1302
|
declare const BenchmarkReportsMap: {
|
|
1258
1303
|
default: typeof TableReporter;
|
|
1259
1304
|
verbose: typeof VerboseReporter;
|
|
1260
|
-
json: typeof JsonReporter;
|
|
1261
1305
|
};
|
|
1262
1306
|
type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
|
|
1263
1307
|
|
|
@@ -1266,7 +1310,7 @@ declare const ReportersMap: {
|
|
|
1266
1310
|
basic: typeof BasicReporter;
|
|
1267
1311
|
verbose: typeof VerboseReporter;
|
|
1268
1312
|
dot: typeof DotReporter;
|
|
1269
|
-
json: typeof JsonReporter
|
|
1313
|
+
json: typeof JsonReporter;
|
|
1270
1314
|
tap: typeof TapReporter;
|
|
1271
1315
|
'tap-flat': typeof TapFlatReporter;
|
|
1272
1316
|
junit: typeof JUnitReporter;
|
|
@@ -1444,7 +1488,10 @@ interface PendingSuiteMock {
|
|
|
1444
1488
|
|
|
1445
1489
|
type TransformMode = 'web' | 'ssr';
|
|
1446
1490
|
interface RuntimeRPC {
|
|
1447
|
-
fetch: (id: string, environment: TransformMode) => Promise<
|
|
1491
|
+
fetch: (id: string, environment: TransformMode) => Promise<{
|
|
1492
|
+
externalize?: string;
|
|
1493
|
+
id?: string;
|
|
1494
|
+
}>;
|
|
1448
1495
|
transform: (id: string, environment: TransformMode) => Promise<FetchResult>;
|
|
1449
1496
|
resolveId: (id: string, importer: string | undefined, environment: TransformMode) => Promise<ViteNodeResolveId | null>;
|
|
1450
1497
|
getSourceMap: (id: string, force?: boolean) => Promise<RawSourceMap | undefined>;
|
|
@@ -1588,7 +1635,7 @@ interface BaseCoverageOptions {
|
|
|
1588
1635
|
/**
|
|
1589
1636
|
* List of files excluded from coverage as glob patterns
|
|
1590
1637
|
*
|
|
1591
|
-
* @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}']
|
|
1638
|
+
* @default ['coverage/**', 'dist/**', '**\/[.]**', 'packages/*\/test?(s)/**', '**\/*.d.ts', '**\/virtual:*', '**\/__x00__*', '**\/\x00*', 'cypress/**', 'test?(s)/**', 'test?(-*).?(c|m)[jt]s?(x)', '**\/*{.,-}{test,spec}?(-d).?(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}']
|
|
1592
1639
|
*/
|
|
1593
1640
|
exclude?: string[];
|
|
1594
1641
|
/**
|
|
@@ -1854,6 +1901,14 @@ interface BenchmarkUserOptions {
|
|
|
1854
1901
|
* Also definable individually per reporter by using an object instead.
|
|
1855
1902
|
*/
|
|
1856
1903
|
outputFile?: string | (Partial<Record<BenchmarkBuiltinReporters, string>> & Record<string, string>);
|
|
1904
|
+
/**
|
|
1905
|
+
* benchmark output file to compare against
|
|
1906
|
+
*/
|
|
1907
|
+
compare?: string;
|
|
1908
|
+
/**
|
|
1909
|
+
* benchmark output file
|
|
1910
|
+
*/
|
|
1911
|
+
outputJson?: string;
|
|
1857
1912
|
}
|
|
1858
1913
|
interface Benchmark extends Custom {
|
|
1859
1914
|
meta: {
|
|
@@ -2414,6 +2469,10 @@ interface InlineConfig {
|
|
|
2414
2469
|
* Resolve custom snapshot path
|
|
2415
2470
|
*/
|
|
2416
2471
|
resolveSnapshotPath?: (path: string, extension: string) => string;
|
|
2472
|
+
/**
|
|
2473
|
+
* Path to a custom snapshot environment module that has a defualt export of `SnapshotEnvironment` object.
|
|
2474
|
+
*/
|
|
2475
|
+
snapshotEnvironment?: string;
|
|
2417
2476
|
/**
|
|
2418
2477
|
* Pass with no tests
|
|
2419
2478
|
*/
|
|
@@ -2629,6 +2688,14 @@ interface UserConfig extends InlineConfig {
|
|
|
2629
2688
|
* Setting to `false` will disable config resolving.
|
|
2630
2689
|
*/
|
|
2631
2690
|
config?: string | false | undefined;
|
|
2691
|
+
/**
|
|
2692
|
+
* Do not run tests when Vitest starts.
|
|
2693
|
+
*
|
|
2694
|
+
* Vitest will only run tests if it's called programmatically or the test file changes.
|
|
2695
|
+
*
|
|
2696
|
+
* CLI file filters will be ignored.
|
|
2697
|
+
*/
|
|
2698
|
+
standalone?: boolean;
|
|
2632
2699
|
/**
|
|
2633
2700
|
* Use happy-dom
|
|
2634
2701
|
*/
|
|
@@ -2667,6 +2734,14 @@ interface UserConfig extends InlineConfig {
|
|
|
2667
2734
|
* Override vite config's clearScreen from cli
|
|
2668
2735
|
*/
|
|
2669
2736
|
clearScreen?: boolean;
|
|
2737
|
+
/**
|
|
2738
|
+
* benchmark.compare option exposed at the top level for cli
|
|
2739
|
+
*/
|
|
2740
|
+
compare?: string;
|
|
2741
|
+
/**
|
|
2742
|
+
* benchmark.outputJson option exposed at the top level for cli
|
|
2743
|
+
*/
|
|
2744
|
+
outputJson?: string;
|
|
2670
2745
|
}
|
|
2671
2746
|
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool' | 'cliExclude'> {
|
|
2672
2747
|
mode: VitestRunMode;
|
|
@@ -2684,7 +2759,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2684
2759
|
defines: Record<string, any>;
|
|
2685
2760
|
api?: ApiConfig;
|
|
2686
2761
|
cliExclude?: string[];
|
|
2687
|
-
benchmark?: Required<Omit<BenchmarkUserOptions, 'outputFile'>> & Pick<BenchmarkUserOptions, 'outputFile'>;
|
|
2762
|
+
benchmark?: Required<Omit<BenchmarkUserOptions, 'outputFile' | 'compare' | 'outputJson'>> & Pick<BenchmarkUserOptions, 'outputFile' | 'compare' | 'outputJson'>;
|
|
2688
2763
|
shard?: {
|
|
2689
2764
|
index: number;
|
|
2690
2765
|
count: number;
|
|
@@ -2819,4 +2894,4 @@ type Context = RootAndTarget & {
|
|
|
2819
2894
|
lastActivePath?: string;
|
|
2820
2895
|
};
|
|
2821
2896
|
|
|
2822
|
-
export { type
|
|
2897
|
+
export { type ProjectConfig as $, type AfterSuiteRunMeta as A, type BaseCoverageOptions as B, type CoverageOptions as C, type RootAndTarget as D, type Environment as E, type FakeTimerInstallOpts as F, type Context as G, type Pool as H, type PoolOptions as I, type JSDOMOptions as J, type HappyDOMOptions as K, type BuiltinEnvironment as L, type MockFactoryWithHelper as M, type VitestEnvironment as N, type CSSModuleScopeStrategy as O, type ProvidedContext as P, type ApiConfig as Q, type ResolvedConfig as R, type EnvironmentOptions as S, type TestSequencer as T, type UserConfig as U, type VitestRunMode as V, type WorkerGlobalState as W, type DepsOptimizationOptions as X, type TransformModePatterns as Y, type InlineConfig as Z, type TypecheckConfig as _, type ResolvedCoverageOptions as a, type BrowserConfigOptions 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 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, WorkspaceProject as j, type WorkspaceSpec as k, type ProcessPool as l, VitestPackageInstaller as m, type TestSequencerConstructor as n, type BrowserProviderInitializationOptions as o, type BrowserProvider as p, type BrowserProviderOptions as q, type BrowserScript as r, type RuntimeConfig as s, type UserConsoleLog as t, type ModuleGraphData as u, type Reporter as v, type RawErrsMap as w, type TscErrorInfo as x, type CollectLineNumbers as y, type CollectLines as z };
|
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, v as Reporter, aT as ReportersMap, aP as TapFlatReporter, aN as TapReporter, aM as VerboseReporter } from './reporters-yx5ZTtEV.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
package/dist/reporters.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
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.
|
|
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.Q04MCqDO.js';
|
|
2
2
|
import 'node:fs';
|
|
3
|
+
import 'picocolors';
|
|
3
4
|
import 'pathe';
|
|
4
|
-
import './vendor/
|
|
5
|
-
import 'std-env';
|
|
5
|
+
import './vendor/tasks.IknbGB2n.js';
|
|
6
6
|
import '@vitest/runner/utils';
|
|
7
7
|
import '@vitest/utils';
|
|
8
|
-
import './vendor/
|
|
9
|
-
import '
|
|
10
|
-
import './vendor/utils.
|
|
11
|
-
import './vendor/base.
|
|
12
|
-
import './vendor/tasks.IknbGB2n.js';
|
|
8
|
+
import './vendor/env.AtSIuHFg.js';
|
|
9
|
+
import 'std-env';
|
|
10
|
+
import './vendor/utils.dEtNIEgr.js';
|
|
11
|
+
import './vendor/base.5NT-gWu5.js';
|
|
13
12
|
import 'node:perf_hooks';
|
|
14
|
-
import './
|
|
13
|
+
import './vendor/index.SMVOaj7F.js';
|
|
14
|
+
import './vendor/global.CkGT_TMy.js';
|
|
15
|
+
import './chunks/runtime-console.EO5ha7qv.js';
|
|
15
16
|
import 'node:stream';
|
|
16
17
|
import 'node:console';
|
|
17
18
|
import 'node:path';
|
|
18
19
|
import './vendor/date.Ns1pGd_X.js';
|
|
19
20
|
import '@vitest/utils/source-map';
|
|
20
21
|
import 'node:os';
|
|
21
|
-
import 'node:module';
|
|
22
22
|
import 'node:fs/promises';
|
|
23
23
|
import 'execa';
|
|
24
24
|
import 'node:url';
|
|
@@ -33,3 +33,4 @@ import 'assert';
|
|
|
33
33
|
import 'events';
|
|
34
34
|
import 'node:crypto';
|
|
35
35
|
import 'vite-node/utils';
|
|
36
|
+
import 'node:module';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VitestRunner, VitestRunnerImportSource, Suite, Task, CancelReason, Test, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig } from './reporters-
|
|
2
|
+
import { R as ResolvedConfig } from './reporters-yx5ZTtEV.js';
|
|
3
3
|
import * as tinybench from 'tinybench';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
package/dist/runners.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
2
|
-
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.
|
|
3
|
-
import '
|
|
4
|
-
import { r as rpc } from './vendor/rpc.joBhAkyK.js';
|
|
2
|
+
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.YFlodzP_.js';
|
|
3
|
+
import 'pathe';
|
|
5
4
|
import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
|
|
5
|
+
import { createDefer, getSafeTimers } from '@vitest/utils';
|
|
6
6
|
import { g as getWorkerState } from './vendor/global.CkGT_TMy.js';
|
|
7
|
+
import './vendor/env.AtSIuHFg.js';
|
|
8
|
+
import { r as rpc } from './vendor/rpc.joBhAkyK.js';
|
|
7
9
|
import { getTests, getNames } from '@vitest/runner/utils';
|
|
8
10
|
import { updateTask } from '@vitest/runner';
|
|
9
|
-
import {
|
|
10
|
-
import { a as getBenchOptions, g as getBenchFn } from './vendor/benchmark.eeqk2rd8.js';
|
|
11
|
+
import { a as getBenchOptions, g as getBenchFn } from './vendor/benchmark.yGkUTKnC.js';
|
|
11
12
|
import 'chai';
|
|
12
13
|
import './vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
13
14
|
import '@vitest/snapshot';
|
|
14
15
|
import '@vitest/utils/error';
|
|
15
16
|
import '@vitest/utils/source-map';
|
|
16
|
-
import './vendor/base.
|
|
17
|
+
import './vendor/base.5NT-gWu5.js';
|
|
17
18
|
import './vendor/date.Ns1pGd_X.js';
|
|
18
19
|
import '@vitest/spy';
|
|
19
|
-
import 'pathe';
|
|
20
20
|
import 'std-env';
|
|
21
21
|
import './vendor/index.8bPxjt7g.js';
|
|
22
|
+
import './vendor/index.SMVOaj7F.js';
|
|
22
23
|
|
|
23
24
|
class VitestTestRunner {
|
|
24
25
|
constructor(config) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
2
|
+
export { SnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
3
|
+
|
|
4
|
+
declare class VitestNodeSnapshotEnvironment extends NodeSnapshotEnvironment {
|
|
5
|
+
getHeader(): string;
|
|
6
|
+
resolvePath(filepath: string): Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment };
|
package/dist/snapshot.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/environments-node.vcoXCoKs.js';
|
|
2
|
+
import '@vitest/snapshot/environment';
|
|
3
|
+
import 'pathe';
|
|
4
|
+
import '@vitest/runner/utils';
|
|
5
|
+
import '@vitest/utils';
|
|
6
|
+
import './vendor/global.CkGT_TMy.js';
|
|
7
|
+
import './vendor/env.AtSIuHFg.js';
|
|
8
|
+
import 'std-env';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Custom } from '@vitest/runner';
|
|
2
2
|
import '@vitest/runner/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { ap as BenchFunction, aq as BenchmarkAPI } from './reporters-yx5ZTtEV.js';
|
|
4
4
|
import { Options } from 'tinybench';
|
|
5
5
|
|
|
6
6
|
declare function getBenchOptions(key: Custom): Options;
|
package/dist/suite.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { createTaskCollector, getCurrentSuite, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
|
|
1
|
+
export { createTaskCollector, getCurrentSuite, getCurrentTest, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
|
|
2
2
|
export { createChainable } from '@vitest/runner/utils';
|
|
3
|
-
export { g as getBenchFn, a as getBenchOptions } from './suite-
|
|
4
|
-
import './reporters-
|
|
3
|
+
export { g as getBenchFn, a as getBenchOptions } from './suite-IbNSsUWN.js';
|
|
4
|
+
import './reporters-yx5ZTtEV.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import 'vite-node';
|
|
7
7
|
import '@vitest/snapshot';
|
package/dist/suite.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { createTaskCollector, getCurrentSuite, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
|
|
1
|
+
export { createTaskCollector, getCurrentSuite, getCurrentTest, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
|
|
2
2
|
export { createChainable } from '@vitest/runner/utils';
|
|
3
|
-
export { g as getBenchFn, a as getBenchOptions } from './vendor/benchmark.
|
|
3
|
+
export { g as getBenchFn, a as getBenchOptions } from './vendor/benchmark.yGkUTKnC.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
|
-
import './vendor/index.
|
|
5
|
+
import './vendor/index.SMVOaj7F.js';
|
|
6
6
|
import 'pathe';
|
|
7
|
-
import 'std-env';
|
|
8
7
|
import './vendor/global.CkGT_TMy.js';
|
|
8
|
+
import './vendor/env.AtSIuHFg.js';
|
|
9
|
+
import 'std-env';
|
|
@@ -107,5 +107,13 @@ function escapeRegExp(s) {
|
|
|
107
107
|
function wildcardPatternToRegExp(pattern) {
|
|
108
108
|
return new RegExp(`^${pattern.split("*").map(escapeRegExp).join(".*")}$`, "i");
|
|
109
109
|
}
|
|
110
|
+
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
111
|
+
function nanoid(size = 21) {
|
|
112
|
+
let id = "";
|
|
113
|
+
let i = size;
|
|
114
|
+
while (i--)
|
|
115
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
116
|
+
return id;
|
|
117
|
+
}
|
|
110
118
|
|
|
111
|
-
export { AggregateErrorPonyfill as A, slash as a, isPrimitive as b, groupBy as c, deepMerge as d,
|
|
119
|
+
export { AggregateErrorPonyfill as A, slash as a, isPrimitive as b, groupBy as c, deepMerge as d, nanoid as e, stdout as f, getAllMockableProperties as g, isChildProcess as i, noop as n, setProcessTitle as s, toArray as t, wildcardPatternToRegExp as w };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModuleCacheMap } from 'vite-node/client';
|
|
2
2
|
import { p as provideWorkerState } from './global.CkGT_TMy.js';
|
|
3
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.
|
|
3
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.fL3szUAI.js';
|
|
4
4
|
|
|
5
5
|
let _viteNode;
|
|
6
6
|
const moduleCache = new ModuleCacheMap();
|
|
@@ -25,7 +25,7 @@ async function runBaseTests(state) {
|
|
|
25
25
|
ctx.files.forEach((i) => state.moduleCache.delete(i));
|
|
26
26
|
const [executor, { run }] = await Promise.all([
|
|
27
27
|
startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
|
|
28
|
-
import('../chunks/runtime-runBaseTests
|
|
28
|
+
import('../chunks/runtime-runBaseTests.oAvMKtQC.js')
|
|
29
29
|
]);
|
|
30
30
|
await run(
|
|
31
31
|
ctx.files,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCurrentSuite } from '@vitest/runner';
|
|
2
2
|
import { createChainable } from '@vitest/runner/utils';
|
|
3
3
|
import { noop } from '@vitest/utils';
|
|
4
|
-
import { i as isRunningInBenchmark } from './index.
|
|
4
|
+
import { i as isRunningInBenchmark } from './index.SMVOaj7F.js';
|
|
5
5
|
|
|
6
6
|
const benchFns = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
const benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalize } from 'pathe';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import c from 'picocolors';
|
|
4
|
-
import { t as toArray } from './base.
|
|
4
|
+
import { t as toArray } from './base.5NT-gWu5.js';
|
|
5
5
|
import { d as defaultPort, a as defaultBrowserPort } from './constants.5J7I254_.js';
|
|
6
6
|
|
|
7
7
|
function toArr(any) {
|
|
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
|
|
|
618
618
|
|
|
619
619
|
const cac = (name = "") => new CAC(name);
|
|
620
620
|
|
|
621
|
-
var version = "1.
|
|
621
|
+
var version = "1.6.0";
|
|
622
622
|
|
|
623
623
|
const apiConfig = (port) => ({
|
|
624
624
|
port: {
|
|
@@ -793,13 +793,13 @@ const cliOptionsConfig = {
|
|
|
793
793
|
array: true
|
|
794
794
|
},
|
|
795
795
|
reportOnFailure: {
|
|
796
|
-
description: "Generate coverage report even when tests fail (default: false)"
|
|
796
|
+
description: "Generate coverage report even when tests fail (default: `false`)"
|
|
797
797
|
},
|
|
798
798
|
allowExternal: {
|
|
799
|
-
description: "Collect coverage of files outside the project root (default: false)"
|
|
799
|
+
description: "Collect coverage of files outside the project root (default: `false`)"
|
|
800
800
|
},
|
|
801
801
|
skipFull: {
|
|
802
|
-
description: "Do not show files with 100% statement, branch, and function coverage (default: false)"
|
|
802
|
+
description: "Do not show files with 100% statement, branch, and function coverage (default: `false`)"
|
|
803
803
|
},
|
|
804
804
|
thresholds: {
|
|
805
805
|
description: null,
|
|
@@ -944,7 +944,9 @@ const cliOptionsConfig = {
|
|
|
944
944
|
},
|
|
945
945
|
fileParallelism: {
|
|
946
946
|
description: "Should all test files run in parallel. Use `--browser.file-parallelism=false` to disable (default: same as `--file-parallelism`)"
|
|
947
|
-
}
|
|
947
|
+
},
|
|
948
|
+
indexScripts: null,
|
|
949
|
+
testerScripts: null
|
|
948
950
|
}
|
|
949
951
|
},
|
|
950
952
|
pool: {
|
|
@@ -1199,6 +1201,9 @@ const cliOptionsConfig = {
|
|
|
1199
1201
|
clearScreen: {
|
|
1200
1202
|
description: "Clear terminal screen when re-running tests during watch mode (default: `true`)"
|
|
1201
1203
|
},
|
|
1204
|
+
standalone: {
|
|
1205
|
+
description: "Start Vitest without running tests. File filters will be ignored, tests will be running only on change (default: `false`)"
|
|
1206
|
+
},
|
|
1202
1207
|
// disable CLI options
|
|
1203
1208
|
cliExclude: null,
|
|
1204
1209
|
server: null,
|
|
@@ -1230,7 +1235,20 @@ const cliOptionsConfig = {
|
|
|
1230
1235
|
poolMatchGlobs: null,
|
|
1231
1236
|
deps: null,
|
|
1232
1237
|
name: null,
|
|
1233
|
-
includeTaskLocation: null
|
|
1238
|
+
includeTaskLocation: null,
|
|
1239
|
+
snapshotEnvironment: null,
|
|
1240
|
+
compare: null,
|
|
1241
|
+
outputJson: null
|
|
1242
|
+
};
|
|
1243
|
+
const benchCliOptionsConfig = {
|
|
1244
|
+
compare: {
|
|
1245
|
+
description: "benchmark output file to compare against",
|
|
1246
|
+
argument: "<filename>"
|
|
1247
|
+
},
|
|
1248
|
+
outputJson: {
|
|
1249
|
+
description: "benchmark output file",
|
|
1250
|
+
argument: "<filename>"
|
|
1251
|
+
}
|
|
1234
1252
|
};
|
|
1235
1253
|
|
|
1236
1254
|
function addCommand(cli, name, option) {
|
|
@@ -1270,14 +1288,16 @@ function addCommand(cli, name, option) {
|
|
|
1270
1288
|
}
|
|
1271
1289
|
}
|
|
1272
1290
|
}
|
|
1273
|
-
function
|
|
1274
|
-
const
|
|
1275
|
-
cli.version(version);
|
|
1276
|
-
for (const optionName in cliOptionsConfig) {
|
|
1277
|
-
const option = cliOptionsConfig[optionName];
|
|
1291
|
+
function addCliOptions(cli, options) {
|
|
1292
|
+
for (const [optionName, option] of Object.entries(options)) {
|
|
1278
1293
|
if (option)
|
|
1279
1294
|
addCommand(cli, optionName, option);
|
|
1280
1295
|
}
|
|
1296
|
+
}
|
|
1297
|
+
function createCLI(options = {}) {
|
|
1298
|
+
const cli = cac("vitest");
|
|
1299
|
+
cli.version(version);
|
|
1300
|
+
addCliOptions(cli, cliOptionsConfig);
|
|
1281
1301
|
cli.help((info) => {
|
|
1282
1302
|
const helpSection = info.find((current) => {
|
|
1283
1303
|
var _a;
|
|
@@ -1328,7 +1348,10 @@ function createCLI(options = {}) {
|
|
|
1328
1348
|
cli.command("related [...filters]", void 0, options).action(runRelated);
|
|
1329
1349
|
cli.command("watch [...filters]", void 0, options).action(watch);
|
|
1330
1350
|
cli.command("dev [...filters]", void 0, options).action(watch);
|
|
1331
|
-
|
|
1351
|
+
addCliOptions(
|
|
1352
|
+
cli.command("bench [...filters]", void 0, options).action(benchmark),
|
|
1353
|
+
benchCliOptionsConfig
|
|
1354
|
+
);
|
|
1332
1355
|
cli.command("typecheck [...filters]").action(() => {
|
|
1333
1356
|
throw new Error(`Running typecheck via "typecheck" command is removed. Please use "--typecheck" to run your regular tests alongside typechecking, or "--typecheck.only" to run only typecheck tests.`);
|
|
1334
1357
|
});
|
|
@@ -1388,13 +1411,13 @@ async function start(mode, cliFilters, options) {
|
|
|
1388
1411
|
} catch {
|
|
1389
1412
|
}
|
|
1390
1413
|
try {
|
|
1391
|
-
const { startVitest } = await import('./cli-api.
|
|
1414
|
+
const { startVitest } = await import('./cli-api.E07AF1Yq.js').then(function (n) { return n.d; });
|
|
1392
1415
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
|
|
1393
1416
|
if (!(ctx == null ? void 0 : ctx.shouldKeepServer()))
|
|
1394
1417
|
await (ctx == null ? void 0 : ctx.exit());
|
|
1395
1418
|
return ctx;
|
|
1396
1419
|
} catch (e) {
|
|
1397
|
-
const { divider } = await import('./utils.
|
|
1420
|
+
const { divider } = await import('./utils.dEtNIEgr.js').then(function (n) { return n.u; });
|
|
1398
1421
|
console.error(`
|
|
1399
1422
|
${c.red(divider(c.bold(c.inverse(" Unhandled Error "))))}`);
|
|
1400
1423
|
console.error(e);
|