vitest 1.3.1 → 1.4.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 +1 -1
- package/dist/chunks/{integrations-globals.THajbSRg.js → integrations-globals.trMeEBob.js} +3 -3
- package/dist/chunks/{runtime-console.Iloo9fIt.js → runtime-console.tUKE_2UJ.js} +4 -4
- package/dist/chunks/{runtime-runBaseTests.9RbsHRbU.js → runtime-runBaseTests.SKlFOhuq.js} +6 -6
- package/dist/cli.js +4 -4
- package/dist/config.d.ts +1 -1
- package/dist/coverage.d.ts +1 -1
- package/dist/environments.d.ts +1 -1
- package/dist/execute.d.ts +1 -1
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -4
- package/dist/node.d.ts +2 -2
- package/dist/node.js +4 -4
- package/dist/{reporters-MmQN-57K.d.ts → reporters-P7C2ytIv.d.ts} +198 -166
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +2 -1
- package/dist/runners.js +8 -3
- package/dist/{suite-UrZdHRff.d.ts → suite-a18diDsI.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +6 -0
- package/dist/vendor/{base.N3JkKp7j.js → base.Xt0Omgh7.js} +9 -3
- package/dist/vendor/{base.Z38YsPLm.js → base.nhvUBzQY.js} +2 -2
- package/dist/vendor/{cac.wWT9ELdg.js → cac.RvTIWZBK.js} +115 -68
- package/dist/vendor/{execute.27Kk4lQF.js → execute.2_yoIC01.js} +1 -1
- package/dist/vendor/{index.JZMafwT-.js → index.BeX1oZht.js} +1 -1
- package/dist/vendor/{index.9hqYxJUw.js → index.LNWuEnUT.js} +1 -1
- package/dist/vendor/{index.c1V_jzyZ.js → index.e9RDLAeW.js} +39 -21
- package/dist/vendor/{setup-common.snyQUvE3.js → setup-common.vyF1kALR.js} +1 -1
- package/dist/vendor/{utils.GbToHGHI.js → utils.w0xgzP1h.js} +15 -10
- package/dist/vendor/{vi.C5mroSoP.js → vi.JYQecGiw.js} +16 -1
- package/dist/vendor/{vm.o1IruPAo.js → vm.cAHVDF92.js} +2 -2
- package/dist/worker.js +20 -5
- package/dist/workers/forks.js +5 -5
- package/dist/workers/runVmTests.js +5 -5
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +6 -6
- package/dist/workers/vmThreads.js +5 -5
- package/dist/workers.d.ts +6 -3
- package/dist/workers.js +6 -6
- package/package.json +10 -10
|
@@ -344,6 +344,113 @@ interface FakeTimerInstallOpts {
|
|
|
344
344
|
shouldClearNativeTimers?: boolean | undefined;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
type BuiltinPool = 'browser' | 'threads' | 'forks' | 'vmThreads' | 'vmForks' | 'typescript';
|
|
348
|
+
type Pool = BuiltinPool | (string & {});
|
|
349
|
+
interface PoolOptions extends Record<string, unknown> {
|
|
350
|
+
/**
|
|
351
|
+
* Run tests in `node:worker_threads`.
|
|
352
|
+
*
|
|
353
|
+
* Test isolation (when enabled) is done by spawning a new thread for each test file.
|
|
354
|
+
*
|
|
355
|
+
* This pool is used by default.
|
|
356
|
+
*/
|
|
357
|
+
threads?: ThreadsOptions & WorkerContextOptions;
|
|
358
|
+
/**
|
|
359
|
+
* Run tests in `node:child_process` using [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
|
|
360
|
+
*
|
|
361
|
+
* Test isolation (when enabled) is done by spawning a new child process for each test file.
|
|
362
|
+
*/
|
|
363
|
+
forks?: ForksOptions & WorkerContextOptions;
|
|
364
|
+
/**
|
|
365
|
+
* Run tests in isolated `node:vm`.
|
|
366
|
+
* Test files are run parallel using `node:worker_threads`.
|
|
367
|
+
*
|
|
368
|
+
* This makes tests run faster, but VM module is unstable. Your tests might leak memory.
|
|
369
|
+
*/
|
|
370
|
+
vmThreads?: ThreadsOptions & VmOptions;
|
|
371
|
+
/**
|
|
372
|
+
* Run tests in isolated `node:vm`.
|
|
373
|
+
*
|
|
374
|
+
* Test files are run parallel using `node:child_process` [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
|
|
375
|
+
*
|
|
376
|
+
* This makes tests run faster, but VM module is unstable. Your tests might leak memory.
|
|
377
|
+
*/
|
|
378
|
+
vmForks?: ForksOptions & VmOptions;
|
|
379
|
+
}
|
|
380
|
+
interface ThreadsOptions {
|
|
381
|
+
/** Minimum amount of threads to use */
|
|
382
|
+
minThreads?: number;
|
|
383
|
+
/** Maximum amount of threads to use */
|
|
384
|
+
maxThreads?: number;
|
|
385
|
+
/**
|
|
386
|
+
* Run tests inside a single thread.
|
|
387
|
+
*
|
|
388
|
+
* @default false
|
|
389
|
+
*/
|
|
390
|
+
singleThread?: boolean;
|
|
391
|
+
/**
|
|
392
|
+
* Use Atomics to synchronize threads
|
|
393
|
+
*
|
|
394
|
+
* This can improve performance in some cases, but might cause segfault in older Node versions.
|
|
395
|
+
*
|
|
396
|
+
* @default false
|
|
397
|
+
*/
|
|
398
|
+
useAtomics?: boolean;
|
|
399
|
+
}
|
|
400
|
+
interface ForksOptions {
|
|
401
|
+
/** Minimum amount of child processes to use */
|
|
402
|
+
minForks?: number;
|
|
403
|
+
/** Maximum amount of child processes to use */
|
|
404
|
+
maxForks?: number;
|
|
405
|
+
/**
|
|
406
|
+
* Run tests inside a single fork.
|
|
407
|
+
*
|
|
408
|
+
* @default false
|
|
409
|
+
*/
|
|
410
|
+
singleFork?: boolean;
|
|
411
|
+
}
|
|
412
|
+
interface WorkerContextOptions {
|
|
413
|
+
/**
|
|
414
|
+
* Isolate test environment by recycling `worker_threads` or `child_process` after each test
|
|
415
|
+
*
|
|
416
|
+
* @default true
|
|
417
|
+
*/
|
|
418
|
+
isolate?: boolean;
|
|
419
|
+
/**
|
|
420
|
+
* Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
|
|
421
|
+
*
|
|
422
|
+
* See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
|
|
423
|
+
*
|
|
424
|
+
* Set to `process.execArgv` to pass all arguments of the current process.
|
|
425
|
+
*
|
|
426
|
+
* Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
|
|
427
|
+
*
|
|
428
|
+
* @default [] // no execution arguments are passed
|
|
429
|
+
*/
|
|
430
|
+
execArgv?: string[];
|
|
431
|
+
}
|
|
432
|
+
interface VmOptions {
|
|
433
|
+
/**
|
|
434
|
+
* Specifies the memory limit for `worker_thread` or `child_process` before they are recycled.
|
|
435
|
+
* If you see memory leaks, try to tinker this value.
|
|
436
|
+
*/
|
|
437
|
+
memoryLimit?: string | number;
|
|
438
|
+
/** Isolation is always enabled */
|
|
439
|
+
isolate?: true;
|
|
440
|
+
/**
|
|
441
|
+
* Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
|
|
442
|
+
*
|
|
443
|
+
* See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
|
|
444
|
+
*
|
|
445
|
+
* Set to `process.execArgv` to pass all arguments of the current process.
|
|
446
|
+
*
|
|
447
|
+
* Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
|
|
448
|
+
*
|
|
449
|
+
* @default [] // no execution arguments are passed
|
|
450
|
+
*/
|
|
451
|
+
execArgv?: string[];
|
|
452
|
+
}
|
|
453
|
+
|
|
347
454
|
interface ParsedFile extends File {
|
|
348
455
|
start: number;
|
|
349
456
|
end: number;
|
|
@@ -463,61 +570,6 @@ declare class Logger {
|
|
|
463
570
|
printSourceTypeErrors(errors: TypeCheckError[]): Promise<void>;
|
|
464
571
|
}
|
|
465
572
|
|
|
466
|
-
interface InitializeProjectOptions extends UserWorkspaceConfig {
|
|
467
|
-
workspaceConfigPath: string;
|
|
468
|
-
extends?: string;
|
|
469
|
-
}
|
|
470
|
-
declare class WorkspaceProject {
|
|
471
|
-
path: string | number;
|
|
472
|
-
ctx: Vitest;
|
|
473
|
-
options?: InitializeProjectOptions | undefined;
|
|
474
|
-
configOverride: Partial<ResolvedConfig> | undefined;
|
|
475
|
-
config: ResolvedConfig;
|
|
476
|
-
server: ViteDevServer;
|
|
477
|
-
vitenode: ViteNodeServer;
|
|
478
|
-
runner: ViteNodeRunner;
|
|
479
|
-
browser?: ViteDevServer;
|
|
480
|
-
typechecker?: Typechecker;
|
|
481
|
-
closingPromise: Promise<unknown> | undefined;
|
|
482
|
-
browserProvider: BrowserProvider | undefined;
|
|
483
|
-
browserState: {
|
|
484
|
-
files: string[];
|
|
485
|
-
resolve: () => void;
|
|
486
|
-
reject: (v: unknown) => void;
|
|
487
|
-
} | undefined;
|
|
488
|
-
testFilesList: string[] | null;
|
|
489
|
-
private _globalSetups;
|
|
490
|
-
private _provided;
|
|
491
|
-
constructor(path: string | number, ctx: Vitest, options?: InitializeProjectOptions | undefined);
|
|
492
|
-
getName(): string;
|
|
493
|
-
isCore(): boolean;
|
|
494
|
-
provide: (key: string, value: unknown) => void;
|
|
495
|
-
getProvidedContext(): ProvidedContext;
|
|
496
|
-
initializeGlobalSetup(): Promise<void>;
|
|
497
|
-
teardownGlobalSetup(): Promise<void>;
|
|
498
|
-
get logger(): Logger;
|
|
499
|
-
getModulesByFilepath(file: string): Set<vite.ModuleNode>;
|
|
500
|
-
getModuleById(id: string): vite.ModuleNode | undefined;
|
|
501
|
-
getSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
|
|
502
|
-
getBrowserSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
|
|
503
|
-
get reporters(): Reporter[];
|
|
504
|
-
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
505
|
-
globAllTestFiles(include: string[], exclude: string[], includeSource: string[] | undefined, cwd: string): Promise<string[]>;
|
|
506
|
-
isTestFile(id: string): boolean | null;
|
|
507
|
-
globFiles(include: string[], exclude: string[], cwd: string): Promise<string[]>;
|
|
508
|
-
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
509
|
-
isInSourceTestFile(code: string): boolean;
|
|
510
|
-
filterFiles(testFiles: string[], filters: string[] | undefined, dir: string): string[];
|
|
511
|
-
initBrowserServer(configFile: string | undefined): Promise<void>;
|
|
512
|
-
static createBasicProject(ctx: Vitest): WorkspaceProject;
|
|
513
|
-
static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
|
|
514
|
-
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
515
|
-
isBrowserEnabled(): boolean;
|
|
516
|
-
getSerializableConfig(): ResolvedConfig;
|
|
517
|
-
close(): Promise<unknown>;
|
|
518
|
-
initBrowserProvider(): Promise<void>;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
573
|
interface BrowserProviderInitializationOptions {
|
|
522
574
|
browser: string;
|
|
523
575
|
options?: BrowserProviderOptions;
|
|
@@ -599,111 +651,59 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
|
|
|
599
651
|
api: ApiConfig;
|
|
600
652
|
}
|
|
601
653
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
/**
|
|
606
|
-
* Run tests in `node:worker_threads`.
|
|
607
|
-
*
|
|
608
|
-
* Test isolation (when enabled) is done by spawning a new thread for each test file.
|
|
609
|
-
*
|
|
610
|
-
* This pool is used by default.
|
|
611
|
-
*/
|
|
612
|
-
threads?: ThreadsOptions & WorkerContextOptions;
|
|
613
|
-
/**
|
|
614
|
-
* Run tests in `node:child_process` using [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
|
|
615
|
-
*
|
|
616
|
-
* Test isolation (when enabled) is done by spawning a new child process for each test file.
|
|
617
|
-
*/
|
|
618
|
-
forks?: ForksOptions & WorkerContextOptions;
|
|
619
|
-
/**
|
|
620
|
-
* Run tests in isolated `node:vm`.
|
|
621
|
-
* Test files are run parallel using `node:worker_threads`.
|
|
622
|
-
*
|
|
623
|
-
* This makes tests run faster, but VM module is unstable. Your tests might leak memory.
|
|
624
|
-
*/
|
|
625
|
-
vmThreads?: ThreadsOptions & VmOptions;
|
|
626
|
-
/**
|
|
627
|
-
* Run tests in isolated `node:vm`.
|
|
628
|
-
*
|
|
629
|
-
* Test files are run parallel using `node:child_process` [`fork()`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options)
|
|
630
|
-
*
|
|
631
|
-
* This makes tests run faster, but VM module is unstable. Your tests might leak memory.
|
|
632
|
-
*/
|
|
633
|
-
vmForks?: ForksOptions & VmOptions;
|
|
634
|
-
}
|
|
635
|
-
interface ThreadsOptions {
|
|
636
|
-
/** Minimum amount of threads to use */
|
|
637
|
-
minThreads?: number;
|
|
638
|
-
/** Maximum amount of threads to use */
|
|
639
|
-
maxThreads?: number;
|
|
640
|
-
/**
|
|
641
|
-
* Run tests inside a single thread.
|
|
642
|
-
*
|
|
643
|
-
* @default false
|
|
644
|
-
*/
|
|
645
|
-
singleThread?: boolean;
|
|
646
|
-
/**
|
|
647
|
-
* Use Atomics to synchronize threads
|
|
648
|
-
*
|
|
649
|
-
* This can improve performance in some cases, but might cause segfault in older Node versions.
|
|
650
|
-
*
|
|
651
|
-
* @default false
|
|
652
|
-
*/
|
|
653
|
-
useAtomics?: boolean;
|
|
654
|
-
}
|
|
655
|
-
interface ForksOptions {
|
|
656
|
-
/** Minimum amount of child processes to use */
|
|
657
|
-
minForks?: number;
|
|
658
|
-
/** Maximum amount of child processes to use */
|
|
659
|
-
maxForks?: number;
|
|
660
|
-
/**
|
|
661
|
-
* Run tests inside a single fork.
|
|
662
|
-
*
|
|
663
|
-
* @default false
|
|
664
|
-
*/
|
|
665
|
-
singleFork?: boolean;
|
|
666
|
-
}
|
|
667
|
-
interface WorkerContextOptions {
|
|
668
|
-
/**
|
|
669
|
-
* Isolate test environment by recycling `worker_threads` or `child_process` after each test
|
|
670
|
-
*
|
|
671
|
-
* @default true
|
|
672
|
-
*/
|
|
673
|
-
isolate?: boolean;
|
|
674
|
-
/**
|
|
675
|
-
* Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.
|
|
676
|
-
*
|
|
677
|
-
* See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information.
|
|
678
|
-
*
|
|
679
|
-
* Set to `process.execArgv` to pass all arguments of the current process.
|
|
680
|
-
*
|
|
681
|
-
* Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
|
|
682
|
-
*
|
|
683
|
-
* @default [] // no execution arguments are passed
|
|
684
|
-
*/
|
|
685
|
-
execArgv?: string[];
|
|
654
|
+
interface InitializeProjectOptions extends UserWorkspaceConfig {
|
|
655
|
+
workspaceConfigPath: string;
|
|
656
|
+
extends?: string;
|
|
686
657
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
658
|
+
declare class WorkspaceProject {
|
|
659
|
+
path: string | number;
|
|
660
|
+
ctx: Vitest;
|
|
661
|
+
options?: InitializeProjectOptions | undefined;
|
|
662
|
+
configOverride: Partial<ResolvedConfig> | undefined;
|
|
663
|
+
config: ResolvedConfig;
|
|
664
|
+
server: ViteDevServer;
|
|
665
|
+
vitenode: ViteNodeServer;
|
|
666
|
+
runner: ViteNodeRunner;
|
|
667
|
+
browser?: ViteDevServer;
|
|
668
|
+
typechecker?: Typechecker;
|
|
669
|
+
closingPromise: Promise<unknown> | undefined;
|
|
670
|
+
browserProvider: BrowserProvider | undefined;
|
|
671
|
+
browserState: {
|
|
672
|
+
files: string[];
|
|
673
|
+
resolve: () => void;
|
|
674
|
+
reject: (v: unknown) => void;
|
|
675
|
+
} | undefined;
|
|
676
|
+
testFilesList: string[] | null;
|
|
677
|
+
private _globalSetups;
|
|
678
|
+
private _provided;
|
|
679
|
+
constructor(path: string | number, ctx: Vitest, options?: InitializeProjectOptions | undefined);
|
|
680
|
+
getName(): string;
|
|
681
|
+
isCore(): boolean;
|
|
682
|
+
provide: (key: string, value: unknown) => void;
|
|
683
|
+
getProvidedContext(): ProvidedContext;
|
|
684
|
+
initializeGlobalSetup(): Promise<void>;
|
|
685
|
+
teardownGlobalSetup(): Promise<void>;
|
|
686
|
+
get logger(): Logger;
|
|
687
|
+
getModulesByFilepath(file: string): Set<vite.ModuleNode>;
|
|
688
|
+
getModuleById(id: string): vite.ModuleNode | undefined;
|
|
689
|
+
getSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
|
|
690
|
+
getBrowserSourceMapModuleById(id: string): TransformResult$1['map'] | undefined;
|
|
691
|
+
get reporters(): Reporter[];
|
|
692
|
+
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
693
|
+
globAllTestFiles(include: string[], exclude: string[], includeSource: string[] | undefined, cwd: string): Promise<string[]>;
|
|
694
|
+
isTestFile(id: string): boolean | null;
|
|
695
|
+
globFiles(include: string[], exclude: string[], cwd: string): Promise<string[]>;
|
|
696
|
+
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
697
|
+
isInSourceTestFile(code: string): boolean;
|
|
698
|
+
filterFiles(testFiles: string[], filters: string[] | undefined, dir: string): string[];
|
|
699
|
+
initBrowserServer(configFile: string | undefined): Promise<void>;
|
|
700
|
+
static createBasicProject(ctx: Vitest): WorkspaceProject;
|
|
701
|
+
static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
|
|
702
|
+
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
703
|
+
isBrowserEnabled(): boolean;
|
|
704
|
+
getSerializableConfig(): ResolvedConfig;
|
|
705
|
+
close(): Promise<unknown>;
|
|
706
|
+
initBrowserProvider(): Promise<void>;
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
type WorkspaceSpec = [project: WorkspaceProject, testFile: string];
|
|
@@ -846,7 +846,7 @@ declare class VitestCache {
|
|
|
846
846
|
getFileStats(key: string): {
|
|
847
847
|
size: number;
|
|
848
848
|
} | undefined;
|
|
849
|
-
static resolveCacheDir(root: string, dir
|
|
849
|
+
static resolveCacheDir(root: string, dir?: string, projectName?: string): string;
|
|
850
850
|
static clearCache(options: CliOptions): Promise<{
|
|
851
851
|
dir: string;
|
|
852
852
|
cleared: boolean;
|
|
@@ -870,12 +870,12 @@ declare class Vitest {
|
|
|
870
870
|
cache: VitestCache;
|
|
871
871
|
reporters: Reporter[];
|
|
872
872
|
coverageProvider: CoverageProvider | null | undefined;
|
|
873
|
-
browserProvider: BrowserProvider | undefined;
|
|
874
873
|
logger: Logger;
|
|
875
874
|
pool: ProcessPool | undefined;
|
|
876
875
|
vitenode: ViteNodeServer;
|
|
877
876
|
invalidates: Set<string>;
|
|
878
877
|
changedTests: Set<string>;
|
|
878
|
+
watchedTests: Set<string>;
|
|
879
879
|
filenamePattern?: string;
|
|
880
880
|
runningPromise?: Promise<void>;
|
|
881
881
|
closingPromise?: Promise<void>;
|
|
@@ -918,6 +918,10 @@ declare class Vitest {
|
|
|
918
918
|
private _rerunTimer;
|
|
919
919
|
private scheduleRerun;
|
|
920
920
|
getModuleProjects(filepath: string): WorkspaceProject[];
|
|
921
|
+
/**
|
|
922
|
+
* Watch only the specified tests. If no tests are provided, all tests will be watched.
|
|
923
|
+
*/
|
|
924
|
+
watchTests(tests: string[]): void;
|
|
921
925
|
private unregisterWatcher;
|
|
922
926
|
private registerWatcher;
|
|
923
927
|
/**
|
|
@@ -1908,10 +1912,22 @@ interface SequenceOptions {
|
|
|
1908
1912
|
*/
|
|
1909
1913
|
sequencer?: TestSequencerConstructor;
|
|
1910
1914
|
/**
|
|
1911
|
-
* Should tests run in random order.
|
|
1915
|
+
* Should files and tests run in random order.
|
|
1912
1916
|
* @default false
|
|
1913
1917
|
*/
|
|
1914
|
-
shuffle?: boolean
|
|
1918
|
+
shuffle?: boolean | {
|
|
1919
|
+
/**
|
|
1920
|
+
* Should files run in random order. Long running tests will not start
|
|
1921
|
+
* earlier if you enable this option.
|
|
1922
|
+
* @default false
|
|
1923
|
+
*/
|
|
1924
|
+
files?: boolean;
|
|
1925
|
+
/**
|
|
1926
|
+
* Should tests run in random order.
|
|
1927
|
+
* @default false
|
|
1928
|
+
*/
|
|
1929
|
+
tests?: boolean;
|
|
1930
|
+
};
|
|
1915
1931
|
/**
|
|
1916
1932
|
* Should tests run in parallel.
|
|
1917
1933
|
* @default false
|
|
@@ -2371,7 +2387,7 @@ interface InlineConfig {
|
|
|
2371
2387
|
*
|
|
2372
2388
|
* Return `false` to ignore the log.
|
|
2373
2389
|
*/
|
|
2374
|
-
onConsoleLog?: (log: string, type: 'stdout' | 'stderr') =>
|
|
2390
|
+
onConsoleLog?: (log: string, type: 'stdout' | 'stderr') => boolean | void;
|
|
2375
2391
|
/**
|
|
2376
2392
|
* Enable stack trace filtering. If absent, all stack trace frames
|
|
2377
2393
|
* will be shown.
|
|
@@ -2400,10 +2416,13 @@ interface InlineConfig {
|
|
|
2400
2416
|
maxConcurrency?: number;
|
|
2401
2417
|
/**
|
|
2402
2418
|
* Options for configuring cache policy.
|
|
2403
|
-
* @default { dir: 'node_modules/.vitest' }
|
|
2419
|
+
* @default { dir: 'node_modules/.vite/vitest' }
|
|
2404
2420
|
*/
|
|
2405
2421
|
cache?: false | {
|
|
2406
|
-
|
|
2422
|
+
/**
|
|
2423
|
+
* @deprecated Use Vite's "cacheDir" instead if you want to change the cache director. Note caches will be written to "cacheDir\/vitest".
|
|
2424
|
+
*/
|
|
2425
|
+
dir: string;
|
|
2407
2426
|
};
|
|
2408
2427
|
/**
|
|
2409
2428
|
* Options for configuring the order of running tests.
|
|
@@ -2478,6 +2497,12 @@ interface InlineConfig {
|
|
|
2478
2497
|
* @default false
|
|
2479
2498
|
*/
|
|
2480
2499
|
disableConsoleIntercept?: boolean;
|
|
2500
|
+
/**
|
|
2501
|
+
* Include "location" property inside the test definition
|
|
2502
|
+
*
|
|
2503
|
+
* @default false
|
|
2504
|
+
*/
|
|
2505
|
+
includeTaskLocation?: boolean;
|
|
2481
2506
|
}
|
|
2482
2507
|
interface TypecheckConfig {
|
|
2483
2508
|
/**
|
|
@@ -2563,6 +2588,10 @@ interface UserConfig extends InlineConfig {
|
|
|
2563
2588
|
* Additional exclude patterns
|
|
2564
2589
|
*/
|
|
2565
2590
|
cliExclude?: string[];
|
|
2591
|
+
/**
|
|
2592
|
+
* Override vite config's clearScreen from cli
|
|
2593
|
+
*/
|
|
2594
|
+
clearScreen?: boolean;
|
|
2566
2595
|
}
|
|
2567
2596
|
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool' | 'cliExclude'> {
|
|
2568
2597
|
mode: VitestRunMode;
|
|
@@ -2586,6 +2615,9 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
2586
2615
|
count: number;
|
|
2587
2616
|
};
|
|
2588
2617
|
cache: {
|
|
2618
|
+
/**
|
|
2619
|
+
* @deprecated
|
|
2620
|
+
*/
|
|
2589
2621
|
dir: string;
|
|
2590
2622
|
} | false;
|
|
2591
2623
|
sequence: {
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { aS as BaseReporter, aJ as BasicReporter, a_ as BenchmarkBuiltinReporters, aZ as BenchmarkReportsMap, aV as BuiltinReporterOptions, aU as BuiltinReporters, aI as DefaultReporter, aK as DotReporter, aR as GithubActionsReporter, aQ as HangingProcessReporter, aO as JUnitReporter, aW as JsonAssertionResult, aL as JsonReporter, aX as JsonTestResult, aY as JsonTestResults, w as Reporter, aT as ReportersMap, aP as TapFlatReporter, aN as TapReporter, aM as VerboseReporter } from './reporters-
|
|
1
|
+
export { aS as BaseReporter, aJ as BasicReporter, a_ as BenchmarkBuiltinReporters, aZ as BenchmarkReportsMap, aV as BuiltinReporterOptions, aU as BuiltinReporters, aI as DefaultReporter, aK as DotReporter, aR as GithubActionsReporter, aQ as HangingProcessReporter, aO as JUnitReporter, aW as JsonAssertionResult, aL as JsonReporter, aX as JsonTestResult, aY as JsonTestResults, w as Reporter, aT as ReportersMap, aP as TapFlatReporter, aN as TapReporter, aM as VerboseReporter } from './reporters-P7C2ytIv.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
package/dist/reporters.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as BasicReporter, e as BenchmarkReportsMap, D as DefaultReporter, b as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, c as JUnitReporter, J as JsonReporter, R as ReportersMap, d as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.
|
|
1
|
+
export { a as BasicReporter, e as BenchmarkReportsMap, D as DefaultReporter, b as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, c as JUnitReporter, J as JsonReporter, R as ReportersMap, d as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.e9RDLAeW.js';
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'pathe';
|
|
4
4
|
import './vendor/index.ir9i0ywP.js';
|
|
@@ -8,12 +8,12 @@ import '@vitest/utils';
|
|
|
8
8
|
import './vendor/global.CkGT_TMy.js';
|
|
9
9
|
import 'picocolors';
|
|
10
10
|
import 'node:perf_hooks';
|
|
11
|
-
import './chunks/runtime-console.
|
|
11
|
+
import './chunks/runtime-console.tUKE_2UJ.js';
|
|
12
12
|
import 'node:stream';
|
|
13
13
|
import 'node:console';
|
|
14
14
|
import 'node:path';
|
|
15
15
|
import './vendor/date.Ns1pGd_X.js';
|
|
16
|
-
import './vendor/base.
|
|
16
|
+
import './vendor/base.Xt0Omgh7.js';
|
|
17
17
|
import './vendor/tasks.IknbGB2n.js';
|
|
18
18
|
import '@vitest/utils/source-map';
|
|
19
19
|
import 'node:os';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VitestRunner, VitestRunnerImportSource, Suite, Task, CancelReason, Test, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig } from './reporters-
|
|
2
|
+
import { R as ResolvedConfig } from './reporters-P7C2ytIv.js';
|
|
3
3
|
import * as tinybench from 'tinybench';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
|
@@ -23,6 +23,7 @@ declare class VitestTestRunner implements VitestRunner {
|
|
|
23
23
|
constructor(config: ResolvedConfig);
|
|
24
24
|
importFile(filepath: string, source: VitestRunnerImportSource): unknown;
|
|
25
25
|
onBeforeRunFiles(): void;
|
|
26
|
+
onAfterRunFiles(): void;
|
|
26
27
|
onAfterRunSuite(suite: Suite): Promise<void>;
|
|
27
28
|
onAfterRunTask(test: Task): void;
|
|
28
29
|
onCancel(_reason: CancelReason): void;
|
package/dist/runners.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.JYQecGiw.js';
|
|
3
3
|
import './vendor/index.ir9i0ywP.js';
|
|
4
4
|
import { r as rpc } from './vendor/rpc.joBhAkyK.js';
|
|
5
5
|
import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
|
|
@@ -13,7 +13,7 @@ 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.
|
|
16
|
+
import './vendor/base.Xt0Omgh7.js';
|
|
17
17
|
import './vendor/date.Ns1pGd_X.js';
|
|
18
18
|
import '@vitest/spy';
|
|
19
19
|
import 'pathe';
|
|
@@ -36,6 +36,9 @@ class VitestTestRunner {
|
|
|
36
36
|
onBeforeRunFiles() {
|
|
37
37
|
this.snapshotClient.clear();
|
|
38
38
|
}
|
|
39
|
+
onAfterRunFiles() {
|
|
40
|
+
this.workerState.current = void 0;
|
|
41
|
+
}
|
|
39
42
|
async onAfterRunSuite(suite) {
|
|
40
43
|
if (this.config.logHeapUsage && typeof process !== "undefined")
|
|
41
44
|
suite.result.heap = process.memoryUsage().heapUsed;
|
|
@@ -50,12 +53,13 @@ class VitestTestRunner {
|
|
|
50
53
|
if (result)
|
|
51
54
|
await rpc().snapshotSaved(result);
|
|
52
55
|
}
|
|
56
|
+
this.workerState.current = suite.suite;
|
|
53
57
|
}
|
|
54
58
|
onAfterRunTask(test) {
|
|
55
59
|
this.snapshotClient.clearTest();
|
|
56
60
|
if (this.config.logHeapUsage && typeof process !== "undefined")
|
|
57
61
|
test.result.heap = process.memoryUsage().heapUsed;
|
|
58
|
-
this.workerState.current =
|
|
62
|
+
this.workerState.current = test.suite;
|
|
59
63
|
}
|
|
60
64
|
onCancel(_reason) {
|
|
61
65
|
this.cancelRun = true;
|
|
@@ -74,6 +78,7 @@ class VitestTestRunner {
|
|
|
74
78
|
if (suite.mode !== "skip" && typeof suite.filepath !== "undefined") {
|
|
75
79
|
await this.snapshotClient.startCurrentRun(suite.filepath, "__default_name_", this.workerState.config.snapshotOptions);
|
|
76
80
|
}
|
|
81
|
+
this.workerState.current = suite;
|
|
77
82
|
}
|
|
78
83
|
onBeforeTryTask(test) {
|
|
79
84
|
var _a, _b;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Custom } from '@vitest/runner';
|
|
2
2
|
import '@vitest/runner/utils';
|
|
3
|
-
import { ap as BenchFunction, aq as BenchmarkAPI } from './reporters-
|
|
3
|
+
import { ap as BenchFunction, aq as BenchmarkAPI } from './reporters-P7C2ytIv.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, 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-a18diDsI.js';
|
|
4
|
+
import './reporters-P7C2ytIv.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import 'vite-node';
|
|
7
7
|
import '@vitest/snapshot';
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -21,13 +21,13 @@ function getAllMockableProperties(obj, isModule, constructors) {
|
|
|
21
21
|
Map,
|
|
22
22
|
Object: Object2,
|
|
23
23
|
Function,
|
|
24
|
-
RegExp,
|
|
24
|
+
RegExp: RegExp2,
|
|
25
25
|
Array: Array2
|
|
26
26
|
} = constructors;
|
|
27
27
|
const allProps = new Map();
|
|
28
28
|
let curr = obj;
|
|
29
29
|
do {
|
|
30
|
-
if (curr === Object2.prototype || curr === Function.prototype || curr ===
|
|
30
|
+
if (curr === Object2.prototype || curr === Function.prototype || curr === RegExp2.prototype)
|
|
31
31
|
break;
|
|
32
32
|
collectOwnProperties(curr, (key) => {
|
|
33
33
|
const descriptor = Object2.getOwnPropertyDescriptor(curr, key);
|
|
@@ -101,5 +101,11 @@ function setProcessTitle(title) {
|
|
|
101
101
|
} catch {
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
+
function escapeRegExp(s) {
|
|
105
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
106
|
+
}
|
|
107
|
+
function wildcardPatternToRegExp(pattern) {
|
|
108
|
+
return new RegExp(`^${pattern.split("*").map(escapeRegExp).join(".*")}$`, "i");
|
|
109
|
+
}
|
|
104
110
|
|
|
105
|
-
export { AggregateErrorPonyfill as A, slash as a, isPrimitive as b, groupBy as c, deepMerge as d, stdout as e, getAllMockableProperties as g, isChildProcess as i, noop as n, setProcessTitle as s, toArray as t };
|
|
111
|
+
export { AggregateErrorPonyfill as A, slash as a, isPrimitive as b, groupBy as c, deepMerge as d, stdout as e, getAllMockableProperties as g, isChildProcess as i, noop as n, setProcessTitle as s, toArray as t, wildcardPatternToRegExp as w };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModuleCacheMap } from 'vite-node/client';
|
|
2
2
|
import { p as provideWorkerState } from './global.CkGT_TMy.js';
|
|
3
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.
|
|
3
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.2_yoIC01.js';
|
|
4
4
|
|
|
5
5
|
let _viteNode;
|
|
6
6
|
const moduleCache = new ModuleCacheMap();
|
|
@@ -25,7 +25,7 @@ async function runBaseTests(state) {
|
|
|
25
25
|
ctx.files.forEach((i) => state.moduleCache.delete(i));
|
|
26
26
|
const [executor, { run }] = await Promise.all([
|
|
27
27
|
startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
|
|
28
|
-
import('../chunks/runtime-runBaseTests.
|
|
28
|
+
import('../chunks/runtime-runBaseTests.SKlFOhuq.js')
|
|
29
29
|
]);
|
|
30
30
|
await run(
|
|
31
31
|
ctx.files,
|