vitest 2.0.0-beta.11 → 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.DSqYDthP.js +673 -0
- package/dist/chunks/{environments-node.39w4gmlF.js → environments-node.XE5FbRPQ.js} +1 -1
- package/dist/chunks/{integrations-globals.CC2ed6Py.js → integrations-globals.CzYWb38r.js} +6 -6
- package/dist/chunks/{runtime-console.Ckl0vEQr.js → runtime-console.O41g23Zj.js} +1 -1
- package/dist/chunks/{runtime-runBaseTests.BXW_BJeO.js → runtime-runBaseTests.DX3h28Mp.js} +15 -11
- package/dist/cli.js +2 -2
- package/dist/config.cjs +6 -4
- package/dist/config.d.ts +2 -1
- package/dist/config.js +6 -4
- package/dist/coverage.d.ts +4 -2
- package/dist/coverage.js +3 -2
- 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 +7 -6
- package/dist/index.js +6 -6
- package/dist/node.d.ts +19 -5
- package/dist/node.js +15 -14
- package/dist/{reporters-fiIq_dT9.d.ts → reporters-DrywOHjt.d.ts} +73 -23
- package/dist/reporters.d.ts +2 -1
- package/dist/reporters.js +5 -5
- package/dist/runners.d.ts +3 -1
- package/dist/runners.js +5 -4
- package/dist/snapshot.js +2 -2
- package/dist/{suite-D4aoU9rI.d.ts → suite-CrOPuDIk.d.ts} +1 -1
- package/dist/suite.d.ts +3 -2
- package/dist/suite.js +3 -3
- package/dist/vendor/{base.C2DbLEfT.js → base.CdA1i5tB.js} +4 -3
- package/dist/vendor/{benchmark.CMp8QfyL.js → benchmark.B6pblCp2.js} +1 -1
- package/dist/vendor/{cac.BcJW7n2j.js → cac.CpoEMnGk.js} +71 -14
- package/dist/vendor/{cli-api.C8t8m4__.js → cli-api.CXFLjKVN.js} +400 -6675
- package/dist/vendor/{constants.BWsVtsAj.js → constants.CsnA4eRy.js} +1 -2
- package/dist/vendor/env.2ltrQNq0.js +8 -0
- package/dist/vendor/{execute.T3gg2ZK6.js → execute.Dx503nGn.js} +12 -4
- package/dist/vendor/{index.BC5zhX9y.js → index.3x3MdmUV.js} +139 -82
- package/dist/vendor/{index.C9Thslzw.js → index.BJmtb_7W.js} +1 -1
- package/dist/vendor/{index.-dbR4KUi.js → index.CROIsoiT.js} +2 -2
- package/dist/vendor/index.D6GZqexG.js +6575 -0
- package/dist/vendor/{index.CQJ2m700.js → index.Hqvcg1pf.js} +2 -2
- package/dist/vendor/{setup-common.uqZOEWuR.js → setup-common.yHaxjRhz.js} +1 -1
- package/dist/vendor/{utils.DSO2UK15.js → utils.BVMrsl6E.js} +15 -5
- package/dist/vendor/{vi.BPjl8cAZ.js → vi.DXACdGTu.js} +1 -1
- package/dist/vendor/{vm.CycSoHnJ.js → vm.BrDS6p7h.js} +8 -6
- package/dist/worker.js +11 -4
- package/dist/workers/forks.js +10 -4
- package/dist/workers/runVmTests.js +14 -10
- package/dist/workers/threads.js +6 -3
- package/dist/workers/vmForks.js +12 -6
- package/dist/workers/vmThreads.js +8 -5
- package/dist/workers.d.ts +7 -4
- package/dist/workers.js +6 -6
- package/package.json +12 -12
- package/dist/vendor/env.bmJgw1qP.js +0 -7
|
@@ -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;
|
|
@@ -646,6 +668,12 @@ interface BrowserProviderInitializationOptions {
|
|
|
646
668
|
browser: string;
|
|
647
669
|
options?: BrowserProviderOptions;
|
|
648
670
|
}
|
|
671
|
+
interface CDPSession {
|
|
672
|
+
send: (method: string, params?: Record<string, unknown>) => Promise<unknown>;
|
|
673
|
+
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
674
|
+
once: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
675
|
+
off: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
676
|
+
}
|
|
649
677
|
interface BrowserProvider {
|
|
650
678
|
name: string;
|
|
651
679
|
/**
|
|
@@ -657,6 +685,7 @@ interface BrowserProvider {
|
|
|
657
685
|
afterCommand?: (command: string, args: unknown[]) => Awaitable$1<void>;
|
|
658
686
|
getCommandsContext: (contextId: string) => Record<string, unknown>;
|
|
659
687
|
openPage: (contextId: string, url: string) => Promise<void>;
|
|
688
|
+
getCDPSession?: (contextId: string) => Promise<CDPSession>;
|
|
660
689
|
close: () => Awaitable$1<void>;
|
|
661
690
|
initialize(ctx: WorkspaceProject, options: BrowserProviderInitializationOptions): Awaitable$1<void>;
|
|
662
691
|
}
|
|
@@ -665,6 +694,7 @@ interface BrowserProviderModule {
|
|
|
665
694
|
}
|
|
666
695
|
interface BrowserProviderOptions {
|
|
667
696
|
}
|
|
697
|
+
type BrowserBuiltinProvider = 'webdriverio' | 'playwright' | 'preview';
|
|
668
698
|
interface BrowserConfigOptions {
|
|
669
699
|
/**
|
|
670
700
|
* if running tests in the browser should be the default
|
|
@@ -681,7 +711,7 @@ interface BrowserConfigOptions {
|
|
|
681
711
|
*
|
|
682
712
|
* @default 'preview'
|
|
683
713
|
*/
|
|
684
|
-
provider?:
|
|
714
|
+
provider?: BrowserBuiltinProvider | (string & {});
|
|
685
715
|
/**
|
|
686
716
|
* Options that are passed down to a browser provider.
|
|
687
717
|
* To support type hinting, add one of the types to your tsconfig.json "compilerOptions.types" field:
|
|
@@ -746,6 +776,11 @@ interface BrowserConfigOptions {
|
|
|
746
776
|
* @default __screenshots__
|
|
747
777
|
*/
|
|
748
778
|
screenshotDirectory?: string;
|
|
779
|
+
/**
|
|
780
|
+
* Should Vitest take screenshots if the test fails
|
|
781
|
+
* @default !browser.ui
|
|
782
|
+
*/
|
|
783
|
+
screenshotFailures?: boolean;
|
|
749
784
|
/**
|
|
750
785
|
* Scripts injected into the tester iframe.
|
|
751
786
|
*/
|
|
@@ -757,7 +792,7 @@ interface BrowserConfigOptions {
|
|
|
757
792
|
/**
|
|
758
793
|
* Commands that will be executed on the server
|
|
759
794
|
* via the browser `import("@vitest/browser/context").commands` API.
|
|
760
|
-
* @see {@link https://vitest.dev/guide/browser
|
|
795
|
+
* @see {@link https://vitest.dev/guide/browser/commands}
|
|
761
796
|
*/
|
|
762
797
|
commands?: Record<string, BrowserCommand<any>>;
|
|
763
798
|
}
|
|
@@ -769,6 +804,7 @@ interface BrowserCommandContext {
|
|
|
769
804
|
}
|
|
770
805
|
interface BrowserServerStateContext {
|
|
771
806
|
files: string[];
|
|
807
|
+
method: 'run' | 'collect';
|
|
772
808
|
resolve: () => void;
|
|
773
809
|
reject: (v: unknown) => void;
|
|
774
810
|
}
|
|
@@ -779,7 +815,7 @@ interface BrowserOrchestrator {
|
|
|
779
815
|
interface BrowserServerState {
|
|
780
816
|
orchestrators: Map<string, BrowserOrchestrator>;
|
|
781
817
|
getContext: (contextId: string) => BrowserServerStateContext | undefined;
|
|
782
|
-
createAsyncContext: (contextId: string, files: string[]) => Promise<void>;
|
|
818
|
+
createAsyncContext: (method: 'collect' | 'run', contextId: string, files: string[]) => Promise<void>;
|
|
783
819
|
}
|
|
784
820
|
interface BrowserServer {
|
|
785
821
|
vite: ViteDevServer;
|
|
@@ -787,6 +823,8 @@ interface BrowserServer {
|
|
|
787
823
|
provider: BrowserProvider;
|
|
788
824
|
close: () => Promise<void>;
|
|
789
825
|
initBrowserProvider: () => Promise<void>;
|
|
826
|
+
parseStacktrace: (stack: string) => ParsedStack[];
|
|
827
|
+
parseErrorStacktrace: (error: ErrorWithDiff, options?: StackTraceParserOptions) => ParsedStack[];
|
|
790
828
|
}
|
|
791
829
|
interface BrowserCommand<Payload extends unknown[]> {
|
|
792
830
|
(context: BrowserCommandContext, ...payload: Payload): Awaitable$1<any>;
|
|
@@ -856,7 +894,7 @@ declare class WorkspaceProject {
|
|
|
856
894
|
constructor(path: string | number, ctx: Vitest, options?: InitializeProjectOptions | undefined);
|
|
857
895
|
getName(): string;
|
|
858
896
|
isCore(): boolean;
|
|
859
|
-
provide
|
|
897
|
+
provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
|
|
860
898
|
getProvidedContext(): ProvidedContext;
|
|
861
899
|
initializeGlobalSetup(): Promise<void>;
|
|
862
900
|
teardownGlobalSetup(): Promise<void>;
|
|
@@ -878,7 +916,7 @@ declare class WorkspaceProject {
|
|
|
878
916
|
static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
|
|
879
917
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
880
918
|
isBrowserEnabled(): boolean;
|
|
881
|
-
getSerializableConfig(): ResolvedConfig;
|
|
919
|
+
getSerializableConfig(method?: 'run' | 'collect'): ResolvedConfig;
|
|
882
920
|
close(): Promise<unknown>;
|
|
883
921
|
private clearTmpDir;
|
|
884
922
|
initBrowserProvider(): Promise<void>;
|
|
@@ -889,6 +927,7 @@ type RunWithFiles = (files: WorkspaceSpec[], invalidates?: string[]) => Awaitabl
|
|
|
889
927
|
interface ProcessPool {
|
|
890
928
|
name: string;
|
|
891
929
|
runTests: RunWithFiles;
|
|
930
|
+
collectTests: RunWithFiles;
|
|
892
931
|
close?: () => Awaitable$1<void>;
|
|
893
932
|
}
|
|
894
933
|
declare function getFilePoolName(project: WorkspaceProject, file: string): Pool;
|
|
@@ -1058,7 +1097,7 @@ declare class Vitest {
|
|
|
1058
1097
|
private _onSetServer;
|
|
1059
1098
|
private _onCancelListeners;
|
|
1060
1099
|
setServer(options: UserConfig, server: ViteDevServer, cliOptions: UserConfig): Promise<void>;
|
|
1061
|
-
provide<T extends keyof ProvidedContext>(key: T, value: ProvidedContext[T]): void;
|
|
1100
|
+
provide<T extends keyof ProvidedContext & string>(key: T, value: ProvidedContext[T]): void;
|
|
1062
1101
|
private createCoreProject;
|
|
1063
1102
|
getCoreWorkspaceProject(): WorkspaceProject;
|
|
1064
1103
|
getProjectByTaskId(taskId: string): WorkspaceProject;
|
|
@@ -1068,6 +1107,10 @@ declare class Vitest {
|
|
|
1068
1107
|
private initCoverageProvider;
|
|
1069
1108
|
private initBrowserProviders;
|
|
1070
1109
|
mergeReports(): Promise<void>;
|
|
1110
|
+
collect(filters?: string[]): Promise<{
|
|
1111
|
+
tests: File[];
|
|
1112
|
+
errors: unknown[];
|
|
1113
|
+
}>;
|
|
1071
1114
|
start(filters?: string[]): Promise<void>;
|
|
1072
1115
|
init(): Promise<void>;
|
|
1073
1116
|
private getTestDependencies;
|
|
@@ -1076,6 +1119,7 @@ declare class Vitest {
|
|
|
1076
1119
|
initializeGlobalSetup(paths: WorkspaceSpec[]): Promise<void>;
|
|
1077
1120
|
private initializeDistPath;
|
|
1078
1121
|
runFiles(specs: WorkspaceSpec[], allTestsRun: boolean): Promise<void>;
|
|
1122
|
+
collectFiles(specs: WorkspaceSpec[]): Promise<void>;
|
|
1079
1123
|
cancelCurrentRun(reason: CancelReason): Promise<void>;
|
|
1080
1124
|
rerunFiles(files?: string[], trigger?: string): Promise<void>;
|
|
1081
1125
|
changeProjectName(pattern: string): Promise<void>;
|
|
@@ -1187,7 +1231,7 @@ interface Reporter {
|
|
|
1187
1231
|
onPathsCollected?: (paths?: string[]) => Awaitable<void>;
|
|
1188
1232
|
onSpecsCollected?: (specs?: SerializableSpec[]) => Awaitable<void>;
|
|
1189
1233
|
onCollected?: (files?: File[]) => Awaitable<void>;
|
|
1190
|
-
onFinished?: (files
|
|
1234
|
+
onFinished?: (files: File[], errors: unknown[], coverage?: unknown) => Awaitable<void>;
|
|
1191
1235
|
onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
|
|
1192
1236
|
onTestRemoved?: (trigger?: string) => Awaitable<void>;
|
|
1193
1237
|
onWatcherStart?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
@@ -1247,6 +1291,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
1247
1291
|
start: number;
|
|
1248
1292
|
end: number;
|
|
1249
1293
|
watchFilters?: string[];
|
|
1294
|
+
failedUnwatchedFiles: Task[];
|
|
1250
1295
|
isTTY: boolean;
|
|
1251
1296
|
ctx: Vitest;
|
|
1252
1297
|
protected verbose: boolean;
|
|
@@ -1262,6 +1307,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
1262
1307
|
relative(path: string): string;
|
|
1263
1308
|
onFinished(files?: File[], errors?: unknown[]): void;
|
|
1264
1309
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
1310
|
+
protected printTask(task: Task): void;
|
|
1265
1311
|
onWatcherStart(files?: File[], errors?: unknown[]): void;
|
|
1266
1312
|
private resetLastRunLog;
|
|
1267
1313
|
onWatcherRerun(files: string[], trigger?: string): void;
|
|
@@ -1277,7 +1323,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
1277
1323
|
}
|
|
1278
1324
|
|
|
1279
1325
|
declare class BasicReporter extends BaseReporter {
|
|
1280
|
-
|
|
1326
|
+
constructor();
|
|
1281
1327
|
reportSummary(files: File[], errors: unknown[]): void;
|
|
1282
1328
|
}
|
|
1283
1329
|
|
|
@@ -2388,13 +2434,13 @@ interface InlineConfig {
|
|
|
2388
2434
|
*/
|
|
2389
2435
|
poolOptions?: PoolOptions;
|
|
2390
2436
|
/**
|
|
2391
|
-
* 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.
|
|
2392
2438
|
*/
|
|
2393
|
-
maxWorkers?: number;
|
|
2439
|
+
maxWorkers?: number | string;
|
|
2394
2440
|
/**
|
|
2395
|
-
* 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.
|
|
2396
2442
|
*/
|
|
2397
|
-
minWorkers?: number;
|
|
2443
|
+
minWorkers?: number | string;
|
|
2398
2444
|
/**
|
|
2399
2445
|
* Should all test files run in parallel. Doesn't affect tests running in the same file.
|
|
2400
2446
|
* Setting this to `false` will override `maxWorkers` and `minWorkers` options to `1`.
|
|
@@ -2891,9 +2937,10 @@ interface UserConfig extends InlineConfig {
|
|
|
2891
2937
|
*/
|
|
2892
2938
|
mergeReports?: string;
|
|
2893
2939
|
}
|
|
2894
|
-
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'> {
|
|
2895
2941
|
mode: VitestRunMode;
|
|
2896
2942
|
base?: string;
|
|
2943
|
+
diff?: string;
|
|
2897
2944
|
config?: string;
|
|
2898
2945
|
filters?: string[];
|
|
2899
2946
|
testNamePattern?: RegExp;
|
|
@@ -2902,7 +2949,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2902
2949
|
snapshotOptions: SnapshotStateOptions;
|
|
2903
2950
|
browser: ResolvedBrowserOptions;
|
|
2904
2951
|
pool: Pool;
|
|
2905
|
-
poolOptions?:
|
|
2952
|
+
poolOptions?: ResolvedPoolOptions;
|
|
2906
2953
|
reporters: (InlineReporter | ReporterWithOptions)[];
|
|
2907
2954
|
defines: Record<string, any>;
|
|
2908
2955
|
api?: ApiConfig;
|
|
@@ -2930,8 +2977,10 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2930
2977
|
enabled: boolean;
|
|
2931
2978
|
};
|
|
2932
2979
|
runner?: string;
|
|
2980
|
+
maxWorkers: number;
|
|
2981
|
+
minWorkers: number;
|
|
2933
2982
|
}
|
|
2934
|
-
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'> & {
|
|
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'> & {
|
|
2935
2984
|
sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
|
|
2936
2985
|
deps?: Omit<DepsOptions, 'moduleDirectories'>;
|
|
2937
2986
|
poolOptions?: {
|
|
@@ -3014,6 +3063,7 @@ declare module '@vitest/runner' {
|
|
|
3014
3063
|
interface TaskMeta {
|
|
3015
3064
|
typecheck?: boolean;
|
|
3016
3065
|
benchmark?: boolean;
|
|
3066
|
+
failScreenshotPath?: string;
|
|
3017
3067
|
}
|
|
3018
3068
|
interface File {
|
|
3019
3069
|
prepareDuration?: number;
|
|
@@ -3053,4 +3103,4 @@ type Context = RootAndTarget & {
|
|
|
3053
3103
|
lastActivePath?: string;
|
|
3054
3104
|
};
|
|
3055
3105
|
|
|
3056
|
-
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 {
|
|
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,19 +1,19 @@
|
|
|
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';
|
|
5
5
|
import './vendor/tasks.DhVtQBtW.js';
|
|
6
6
|
import '@vitest/runner/utils';
|
|
7
7
|
import '@vitest/utils';
|
|
8
|
-
import './vendor/env.
|
|
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';
|
|
14
|
-
import './vendor/index.
|
|
14
|
+
import './vendor/index.BJmtb_7W.js';
|
|
15
15
|
import './vendor/global.7bFbnyXl.js';
|
|
16
|
-
import './chunks/runtime-console.
|
|
16
|
+
import './chunks/runtime-console.O41g23Zj.js';
|
|
17
17
|
import 'node:stream';
|
|
18
18
|
import 'node:console';
|
|
19
19
|
import 'node:path';
|
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-fiIq_dT9.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
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
2
|
-
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.
|
|
2
|
+
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.DXACdGTu.js';
|
|
3
3
|
import 'pathe';
|
|
4
4
|
import { g as getTestName } from './vendor/tasks.DhVtQBtW.js';
|
|
5
5
|
import { createDefer, getSafeTimers } from '@vitest/utils';
|
|
6
6
|
import { g as getWorkerState } from './vendor/global.7bFbnyXl.js';
|
|
7
|
-
import './vendor/env.
|
|
7
|
+
import './vendor/env.2ltrQNq0.js';
|
|
8
8
|
import { r as rpc } from './vendor/rpc.BGx7q_k2.js';
|
|
9
9
|
import { getTests, getNames } from '@vitest/runner/utils';
|
|
10
10
|
import { updateTask } from '@vitest/runner';
|
|
11
|
-
import { a as getBenchOptions, g as getBenchFn } from './vendor/benchmark.
|
|
11
|
+
import { a as getBenchOptions, g as getBenchFn } from './vendor/benchmark.B6pblCp2.js';
|
|
12
12
|
import 'chai';
|
|
13
13
|
import './vendor/_commonjsHelpers.BFTU3MAI.js';
|
|
14
14
|
import '@vitest/snapshot';
|
|
@@ -19,7 +19,7 @@ import './vendor/date.W2xKR2qe.js';
|
|
|
19
19
|
import '@vitest/spy';
|
|
20
20
|
import 'std-env';
|
|
21
21
|
import './vendor/index.BpSiYbpB.js';
|
|
22
|
-
import './vendor/index.
|
|
22
|
+
import './vendor/index.BJmtb_7W.js';
|
|
23
23
|
|
|
24
24
|
class VitestTestRunner {
|
|
25
25
|
constructor(config) {
|
|
@@ -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);
|
package/dist/snapshot.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/environments-node.
|
|
1
|
+
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/environments-node.XE5FbRPQ.js';
|
|
2
2
|
import '@vitest/snapshot/environment';
|
|
3
3
|
import 'pathe';
|
|
4
4
|
import '@vitest/runner/utils';
|
|
5
5
|
import '@vitest/utils';
|
|
6
6
|
import './vendor/global.7bFbnyXl.js';
|
|
7
|
-
import './vendor/env.
|
|
7
|
+
import './vendor/env.2ltrQNq0.js';
|
|
8
8
|
import 'std-env';
|
|
@@ -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';
|
package/dist/suite.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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 './vendor/benchmark.
|
|
3
|
+
export { g as getBenchFn, a as getBenchOptions } from './vendor/benchmark.B6pblCp2.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
|
-
import './vendor/index.
|
|
5
|
+
import './vendor/index.BJmtb_7W.js';
|
|
6
6
|
import 'pathe';
|
|
7
7
|
import './vendor/global.7bFbnyXl.js';
|
|
8
|
-
import './vendor/env.
|
|
8
|
+
import './vendor/env.2ltrQNq0.js';
|
|
9
9
|
import 'std-env';
|
|
@@ -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 },
|
|
@@ -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.BJmtb_7W.js';
|
|
5
5
|
|
|
6
6
|
const benchFns = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
const benchOptsMap = /* @__PURE__ */ new WeakMap();
|