vitest 1.1.2 → 1.2.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 +5 -31
- package/dist/chunks/{api-setup.mFKdEKxa.js → api-setup.MAoRkVWJ.js} +60 -6
- package/dist/chunks/{integrations-globals.tnKXwyh5.js → integrations-globals.VbxbZ7hn.js} +9 -8
- package/dist/{entry.js → chunks/runtime-runBaseTests.LWFmrzDk.js} +20 -18
- package/dist/cli-wrapper.js +1 -1
- package/dist/cli.js +14 -14
- package/dist/config.cjs +12 -1
- package/dist/config.d.ts +5 -2
- package/dist/config.js +12 -2
- package/dist/coverage.d.ts +1 -1
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +8 -6
- package/dist/execute.js +4 -7
- package/dist/index.d.ts +4 -3
- package/dist/index.js +8 -7
- package/dist/node.d.ts +3 -3
- package/dist/node.js +12 -12
- package/dist/{reporters-xH8_lESK.d.ts → reporters-trlZlObr.d.ts} +113 -27
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +4 -4
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +7 -5
- package/dist/{suite-GoqTeX8s.d.ts → suite-6Pt_ep5V.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +3 -3
- package/dist/vendor/base.8wUUWReP.js +38 -0
- package/dist/vendor/{base._79unx2z.js → base.dzu0Y6Hj.js} +10 -1
- package/dist/vendor/{benchmark.WVm6DARl.js → benchmark.IlKmJkUU.js} +1 -1
- package/dist/vendor/{constants.WSvnD_fn.js → constants.i1PoEnhr.js} +9 -1
- package/dist/vendor/{coverage.v6aD8iAh.js → coverage.E7sG1b3r.js} +1 -1
- package/dist/vendor/{environments.QJtma9XQ.js → environments.sU0TD7wX.js} +19 -7
- package/dist/vendor/execute.3_hyGknJ.js +589 -0
- package/dist/vendor/{global.L7JRz1qU.js → global.CkGT_TMy.js} +10 -1
- package/dist/vendor/{index.IhksUGLR.js → index.3iX2R_Z5.js} +6 -6
- package/dist/vendor/{index.h0j9y5vy.js → index.D-jOsMas.js} +5 -5
- package/dist/vendor/{index.XU72Rmy8.js → index.rJjbcrrp.js} +1 -1
- package/dist/vendor/{node.UBNKMR9Y.js → node.xyYo9ZvH.js} +660 -288
- package/dist/vendor/{reporters.oUR9etwS.js → reporters.2PaQ2peU.js} +11 -8
- package/dist/vendor/{rpc.Bl-ysZIr.js → rpc.w4v8oCkK.js} +23 -2
- package/dist/vendor/{run-once.X3E7xx3F.js → run-once.Olz_Zkd8.js} +2 -2
- package/dist/vendor/setup-common.j9IXYrbN.js +29 -0
- package/dist/vendor/utils.GbToHGHI.js +41 -0
- package/dist/vendor/{vi.DTC--YO5.js → vi.smj1Ggd4.js} +9 -5
- package/dist/vendor/vm.vFKXXdo0.js +696 -0
- package/dist/worker.js +109 -82
- package/dist/workers/forks.js +33 -0
- package/dist/{entry-vm.js → workers/runVmTests.js} +20 -16
- package/dist/workers/threads.js +26 -0
- package/dist/workers/vmForks.js +43 -0
- package/dist/workers/vmThreads.js +36 -0
- package/dist/workers.d.ts +36 -0
- package/dist/workers.js +30 -0
- package/package.json +11 -7
- package/workers.d.ts +1 -0
- package/dist/child.js +0 -125
- package/dist/vendor/execute.cedv4NLQ.js +0 -1235
- package/dist/vendor/inspector.lFAeuaAt.js +0 -26
- package/dist/vendor/loader.L9CYwKn1.js +0 -39
- package/dist/vm.js +0 -126
- /package/dist/{paths.js → path.js} +0 -0
package/dist/node.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { B as BaseSequencer, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/node.
|
|
1
|
+
export { B as BaseSequencer, b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/node.xyYo9ZvH.js';
|
|
2
2
|
import 'pathe';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import 'node:path';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
import 'node:process';
|
|
7
7
|
import 'node:fs';
|
|
8
|
-
import './vendor/constants.
|
|
8
|
+
import './vendor/constants.i1PoEnhr.js';
|
|
9
9
|
import './vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
10
10
|
import 'os';
|
|
11
11
|
import 'path';
|
|
@@ -15,43 +15,43 @@ import 'stream';
|
|
|
15
15
|
import 'events';
|
|
16
16
|
import 'fs';
|
|
17
17
|
import 'picocolors';
|
|
18
|
-
import 'vite-node/utils';
|
|
19
18
|
import 'vite-node/client';
|
|
20
19
|
import '@vitest/snapshot/manager';
|
|
21
20
|
import 'vite-node/server';
|
|
22
|
-
import './vendor/index.
|
|
21
|
+
import './vendor/index.rJjbcrrp.js';
|
|
23
22
|
import 'std-env';
|
|
24
23
|
import '@vitest/runner/utils';
|
|
25
24
|
import '@vitest/utils';
|
|
26
|
-
import './vendor/global.
|
|
27
|
-
import './vendor/coverage.
|
|
28
|
-
import './
|
|
25
|
+
import './vendor/global.CkGT_TMy.js';
|
|
26
|
+
import './vendor/coverage.E7sG1b3r.js';
|
|
27
|
+
import './path.js';
|
|
29
28
|
import 'node:v8';
|
|
30
29
|
import 'node:os';
|
|
31
30
|
import 'node:events';
|
|
32
31
|
import 'tinypool';
|
|
33
32
|
import './vendor/index.cAUulNDf.js';
|
|
34
|
-
import './vendor/base.
|
|
33
|
+
import './vendor/base.dzu0Y6Hj.js';
|
|
35
34
|
import 'node:worker_threads';
|
|
36
35
|
import 'node:fs/promises';
|
|
37
36
|
import 'node:perf_hooks';
|
|
38
37
|
import 'execa';
|
|
39
38
|
import '@vitest/utils/source-map';
|
|
40
|
-
import 'node:module';
|
|
41
|
-
import 'local-pkg';
|
|
42
39
|
import 'module';
|
|
43
40
|
import 'acorn-walk';
|
|
44
|
-
import './vendor/reporters.
|
|
41
|
+
import './vendor/reporters.2PaQ2peU.js';
|
|
45
42
|
import './chunks/runtime-console.hf2msWA9.js';
|
|
46
43
|
import 'node:stream';
|
|
47
44
|
import 'node:console';
|
|
48
45
|
import './vendor/date.Ns1pGd_X.js';
|
|
49
46
|
import './vendor/tasks.IknbGB2n.js';
|
|
47
|
+
import 'node:module';
|
|
48
|
+
import 'local-pkg';
|
|
50
49
|
import 'node:crypto';
|
|
50
|
+
import 'vite-node/utils';
|
|
51
51
|
import 'assert';
|
|
52
52
|
import 'magic-string';
|
|
53
53
|
import '@vitest/utils/ast';
|
|
54
54
|
import 'strip-literal';
|
|
55
|
-
import './vendor/environments.
|
|
55
|
+
import './vendor/environments.sU0TD7wX.js';
|
|
56
56
|
import 'node:readline';
|
|
57
57
|
import 'readline';
|
|
@@ -417,7 +417,7 @@ declare class Typechecker {
|
|
|
417
417
|
}[]>>;
|
|
418
418
|
clear(): Promise<void>;
|
|
419
419
|
stop(): Promise<void>;
|
|
420
|
-
protected ensurePackageInstalled(
|
|
420
|
+
protected ensurePackageInstalled(ctx: Vitest, checker: string): Promise<void>;
|
|
421
421
|
prepare(): Promise<void>;
|
|
422
422
|
getExitCode(): number | false;
|
|
423
423
|
getOutput(): string;
|
|
@@ -446,6 +446,7 @@ declare class Logger {
|
|
|
446
446
|
done(): void;
|
|
447
447
|
};
|
|
448
448
|
private _clearScreenPending;
|
|
449
|
+
private _highlights;
|
|
449
450
|
constructor(ctx: Vitest, console?: Console);
|
|
450
451
|
log(...args: any[]): void;
|
|
451
452
|
error(...args: any[]): void;
|
|
@@ -454,6 +455,8 @@ declare class Logger {
|
|
|
454
455
|
clearScreen(message: string, force?: boolean): void;
|
|
455
456
|
private _clearScreen;
|
|
456
457
|
printError(err: unknown, options?: ErrorOptions): Promise<void>;
|
|
458
|
+
clearHighlightCache(filename?: string): void;
|
|
459
|
+
highlight(filename: string, source: string): string;
|
|
457
460
|
printNoTestFound(filters?: string[]): void;
|
|
458
461
|
printBanner(): void;
|
|
459
462
|
printUnhandledErrors(errors: unknown[]): Promise<void>;
|
|
@@ -499,7 +502,6 @@ declare class WorkspaceProject {
|
|
|
499
502
|
static createBasicProject(ctx: Vitest): WorkspaceProject;
|
|
500
503
|
static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
|
|
501
504
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
502
|
-
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType$1<Reporter[T]>): Promise<void>;
|
|
503
505
|
isBrowserEnabled(): boolean;
|
|
504
506
|
getSerializableConfig(): ResolvedConfig;
|
|
505
507
|
close(): Promise<unknown>;
|
|
@@ -582,7 +584,7 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
|
582
584
|
api: ApiConfig;
|
|
583
585
|
}
|
|
584
586
|
|
|
585
|
-
type BuiltinPool = 'browser' | 'threads' | 'forks' | 'vmThreads' | 'typescript';
|
|
587
|
+
type BuiltinPool = 'browser' | 'threads' | 'forks' | 'vmThreads' | 'vmForks' | 'typescript';
|
|
586
588
|
type Pool = BuiltinPool | (string & {});
|
|
587
589
|
interface PoolOptions extends Record<string, unknown> {
|
|
588
590
|
/**
|
|
@@ -606,6 +608,14 @@ interface PoolOptions extends Record<string, unknown> {
|
|
|
606
608
|
* This makes tests run faster, but VM module is unstable. Your tests might leak memory.
|
|
607
609
|
*/
|
|
608
610
|
vmThreads?: ThreadsOptions & VmOptions;
|
|
611
|
+
/**
|
|
612
|
+
* Run tests in isolated `node:vm`.
|
|
613
|
+
*
|
|
614
|
+
* Test files are run parallel using `node:child_process` [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
|
|
615
|
+
*
|
|
616
|
+
* This makes tests run faster, but VM module is unstable. Your tests might leak memory.
|
|
617
|
+
*/
|
|
618
|
+
vmForks?: ForksOptions & VmOptions;
|
|
609
619
|
}
|
|
610
620
|
interface ThreadsOptions {
|
|
611
621
|
/** Minimum amount of threads to use */
|
|
@@ -799,7 +809,7 @@ interface CliOptions extends UserConfig {
|
|
|
799
809
|
*
|
|
800
810
|
* Returns a Vitest instance if initialized successfully.
|
|
801
811
|
*/
|
|
802
|
-
declare function startVitest(mode: VitestRunMode, cliFilters?: string[], options?: CliOptions, viteOverrides?: UserConfig$1): Promise<Vitest | undefined>;
|
|
812
|
+
declare function startVitest(mode: VitestRunMode, cliFilters?: string[], options?: CliOptions, viteOverrides?: UserConfig$1, vitestOptions?: VitestOptions): Promise<Vitest | undefined>;
|
|
803
813
|
|
|
804
814
|
type FileStatsCache = Pick<Stats, 'size'>;
|
|
805
815
|
declare class FilesStatsCache {
|
|
@@ -824,6 +834,13 @@ declare class VitestCache {
|
|
|
824
834
|
}>;
|
|
825
835
|
}
|
|
826
836
|
|
|
837
|
+
declare class VitestPackageInstaller {
|
|
838
|
+
ensureInstalled(dependency: string, root: string): Promise<boolean>;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
interface VitestOptions {
|
|
842
|
+
packageInstaller?: VitestPackageInstaller;
|
|
843
|
+
}
|
|
827
844
|
declare class Vitest {
|
|
828
845
|
readonly mode: VitestRunMode;
|
|
829
846
|
config: ResolvedConfig;
|
|
@@ -847,16 +864,13 @@ declare class Vitest {
|
|
|
847
864
|
isFirstRun: boolean;
|
|
848
865
|
restartsCount: number;
|
|
849
866
|
runner: ViteNodeRunner;
|
|
867
|
+
packageInstaller: VitestPackageInstaller;
|
|
850
868
|
private coreWorkspaceProject;
|
|
851
869
|
private resolvedProjects;
|
|
852
870
|
projects: WorkspaceProject[];
|
|
853
871
|
private projectsTestFiles;
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
forksPath: string;
|
|
857
|
-
vmPath: string;
|
|
858
|
-
};
|
|
859
|
-
constructor(mode: VitestRunMode);
|
|
872
|
+
distPath: string;
|
|
873
|
+
constructor(mode: VitestRunMode, options?: VitestOptions);
|
|
860
874
|
private _onRestartListeners;
|
|
861
875
|
private _onClose;
|
|
862
876
|
private _onSetServer;
|
|
@@ -884,7 +898,7 @@ declare class Vitest {
|
|
|
884
898
|
updateSnapshot(files?: string[]): Promise<void>;
|
|
885
899
|
private _rerunTimer;
|
|
886
900
|
private scheduleRerun;
|
|
887
|
-
getModuleProjects(
|
|
901
|
+
getModuleProjects(filepath: string): WorkspaceProject[];
|
|
888
902
|
private unregisterWatcher;
|
|
889
903
|
private registerWatcher;
|
|
890
904
|
/**
|
|
@@ -955,13 +969,14 @@ declare class BasicReporter extends BaseReporter {
|
|
|
955
969
|
reportSummary(files: File[], errors: unknown[]): Promise<void>;
|
|
956
970
|
}
|
|
957
971
|
|
|
958
|
-
interface ListRendererOptions
|
|
972
|
+
interface ListRendererOptions {
|
|
959
973
|
renderSucceed?: boolean;
|
|
960
974
|
logger: Logger;
|
|
961
975
|
showHeap: boolean;
|
|
976
|
+
slowTestThreshold: number;
|
|
962
977
|
mode: VitestRunMode;
|
|
963
978
|
}
|
|
964
|
-
declare function createListRenderer(_tasks: Task[], options: ListRendererOptions
|
|
979
|
+
declare function createListRenderer(_tasks: Task[], options: ListRendererOptions): {
|
|
965
980
|
start(): any;
|
|
966
981
|
update(_tasks: Task[]): any;
|
|
967
982
|
stop(): Promise<any>;
|
|
@@ -970,7 +985,7 @@ declare function createListRenderer(_tasks: Task[], options: ListRendererOptions
|
|
|
970
985
|
|
|
971
986
|
declare class DefaultReporter extends BaseReporter {
|
|
972
987
|
renderer?: ReturnType<typeof createListRenderer>;
|
|
973
|
-
rendererOptions: ListRendererOptions
|
|
988
|
+
rendererOptions: ListRendererOptions;
|
|
974
989
|
private renderSucceedDefault?;
|
|
975
990
|
onPathsCollected(paths?: string[]): void;
|
|
976
991
|
onTestRemoved(trigger?: string): Promise<void>;
|
|
@@ -982,8 +997,18 @@ declare class DefaultReporter extends BaseReporter {
|
|
|
982
997
|
onUserConsoleLog(log: UserConsoleLog): void;
|
|
983
998
|
}
|
|
984
999
|
|
|
1000
|
+
interface DotRendererOptions {
|
|
1001
|
+
logger: Logger;
|
|
1002
|
+
}
|
|
1003
|
+
declare function createDotRenderer(_tasks: Task[], options: DotRendererOptions): {
|
|
1004
|
+
start(): any;
|
|
1005
|
+
update(_tasks: Task[]): any;
|
|
1006
|
+
stop(): Promise<any>;
|
|
1007
|
+
clear(): void;
|
|
1008
|
+
};
|
|
1009
|
+
|
|
985
1010
|
declare class DotReporter extends BaseReporter {
|
|
986
|
-
renderer?: ReturnType<typeof
|
|
1011
|
+
renderer?: ReturnType<typeof createDotRenderer>;
|
|
987
1012
|
onCollected(): void;
|
|
988
1013
|
onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
|
|
989
1014
|
onWatcherStart(): Promise<void>;
|
|
@@ -1080,12 +1105,13 @@ declare class JsonReporter implements Reporter {
|
|
|
1080
1105
|
writeReport(report: string): Promise<void>;
|
|
1081
1106
|
}
|
|
1082
1107
|
|
|
1083
|
-
interface
|
|
1108
|
+
interface TableRendererOptions {
|
|
1084
1109
|
renderSucceed?: boolean;
|
|
1085
1110
|
logger: Logger;
|
|
1086
1111
|
showHeap: boolean;
|
|
1112
|
+
slowTestThreshold: number;
|
|
1087
1113
|
}
|
|
1088
|
-
declare function createTableRenderer(_tasks: Task[], options:
|
|
1114
|
+
declare function createTableRenderer(_tasks: Task[], options: TableRendererOptions): {
|
|
1089
1115
|
start(): any;
|
|
1090
1116
|
update(_tasks: Task[]): any;
|
|
1091
1117
|
stop(): Promise<any>;
|
|
@@ -1094,7 +1120,7 @@ declare function createTableRenderer(_tasks: Task[], options: ListRendererOption
|
|
|
1094
1120
|
|
|
1095
1121
|
declare class TableReporter extends BaseReporter {
|
|
1096
1122
|
renderer?: ReturnType<typeof createTableRenderer>;
|
|
1097
|
-
rendererOptions:
|
|
1123
|
+
rendererOptions: TableRendererOptions;
|
|
1098
1124
|
onTestRemoved(trigger?: string): Promise<void>;
|
|
1099
1125
|
onCollected(): void;
|
|
1100
1126
|
onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
|
|
@@ -1204,6 +1230,52 @@ interface LinkMapper {
|
|
|
1204
1230
|
type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
1205
1231
|
type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
|
|
1206
1232
|
type PromisifyFn<T> = ReturnType$1<T> extends Promise<any> ? T : (...args: ArgumentsType<T>) => Promise<Awaited<ReturnType$1<T>>>;
|
|
1233
|
+
type BirpcResolver = (name: string, resolved: (...args: unknown[]) => unknown) => ((...args: unknown[]) => unknown) | undefined;
|
|
1234
|
+
interface ChannelOptions {
|
|
1235
|
+
/**
|
|
1236
|
+
* Function to post raw message
|
|
1237
|
+
*/
|
|
1238
|
+
post: (data: any, ...extras: any[]) => any | Promise<any>;
|
|
1239
|
+
/**
|
|
1240
|
+
* Listener to receive raw message
|
|
1241
|
+
*/
|
|
1242
|
+
on: (fn: (data: any, ...extras: any[]) => void) => any | Promise<any>;
|
|
1243
|
+
/**
|
|
1244
|
+
* Custom function to serialize data
|
|
1245
|
+
*
|
|
1246
|
+
* by default it passes the data as-is
|
|
1247
|
+
*/
|
|
1248
|
+
serialize?: (data: any) => any;
|
|
1249
|
+
/**
|
|
1250
|
+
* Custom function to deserialize data
|
|
1251
|
+
*
|
|
1252
|
+
* by default it passes the data as-is
|
|
1253
|
+
*/
|
|
1254
|
+
deserialize?: (data: any) => any;
|
|
1255
|
+
}
|
|
1256
|
+
interface EventOptions<Remote> {
|
|
1257
|
+
/**
|
|
1258
|
+
* Names of remote functions that do not need response.
|
|
1259
|
+
*/
|
|
1260
|
+
eventNames?: (keyof Remote)[];
|
|
1261
|
+
/**
|
|
1262
|
+
* Maximum timeout for waiting for response, in milliseconds.
|
|
1263
|
+
*
|
|
1264
|
+
* @default 60_000
|
|
1265
|
+
*/
|
|
1266
|
+
timeout?: number;
|
|
1267
|
+
/**
|
|
1268
|
+
* Custom resolver to resolve function to be called
|
|
1269
|
+
*
|
|
1270
|
+
* For advanced use cases only
|
|
1271
|
+
*/
|
|
1272
|
+
resolver?: BirpcResolver;
|
|
1273
|
+
/**
|
|
1274
|
+
* Custom error handler
|
|
1275
|
+
*/
|
|
1276
|
+
onError?: (error: Error, functionName: string, args: any[]) => boolean | void;
|
|
1277
|
+
}
|
|
1278
|
+
type BirpcOptions<Remote> = EventOptions<Remote> & ChannelOptions;
|
|
1207
1279
|
type BirpcFn<T> = PromisifyFn<T> & {
|
|
1208
1280
|
/**
|
|
1209
1281
|
* Send event without asking for response
|
|
@@ -1234,7 +1306,6 @@ interface RuntimeRPC {
|
|
|
1234
1306
|
resolveId: (id: string, importer: string | undefined, environment: TransformMode) => Promise<ViteNodeResolveId | null>;
|
|
1235
1307
|
getSourceMap: (id: string, force?: boolean) => Promise<RawSourceMap | undefined>;
|
|
1236
1308
|
onFinished: (files: File[], errors?: unknown[]) => void;
|
|
1237
|
-
onWorkerExit: (error: unknown, code?: number) => void;
|
|
1238
1309
|
onPathsCollected: (paths: string[]) => void;
|
|
1239
1310
|
onUserConsoleLog: (log: UserConsoleLog) => void;
|
|
1240
1311
|
onUnhandledError: (err: unknown, type: string) => void;
|
|
@@ -1251,7 +1322,6 @@ interface RunnerRPC {
|
|
|
1251
1322
|
}
|
|
1252
1323
|
interface ContextTestEnvironment {
|
|
1253
1324
|
name: VitestEnvironment;
|
|
1254
|
-
environment?: Environment;
|
|
1255
1325
|
transformMode?: TransformMode;
|
|
1256
1326
|
options: EnvironmentOptions | null;
|
|
1257
1327
|
}
|
|
@@ -1260,16 +1330,18 @@ interface ResolvedTestEnvironment {
|
|
|
1260
1330
|
options: EnvironmentOptions | null;
|
|
1261
1331
|
}
|
|
1262
1332
|
interface ContextRPC {
|
|
1333
|
+
pool: Pool;
|
|
1334
|
+
worker: string;
|
|
1335
|
+
workerId: number;
|
|
1263
1336
|
config: ResolvedConfig;
|
|
1264
1337
|
projectName: string;
|
|
1265
1338
|
files: string[];
|
|
1266
|
-
invalidates?: string[];
|
|
1267
1339
|
environment: ContextTestEnvironment;
|
|
1268
1340
|
providedContext: Record<string, any>;
|
|
1341
|
+
invalidates?: string[];
|
|
1269
1342
|
}
|
|
1270
1343
|
|
|
1271
1344
|
interface WorkerContext extends ContextRPC {
|
|
1272
|
-
workerId: number;
|
|
1273
1345
|
port: MessagePort;
|
|
1274
1346
|
}
|
|
1275
1347
|
type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
|
|
@@ -1295,7 +1367,6 @@ interface WorkerGlobalState {
|
|
|
1295
1367
|
environment: number;
|
|
1296
1368
|
prepare: number;
|
|
1297
1369
|
};
|
|
1298
|
-
isChildProcess?: boolean;
|
|
1299
1370
|
}
|
|
1300
1371
|
|
|
1301
1372
|
type TransformResult = string | Partial<TransformResult$1> | undefined | null | void;
|
|
@@ -1330,8 +1401,8 @@ interface CoverageProviderModule {
|
|
|
1330
1401
|
*/
|
|
1331
1402
|
stopCoverage?(): unknown | Promise<unknown>;
|
|
1332
1403
|
}
|
|
1333
|
-
type CoverageReporter = keyof ReportOptions;
|
|
1334
|
-
type CoverageReporterWithOptions<ReporterName extends CoverageReporter = CoverageReporter> = ReporterName extends
|
|
1404
|
+
type CoverageReporter = keyof ReportOptions | (string & {});
|
|
1405
|
+
type CoverageReporterWithOptions<ReporterName extends CoverageReporter = CoverageReporter> = ReporterName extends keyof ReportOptions ? ReportOptions[ReporterName] extends never ? [ReporterName, {}] : [ReporterName, Partial<ReportOptions[ReporterName]>] : [ReporterName, Record<string, unknown>];
|
|
1335
1406
|
type Provider = 'v8' | 'istanbul' | 'custom' | undefined;
|
|
1336
1407
|
type CoverageOptions<T extends Provider = Provider> = T extends 'istanbul' ? ({
|
|
1337
1408
|
provider: T;
|
|
@@ -2215,6 +2286,16 @@ interface InlineConfig {
|
|
|
2215
2286
|
* Show full diff when snapshot fails instead of a patch.
|
|
2216
2287
|
*/
|
|
2217
2288
|
expandSnapshotDiff?: boolean;
|
|
2289
|
+
/**
|
|
2290
|
+
* By default, Vitest automatically intercepts console logging during tests for extra formatting of test file, test title, etc...
|
|
2291
|
+
* This is also required for console log preview on Vitest UI.
|
|
2292
|
+
* However, disabling such interception might help when you want to debug a code with normal synchronus terminal console logging.
|
|
2293
|
+
*
|
|
2294
|
+
* This option has no effect on browser pool since Vitest preserves original logging on browser devtools.
|
|
2295
|
+
*
|
|
2296
|
+
* @default false
|
|
2297
|
+
*/
|
|
2298
|
+
disableConsoleIntercept?: boolean;
|
|
2218
2299
|
}
|
|
2219
2300
|
interface TypecheckConfig {
|
|
2220
2301
|
/**
|
|
@@ -2332,9 +2413,14 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2332
2413
|
};
|
|
2333
2414
|
runner?: string;
|
|
2334
2415
|
}
|
|
2335
|
-
type ProjectConfig = Omit<UserConfig, 'sequencer' | 'shard' | 'watch' | 'run' | 'cache' | 'update' | 'reporters' | 'outputFile' | '
|
|
2416
|
+
type ProjectConfig = Omit<UserConfig, 'sequencer' | 'shard' | 'watch' | 'run' | 'cache' | 'update' | 'reporters' | 'outputFile' | 'poolOptions' | 'teardownTimeout' | 'silent' | 'watchExclude' | 'forceRerunTriggers' | 'testNamePattern' | 'ui' | 'open' | 'uiBase' | 'snapshotFormat' | 'resolveSnapshotPath' | 'passWithNoTests' | 'onConsoleLog' | 'onStackTrace' | 'dangerouslyIgnoreUnhandledErrors' | 'slowTestThreshold' | 'inspect' | 'inspectBrk' | 'deps' | 'coverage'> & {
|
|
2336
2417
|
sequencer?: Omit<SequenceOptions, 'sequencer' | 'seed'>;
|
|
2337
2418
|
deps?: Omit<DepsOptions, 'moduleDirectories'>;
|
|
2419
|
+
poolOptions?: {
|
|
2420
|
+
threads?: Pick<NonNullable<PoolOptions['threads']>, 'singleThread' | 'isolate'>;
|
|
2421
|
+
vmThreads?: Pick<NonNullable<PoolOptions['vmThreads']>, 'singleThread'>;
|
|
2422
|
+
forks?: Pick<NonNullable<PoolOptions['forks']>, 'singleFork' | 'isolate'>;
|
|
2423
|
+
};
|
|
2338
2424
|
};
|
|
2339
2425
|
type RuntimeConfig = Pick<UserConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency'> & {
|
|
2340
2426
|
sequence?: {
|
|
@@ -2435,4 +2521,4 @@ type Context = RootAndTarget & {
|
|
|
2435
2521
|
lastActivePath?: string;
|
|
2436
2522
|
};
|
|
2437
2523
|
|
|
2438
|
-
export { type
|
|
2524
|
+
export { type InlineConfig as $, type AfterSuiteRunMeta as A, type BaseCoverageOptions as B, type CoverageV8Options as C, type CollectLineNumbers as D, type Environment as E, type FakeTimerInstallOpts as F, type CollectLines as G, type RootAndTarget as H, type Context as I, type Pool as J, type PoolOptions as K, type JSDOMOptions as L, type MockFactoryWithHelper as M, type HappyDOMOptions as N, type BuiltinEnvironment as O, type ProjectConfig as P, type VitestEnvironment as Q, type ResolvedConfig as R, type CSSModuleScopeStrategy as S, type TestSequencer as T, type UserConfig as U, type VitestRunMode as V, WorkspaceProject as W, type ApiConfig as X, type EnvironmentOptions as Y, type DepsOptimizationOptions as Z, type TransformModePatterns as _, type ResolvedCoverageOptions as a, type TypecheckConfig as a0, type RunnerRPC as a1, type ContextTestEnvironment as a2, type ResolvedTestEnvironment as a3, type ResolveIdFunction as a4, type WorkerRPC as a5, type Awaitable as a6, type Nullable as a7, type Arrayable as a8, type ArgumentsType$1 as a9, HangingProcessReporter as aA, BaseReporter as aB, ReportersMap as aC, type BuiltinReporters as aD, BenchmarkReportsMap as aE, type BenchmarkBuiltinReporters as aF, type MutableArray as aa, type Constructable as ab, type ModuleCache as ac, type EnvironmentReturn as ad, type VmEnvironmentReturn as ae, type OnServerRestartHandler as af, type ReportContext as ag, type CoverageReporter as ah, type CoverageIstanbulOptions as ai, type CustomProviderOptions as aj, type BenchmarkUserOptions as ak, type Benchmark as al, type BenchmarkResult as am, type BenchFunction as an, type BenchmarkAPI as ao, type PendingSuiteMock as ap, type MockFactory as aq, type MockMap as ar, DefaultReporter as as, BasicReporter as at, DotReporter as au, JsonReporter$1 as av, VerboseReporter as aw, TapReporter as ax, JUnitReporter as ay, TapFlatReporter as az, type CoverageOptions as b, type CoverageProvider as c, type CoverageProviderModule as d, type VitestOptions as e, Vitest as f, type ProvidedContext as g, type RuntimeRPC as h, type WorkspaceSpec as i, type ProcessPool as j, VitestPackageInstaller as k, type TestSequencerConstructor as l, type BrowserProviderInitializationOptions as m, type BrowserProvider as n, type BrowserProviderOptions as o, type BirpcOptions as p, type ContextRPC as q, type WorkerGlobalState as r, startVitest as s, type WorkerContext as t, type RuntimeConfig as u, type UserConsoleLog as v, type ModuleGraphData as w, type Reporter as x, type RawErrsMap as y, type TscErrorInfo as z };
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aB as BaseReporter, at as BasicReporter, aF as BenchmarkBuiltinReporters, aE as BenchmarkReportsMap, aD as BuiltinReporters, as as DefaultReporter, au as DotReporter, aA as HangingProcessReporter, ay as JUnitReporter, av as JsonReporter, x as Reporter, aC as ReportersMap, az as TapFlatReporter, ax as TapReporter, aw as VerboseReporter } from './reporters-trlZlObr.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
package/dist/reporters.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export { e as BasicReporter, B as BenchmarkReportsMap, D as DefaultReporter, f as DotReporter, H as HangingProcessReporter, g as JUnitReporter, J as JsonReporter, R as ReportersMap, h as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/reporters.
|
|
1
|
+
export { e as BasicReporter, B as BenchmarkReportsMap, D as DefaultReporter, f as DotReporter, H as HangingProcessReporter, g as JUnitReporter, J as JsonReporter, R as ReportersMap, h as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/reporters.2PaQ2peU.js';
|
|
2
2
|
import 'node:perf_hooks';
|
|
3
3
|
import 'picocolors';
|
|
4
|
-
import './vendor/index.
|
|
4
|
+
import './vendor/index.rJjbcrrp.js';
|
|
5
5
|
import 'pathe';
|
|
6
6
|
import 'std-env';
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import '@vitest/utils';
|
|
9
|
-
import './vendor/global.
|
|
9
|
+
import './vendor/global.CkGT_TMy.js';
|
|
10
10
|
import './chunks/runtime-console.hf2msWA9.js';
|
|
11
11
|
import 'node:stream';
|
|
12
12
|
import 'node:console';
|
|
13
13
|
import 'node:path';
|
|
14
14
|
import './vendor/date.Ns1pGd_X.js';
|
|
15
|
-
import './vendor/base.
|
|
15
|
+
import './vendor/base.dzu0Y6Hj.js';
|
|
16
16
|
import './vendor/tasks.IknbGB2n.js';
|
|
17
17
|
import 'node:fs';
|
|
18
18
|
import '@vitest/utils/source-map';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VitestRunner, VitestRunnerImportSource, Suite, Test, CancelReason, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig } from './reporters-
|
|
2
|
+
import { R as ResolvedConfig } from './reporters-trlZlObr.js';
|
|
3
3
|
import * as tinybench from 'tinybench';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
package/dist/runners.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
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 './vendor/index.
|
|
4
|
-
import {
|
|
2
|
+
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.smj1Ggd4.js';
|
|
3
|
+
import './vendor/index.rJjbcrrp.js';
|
|
4
|
+
import { r as rpc } from './vendor/rpc.w4v8oCkK.js';
|
|
5
5
|
import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
|
|
6
|
-
import { g as getWorkerState } from './vendor/global.
|
|
6
|
+
import { g as getWorkerState } from './vendor/global.CkGT_TMy.js';
|
|
7
7
|
import { getTests, getNames } from '@vitest/runner/utils';
|
|
8
8
|
import { updateTask } from '@vitest/runner';
|
|
9
9
|
import { createDefer, getSafeTimers } from '@vitest/utils';
|
|
10
|
-
import { a as getBenchOptions, g as getBenchFn } from './vendor/benchmark.
|
|
10
|
+
import { a as getBenchOptions, g as getBenchFn } from './vendor/benchmark.IlKmJkUU.js';
|
|
11
11
|
import 'chai';
|
|
12
12
|
import './vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
13
13
|
import '@vitest/snapshot';
|
|
14
14
|
import '@vitest/utils/error';
|
|
15
15
|
import '@vitest/utils/source-map';
|
|
16
|
+
import './vendor/base.dzu0Y6Hj.js';
|
|
16
17
|
import './vendor/date.Ns1pGd_X.js';
|
|
17
18
|
import '@vitest/spy';
|
|
18
19
|
import 'pathe';
|
|
19
20
|
import 'std-env';
|
|
21
|
+
import './vendor/index.cAUulNDf.js';
|
|
20
22
|
|
|
21
23
|
class VitestTestRunner {
|
|
22
24
|
constructor(config) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Custom } from '@vitest/runner';
|
|
2
2
|
import '@vitest/runner/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { an as BenchFunction, ao as BenchmarkAPI } from './reporters-trlZlObr.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, getFn, setFn } 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-6Pt_ep5V.js';
|
|
4
|
+
import './reporters-trlZlObr.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import 'vite-node';
|
|
7
7
|
import '@vitest/snapshot';
|
package/dist/suite.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { createTaskCollector, getCurrentSuite, getFn, setFn } 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.IlKmJkUU.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
|
-
import './vendor/index.
|
|
5
|
+
import './vendor/index.rJjbcrrp.js';
|
|
6
6
|
import 'pathe';
|
|
7
7
|
import 'std-env';
|
|
8
|
-
import './vendor/global.
|
|
8
|
+
import './vendor/global.CkGT_TMy.js';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ModuleCacheMap } from 'vite-node/client';
|
|
2
|
+
import { p as provideWorkerState } from './global.CkGT_TMy.js';
|
|
3
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.3_hyGknJ.js';
|
|
4
|
+
|
|
5
|
+
let _viteNode;
|
|
6
|
+
const moduleCache = new ModuleCacheMap();
|
|
7
|
+
const mockMap = /* @__PURE__ */ new Map();
|
|
8
|
+
async function startViteNode(options) {
|
|
9
|
+
if (_viteNode)
|
|
10
|
+
return _viteNode;
|
|
11
|
+
_viteNode = await startVitestExecutor(options);
|
|
12
|
+
return _viteNode;
|
|
13
|
+
}
|
|
14
|
+
async function runBaseTests(state) {
|
|
15
|
+
const { ctx } = state;
|
|
16
|
+
state.moduleCache = moduleCache;
|
|
17
|
+
state.mockMap = mockMap;
|
|
18
|
+
provideWorkerState(globalThis, state);
|
|
19
|
+
if (ctx.invalidates) {
|
|
20
|
+
ctx.invalidates.forEach((fsPath) => {
|
|
21
|
+
moduleCache.delete(fsPath);
|
|
22
|
+
moduleCache.delete(`mock:${fsPath}`);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
ctx.files.forEach((i) => state.moduleCache.delete(i));
|
|
26
|
+
const [executor, { run }] = await Promise.all([
|
|
27
|
+
startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
|
|
28
|
+
import('../chunks/runtime-runBaseTests.LWFmrzDk.js')
|
|
29
|
+
]);
|
|
30
|
+
await run(
|
|
31
|
+
ctx.files,
|
|
32
|
+
ctx.config,
|
|
33
|
+
{ environment: state.environment, options: ctx.environment.options },
|
|
34
|
+
executor
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { runBaseTests as r };
|
|
@@ -92,5 +92,14 @@ class AggregateErrorPonyfill extends Error {
|
|
|
92
92
|
this.errors = [...errors];
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
+
function isChildProcess() {
|
|
96
|
+
return !!(process == null ? void 0 : process.send);
|
|
97
|
+
}
|
|
98
|
+
function setProcessTitle(title) {
|
|
99
|
+
try {
|
|
100
|
+
process.title = `node (${title})`;
|
|
101
|
+
} catch {
|
|
102
|
+
}
|
|
103
|
+
}
|
|
95
104
|
|
|
96
|
-
export { AggregateErrorPonyfill as A,
|
|
105
|
+
export { AggregateErrorPonyfill as A, isPrimitive as a, slash as b, stdout as c, deepMerge as d, getAllMockableProperties as e, groupBy as g, isChildProcess as i, noop as n, setProcessTitle as s, toArray as t };
|
|
@@ -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.rJjbcrrp.js';
|
|
5
5
|
|
|
6
6
|
const benchFns = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
const benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -2,6 +2,14 @@ const defaultPort = 51204;
|
|
|
2
2
|
const defaultBrowserPort = 63315;
|
|
3
3
|
const EXIT_CODE_RESTART = 43;
|
|
4
4
|
const API_PATH = "/__vitest_api__";
|
|
5
|
+
const extraInlineDeps = [
|
|
6
|
+
/^(?!.*(?:node_modules)).*\.mjs$/,
|
|
7
|
+
/^(?!.*(?:node_modules)).*\.cjs\.js$/,
|
|
8
|
+
// Vite client
|
|
9
|
+
/vite\w*\/dist\/client\/env.mjs/,
|
|
10
|
+
// Nuxt
|
|
11
|
+
"@nuxt/test-utils"
|
|
12
|
+
];
|
|
5
13
|
const CONFIG_NAMES = [
|
|
6
14
|
"vitest.config",
|
|
7
15
|
"vite.config"
|
|
@@ -51,4 +59,4 @@ const globalApis = [
|
|
|
51
59
|
"afterEach"
|
|
52
60
|
];
|
|
53
61
|
|
|
54
|
-
export { API_PATH as A, CONFIG_NAMES as C, EXIT_CODE_RESTART as E, defaultBrowserPort as a, configFiles as c, defaultPort as d, globalApis as g, workspacesFiles as w };
|
|
62
|
+
export { API_PATH as A, CONFIG_NAMES as C, EXIT_CODE_RESTART as E, defaultBrowserPort as a, configFiles as c, defaultPort as d, extraInlineDeps as e, globalApis as g, workspacesFiles as w };
|
|
@@ -50,4 +50,4 @@ async function stopCoverageInsideWorker(options, loader) {
|
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export { CoverageProviderMap as C,
|
|
53
|
+
export { CoverageProviderMap as C, startCoverageInsideWorker as a, getCoverageProvider as g, stopCoverageInsideWorker as s, takeCoverageInsideWorker as t };
|