vitest 0.17.1 → 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.c728e251.mjs → chunk-api-setup.63babd7c.mjs} +4 -4
- package/dist/{chunk-constants.27550afb.mjs → chunk-constants.8eb2ed35.mjs} +1 -1
- package/dist/{chunk-env-node.aa51c4cc.mjs → chunk-env-node.26c72624.mjs} +1 -1
- package/dist/{chunk-install-pkg.6f5930c3.mjs → chunk-install-pkg.2dcb2c04.mjs} +1 -1
- package/dist/{chunk-integrations-globals.3df36e26.mjs → chunk-integrations-globals.61e4d6ae.mjs} +7 -7
- package/dist/{chunk-runtime-chain.6d23d202.mjs → chunk-runtime-chain.eb764dff.mjs} +3 -3
- package/dist/{chunk-runtime-mocker.34b9d585.mjs → chunk-runtime-mocker.79ccc3de.mjs} +3 -3
- package/dist/{chunk-runtime-rpc.d986adb9.mjs → chunk-runtime-rpc.cc6a06a2.mjs} +1 -1
- package/dist/{chunk-utils-global.4828c2e2.mjs → chunk-utils-global.1b22c4fd.mjs} +5 -5
- package/dist/{chunk-utils-source-map.a9047343.mjs → chunk-utils-source-map.957e7756.mjs} +2 -2
- package/dist/{chunk-vite-node-externalize.0fc8ed68.mjs → chunk-vite-node-externalize.0791f2ed.mjs} +2629 -2536
- package/dist/{chunk-vite-node-utils.0f776286.mjs → chunk-vite-node-utils.af8ead96.mjs} +1 -1
- package/dist/cli.mjs +11 -11
- package/dist/entry.mjs +6 -6
- package/dist/index.d.ts +70 -31
- package/dist/index.mjs +4 -4
- package/dist/node.d.ts +72 -40
- package/dist/node.mjs +12 -12
- package/dist/{vendor-entry.1ad8a08d.mjs → vendor-entry.78de67ab.mjs} +6 -6
- package/dist/{vendor-index.a2a385d8.mjs → vendor-index.4bf9c627.mjs} +405 -405
- package/dist/{vendor-index.98e769c1.mjs → vendor-index.de788b6a.mjs} +7 -7
- package/dist/worker.mjs +5 -5
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { builtinModules, createRequire } from 'module';
|
|
2
2
|
import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
|
-
import { t as isAbsolute$2, q as resolve, j as join$2, L as extname$2, d as dirname$2 } from './chunk-utils-global.
|
|
4
|
+
import { t as isAbsolute$2, q as resolve, j as join$2, L as extname$2, d as dirname$2 } from './chunk-utils-global.1b22c4fd.mjs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import fs, { realpathSync, statSync, Stats, promises, existsSync } from 'fs';
|
|
7
7
|
import assert from 'assert';
|
package/dist/cli.mjs
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { p as picocolors } from './chunk-utils-global.
|
|
3
|
-
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.
|
|
2
|
+
import { p as picocolors } from './chunk-utils-global.1b22c4fd.mjs';
|
|
3
|
+
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.0791f2ed.mjs';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
|
6
6
|
import 'path';
|
|
7
|
-
import './chunk-env-node.
|
|
7
|
+
import './chunk-env-node.26c72624.mjs';
|
|
8
8
|
import 'fs';
|
|
9
9
|
import 'module';
|
|
10
10
|
import 'url';
|
|
11
11
|
import 'vite';
|
|
12
12
|
import 'process';
|
|
13
|
-
import './chunk-constants.
|
|
14
|
-
import 'readline';
|
|
13
|
+
import './chunk-constants.8eb2ed35.mjs';
|
|
15
14
|
import 'os';
|
|
16
15
|
import 'util';
|
|
17
16
|
import 'stream';
|
|
18
17
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
19
|
-
import './chunk-vite-node-utils.
|
|
18
|
+
import './chunk-vite-node-utils.af8ead96.mjs';
|
|
20
19
|
import 'vm';
|
|
21
20
|
import 'assert';
|
|
22
21
|
import 'debug';
|
|
23
22
|
import 'worker_threads';
|
|
24
23
|
import 'tinypool';
|
|
25
24
|
import 'perf_hooks';
|
|
26
|
-
import './chunk-utils-source-map.
|
|
27
|
-
import './vendor-index.a2a385d8.mjs';
|
|
28
|
-
import 'child_process';
|
|
29
|
-
import 'buffer';
|
|
25
|
+
import './chunk-utils-source-map.957e7756.mjs';
|
|
30
26
|
import 'crypto';
|
|
27
|
+
import 'buffer';
|
|
28
|
+
import 'child_process';
|
|
29
|
+
import './vendor-index.4bf9c627.mjs';
|
|
31
30
|
import './chunk-magic-string.efe26975.mjs';
|
|
32
|
-
import '
|
|
31
|
+
import 'readline';
|
|
32
|
+
import './vendor-index.de788b6a.mjs';
|
|
33
33
|
|
|
34
34
|
function toArr(any) {
|
|
35
35
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
package/dist/entry.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export { r as run } from './vendor-entry.
|
|
1
|
+
export { r as run } from './vendor-entry.78de67ab.mjs';
|
|
2
2
|
import 'fs';
|
|
3
|
-
import './chunk-utils-global.
|
|
3
|
+
import './chunk-utils-global.1b22c4fd.mjs';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
|
6
6
|
import 'path';
|
|
7
|
-
import './chunk-env-node.
|
|
7
|
+
import './chunk-env-node.26c72624.mjs';
|
|
8
8
|
import 'module';
|
|
9
9
|
import 'url';
|
|
10
|
-
import './chunk-runtime-chain.
|
|
10
|
+
import './chunk-runtime-chain.eb764dff.mjs';
|
|
11
11
|
import 'chai';
|
|
12
12
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
13
|
-
import './chunk-runtime-rpc.
|
|
14
|
-
import './chunk-utils-source-map.
|
|
13
|
+
import './chunk-runtime-rpc.cc6a06a2.mjs';
|
|
14
|
+
import './chunk-utils-source-map.957e7756.mjs';
|
|
15
15
|
import './chunk-integrations-spy.674b628e.mjs';
|
|
16
16
|
import 'tinyspy';
|
|
17
17
|
import 'util';
|
package/dist/index.d.ts
CHANGED
|
@@ -380,6 +380,50 @@ interface WorkerPool {
|
|
|
380
380
|
close: () => Promise<void>;
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
+
declare class StateManager {
|
|
384
|
+
filesMap: Map<string, File>;
|
|
385
|
+
idMap: Map<string, Task>;
|
|
386
|
+
taskFileMap: WeakMap<Task, File>;
|
|
387
|
+
errorsSet: Set<unknown>;
|
|
388
|
+
catchError(err: unknown, type: string): void;
|
|
389
|
+
clearErrors(): void;
|
|
390
|
+
getUnhandledErrors(): unknown[];
|
|
391
|
+
getFiles(keys?: string[]): File[];
|
|
392
|
+
getFilepaths(): string[];
|
|
393
|
+
getFailedFilepaths(): string[];
|
|
394
|
+
collectFiles(files?: File[]): void;
|
|
395
|
+
clearFiles(paths?: string[]): void;
|
|
396
|
+
updateId(task: Task): void;
|
|
397
|
+
updateTasks(packs: TaskResultPack[]): void;
|
|
398
|
+
updateUserLog(log: UserConsoleLog): void;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
declare class Logger {
|
|
402
|
+
ctx: Vitest;
|
|
403
|
+
console: Console;
|
|
404
|
+
outputStream: NodeJS.WriteStream & {
|
|
405
|
+
fd: 1;
|
|
406
|
+
};
|
|
407
|
+
errorStream: NodeJS.WriteStream & {
|
|
408
|
+
fd: 2;
|
|
409
|
+
};
|
|
410
|
+
logUpdate: ((...text: string[]) => void) & {
|
|
411
|
+
clear(): void;
|
|
412
|
+
done(): void;
|
|
413
|
+
};
|
|
414
|
+
private _clearScreenPending;
|
|
415
|
+
constructor(ctx: Vitest, console?: Console);
|
|
416
|
+
log(...args: any[]): void;
|
|
417
|
+
error(...args: any[]): void;
|
|
418
|
+
warn(...args: any[]): void;
|
|
419
|
+
clearScreen(message: string, force?: boolean): void;
|
|
420
|
+
private _clearScreen;
|
|
421
|
+
printError(err: unknown, fullStack?: boolean, type?: string): Promise<void>;
|
|
422
|
+
printNoTestFound(filters?: string[]): void;
|
|
423
|
+
printBanner(): void;
|
|
424
|
+
printUnhandledErrors(errors: unknown[]): Promise<void>;
|
|
425
|
+
}
|
|
426
|
+
|
|
383
427
|
interface SuiteResultCache {
|
|
384
428
|
failed: boolean;
|
|
385
429
|
duration: number;
|
|
@@ -389,6 +433,7 @@ declare class ResultsCache {
|
|
|
389
433
|
private cachePath;
|
|
390
434
|
private version;
|
|
391
435
|
private root;
|
|
436
|
+
getCachePath(): string | null;
|
|
392
437
|
setConfig(root: string, config: ResolvedConfig['cache']): void;
|
|
393
438
|
getResults(fsPath: string): SuiteResultCache | undefined;
|
|
394
439
|
readFromCache(): Promise<void>;
|
|
@@ -397,6 +442,13 @@ declare class ResultsCache {
|
|
|
397
442
|
writeToCache(): Promise<void>;
|
|
398
443
|
}
|
|
399
444
|
|
|
445
|
+
interface CliOptions extends UserConfig {
|
|
446
|
+
/**
|
|
447
|
+
* Override the watch mode
|
|
448
|
+
*/
|
|
449
|
+
run?: boolean;
|
|
450
|
+
}
|
|
451
|
+
|
|
400
452
|
declare type FileStatsCache = Pick<Stats, 'size'>;
|
|
401
453
|
declare class FilesStatsCache {
|
|
402
454
|
cache: Map<string, FileStatsCache>;
|
|
@@ -405,27 +457,18 @@ declare class FilesStatsCache {
|
|
|
405
457
|
removeStats(fsPath: string): void;
|
|
406
458
|
}
|
|
407
459
|
|
|
408
|
-
declare class
|
|
409
|
-
filesMap: Map<string, File>;
|
|
410
|
-
idMap: Map<string, Task>;
|
|
411
|
-
taskFileMap: WeakMap<Task, File>;
|
|
412
|
-
errorsSet: Set<unknown>;
|
|
460
|
+
declare class VitestCache {
|
|
413
461
|
results: ResultsCache;
|
|
414
462
|
stats: FilesStatsCache;
|
|
415
463
|
getFileTestResults(id: string): SuiteResultCache | undefined;
|
|
416
464
|
getFileStats(id: string): {
|
|
417
465
|
size: number;
|
|
418
466
|
} | undefined;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
getFailedFilepaths(): string[];
|
|
425
|
-
collectFiles(files?: File[]): void;
|
|
426
|
-
updateId(task: Task): void;
|
|
427
|
-
updateTasks(packs: TaskResultPack[]): void;
|
|
428
|
-
updateUserLog(log: UserConsoleLog): void;
|
|
467
|
+
static resolveCacheDir(root: string, dir: string | undefined): string;
|
|
468
|
+
static clearCache(options: CliOptions): Promise<{
|
|
469
|
+
dir: string;
|
|
470
|
+
cleared: boolean;
|
|
471
|
+
}>;
|
|
429
472
|
}
|
|
430
473
|
|
|
431
474
|
declare class Vitest {
|
|
@@ -434,15 +477,10 @@ declare class Vitest {
|
|
|
434
477
|
server: ViteDevServer;
|
|
435
478
|
state: StateManager;
|
|
436
479
|
snapshot: SnapshotManager;
|
|
480
|
+
cache: VitestCache;
|
|
437
481
|
reporters: Reporter[];
|
|
438
|
-
|
|
482
|
+
logger: Logger;
|
|
439
483
|
pool: WorkerPool | undefined;
|
|
440
|
-
outputStream: NodeJS.WriteStream & {
|
|
441
|
-
fd: 1;
|
|
442
|
-
};
|
|
443
|
-
errorStream: NodeJS.WriteStream & {
|
|
444
|
-
fd: 2;
|
|
445
|
-
};
|
|
446
484
|
vitenode: ViteNodeServer;
|
|
447
485
|
invalidates: Set<string>;
|
|
448
486
|
changedTests: Set<string>;
|
|
@@ -451,8 +489,8 @@ declare class Vitest {
|
|
|
451
489
|
isFirstRun: boolean;
|
|
452
490
|
restartsCount: number;
|
|
453
491
|
runner: ViteNodeRunner;
|
|
454
|
-
private _onRestartListeners;
|
|
455
492
|
constructor();
|
|
493
|
+
private _onRestartListeners;
|
|
456
494
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
457
495
|
getSerializableConfig(): ResolvedConfig;
|
|
458
496
|
start(filters?: string[]): Promise<void>;
|
|
@@ -463,9 +501,6 @@ declare class Vitest {
|
|
|
463
501
|
changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
|
|
464
502
|
rerunFailed(): Promise<void>;
|
|
465
503
|
updateSnapshot(files?: string[]): Promise<void>;
|
|
466
|
-
log(...args: any[]): void;
|
|
467
|
-
error(...args: any[]): void;
|
|
468
|
-
clearScreen(): void;
|
|
469
504
|
private _rerunTimer;
|
|
470
505
|
private scheduleRerun;
|
|
471
506
|
private unregisterWatcher;
|
|
@@ -480,7 +515,6 @@ declare class Vitest {
|
|
|
480
515
|
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
481
516
|
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
482
517
|
isInSourceTestFile(code: string): boolean;
|
|
483
|
-
printError(err: unknown, fullStack?: boolean, type?: string): Promise<void>;
|
|
484
518
|
onServerRestarted(fn: () => void): void;
|
|
485
519
|
}
|
|
486
520
|
|
|
@@ -494,7 +528,7 @@ interface TestSequencer {
|
|
|
494
528
|
shard(files: string[]): Awaitable<string[]>;
|
|
495
529
|
sort(files: string[]): Awaitable<string[]>;
|
|
496
530
|
}
|
|
497
|
-
interface
|
|
531
|
+
interface TestSequencerConstructor {
|
|
498
532
|
new (ctx: Vitest): TestSequencer;
|
|
499
533
|
}
|
|
500
534
|
|
|
@@ -504,12 +538,17 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
504
538
|
watchFilters?: string[];
|
|
505
539
|
isTTY: boolean;
|
|
506
540
|
ctx: Vitest;
|
|
541
|
+
private _filesInWatchMode;
|
|
542
|
+
private _lastRunTimeout;
|
|
543
|
+
private _lastRunTimer;
|
|
544
|
+
private _lastRunCount;
|
|
507
545
|
constructor();
|
|
508
546
|
onInit(ctx: Vitest): void;
|
|
509
547
|
relative(path: string): string;
|
|
510
548
|
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
511
549
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
512
550
|
onWatcherStart(): Promise<void>;
|
|
551
|
+
private resetLastRunLog;
|
|
513
552
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
514
553
|
onUserConsoleLog(log: UserConsoleLog): void;
|
|
515
554
|
shouldLog(log: UserConsoleLog): boolean;
|
|
@@ -521,7 +560,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
521
560
|
|
|
522
561
|
interface ListRendererOptions {
|
|
523
562
|
renderSucceed?: boolean;
|
|
524
|
-
|
|
563
|
+
logger: Logger;
|
|
525
564
|
showHeap: boolean;
|
|
526
565
|
}
|
|
527
566
|
declare const createListRenderer: (_tasks: Task[], options: ListRendererOptions) => {
|
|
@@ -1314,7 +1353,7 @@ interface InlineConfig {
|
|
|
1314
1353
|
* your custom sequencer from `BaseSequencer` from `vitest/node`.
|
|
1315
1354
|
* @default BaseSequencer
|
|
1316
1355
|
*/
|
|
1317
|
-
sequencer?:
|
|
1356
|
+
sequencer?: TestSequencerConstructor;
|
|
1318
1357
|
/**
|
|
1319
1358
|
* Should tests run in random order.
|
|
1320
1359
|
* @default false
|
|
@@ -1384,7 +1423,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
1384
1423
|
dir: string;
|
|
1385
1424
|
} | false;
|
|
1386
1425
|
sequence: {
|
|
1387
|
-
sequencer:
|
|
1426
|
+
sequencer: TestSequencerConstructor;
|
|
1388
1427
|
shuffle?: boolean;
|
|
1389
1428
|
seed?: number;
|
|
1390
1429
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { c as afterAll, f as afterEach, b as beforeAll, e as beforeEach, g as createExpect, d as describe, h as expect, k as getRunningMode, a as isFirstRun, l as isWatchMode, i as it, r as runOnce, s as suite, t as test, j as vi, v as vitest, w as withCallback } from './chunk-runtime-chain.
|
|
1
|
+
export { c as afterAll, f as afterEach, b as beforeAll, e as beforeEach, g as createExpect, d as describe, h as expect, k as getRunningMode, a as isFirstRun, l as isWatchMode, i as it, r as runOnce, s as suite, t as test, j as vi, v as vitest, w as withCallback } from './chunk-runtime-chain.eb764dff.mjs';
|
|
2
2
|
export { assert, default as chai, should } from 'chai';
|
|
3
3
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
4
|
-
import './chunk-runtime-rpc.
|
|
5
|
-
import './chunk-utils-global.
|
|
4
|
+
import './chunk-runtime-rpc.cc6a06a2.mjs';
|
|
5
|
+
import './chunk-utils-global.1b22c4fd.mjs';
|
|
6
6
|
import 'tty';
|
|
7
7
|
import 'local-pkg';
|
|
8
8
|
import 'path';
|
|
9
9
|
import 'fs';
|
|
10
|
-
import './chunk-utils-source-map.
|
|
10
|
+
import './chunk-utils-source-map.957e7756.mjs';
|
|
11
11
|
import './chunk-integrations-spy.674b628e.mjs';
|
|
12
12
|
import 'tinyspy';
|
|
13
13
|
import 'util';
|
package/dist/node.d.ts
CHANGED
|
@@ -367,12 +367,17 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
367
367
|
watchFilters?: string[];
|
|
368
368
|
isTTY: boolean;
|
|
369
369
|
ctx: Vitest;
|
|
370
|
+
private _filesInWatchMode;
|
|
371
|
+
private _lastRunTimeout;
|
|
372
|
+
private _lastRunTimer;
|
|
373
|
+
private _lastRunCount;
|
|
370
374
|
constructor();
|
|
371
375
|
onInit(ctx: Vitest): void;
|
|
372
376
|
relative(path: string): string;
|
|
373
377
|
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
374
378
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
375
379
|
onWatcherStart(): Promise<void>;
|
|
380
|
+
private resetLastRunLog;
|
|
376
381
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
377
382
|
onUserConsoleLog(log: UserConsoleLog): void;
|
|
378
383
|
shouldLog(log: UserConsoleLog): boolean;
|
|
@@ -382,9 +387,35 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
382
387
|
registerUnhandledRejection(): void;
|
|
383
388
|
}
|
|
384
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
|
+
|
|
385
416
|
interface ListRendererOptions {
|
|
386
417
|
renderSucceed?: boolean;
|
|
387
|
-
|
|
418
|
+
logger: Logger;
|
|
388
419
|
showHeap: boolean;
|
|
389
420
|
}
|
|
390
421
|
declare const createListRenderer: (_tasks: Task[], options: ListRendererOptions) => {
|
|
@@ -482,7 +513,7 @@ interface TestSequencer {
|
|
|
482
513
|
shard(files: string[]): Awaitable<string[]>;
|
|
483
514
|
sort(files: string[]): Awaitable<string[]>;
|
|
484
515
|
}
|
|
485
|
-
interface
|
|
516
|
+
interface TestSequencerConstructor {
|
|
486
517
|
new (ctx: Vitest): TestSequencer;
|
|
487
518
|
}
|
|
488
519
|
|
|
@@ -1103,7 +1134,7 @@ interface InlineConfig {
|
|
|
1103
1134
|
* your custom sequencer from `BaseSequencer` from `vitest/node`.
|
|
1104
1135
|
* @default BaseSequencer
|
|
1105
1136
|
*/
|
|
1106
|
-
sequencer?:
|
|
1137
|
+
sequencer?: TestSequencerConstructor;
|
|
1107
1138
|
/**
|
|
1108
1139
|
* Should tests run in random order.
|
|
1109
1140
|
* @default false
|
|
@@ -1173,7 +1204,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
1173
1204
|
dir: string;
|
|
1174
1205
|
} | false;
|
|
1175
1206
|
sequence: {
|
|
1176
|
-
sequencer:
|
|
1207
|
+
sequencer: TestSequencerConstructor;
|
|
1177
1208
|
shuffle?: boolean;
|
|
1178
1209
|
seed?: number;
|
|
1179
1210
|
};
|
|
@@ -1457,6 +1488,24 @@ interface WorkerPool {
|
|
|
1457
1488
|
close: () => Promise<void>;
|
|
1458
1489
|
}
|
|
1459
1490
|
|
|
1491
|
+
declare class StateManager {
|
|
1492
|
+
filesMap: Map<string, File>;
|
|
1493
|
+
idMap: Map<string, Task>;
|
|
1494
|
+
taskFileMap: WeakMap<Task, File>;
|
|
1495
|
+
errorsSet: Set<unknown>;
|
|
1496
|
+
catchError(err: unknown, type: string): void;
|
|
1497
|
+
clearErrors(): void;
|
|
1498
|
+
getUnhandledErrors(): unknown[];
|
|
1499
|
+
getFiles(keys?: string[]): File[];
|
|
1500
|
+
getFilepaths(): string[];
|
|
1501
|
+
getFailedFilepaths(): string[];
|
|
1502
|
+
collectFiles(files?: File[]): void;
|
|
1503
|
+
clearFiles(paths?: string[]): void;
|
|
1504
|
+
updateId(task: Task): void;
|
|
1505
|
+
updateTasks(packs: TaskResultPack[]): void;
|
|
1506
|
+
updateUserLog(log: UserConsoleLog): void;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1460
1509
|
interface SuiteResultCache {
|
|
1461
1510
|
failed: boolean;
|
|
1462
1511
|
duration: number;
|
|
@@ -1466,6 +1515,7 @@ declare class ResultsCache {
|
|
|
1466
1515
|
private cachePath;
|
|
1467
1516
|
private version;
|
|
1468
1517
|
private root;
|
|
1518
|
+
getCachePath(): string | null;
|
|
1469
1519
|
setConfig(root: string, config: ResolvedConfig['cache']): void;
|
|
1470
1520
|
getResults(fsPath: string): SuiteResultCache | undefined;
|
|
1471
1521
|
readFromCache(): Promise<void>;
|
|
@@ -1474,6 +1524,14 @@ declare class ResultsCache {
|
|
|
1474
1524
|
writeToCache(): Promise<void>;
|
|
1475
1525
|
}
|
|
1476
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
|
+
|
|
1477
1535
|
declare type FileStatsCache = Pick<Stats, 'size'>;
|
|
1478
1536
|
declare class FilesStatsCache {
|
|
1479
1537
|
cache: Map<string, FileStatsCache>;
|
|
@@ -1482,27 +1540,18 @@ declare class FilesStatsCache {
|
|
|
1482
1540
|
removeStats(fsPath: string): void;
|
|
1483
1541
|
}
|
|
1484
1542
|
|
|
1485
|
-
declare class
|
|
1486
|
-
filesMap: Map<string, File>;
|
|
1487
|
-
idMap: Map<string, Task>;
|
|
1488
|
-
taskFileMap: WeakMap<Task, File>;
|
|
1489
|
-
errorsSet: Set<unknown>;
|
|
1543
|
+
declare class VitestCache {
|
|
1490
1544
|
results: ResultsCache;
|
|
1491
1545
|
stats: FilesStatsCache;
|
|
1492
1546
|
getFileTestResults(id: string): SuiteResultCache | undefined;
|
|
1493
1547
|
getFileStats(id: string): {
|
|
1494
1548
|
size: number;
|
|
1495
1549
|
} | undefined;
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
getFailedFilepaths(): string[];
|
|
1502
|
-
collectFiles(files?: File[]): void;
|
|
1503
|
-
updateId(task: Task): void;
|
|
1504
|
-
updateTasks(packs: TaskResultPack[]): void;
|
|
1505
|
-
updateUserLog(log: UserConsoleLog): void;
|
|
1550
|
+
static resolveCacheDir(root: string, dir: string | undefined): string;
|
|
1551
|
+
static clearCache(options: CliOptions): Promise<{
|
|
1552
|
+
dir: string;
|
|
1553
|
+
cleared: boolean;
|
|
1554
|
+
}>;
|
|
1506
1555
|
}
|
|
1507
1556
|
|
|
1508
1557
|
declare class Vitest {
|
|
@@ -1511,15 +1560,10 @@ declare class Vitest {
|
|
|
1511
1560
|
server: ViteDevServer;
|
|
1512
1561
|
state: StateManager;
|
|
1513
1562
|
snapshot: SnapshotManager;
|
|
1563
|
+
cache: VitestCache;
|
|
1514
1564
|
reporters: Reporter[];
|
|
1515
|
-
|
|
1565
|
+
logger: Logger;
|
|
1516
1566
|
pool: WorkerPool | undefined;
|
|
1517
|
-
outputStream: NodeJS.WriteStream & {
|
|
1518
|
-
fd: 1;
|
|
1519
|
-
};
|
|
1520
|
-
errorStream: NodeJS.WriteStream & {
|
|
1521
|
-
fd: 2;
|
|
1522
|
-
};
|
|
1523
1567
|
vitenode: ViteNodeServer;
|
|
1524
1568
|
invalidates: Set<string>;
|
|
1525
1569
|
changedTests: Set<string>;
|
|
@@ -1528,8 +1572,8 @@ declare class Vitest {
|
|
|
1528
1572
|
isFirstRun: boolean;
|
|
1529
1573
|
restartsCount: number;
|
|
1530
1574
|
runner: ViteNodeRunner;
|
|
1531
|
-
private _onRestartListeners;
|
|
1532
1575
|
constructor();
|
|
1576
|
+
private _onRestartListeners;
|
|
1533
1577
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
1534
1578
|
getSerializableConfig(): ResolvedConfig;
|
|
1535
1579
|
start(filters?: string[]): Promise<void>;
|
|
@@ -1540,9 +1584,6 @@ declare class Vitest {
|
|
|
1540
1584
|
changeNamePattern(pattern: string, files?: string[], trigger?: string): Promise<void>;
|
|
1541
1585
|
rerunFailed(): Promise<void>;
|
|
1542
1586
|
updateSnapshot(files?: string[]): Promise<void>;
|
|
1543
|
-
log(...args: any[]): void;
|
|
1544
|
-
error(...args: any[]): void;
|
|
1545
|
-
clearScreen(): void;
|
|
1546
1587
|
private _rerunTimer;
|
|
1547
1588
|
private scheduleRerun;
|
|
1548
1589
|
private unregisterWatcher;
|
|
@@ -1557,7 +1598,6 @@ declare class Vitest {
|
|
|
1557
1598
|
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
1558
1599
|
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
1559
1600
|
isInSourceTestFile(code: string): boolean;
|
|
1560
|
-
printError(err: unknown, fullStack?: boolean, type?: string): Promise<void>;
|
|
1561
1601
|
onServerRestarted(fn: () => void): void;
|
|
1562
1602
|
}
|
|
1563
1603
|
|
|
@@ -1565,14 +1605,6 @@ declare function createVitest(options: UserConfig, viteOverrides?: UserConfig$1)
|
|
|
1565
1605
|
|
|
1566
1606
|
declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugin$1[]>;
|
|
1567
1607
|
|
|
1568
|
-
interface CliOptions extends UserConfig {
|
|
1569
|
-
/**
|
|
1570
|
-
* Override the watch mode
|
|
1571
|
-
*/
|
|
1572
|
-
run?: boolean;
|
|
1573
|
-
}
|
|
1574
|
-
declare function startVitest(cliFilters: string[], options: CliOptions, viteOverrides?: UserConfig$1): Promise<boolean>;
|
|
1575
|
-
|
|
1576
1608
|
interface ViteRunnerRequest {
|
|
1577
1609
|
(dep: string): any;
|
|
1578
1610
|
callstack: string[];
|
|
@@ -1629,4 +1661,4 @@ declare class BaseSequencer implements TestSequencer {
|
|
|
1629
1661
|
sort(files: string[]): Promise<string[]>;
|
|
1630
1662
|
}
|
|
1631
1663
|
|
|
1632
|
-
export { BaseSequencer, ExecuteOptions, TestSequencer,
|
|
1664
|
+
export { BaseSequencer, ExecuteOptions, TestSequencer, TestSequencerConstructor, Vitest, VitestPlugin, VitestRunner, createVitest, startVitest };
|
package/dist/node.mjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
export { B as BaseSequencer, 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-env-node.
|
|
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';
|
|
4
4
|
import 'local-pkg';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'module';
|
|
7
7
|
import 'url';
|
|
8
|
-
import './chunk-utils-global.
|
|
8
|
+
import './chunk-utils-global.1b22c4fd.mjs';
|
|
9
9
|
import 'tty';
|
|
10
10
|
import 'path';
|
|
11
11
|
import 'vite';
|
|
12
12
|
import 'process';
|
|
13
|
-
import './chunk-constants.
|
|
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
24
|
import 'tinypool';
|
|
26
25
|
import 'perf_hooks';
|
|
27
|
-
import './chunk-utils-source-map.
|
|
28
|
-
import './vendor-index.a2a385d8.mjs';
|
|
29
|
-
import 'child_process';
|
|
30
|
-
import 'buffer';
|
|
26
|
+
import './chunk-utils-source-map.957e7756.mjs';
|
|
31
27
|
import 'crypto';
|
|
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';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { v as isNode, a as getWorkerState, R as RealDate, h as safeClearTimeout, f as safeSetTimeout, F as toArray, Q as deepClone, O as getType, u as relative, S as partitionSuiteChildren, E as shuffle, T as hasTests, y as hasFailed, e as getFullName, k as resetModules } from './chunk-utils-global.
|
|
3
|
-
import { d as environments, t as takeCoverage, p as pLimit, f as envs } from './chunk-env-node.
|
|
4
|
-
import { s as suite, t as test, d as describe, i as it, r as runOnce, a as isFirstRun, b as beforeAll, c as afterAll, e as beforeEach, f as afterEach, w as withCallback, g as createExpect, h as globalExpect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter, n as clearCollectorContext, o as defaultSuite, p as setHooks, q as getHooks, u as collectorContext, x as getSnapshotClient, y as setState, G as GLOBAL_EXPECT, z as getFn, A as getState } from './chunk-runtime-chain.
|
|
2
|
+
import { v as isNode, a as getWorkerState, R as RealDate, h as safeClearTimeout, f as safeSetTimeout, F as toArray, Q as deepClone, O as getType, u as relative, S as partitionSuiteChildren, E as shuffle, T as hasTests, y as hasFailed, e as getFullName, k as resetModules } from './chunk-utils-global.1b22c4fd.mjs';
|
|
3
|
+
import { d as environments, t as takeCoverage, p as pLimit, f as envs } from './chunk-env-node.26c72624.mjs';
|
|
4
|
+
import { s as suite, t as test, d as describe, i as it, r as runOnce, a as isFirstRun, b as beforeAll, c as afterAll, e as beforeEach, f as afterEach, w as withCallback, g as createExpect, h as globalExpect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter, n as clearCollectorContext, o as defaultSuite, p as setHooks, q as getHooks, u as collectorContext, x as getSnapshotClient, y as setState, G as GLOBAL_EXPECT, z as getFn, A as getState } from './chunk-runtime-chain.eb764dff.mjs';
|
|
5
5
|
import chai, { assert, should, util } from 'chai';
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.cc6a06a2.mjs';
|
|
7
7
|
import { format } from 'util';
|
|
8
|
-
import { s as stringify } from './chunk-utils-source-map.
|
|
8
|
+
import { s as stringify } from './chunk-utils-source-map.957e7756.mjs';
|
|
9
9
|
|
|
10
10
|
var index = /*#__PURE__*/Object.freeze({
|
|
11
11
|
__proto__: null,
|
|
@@ -45,7 +45,7 @@ async function setupGlobalEnv(config) {
|
|
|
45
45
|
if (isNode)
|
|
46
46
|
await setupConsoleLogSpy();
|
|
47
47
|
if (config.globals)
|
|
48
|
-
(await import('./chunk-integrations-globals.
|
|
48
|
+
(await import('./chunk-integrations-globals.61e4d6ae.mjs')).registerApiGlobally();
|
|
49
49
|
}
|
|
50
50
|
function setupDefines(defines) {
|
|
51
51
|
for (const key in defines)
|