vitest 0.16.0 → 0.18.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/{chunk-api-setup.f43cd039.mjs → chunk-api-setup.63babd7c.mjs} +4 -4
- package/dist/{chunk-constants.7b9cfc82.mjs → chunk-constants.8eb2ed35.mjs} +8 -2
- package/dist/chunk-env-node.26c72624.mjs +675 -0
- package/dist/{chunk-install-pkg.3fa50769.mjs → chunk-install-pkg.2dcb2c04.mjs} +1 -1
- package/dist/{chunk-integrations-globals.d0c363a6.mjs → chunk-integrations-globals.61e4d6ae.mjs} +8 -8
- package/dist/{chunk-runtime-chain.7103058b.mjs → chunk-runtime-chain.eb764dff.mjs} +55 -188
- package/dist/{chunk-runtime-mocker.110e3634.mjs → chunk-runtime-mocker.79ccc3de.mjs} +36 -62
- package/dist/{chunk-runtime-rpc.5e78af38.mjs → chunk-runtime-rpc.cc6a06a2.mjs} +1 -1
- package/dist/{chunk-utils-global.79a8b1cc.mjs → chunk-utils-global.1b22c4fd.mjs} +69 -5
- package/dist/{chunk-utils-source-map.2556cba8.mjs → chunk-utils-source-map.957e7756.mjs} +10 -24
- package/dist/{chunk-vite-node-externalize.58e10976.mjs → chunk-vite-node-externalize.0791f2ed.mjs} +2683 -2553
- package/dist/{chunk-vite-node-utils.7450fc0c.mjs → chunk-vite-node-utils.af8ead96.mjs} +28 -13
- package/dist/cli.mjs +15 -15
- package/dist/config.cjs +5 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.mjs +5 -1
- package/dist/entry.mjs +8 -8
- package/dist/index.d.ts +223 -18
- package/dist/index.mjs +4 -4
- package/dist/node.d.ts +236 -38
- package/dist/node.mjs +16 -16
- package/dist/{vendor-entry.efeeaa5c.mjs → vendor-entry.78de67ab.mjs} +18 -424
- package/dist/{vendor-index.e5dc6622.mjs → vendor-index.4bf9c627.mjs} +405 -405
- package/dist/{vendor-index.98e769c1.mjs → vendor-index.de788b6a.mjs} +7 -7
- package/dist/worker.mjs +8 -8
- package/package.json +9 -4
- package/dist/chunk-defaults.dc6dc23d.mjs +0 -302
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,87 @@
|
|
|
1
1
|
import { ViteDevServer, TransformResult, CommonServerOptions, UserConfig as UserConfig$1, Plugin as Plugin$1 } from 'vite';
|
|
2
|
+
import { Stats } from 'fs';
|
|
2
3
|
|
|
4
|
+
interface UpdatePayload {
|
|
5
|
+
type: 'update'
|
|
6
|
+
updates: Update[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface Update {
|
|
10
|
+
type: 'js-update' | 'css-update'
|
|
11
|
+
path: string
|
|
12
|
+
acceptedPath: string
|
|
13
|
+
timestamp: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface PrunePayload {
|
|
17
|
+
type: 'prune'
|
|
18
|
+
paths: string[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface FullReloadPayload {
|
|
22
|
+
type: 'full-reload'
|
|
23
|
+
path?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface ErrorPayload {
|
|
27
|
+
type: 'error'
|
|
28
|
+
err: {
|
|
29
|
+
[name: string]: any
|
|
30
|
+
message: string
|
|
31
|
+
stack: string
|
|
32
|
+
id?: string
|
|
33
|
+
frame?: string
|
|
34
|
+
plugin?: string
|
|
35
|
+
pluginCode?: string
|
|
36
|
+
loc?: {
|
|
37
|
+
file?: string
|
|
38
|
+
line: number
|
|
39
|
+
column: number
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface CustomEventMap {
|
|
45
|
+
'vite:beforeUpdate': UpdatePayload
|
|
46
|
+
'vite:beforePrune': PrunePayload
|
|
47
|
+
'vite:beforeFullReload': FullReloadPayload
|
|
48
|
+
'vite:error': ErrorPayload
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type InferCustomEventPayload<T extends string> =
|
|
52
|
+
T extends keyof CustomEventMap ? CustomEventMap[T] : any
|
|
53
|
+
|
|
54
|
+
type ModuleNamespace = Record<string, any> & {
|
|
55
|
+
[Symbol.toStringTag]: 'Module'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface ViteHotContext {
|
|
59
|
+
readonly data: any
|
|
60
|
+
|
|
61
|
+
accept(): void
|
|
62
|
+
accept(cb: (mod: ModuleNamespace | undefined) => void): void
|
|
63
|
+
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
|
64
|
+
accept(
|
|
65
|
+
deps: readonly string[],
|
|
66
|
+
cb: (mods: Array<ModuleNamespace | undefined>) => void
|
|
67
|
+
): void
|
|
68
|
+
|
|
69
|
+
acceptExports(exportNames: string | readonly string[]): void
|
|
70
|
+
acceptExports(
|
|
71
|
+
exportNames: string | readonly string[],
|
|
72
|
+
cb: (mod: ModuleNamespace | undefined) => void
|
|
73
|
+
): void
|
|
74
|
+
|
|
75
|
+
dispose(cb: (data: any) => void): void
|
|
76
|
+
decline(): void
|
|
77
|
+
invalidate(): void
|
|
78
|
+
|
|
79
|
+
on<T extends string>(
|
|
80
|
+
event: T,
|
|
81
|
+
cb: (payload: InferCustomEventPayload<T>) => void
|
|
82
|
+
): void
|
|
83
|
+
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
|
|
84
|
+
}
|
|
3
85
|
declare class ModuleCacheMap extends Map<string, ModuleCache> {
|
|
4
86
|
normalizePath(fsPath: string): string;
|
|
5
87
|
set(fsPath: string, mod: Partial<ModuleCache>): this;
|
|
@@ -61,8 +143,10 @@ interface FetchResult {
|
|
|
61
143
|
externalize?: string;
|
|
62
144
|
map?: RawSourceMap;
|
|
63
145
|
}
|
|
146
|
+
declare type HotContext = Omit<ViteHotContext, 'acceptDeps' | 'decline'>;
|
|
64
147
|
declare type FetchFunction = (id: string) => Promise<FetchResult>;
|
|
65
148
|
declare type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
|
|
149
|
+
declare type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) => HotContext;
|
|
66
150
|
interface ModuleCache {
|
|
67
151
|
promise?: Promise<any>;
|
|
68
152
|
exports?: any;
|
|
@@ -72,6 +156,7 @@ interface ViteNodeRunnerOptions {
|
|
|
72
156
|
root: string;
|
|
73
157
|
fetchModule: FetchFunction;
|
|
74
158
|
resolveId?: ResolveIdFunction;
|
|
159
|
+
createHotContext?: CreateHotContextFunction;
|
|
75
160
|
base?: string;
|
|
76
161
|
moduleCache?: ModuleCacheMap;
|
|
77
162
|
interopDefault?: boolean;
|
|
@@ -282,12 +367,17 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
282
367
|
watchFilters?: string[];
|
|
283
368
|
isTTY: boolean;
|
|
284
369
|
ctx: Vitest;
|
|
370
|
+
private _filesInWatchMode;
|
|
371
|
+
private _lastRunTimeout;
|
|
372
|
+
private _lastRunTimer;
|
|
373
|
+
private _lastRunCount;
|
|
285
374
|
constructor();
|
|
286
375
|
onInit(ctx: Vitest): void;
|
|
287
376
|
relative(path: string): string;
|
|
288
377
|
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
289
378
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
290
379
|
onWatcherStart(): Promise<void>;
|
|
380
|
+
private resetLastRunLog;
|
|
291
381
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
292
382
|
onUserConsoleLog(log: UserConsoleLog): void;
|
|
293
383
|
shouldLog(log: UserConsoleLog): boolean;
|
|
@@ -297,9 +387,35 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
297
387
|
registerUnhandledRejection(): void;
|
|
298
388
|
}
|
|
299
389
|
|
|
390
|
+
declare class Logger {
|
|
391
|
+
ctx: Vitest;
|
|
392
|
+
console: Console;
|
|
393
|
+
outputStream: NodeJS.WriteStream & {
|
|
394
|
+
fd: 1;
|
|
395
|
+
};
|
|
396
|
+
errorStream: NodeJS.WriteStream & {
|
|
397
|
+
fd: 2;
|
|
398
|
+
};
|
|
399
|
+
logUpdate: ((...text: string[]) => void) & {
|
|
400
|
+
clear(): void;
|
|
401
|
+
done(): void;
|
|
402
|
+
};
|
|
403
|
+
private _clearScreenPending;
|
|
404
|
+
constructor(ctx: Vitest, console?: Console);
|
|
405
|
+
log(...args: any[]): void;
|
|
406
|
+
error(...args: any[]): void;
|
|
407
|
+
warn(...args: any[]): void;
|
|
408
|
+
clearScreen(message: string, force?: boolean): void;
|
|
409
|
+
private _clearScreen;
|
|
410
|
+
printError(err: unknown, fullStack?: boolean, type?: string): Promise<void>;
|
|
411
|
+
printNoTestFound(filters?: string[]): void;
|
|
412
|
+
printBanner(): void;
|
|
413
|
+
printUnhandledErrors(errors: unknown[]): Promise<void>;
|
|
414
|
+
}
|
|
415
|
+
|
|
300
416
|
interface ListRendererOptions {
|
|
301
417
|
renderSucceed?: boolean;
|
|
302
|
-
|
|
418
|
+
logger: Logger;
|
|
303
419
|
showHeap: boolean;
|
|
304
420
|
}
|
|
305
421
|
declare const createListRenderer: (_tasks: Task[], options: ListRendererOptions) => {
|
|
@@ -389,6 +505,18 @@ declare const ReportersMap: {
|
|
|
389
505
|
};
|
|
390
506
|
declare type BuiltinReporters = keyof typeof ReportersMap;
|
|
391
507
|
|
|
508
|
+
interface TestSequencer {
|
|
509
|
+
/**
|
|
510
|
+
* Slicing tests into shards. Will be run before `sort`.
|
|
511
|
+
* Only run, if `shard` is defined.
|
|
512
|
+
*/
|
|
513
|
+
shard(files: string[]): Awaitable<string[]>;
|
|
514
|
+
sort(files: string[]): Awaitable<string[]>;
|
|
515
|
+
}
|
|
516
|
+
interface TestSequencerConstructor {
|
|
517
|
+
new (ctx: Vitest): TestSequencer;
|
|
518
|
+
}
|
|
519
|
+
|
|
392
520
|
declare type Awaitable<T> = T | PromiseLike<T>;
|
|
393
521
|
declare type Arrayable<T> = T | Array<T>;
|
|
394
522
|
declare type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
@@ -572,6 +700,7 @@ interface TaskBase {
|
|
|
572
700
|
name: string;
|
|
573
701
|
mode: RunMode;
|
|
574
702
|
concurrent?: boolean;
|
|
703
|
+
shuffle?: boolean;
|
|
575
704
|
suite?: Suite;
|
|
576
705
|
file?: File;
|
|
577
706
|
result?: TaskResult;
|
|
@@ -685,7 +814,7 @@ interface SnapshotSummary {
|
|
|
685
814
|
updated: number;
|
|
686
815
|
}
|
|
687
816
|
|
|
688
|
-
declare type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom';
|
|
817
|
+
declare type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
|
|
689
818
|
declare type ApiConfig = Pick<CommonServerOptions, 'port' | 'strictPort' | 'host'>;
|
|
690
819
|
|
|
691
820
|
interface EnvironmentOptions {
|
|
@@ -763,7 +892,7 @@ interface InlineConfig {
|
|
|
763
892
|
/**
|
|
764
893
|
* Running environment
|
|
765
894
|
*
|
|
766
|
-
* Supports 'node', 'jsdom', 'happy-dom'
|
|
895
|
+
* Supports 'node', 'jsdom', 'happy-dom', 'edge-runtime'
|
|
767
896
|
*
|
|
768
897
|
* @default 'node'
|
|
769
898
|
*/
|
|
@@ -988,6 +1117,35 @@ interface InlineConfig {
|
|
|
988
1117
|
* @default 5
|
|
989
1118
|
*/
|
|
990
1119
|
maxConcurrency?: number;
|
|
1120
|
+
/**
|
|
1121
|
+
* Options for configuring cache policy.
|
|
1122
|
+
* @default { dir: 'node_modules/.vitest' }
|
|
1123
|
+
*/
|
|
1124
|
+
cache?: false | {
|
|
1125
|
+
dir?: string;
|
|
1126
|
+
};
|
|
1127
|
+
/**
|
|
1128
|
+
* Options for configuring the order of running tests.
|
|
1129
|
+
*/
|
|
1130
|
+
sequence?: {
|
|
1131
|
+
/**
|
|
1132
|
+
* Class that handles sorting and sharding algorithm.
|
|
1133
|
+
* If you only need to change sorting, you can extend
|
|
1134
|
+
* your custom sequencer from `BaseSequencer` from `vitest/node`.
|
|
1135
|
+
* @default BaseSequencer
|
|
1136
|
+
*/
|
|
1137
|
+
sequencer?: TestSequencerConstructor;
|
|
1138
|
+
/**
|
|
1139
|
+
* Should tests run in random order.
|
|
1140
|
+
* @default false
|
|
1141
|
+
*/
|
|
1142
|
+
shuffle?: boolean;
|
|
1143
|
+
/**
|
|
1144
|
+
* Seed for the random number generator.
|
|
1145
|
+
* @default Date.now()
|
|
1146
|
+
*/
|
|
1147
|
+
seed?: number;
|
|
1148
|
+
};
|
|
991
1149
|
}
|
|
992
1150
|
interface UserConfig extends InlineConfig {
|
|
993
1151
|
/**
|
|
@@ -1027,7 +1185,7 @@ interface UserConfig extends InlineConfig {
|
|
|
1027
1185
|
*/
|
|
1028
1186
|
shard?: string;
|
|
1029
1187
|
}
|
|
1030
|
-
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'shard'> {
|
|
1188
|
+
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'shard' | 'cache' | 'sequence'> {
|
|
1031
1189
|
base?: string;
|
|
1032
1190
|
config?: string;
|
|
1033
1191
|
filters?: string[];
|
|
@@ -1042,6 +1200,14 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
1042
1200
|
index: number;
|
|
1043
1201
|
count: number;
|
|
1044
1202
|
};
|
|
1203
|
+
cache: {
|
|
1204
|
+
dir: string;
|
|
1205
|
+
} | false;
|
|
1206
|
+
sequence: {
|
|
1207
|
+
sequencer: TestSequencerConstructor;
|
|
1208
|
+
shuffle?: boolean;
|
|
1209
|
+
seed?: number;
|
|
1210
|
+
};
|
|
1045
1211
|
}
|
|
1046
1212
|
|
|
1047
1213
|
declare type VitestInlineConfig = InlineConfig;
|
|
@@ -1334,26 +1500,70 @@ declare class StateManager {
|
|
|
1334
1500
|
getFilepaths(): string[];
|
|
1335
1501
|
getFailedFilepaths(): string[];
|
|
1336
1502
|
collectFiles(files?: File[]): void;
|
|
1503
|
+
clearFiles(paths?: string[]): void;
|
|
1337
1504
|
updateId(task: Task): void;
|
|
1338
1505
|
updateTasks(packs: TaskResultPack[]): void;
|
|
1339
1506
|
updateUserLog(log: UserConsoleLog): void;
|
|
1340
1507
|
}
|
|
1341
1508
|
|
|
1509
|
+
interface SuiteResultCache {
|
|
1510
|
+
failed: boolean;
|
|
1511
|
+
duration: number;
|
|
1512
|
+
}
|
|
1513
|
+
declare class ResultsCache {
|
|
1514
|
+
private cache;
|
|
1515
|
+
private cachePath;
|
|
1516
|
+
private version;
|
|
1517
|
+
private root;
|
|
1518
|
+
getCachePath(): string | null;
|
|
1519
|
+
setConfig(root: string, config: ResolvedConfig['cache']): void;
|
|
1520
|
+
getResults(fsPath: string): SuiteResultCache | undefined;
|
|
1521
|
+
readFromCache(): Promise<void>;
|
|
1522
|
+
updateResults(files: File[]): void;
|
|
1523
|
+
removeFromCache(filepath: string): void;
|
|
1524
|
+
writeToCache(): Promise<void>;
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
interface CliOptions extends UserConfig {
|
|
1528
|
+
/**
|
|
1529
|
+
* Override the watch mode
|
|
1530
|
+
*/
|
|
1531
|
+
run?: boolean;
|
|
1532
|
+
}
|
|
1533
|
+
declare function startVitest(cliFilters: string[], options: CliOptions, viteOverrides?: UserConfig$1): Promise<boolean>;
|
|
1534
|
+
|
|
1535
|
+
declare type FileStatsCache = Pick<Stats, 'size'>;
|
|
1536
|
+
declare class FilesStatsCache {
|
|
1537
|
+
cache: Map<string, FileStatsCache>;
|
|
1538
|
+
getStats(fsPath: string): FileStatsCache | undefined;
|
|
1539
|
+
updateStats(fsPath: string): Promise<void>;
|
|
1540
|
+
removeStats(fsPath: string): void;
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
declare class VitestCache {
|
|
1544
|
+
results: ResultsCache;
|
|
1545
|
+
stats: FilesStatsCache;
|
|
1546
|
+
getFileTestResults(id: string): SuiteResultCache | undefined;
|
|
1547
|
+
getFileStats(id: string): {
|
|
1548
|
+
size: number;
|
|
1549
|
+
} | undefined;
|
|
1550
|
+
static resolveCacheDir(root: string, dir: string | undefined): string;
|
|
1551
|
+
static clearCache(options: CliOptions): Promise<{
|
|
1552
|
+
dir: string;
|
|
1553
|
+
cleared: boolean;
|
|
1554
|
+
}>;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1342
1557
|
declare class Vitest {
|
|
1343
1558
|
config: ResolvedConfig;
|
|
1344
1559
|
configOverride: Partial<ResolvedConfig> | undefined;
|
|
1345
1560
|
server: ViteDevServer;
|
|
1346
1561
|
state: StateManager;
|
|
1347
1562
|
snapshot: SnapshotManager;
|
|
1563
|
+
cache: VitestCache;
|
|
1348
1564
|
reporters: Reporter[];
|
|
1349
|
-
|
|
1565
|
+
logger: Logger;
|
|
1350
1566
|
pool: WorkerPool | undefined;
|
|
1351
|
-
outputStream: NodeJS.WriteStream & {
|
|
1352
|
-
fd: 1;
|
|
1353
|
-
};
|
|
1354
|
-
errorStream: NodeJS.WriteStream & {
|
|
1355
|
-
fd: 2;
|
|
1356
|
-
};
|
|
1357
1567
|
vitenode: ViteNodeServer;
|
|
1358
1568
|
invalidates: Set<string>;
|
|
1359
1569
|
changedTests: Set<string>;
|
|
@@ -1362,21 +1572,18 @@ declare class Vitest {
|
|
|
1362
1572
|
isFirstRun: boolean;
|
|
1363
1573
|
restartsCount: number;
|
|
1364
1574
|
runner: ViteNodeRunner;
|
|
1365
|
-
private _onRestartListeners;
|
|
1366
1575
|
constructor();
|
|
1576
|
+
private _onRestartListeners;
|
|
1367
1577
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
1368
1578
|
getSerializableConfig(): ResolvedConfig;
|
|
1369
1579
|
start(filters?: string[]): Promise<void>;
|
|
1370
1580
|
private getTestDependencies;
|
|
1371
1581
|
filterTestsBySource(tests: string[]): Promise<string[]>;
|
|
1372
|
-
runFiles(
|
|
1582
|
+
runFiles(paths: string[]): Promise<void>;
|
|
1373
1583
|
rerunFiles(files?: string[], trigger?: string): Promise<void>;
|
|
1374
1584
|
changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
|
|
1375
1585
|
rerunFailed(): Promise<void>;
|
|
1376
1586
|
updateSnapshot(files?: string[]): Promise<void>;
|
|
1377
|
-
log(...args: any[]): void;
|
|
1378
|
-
error(...args: any[]): void;
|
|
1379
|
-
clearScreen(): void;
|
|
1380
1587
|
private _rerunTimer;
|
|
1381
1588
|
private scheduleRerun;
|
|
1382
1589
|
private unregisterWatcher;
|
|
@@ -1391,7 +1598,6 @@ declare class Vitest {
|
|
|
1391
1598
|
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
1392
1599
|
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
1393
1600
|
isInSourceTestFile(code: string): boolean;
|
|
1394
|
-
printError(err: unknown, fullStack?: boolean, type?: string): Promise<void>;
|
|
1395
1601
|
onServerRestarted(fn: () => void): void;
|
|
1396
1602
|
}
|
|
1397
1603
|
|
|
@@ -1399,15 +1605,6 @@ declare function createVitest(options: UserConfig, viteOverrides?: UserConfig$1)
|
|
|
1399
1605
|
|
|
1400
1606
|
declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugin$1[]>;
|
|
1401
1607
|
|
|
1402
|
-
interface CliOptions extends UserConfig {
|
|
1403
|
-
/**
|
|
1404
|
-
* Override the watch mode
|
|
1405
|
-
*/
|
|
1406
|
-
run?: boolean;
|
|
1407
|
-
}
|
|
1408
|
-
declare function startVitest(cliFilters: string[], options: CliOptions, viteOverrides?: UserConfig$1): Promise<boolean>;
|
|
1409
|
-
|
|
1410
|
-
declare type Callback = (...args: any[]) => unknown;
|
|
1411
1608
|
interface ViteRunnerRequest {
|
|
1412
1609
|
(dep: string): any;
|
|
1413
1610
|
callstack: string[];
|
|
@@ -1415,15 +1612,13 @@ interface ViteRunnerRequest {
|
|
|
1415
1612
|
declare class VitestMocker {
|
|
1416
1613
|
options: ExecuteOptions;
|
|
1417
1614
|
private moduleCache;
|
|
1615
|
+
private request;
|
|
1418
1616
|
private static pendingIds;
|
|
1419
1617
|
private static spyModule?;
|
|
1420
|
-
|
|
1421
|
-
private root;
|
|
1422
|
-
private
|
|
1423
|
-
|
|
1424
|
-
get mockMap(): MockMap;
|
|
1425
|
-
on(event: string, cb: Callback): void;
|
|
1426
|
-
private emit;
|
|
1618
|
+
constructor(options: ExecuteOptions, moduleCache: ModuleCacheMap, request: ViteRunnerRequest);
|
|
1619
|
+
private get root();
|
|
1620
|
+
private get base();
|
|
1621
|
+
private get mockMap();
|
|
1427
1622
|
getSuiteFilepath(): string;
|
|
1428
1623
|
getMocks(): {
|
|
1429
1624
|
[x: string]: string | (() => unknown) | null;
|
|
@@ -1432,7 +1627,6 @@ declare class VitestMocker {
|
|
|
1432
1627
|
private resolveMocks;
|
|
1433
1628
|
private callFunctionMock;
|
|
1434
1629
|
getDependencyMock(dep: string): string | (() => unknown) | null;
|
|
1435
|
-
resolveDependency(dep: string): string;
|
|
1436
1630
|
normalizePath(path: string): string;
|
|
1437
1631
|
getFsPath(path: string, external: string | null): string;
|
|
1438
1632
|
resolveMockPath(mockPath: string, external: string | null): string | null;
|
|
@@ -1445,7 +1639,6 @@ declare class VitestMocker {
|
|
|
1445
1639
|
requestWithMock(dep: string): Promise<any>;
|
|
1446
1640
|
queueMock(id: string, importer: string, factory?: () => unknown): void;
|
|
1447
1641
|
queueUnmock(id: string, importer: string): void;
|
|
1448
|
-
withRequest(request: ViteRunnerRequest): VitestMocker;
|
|
1449
1642
|
}
|
|
1450
1643
|
|
|
1451
1644
|
interface ExecuteOptions extends ViteNodeRunnerOptions {
|
|
@@ -1453,8 +1646,6 @@ interface ExecuteOptions extends ViteNodeRunnerOptions {
|
|
|
1453
1646
|
}
|
|
1454
1647
|
declare class VitestRunner extends ViteNodeRunner {
|
|
1455
1648
|
options: ExecuteOptions;
|
|
1456
|
-
mocker: VitestMocker;
|
|
1457
|
-
entries: Set<string>;
|
|
1458
1649
|
constructor(options: ExecuteOptions);
|
|
1459
1650
|
prepareContext(context: Record<string, any>): Record<string, any> & {
|
|
1460
1651
|
__vite_ssr_import__: (dep: string) => Promise<any>;
|
|
@@ -1463,4 +1654,11 @@ declare class VitestRunner extends ViteNodeRunner {
|
|
|
1463
1654
|
};
|
|
1464
1655
|
}
|
|
1465
1656
|
|
|
1466
|
-
|
|
1657
|
+
declare class BaseSequencer implements TestSequencer {
|
|
1658
|
+
protected ctx: Vitest;
|
|
1659
|
+
constructor(ctx: Vitest);
|
|
1660
|
+
shard(files: string[]): Promise<string[]>;
|
|
1661
|
+
sort(files: string[]): Promise<string[]>;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
export { BaseSequencer, ExecuteOptions, TestSequencer, TestSequencerConstructor, Vitest, VitestPlugin, VitestRunner, createVitest, startVitest };
|
package/dist/node.mjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.
|
|
3
|
-
import './chunk-
|
|
4
|
-
import 'tty';
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.0791f2ed.mjs';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.79ccc3de.mjs';
|
|
3
|
+
import './chunk-env-node.26c72624.mjs';
|
|
5
4
|
import 'local-pkg';
|
|
5
|
+
import 'fs';
|
|
6
|
+
import 'module';
|
|
7
|
+
import 'url';
|
|
8
|
+
import './chunk-utils-global.1b22c4fd.mjs';
|
|
9
|
+
import 'tty';
|
|
6
10
|
import 'path';
|
|
7
11
|
import 'vite';
|
|
8
|
-
import 'url';
|
|
9
12
|
import 'process';
|
|
10
|
-
import '
|
|
11
|
-
import './chunk-defaults.dc6dc23d.mjs';
|
|
12
|
-
import 'module';
|
|
13
|
-
import './chunk-constants.7b9cfc82.mjs';
|
|
14
|
-
import 'readline';
|
|
13
|
+
import './chunk-constants.8eb2ed35.mjs';
|
|
15
14
|
import 'os';
|
|
16
15
|
import 'util';
|
|
17
16
|
import 'stream';
|
|
18
17
|
import 'events';
|
|
19
18
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
20
|
-
import './chunk-vite-node-utils.
|
|
19
|
+
import './chunk-vite-node-utils.af8ead96.mjs';
|
|
21
20
|
import 'vm';
|
|
22
21
|
import 'assert';
|
|
23
22
|
import 'debug';
|
|
24
23
|
import 'worker_threads';
|
|
25
|
-
import 'crypto';
|
|
26
24
|
import 'tinypool';
|
|
27
25
|
import 'perf_hooks';
|
|
28
|
-
import './chunk-utils-source-map.
|
|
29
|
-
import '
|
|
30
|
-
import 'child_process';
|
|
26
|
+
import './chunk-utils-source-map.957e7756.mjs';
|
|
27
|
+
import 'crypto';
|
|
31
28
|
import 'buffer';
|
|
29
|
+
import 'child_process';
|
|
30
|
+
import './vendor-index.4bf9c627.mjs';
|
|
32
31
|
import './chunk-magic-string.efe26975.mjs';
|
|
33
|
-
import '
|
|
32
|
+
import 'readline';
|
|
33
|
+
import './vendor-index.de788b6a.mjs';
|