vitest 2.0.0-beta.12 → 2.0.0-beta.13
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 +0 -21
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +2 -2
- package/dist/chunks/{browser-creator.Bw94IHrL.js → browser-creator.DSqYDthP.js} +1 -1
- package/dist/chunks/{integrations-globals.DSNOaUHv.js → integrations-globals.CzYWb38r.js} +1 -1
- package/dist/chunks/{runtime-runBaseTests.BDt9gQFB.js → runtime-runBaseTests.DX3h28Mp.js} +9 -5
- package/dist/cli.js +2 -2
- package/dist/config.cjs +3 -2
- package/dist/config.d.ts +2 -1
- package/dist/config.js +3 -2
- package/dist/coverage.d.ts +2 -1
- package/dist/environments.d.ts +2 -1
- package/dist/execute.d.ts +4 -3
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/node.d.ts +18 -4
- package/dist/node.js +8 -8
- package/dist/{reporters-Cd1vkLMZ.d.ts → reporters-DrywOHjt.d.ts} +56 -19
- package/dist/reporters.d.ts +2 -1
- package/dist/reporters.js +2 -2
- package/dist/runners.d.ts +3 -1
- package/dist/runners.js +1 -0
- package/dist/{suite-BS2CV79a.d.ts → suite-CrOPuDIk.d.ts} +1 -1
- package/dist/suite.d.ts +3 -2
- package/dist/vendor/{base.Cy97mmVC.js → base.CdA1i5tB.js} +4 -3
- package/dist/vendor/{cac.DRNUX42m.js → cac.CpoEMnGk.js} +62 -15
- package/dist/vendor/{cli-api.Bu-PSdzx.js → cli-api.CXFLjKVN.js} +369 -97
- package/dist/vendor/{constants.BWsVtsAj.js → constants.CsnA4eRy.js} +1 -2
- package/dist/vendor/{execute.T3gg2ZK6.js → execute.Dx503nGn.js} +12 -4
- package/dist/vendor/{index.ZtQtNPP2.js → index.3x3MdmUV.js} +135 -78
- package/dist/vendor/{index.B7pSlOSa.js → index.CROIsoiT.js} +1 -1
- package/dist/vendor/{setup-common.CWnv_2-5.js → setup-common.yHaxjRhz.js} +1 -1
- package/dist/vendor/{utils.DSO2UK15.js → utils.BVMrsl6E.js} +15 -5
- package/dist/vendor/{vm.D9wVR14y.js → vm.BrDS6p7h.js} +6 -4
- package/dist/worker.js +11 -4
- package/dist/workers/forks.js +10 -4
- package/dist/workers/runVmTests.js +9 -5
- package/dist/workers/threads.js +6 -3
- package/dist/workers/vmForks.js +10 -4
- package/dist/workers/vmThreads.js +6 -3
- package/dist/workers.d.ts +7 -4
- package/dist/workers.js +4 -4
- package/package.json +12 -12
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, ConfigEnv, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
|
|
3
3
|
import * as _vitest_runner from '@vitest/runner';
|
|
4
|
-
import { File, Test as Test$1, Suite, TaskResultPack,
|
|
4
|
+
import { File, Test as Test$1, Suite, TaskResultPack, Task, CancelReason, TaskMeta, Custom, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
5
5
|
import { RawSourceMap, FetchResult, ViteNodeResolveId, ModuleCacheMap, ViteNodeServerOptions } from 'vite-node';
|
|
6
6
|
import { SnapshotSummary, SnapshotResult, SnapshotStateOptions, SnapshotState } from '@vitest/snapshot';
|
|
7
7
|
import { PromisifyAssertion, Tester, ExpectStatic } from '@vitest/expect';
|
|
8
8
|
import { ChainableFunction } from '@vitest/runner/utils';
|
|
9
|
-
import { ParsedStack, Awaitable as Awaitable$1, Arrayable as Arrayable$1 } from '@vitest/utils';
|
|
9
|
+
import { ParsedStack, Awaitable as Awaitable$1, ErrorWithDiff, 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';
|
|
13
13
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
14
14
|
import { ViteNodeServer } from 'vite-node/server';
|
|
15
15
|
import { MessagePort } from 'node:worker_threads';
|
|
16
|
+
import { StackTraceParserOptions } from '@vitest/utils/source-map';
|
|
16
17
|
import { Stats } from 'node:fs';
|
|
17
18
|
import * as chai from 'chai';
|
|
18
19
|
|
|
@@ -380,11 +381,17 @@ interface PoolOptions extends Record<string, unknown> {
|
|
|
380
381
|
*/
|
|
381
382
|
vmForks?: ForksOptions & VmOptions;
|
|
382
383
|
}
|
|
384
|
+
interface ResolvedPoolOptions extends PoolOptions {
|
|
385
|
+
threads?: ResolvedThreadsOptions & WorkerContextOptions;
|
|
386
|
+
forks?: ResolvedForksOptions & WorkerContextOptions;
|
|
387
|
+
vmThreads?: ResolvedThreadsOptions & VmOptions;
|
|
388
|
+
vmForks?: ResolvedForksOptions & VmOptions;
|
|
389
|
+
}
|
|
383
390
|
interface ThreadsOptions {
|
|
384
391
|
/** Minimum amount of threads to use */
|
|
385
|
-
minThreads?: number;
|
|
392
|
+
minThreads?: number | string;
|
|
386
393
|
/** Maximum amount of threads to use */
|
|
387
|
-
maxThreads?: number;
|
|
394
|
+
maxThreads?: number | string;
|
|
388
395
|
/**
|
|
389
396
|
* Run tests inside a single thread.
|
|
390
397
|
*
|
|
@@ -400,11 +407,15 @@ interface ThreadsOptions {
|
|
|
400
407
|
*/
|
|
401
408
|
useAtomics?: boolean;
|
|
402
409
|
}
|
|
410
|
+
interface ResolvedThreadsOptions extends ThreadsOptions {
|
|
411
|
+
minThreads?: number;
|
|
412
|
+
maxThreads?: number;
|
|
413
|
+
}
|
|
403
414
|
interface ForksOptions {
|
|
404
415
|
/** Minimum amount of child processes to use */
|
|
405
|
-
minForks?: number;
|
|
416
|
+
minForks?: number | string;
|
|
406
417
|
/** Maximum amount of child processes to use */
|
|
407
|
-
maxForks?: number;
|
|
418
|
+
maxForks?: number | string;
|
|
408
419
|
/**
|
|
409
420
|
* Run tests inside a single fork.
|
|
410
421
|
*
|
|
@@ -412,6 +423,10 @@ interface ForksOptions {
|
|
|
412
423
|
*/
|
|
413
424
|
singleFork?: boolean;
|
|
414
425
|
}
|
|
426
|
+
interface ResolvedForksOptions extends ForksOptions {
|
|
427
|
+
minForks?: number;
|
|
428
|
+
maxForks?: number;
|
|
429
|
+
}
|
|
415
430
|
interface WorkerContextOptions {
|
|
416
431
|
/**
|
|
417
432
|
* Isolate test environment by recycling `worker_threads` or `child_process` after each test
|
|
@@ -612,11 +627,18 @@ declare class Typechecker {
|
|
|
612
627
|
getTestPacks(): TaskResultPack[];
|
|
613
628
|
}
|
|
614
629
|
|
|
630
|
+
interface PrintErrorResult {
|
|
631
|
+
nearest?: ParsedStack;
|
|
632
|
+
}
|
|
633
|
+
|
|
615
634
|
interface ErrorOptions {
|
|
616
635
|
type?: string;
|
|
617
636
|
fullStack?: boolean;
|
|
618
637
|
project?: WorkspaceProject;
|
|
619
638
|
verbose?: boolean;
|
|
639
|
+
screenshotPaths?: string[];
|
|
640
|
+
task?: Task;
|
|
641
|
+
showCodeFrame?: boolean;
|
|
620
642
|
}
|
|
621
643
|
declare class Logger {
|
|
622
644
|
ctx: Vitest;
|
|
@@ -633,7 +655,7 @@ declare class Logger {
|
|
|
633
655
|
clearFullScreen(message: string): void;
|
|
634
656
|
clearScreen(message: string, force?: boolean): void;
|
|
635
657
|
private _clearScreen;
|
|
636
|
-
printError(err: unknown, options?: ErrorOptions):
|
|
658
|
+
printError(err: unknown, options?: ErrorOptions): PrintErrorResult | undefined;
|
|
637
659
|
clearHighlightCache(filename?: string): void;
|
|
638
660
|
highlight(filename: string, source: string): string;
|
|
639
661
|
printNoTestFound(filters?: string[]): void;
|
|
@@ -770,7 +792,7 @@ interface BrowserConfigOptions {
|
|
|
770
792
|
/**
|
|
771
793
|
* Commands that will be executed on the server
|
|
772
794
|
* via the browser `import("@vitest/browser/context").commands` API.
|
|
773
|
-
* @see {@link https://vitest.dev/guide/browser
|
|
795
|
+
* @see {@link https://vitest.dev/guide/browser/commands}
|
|
774
796
|
*/
|
|
775
797
|
commands?: Record<string, BrowserCommand<any>>;
|
|
776
798
|
}
|
|
@@ -782,6 +804,7 @@ interface BrowserCommandContext {
|
|
|
782
804
|
}
|
|
783
805
|
interface BrowserServerStateContext {
|
|
784
806
|
files: string[];
|
|
807
|
+
method: 'run' | 'collect';
|
|
785
808
|
resolve: () => void;
|
|
786
809
|
reject: (v: unknown) => void;
|
|
787
810
|
}
|
|
@@ -792,7 +815,7 @@ interface BrowserOrchestrator {
|
|
|
792
815
|
interface BrowserServerState {
|
|
793
816
|
orchestrators: Map<string, BrowserOrchestrator>;
|
|
794
817
|
getContext: (contextId: string) => BrowserServerStateContext | undefined;
|
|
795
|
-
createAsyncContext: (contextId: string, files: string[]) => Promise<void>;
|
|
818
|
+
createAsyncContext: (method: 'collect' | 'run', contextId: string, files: string[]) => Promise<void>;
|
|
796
819
|
}
|
|
797
820
|
interface BrowserServer {
|
|
798
821
|
vite: ViteDevServer;
|
|
@@ -800,6 +823,8 @@ interface BrowserServer {
|
|
|
800
823
|
provider: BrowserProvider;
|
|
801
824
|
close: () => Promise<void>;
|
|
802
825
|
initBrowserProvider: () => Promise<void>;
|
|
826
|
+
parseStacktrace: (stack: string) => ParsedStack[];
|
|
827
|
+
parseErrorStacktrace: (error: ErrorWithDiff, options?: StackTraceParserOptions) => ParsedStack[];
|
|
803
828
|
}
|
|
804
829
|
interface BrowserCommand<Payload extends unknown[]> {
|
|
805
830
|
(context: BrowserCommandContext, ...payload: Payload): Awaitable$1<any>;
|
|
@@ -891,7 +916,7 @@ declare class WorkspaceProject {
|
|
|
891
916
|
static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
|
|
892
917
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
893
918
|
isBrowserEnabled(): boolean;
|
|
894
|
-
getSerializableConfig(): ResolvedConfig;
|
|
919
|
+
getSerializableConfig(method?: 'run' | 'collect'): ResolvedConfig;
|
|
895
920
|
close(): Promise<unknown>;
|
|
896
921
|
private clearTmpDir;
|
|
897
922
|
initBrowserProvider(): Promise<void>;
|
|
@@ -902,6 +927,7 @@ type RunWithFiles = (files: WorkspaceSpec[], invalidates?: string[]) => Awaitabl
|
|
|
902
927
|
interface ProcessPool {
|
|
903
928
|
name: string;
|
|
904
929
|
runTests: RunWithFiles;
|
|
930
|
+
collectTests: RunWithFiles;
|
|
905
931
|
close?: () => Awaitable$1<void>;
|
|
906
932
|
}
|
|
907
933
|
declare function getFilePoolName(project: WorkspaceProject, file: string): Pool;
|
|
@@ -1081,6 +1107,10 @@ declare class Vitest {
|
|
|
1081
1107
|
private initCoverageProvider;
|
|
1082
1108
|
private initBrowserProviders;
|
|
1083
1109
|
mergeReports(): Promise<void>;
|
|
1110
|
+
collect(filters?: string[]): Promise<{
|
|
1111
|
+
tests: File[];
|
|
1112
|
+
errors: unknown[];
|
|
1113
|
+
}>;
|
|
1084
1114
|
start(filters?: string[]): Promise<void>;
|
|
1085
1115
|
init(): Promise<void>;
|
|
1086
1116
|
private getTestDependencies;
|
|
@@ -1089,6 +1119,7 @@ declare class Vitest {
|
|
|
1089
1119
|
initializeGlobalSetup(paths: WorkspaceSpec[]): Promise<void>;
|
|
1090
1120
|
private initializeDistPath;
|
|
1091
1121
|
runFiles(specs: WorkspaceSpec[], allTestsRun: boolean): Promise<void>;
|
|
1122
|
+
collectFiles(specs: WorkspaceSpec[]): Promise<void>;
|
|
1092
1123
|
cancelCurrentRun(reason: CancelReason): Promise<void>;
|
|
1093
1124
|
rerunFiles(files?: string[], trigger?: string): Promise<void>;
|
|
1094
1125
|
changeProjectName(pattern: string): Promise<void>;
|
|
@@ -1200,7 +1231,7 @@ interface Reporter {
|
|
|
1200
1231
|
onPathsCollected?: (paths?: string[]) => Awaitable<void>;
|
|
1201
1232
|
onSpecsCollected?: (specs?: SerializableSpec[]) => Awaitable<void>;
|
|
1202
1233
|
onCollected?: (files?: File[]) => Awaitable<void>;
|
|
1203
|
-
onFinished?: (files
|
|
1234
|
+
onFinished?: (files: File[], errors: unknown[], coverage?: unknown) => Awaitable<void>;
|
|
1204
1235
|
onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
|
|
1205
1236
|
onTestRemoved?: (trigger?: string) => Awaitable<void>;
|
|
1206
1237
|
onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
@@ -1260,6 +1291,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
1260
1291
|
start: number;
|
|
1261
1292
|
end: number;
|
|
1262
1293
|
watchFilters?: string[];
|
|
1294
|
+
failedUnwatchedFiles: Task[];
|
|
1263
1295
|
isTTY: boolean;
|
|
1264
1296
|
ctx: Vitest;
|
|
1265
1297
|
protected verbose: boolean;
|
|
@@ -1275,6 +1307,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
1275
1307
|
relative(path: string): string;
|
|
1276
1308
|
onFinished(files?: File[], errors?: unknown[]): void;
|
|
1277
1309
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1310
|
+
protected printTask(task: Task): void;
|
|
1278
1311
|
onWatcherStart(files?: File[], errors?: unknown[]): void;
|
|
1279
1312
|
private resetLastRunLog;
|
|
1280
1313
|
onWatcherRerun(files: string[], trigger?: string): void;
|
|
@@ -1290,7 +1323,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
1290
1323
|
}
|
|
1291
1324
|
|
|
1292
1325
|
declare class BasicReporter extends BaseReporter {
|
|
1293
|
-
|
|
1326
|
+
constructor();
|
|
1294
1327
|
reportSummary(files: File[], errors: unknown[]): void;
|
|
1295
1328
|
}
|
|
1296
1329
|
|
|
@@ -2401,13 +2434,13 @@ interface InlineConfig {
|
|
|
2401
2434
|
*/
|
|
2402
2435
|
poolOptions?: PoolOptions;
|
|
2403
2436
|
/**
|
|
2404
|
-
* Maximum number of workers to run tests in. `poolOptions.{threads,vmThreads}.maxThreads`/`poolOptions.forks.maxForks` has higher priority.
|
|
2437
|
+
* Maximum number or percentage of workers to run tests in. `poolOptions.{threads,vmThreads}.maxThreads`/`poolOptions.forks.maxForks` has higher priority.
|
|
2405
2438
|
*/
|
|
2406
|
-
maxWorkers?: number;
|
|
2439
|
+
maxWorkers?: number | string;
|
|
2407
2440
|
/**
|
|
2408
|
-
* Minimum number of workers to run tests in. `poolOptions.{threads,vmThreads}.minThreads`/`poolOptions.forks.minForks` has higher priority.
|
|
2441
|
+
* Minimum number or percentage of workers to run tests in. `poolOptions.{threads,vmThreads}.minThreads`/`poolOptions.forks.minForks` has higher priority.
|
|
2409
2442
|
*/
|
|
2410
|
-
minWorkers?: number;
|
|
2443
|
+
minWorkers?: number | string;
|
|
2411
2444
|
/**
|
|
2412
2445
|
* Should all test files run in parallel. Doesn't affect tests running in the same file.
|
|
2413
2446
|
* Setting this to `false` will override `maxWorkers` and `minWorkers` options to `1`.
|
|
@@ -2904,9 +2937,10 @@ interface UserConfig extends InlineConfig {
|
|
|
2904
2937
|
*/
|
|
2905
2938
|
mergeReports?: string;
|
|
2906
2939
|
}
|
|
2907
|
-
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool' | 'cliExclude'> {
|
|
2940
|
+
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool' | 'cliExclude' | 'diff'> {
|
|
2908
2941
|
mode: VitestRunMode;
|
|
2909
2942
|
base?: string;
|
|
2943
|
+
diff?: string;
|
|
2910
2944
|
config?: string;
|
|
2911
2945
|
filters?: string[];
|
|
2912
2946
|
testNamePattern?: RegExp;
|
|
@@ -2915,7 +2949,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2915
2949
|
snapshotOptions: SnapshotStateOptions;
|
|
2916
2950
|
browser: ResolvedBrowserOptions;
|
|
2917
2951
|
pool: Pool;
|
|
2918
|
-
poolOptions?:
|
|
2952
|
+
poolOptions?: ResolvedPoolOptions;
|
|
2919
2953
|
reporters: (InlineReporter | ReporterWithOptions)[];
|
|
2920
2954
|
defines: Record<string, any>;
|
|
2921
2955
|
api?: ApiConfig;
|
|
@@ -2943,6 +2977,8 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2943
2977
|
enabled: boolean;
|
|
2944
2978
|
};
|
|
2945
2979
|
runner?: string;
|
|
2980
|
+
maxWorkers: number;
|
|
2981
|
+
minWorkers: number;
|
|
2946
2982
|
}
|
|
2947
2983
|
type ProjectConfig = Omit<UserConfig, 'sequencer' | 'shard' | 'watch' | 'run' | 'cache' | 'update' | 'reporters' | 'outputFile' | 'poolOptions' | 'teardownTimeout' | 'silent' | 'forceRerunTriggers' | 'testNamePattern' | 'ui' | 'open' | 'uiBase' | 'snapshotFormat' | 'resolveSnapshotPath' | 'passWithNoTests' | 'onConsoleLog' | 'onStackTrace' | 'dangerouslyIgnoreUnhandledErrors' | 'slowTestThreshold' | 'inspect' | 'inspectBrk' | 'deps' | 'coverage' | 'maxWorkers' | 'minWorkers' | 'fileParallelism'> & {
|
|
2948
2984
|
sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
|
|
@@ -3027,6 +3063,7 @@ declare module '@vitest/runner' {
|
|
|
3027
3063
|
interface TaskMeta {
|
|
3028
3064
|
typecheck?: boolean;
|
|
3029
3065
|
benchmark?: boolean;
|
|
3066
|
+
failScreenshotPath?: string;
|
|
3030
3067
|
}
|
|
3031
3068
|
interface File {
|
|
3032
3069
|
prepareDuration?: number;
|
|
@@ -3066,4 +3103,4 @@ type Context = RootAndTarget & {
|
|
|
3066
3103
|
lastActivePath?: string;
|
|
3067
3104
|
};
|
|
3068
3105
|
|
|
3069
|
-
export { type Nullable as $, type ApiConfig as A, type BaseCoverageOptions as B, type CoverageOptions as C, type DepsOptimizationOptions as D, type Environment as E, type FakeTimerInstallOpts as F, type BrowserConfigOptions as G, type HappyDOMOptions as H, type InlineConfig as I, type JSDOMOptions as J, type UserWorkspaceConfig as K, type RunnerRPC as L, type MockFactoryWithHelper as M, type ContextTestEnvironment as N, type ResolvedTestEnvironment as O, type
|
|
3106
|
+
export { type Nullable as $, type ApiConfig as A, type BaseCoverageOptions as B, type CoverageOptions as C, type DepsOptimizationOptions as D, type Environment as E, type FakeTimerInstallOpts as F, type BrowserConfigOptions as G, type HappyDOMOptions as H, type InlineConfig as I, type JSDOMOptions as J, type UserWorkspaceConfig as K, type RunnerRPC as L, type MockFactoryWithHelper as M, type ContextTestEnvironment as N, type ResolvedTestEnvironment as O, type Pool as P, Vitest as Q, type ResolvedConfig as R, type SerializableSpec as S, type TscErrorInfo as T, type UserConfig as U, type VitestEnvironment as V, type WorkerGlobalState as W, type ResolveIdFunction as X, type AfterSuiteRunMeta as Y, type WorkerRPC as Z, type Awaitable as _, type ResolvedCoverageOptions as a, BasicReporter as a$, type Arrayable as a0, type ArgumentsType$1 as a1, type MutableArray as a2, type Constructable as a3, type ModuleCache as a4, type EnvironmentReturn as a5, type VmEnvironmentReturn as a6, type UserConsoleLog as a7, type OnServerRestartHandler as a8, type ReportContext as a9, type BrowserCommandContext as aA, type BrowserServer as aB, type BrowserServerState as aC, type BrowserServerStateContext as aD, type BrowserOrchestrator as aE, type JsonOptions$1 as aF, type JUnitOptions as aG, type HTMLOptions as aH, type PendingSuiteMock as aI, type MockFactory as aJ, type MockMap as aK, type UserConfigFnObject as aL, type UserConfigFnPromise as aM, type UserConfigFn as aN, type UserConfigExport as aO, type UserProjectConfigFn as aP, type UserProjectConfigExport as aQ, defineConfig as aR, defineProject as aS, defineWorkspace as aT, defaultBrowserPort as aU, configDefaults as aV, defaultInclude as aW, defaultExclude as aX, coverageConfigDefaults as aY, extraInlineDeps as aZ, DefaultReporter as a_, type CoverageReporter as aa, type CoverageIstanbulOptions as ab, type CoverageV8Options as ac, type CustomProviderOptions as ad, type BenchmarkUserOptions as ae, type Benchmark as af, type BenchmarkResult as ag, type BenchFunction as ah, type BenchmarkAPI as ai, type VitestOptions as aj, WorkspaceProject as ak, Logger as al, type TestSequencer as am, type WorkspaceSpec as an, type ProcessPool as ao, getFilePoolName as ap, VitestPackageInstaller as aq, type TestSequencerConstructor as ar, type BrowserProviderInitializationOptions as as, type BrowserProvider as at, type CDPSession as au, type BrowserProviderModule as av, type ResolvedBrowserOptions as aw, type BrowserProviderOptions as ax, type BrowserBuiltinProvider as ay, type BrowserCommand as az, type CoverageProvider as b, DotReporter as b0, JsonReporter as b1, VerboseReporter as b2, TapReporter as b3, JUnitReporter as b4, TapFlatReporter as b5, HangingProcessReporter as b6, GithubActionsReporter as b7, BaseReporter as b8, ReportersMap as b9, type BuiltinReporters as ba, type BuiltinReporterOptions as bb, type JsonAssertionResult as bc, type JsonTestResult as bd, type JsonTestResults as be, BenchmarkReportsMap as bf, type BenchmarkBuiltinReporters as bg, type CoverageProviderModule as c, type BirpcOptions as d, type RuntimeRPC as e, type ContextRPC as f, type WorkerContext as g, type RuntimeConfig as h, type ProvidedContext as i, type ModuleGraphData as j, type Reporter as k, type BirpcReturn as l, type RawErrsMap as m, type CollectLineNumbers as n, type CollectLines as o, type RootAndTarget as p, type Context as q, type PoolOptions as r, type BuiltinEnvironment as s, type CSSModuleScopeStrategy as t, type EnvironmentOptions as u, type VitestRunMode as v, type TransformModePatterns as w, type TypecheckConfig as x, type ProjectConfig as y, type BrowserScript as z };
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b8 as BaseReporter, a$ as BasicReporter, bg as BenchmarkBuiltinReporters, bf as BenchmarkReportsMap, bb as BuiltinReporterOptions, ba as BuiltinReporters, a_ as DefaultReporter, b0 as DotReporter, b7 as GithubActionsReporter, b6 as HangingProcessReporter, b4 as JUnitReporter, bc as JsonAssertionResult, b1 as JsonReporter, bd as JsonTestResult, be as JsonTestResults,
|
|
1
|
+
export { b8 as BaseReporter, a$ as BasicReporter, bg as BenchmarkBuiltinReporters, bf as BenchmarkReportsMap, bb as BuiltinReporterOptions, ba as BuiltinReporters, a_ as DefaultReporter, b0 as DotReporter, b7 as GithubActionsReporter, b6 as HangingProcessReporter, b4 as JUnitReporter, bc as JsonAssertionResult, b1 as JsonReporter, bd as JsonTestResult, be as JsonTestResults, k as Reporter, b9 as ReportersMap, b5 as TapFlatReporter, b3 as TapReporter, b2 as VerboseReporter } from './reporters-DrywOHjt.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
|
@@ -12,5 +12,6 @@ import 'vite-node/client';
|
|
|
12
12
|
import '@vitest/snapshot/manager';
|
|
13
13
|
import 'vite-node/server';
|
|
14
14
|
import 'node:worker_threads';
|
|
15
|
+
import '@vitest/utils/source-map';
|
|
15
16
|
import 'node:fs';
|
|
16
17
|
import 'chai';
|
package/dist/reporters.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BasicReporter, d as BenchmarkReportsMap, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, c as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.
|
|
1
|
+
export { B as BasicReporter, d as BenchmarkReportsMap, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, c as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.3x3MdmUV.js';
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'picocolors';
|
|
4
4
|
import 'pathe';
|
|
@@ -7,7 +7,7 @@ import '@vitest/runner/utils';
|
|
|
7
7
|
import '@vitest/utils';
|
|
8
8
|
import './vendor/env.2ltrQNq0.js';
|
|
9
9
|
import 'std-env';
|
|
10
|
-
import './vendor/utils.
|
|
10
|
+
import './vendor/utils.BVMrsl6E.js';
|
|
11
11
|
import './vendor/base.CTYV4Gnz.js';
|
|
12
12
|
import 'node:perf_hooks';
|
|
13
13
|
import '@vitest/utils/source-map';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { R as ResolvedConfig, P as Pool } from './reporters-DrywOHjt.js';
|
|
1
2
|
import { VitestRunner, VitestRunnerImportSource, File, Suite, Task, CancelReason, Test, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig } from './reporters-Cd1vkLMZ.js';
|
|
3
3
|
import * as tinybench from 'tinybench';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
|
@@ -12,6 +12,7 @@ import 'vite-node/client';
|
|
|
12
12
|
import '@vitest/snapshot/manager';
|
|
13
13
|
import 'vite-node/server';
|
|
14
14
|
import 'node:worker_threads';
|
|
15
|
+
import '@vitest/utils/source-map';
|
|
15
16
|
import 'node:fs';
|
|
16
17
|
import 'chai';
|
|
17
18
|
|
|
@@ -22,6 +23,7 @@ declare class VitestTestRunner implements VitestRunner {
|
|
|
22
23
|
private __vitest_executor;
|
|
23
24
|
private cancelRun;
|
|
24
25
|
private assertionsErrors;
|
|
26
|
+
pool: Pool;
|
|
25
27
|
constructor(config: ResolvedConfig);
|
|
26
28
|
importFile(filepath: string, source: VitestRunnerImportSource): unknown;
|
|
27
29
|
onCollectStart(file: File): void;
|
package/dist/runners.js
CHANGED
|
@@ -30,6 +30,7 @@ class VitestTestRunner {
|
|
|
30
30
|
__vitest_executor;
|
|
31
31
|
cancelRun = false;
|
|
32
32
|
assertionsErrors = /* @__PURE__ */ new WeakMap();
|
|
33
|
+
pool = this.workerState.ctx.pool;
|
|
33
34
|
importFile(filepath, source) {
|
|
34
35
|
if (source === "setup") {
|
|
35
36
|
this.workerState.moduleCache.delete(filepath);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Custom } from '@vitest/runner';
|
|
2
2
|
import '@vitest/runner/utils';
|
|
3
|
-
import { ah as BenchFunction, ai as BenchmarkAPI } from './reporters-
|
|
3
|
+
import { ah as BenchFunction, ai as BenchmarkAPI } from './reporters-DrywOHjt.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
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-CrOPuDIk.js';
|
|
4
|
+
import './reporters-DrywOHjt.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import 'vite-node';
|
|
7
7
|
import '@vitest/snapshot';
|
|
@@ -13,5 +13,6 @@ import 'vite-node/client';
|
|
|
13
13
|
import '@vitest/snapshot/manager';
|
|
14
14
|
import 'vite-node/server';
|
|
15
15
|
import 'node:worker_threads';
|
|
16
|
+
import '@vitest/utils/source-map';
|
|
16
17
|
import 'node:fs';
|
|
17
18
|
import 'chai';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModuleCacheMap } from 'vite-node/client';
|
|
2
2
|
import { p as provideWorkerState } from './global.7bFbnyXl.js';
|
|
3
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.
|
|
3
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.Dx503nGn.js';
|
|
4
4
|
|
|
5
5
|
let _viteNode;
|
|
6
6
|
const moduleCache = new ModuleCacheMap();
|
|
@@ -12,7 +12,7 @@ async function startViteNode(options) {
|
|
|
12
12
|
_viteNode = await startVitestExecutor(options);
|
|
13
13
|
return _viteNode;
|
|
14
14
|
}
|
|
15
|
-
async function runBaseTests(state) {
|
|
15
|
+
async function runBaseTests(method, state) {
|
|
16
16
|
const { ctx } = state;
|
|
17
17
|
state.moduleCache = moduleCache;
|
|
18
18
|
state.mockMap = mockMap;
|
|
@@ -26,9 +26,10 @@ async function runBaseTests(state) {
|
|
|
26
26
|
ctx.files.forEach((i) => state.moduleCache.delete(i));
|
|
27
27
|
const [executor, { run }] = await Promise.all([
|
|
28
28
|
startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
|
|
29
|
-
import('../chunks/runtime-runBaseTests.
|
|
29
|
+
import('../chunks/runtime-runBaseTests.DX3h28Mp.js')
|
|
30
30
|
]);
|
|
31
31
|
await run(
|
|
32
|
+
method,
|
|
32
33
|
ctx.files,
|
|
33
34
|
ctx.config,
|
|
34
35
|
{ environment: state.environment, options: ctx.environment.options },
|
|
@@ -2,7 +2,7 @@ import { normalize } from 'pathe';
|
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import c from 'picocolors';
|
|
4
4
|
import { t as toArray } from './base.CTYV4Gnz.js';
|
|
5
|
-
import { d as defaultPort, a as defaultBrowserPort } from './constants.
|
|
5
|
+
import { d as defaultPort, a as defaultBrowserPort } from './constants.CsnA4eRy.js';
|
|
6
6
|
|
|
7
7
|
function toArr(any) {
|
|
8
8
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
|
|
|
618
618
|
|
|
619
619
|
const cac = (name = "") => new CAC(name);
|
|
620
620
|
|
|
621
|
-
var version = "2.0.0-beta.
|
|
621
|
+
var version = "2.0.0-beta.13";
|
|
622
622
|
|
|
623
623
|
const apiConfig = (port) => ({
|
|
624
624
|
port: {
|
|
@@ -642,11 +642,11 @@ const poolThreadsCommands = {
|
|
|
642
642
|
description: "Run tests inside a single thread (default: `false`)"
|
|
643
643
|
},
|
|
644
644
|
maxThreads: {
|
|
645
|
-
description: "Maximum number of threads to run tests in",
|
|
645
|
+
description: "Maximum number or percentage of threads to run tests in",
|
|
646
646
|
argument: "<workers>"
|
|
647
647
|
},
|
|
648
648
|
minThreads: {
|
|
649
|
-
description: "Minimum number of threads to run tests in",
|
|
649
|
+
description: "Minimum number or percentage of threads to run tests in",
|
|
650
650
|
argument: "<workers>"
|
|
651
651
|
},
|
|
652
652
|
useAtomics: {
|
|
@@ -662,11 +662,11 @@ const poolForksCommands = {
|
|
|
662
662
|
description: "Run tests inside a single child_process (default: `false`)"
|
|
663
663
|
},
|
|
664
664
|
maxForks: {
|
|
665
|
-
description: "Maximum number of processes to run tests in",
|
|
665
|
+
description: "Maximum number or percentage of processes to run tests in",
|
|
666
666
|
argument: "<workers>"
|
|
667
667
|
},
|
|
668
668
|
minForks: {
|
|
669
|
-
description: "Minimum number of processes to run tests in",
|
|
669
|
+
description: "Minimum number or percentage of processes to run tests in",
|
|
670
670
|
argument: "<workers>"
|
|
671
671
|
},
|
|
672
672
|
execArgv: null
|
|
@@ -1302,18 +1302,25 @@ const cliOptionsConfig = {
|
|
|
1302
1302
|
includeTaskLocation: null,
|
|
1303
1303
|
snapshotEnvironment: null,
|
|
1304
1304
|
compare: null,
|
|
1305
|
-
outputJson: null
|
|
1305
|
+
outputJson: null,
|
|
1306
|
+
json: null
|
|
1306
1307
|
};
|
|
1307
1308
|
const benchCliOptionsConfig = {
|
|
1308
1309
|
compare: {
|
|
1309
|
-
description: "
|
|
1310
|
+
description: "Benchmark output file to compare against",
|
|
1310
1311
|
argument: "<filename>"
|
|
1311
1312
|
},
|
|
1312
1313
|
outputJson: {
|
|
1313
|
-
description: "
|
|
1314
|
+
description: "Benchmark output file",
|
|
1314
1315
|
argument: "<filename>"
|
|
1315
1316
|
}
|
|
1316
1317
|
};
|
|
1318
|
+
const collectCliOptionsConfig = {
|
|
1319
|
+
json: {
|
|
1320
|
+
description: "Print collected tests as JSON or write to a file (Default: false)",
|
|
1321
|
+
argument: "[true/path]"
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1317
1324
|
|
|
1318
1325
|
function addCommand(cli, name, option) {
|
|
1319
1326
|
const commandName = option.alias || name;
|
|
@@ -1428,6 +1435,10 @@ function createCLI(options = {}) {
|
|
|
1428
1435
|
benchCliOptionsConfig
|
|
1429
1436
|
);
|
|
1430
1437
|
cli.command("init <project>", void 0, options).action(init);
|
|
1438
|
+
addCliOptions(
|
|
1439
|
+
cli.command("list [...filters]", void 0, options).action((filters, options2) => collect("test", filters, options2)),
|
|
1440
|
+
collectCliOptionsConfig
|
|
1441
|
+
);
|
|
1431
1442
|
cli.command("[...filters]", void 0, options).action((filters, options2) => start("test", filters, options2));
|
|
1432
1443
|
return cli;
|
|
1433
1444
|
}
|
|
@@ -1487,19 +1498,21 @@ async function start(mode, cliFilters, options) {
|
|
|
1487
1498
|
} catch {
|
|
1488
1499
|
}
|
|
1489
1500
|
try {
|
|
1490
|
-
const { startVitest } = await import('./cli-api.
|
|
1501
|
+
const { startVitest } = await import('./cli-api.CXFLjKVN.js').then(function (n) { return n.h; });
|
|
1491
1502
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
|
|
1492
1503
|
if (!(ctx == null ? void 0 : ctx.shouldKeepServer())) {
|
|
1493
1504
|
await (ctx == null ? void 0 : ctx.exit());
|
|
1494
1505
|
}
|
|
1495
|
-
return ctx;
|
|
1496
1506
|
} catch (e) {
|
|
1497
|
-
const { divider } = await import('./utils.
|
|
1507
|
+
const { divider } = await import('./utils.BVMrsl6E.js').then(function (n) { return n.u; });
|
|
1498
1508
|
console.error(`
|
|
1499
|
-
${c.red(divider(c.bold(c.inverse("
|
|
1509
|
+
${c.red(divider(c.bold(c.inverse(" Startup Error "))))}`);
|
|
1500
1510
|
console.error(e);
|
|
1501
1511
|
console.error("\n\n");
|
|
1502
|
-
process.
|
|
1512
|
+
if (process.exitCode == null) {
|
|
1513
|
+
process.exitCode = 1;
|
|
1514
|
+
}
|
|
1515
|
+
process.exit();
|
|
1503
1516
|
}
|
|
1504
1517
|
}
|
|
1505
1518
|
async function init(project) {
|
|
@@ -1507,8 +1520,42 @@ async function init(project) {
|
|
|
1507
1520
|
console.error(new Error('Only the "browser" project is supported. Use "vitest init browser" to create a new project.'));
|
|
1508
1521
|
process.exit(1);
|
|
1509
1522
|
}
|
|
1510
|
-
const { create } = await import('../chunks/browser-creator.
|
|
1523
|
+
const { create } = await import('../chunks/browser-creator.DSqYDthP.js');
|
|
1511
1524
|
await create();
|
|
1512
1525
|
}
|
|
1526
|
+
async function collect(mode, cliFilters, options) {
|
|
1527
|
+
try {
|
|
1528
|
+
process.title = "node (vitest)";
|
|
1529
|
+
} catch {
|
|
1530
|
+
}
|
|
1531
|
+
try {
|
|
1532
|
+
const { prepareVitest, processCollected } = await import('./cli-api.CXFLjKVN.js').then(function (n) { return n.h; });
|
|
1533
|
+
const ctx = await prepareVitest(mode, {
|
|
1534
|
+
...normalizeCliOptions(options),
|
|
1535
|
+
watch: false,
|
|
1536
|
+
run: true
|
|
1537
|
+
});
|
|
1538
|
+
const { tests, errors } = await ctx.collect(cliFilters.map(normalize));
|
|
1539
|
+
if (errors.length) {
|
|
1540
|
+
console.error("\nThere were unhandled errors during test collection");
|
|
1541
|
+
errors.forEach((e) => console.error(e));
|
|
1542
|
+
console.error("\n\n");
|
|
1543
|
+
await ctx.close();
|
|
1544
|
+
return;
|
|
1545
|
+
}
|
|
1546
|
+
processCollected(ctx, tests, options);
|
|
1547
|
+
await ctx.close();
|
|
1548
|
+
} catch (e) {
|
|
1549
|
+
const { divider } = await import('./utils.BVMrsl6E.js').then(function (n) { return n.u; });
|
|
1550
|
+
console.error(`
|
|
1551
|
+
${c.red(divider(c.bold(c.inverse(" Collect Error "))))}`);
|
|
1552
|
+
console.error(e);
|
|
1553
|
+
console.error("\n\n");
|
|
1554
|
+
if (process.exitCode == null) {
|
|
1555
|
+
process.exitCode = 1;
|
|
1556
|
+
}
|
|
1557
|
+
process.exit();
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1513
1560
|
|
|
1514
1561
|
export { createCLI as c, parseCLI as p, version as v };
|