vitest 3.0.0-beta.3 → 3.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -315
- package/config.d.ts +2 -0
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +1 -1
- package/dist/chunks/{RandomSequencer.C6x84bNN.js → RandomSequencer.DB__To1b.js} +35 -6
- package/dist/chunks/{base.CQ2VEtuH.js → base.BJ8KO-VX.js} +2 -2
- package/dist/chunks/{cac.e7qW4xLT.js → cac.BAYqQ2aM.js} +7 -7
- package/dist/chunks/{cli-api.CWDlED-m.js → cli-api.Dhl34Trr.js} +24 -24
- package/dist/chunks/{config.BTPBhmK5.d.ts → config.BRtC-JeT.d.ts} +6 -0
- package/dist/chunks/{console.BYGVloWk.js → console.CN7AiMGV.js} +16 -7
- package/dist/chunks/{execute.2pr0rHgK.js → execute.BMOaRArH.js} +27 -16
- package/dist/chunks/{globals.BFncSRNA.js → globals.C5RQxaV3.js} +2 -2
- package/dist/chunks/{index.BBoOXW-l.js → index.B2M9nD1V.js} +1 -1
- package/dist/chunks/{index.CkWmZCXU.js → index.BQbxGbG9.js} +1 -1
- package/dist/chunks/index.CAueP3cK.js +3205 -0
- package/dist/chunks/{reporters.DCiyjXOg.d.ts → reporters.Dcdq51WE.d.ts} +80 -155
- package/dist/chunks/{resolveConfig.C1d7TK-U.js → resolveConfig.kZFMjKCQ.js} +4 -4
- package/dist/chunks/{runBaseTests.qNWRkgHj.js → runBaseTests.URiUrnWK.js} +8 -6
- package/dist/chunks/{setup-common.Cp_bu5q3.js → setup-common.D0zLenuv.js} +1 -1
- package/dist/chunks/{utils.Coei4Wlj.js → utils.yHKcm4dz.js} +9 -20
- package/dist/chunks/{vi.S4Fq8wSo.js → vi.Da_PT3Vw.js} +554 -272
- package/dist/chunks/{vite.CRSMFy31.d.ts → vite.DzluO1Kj.d.ts} +1 -1
- package/dist/chunks/{vm.DGhTouO3.js → vm.DrFVeTXo.js} +4 -4
- package/dist/chunks/{worker.R-PA7DpW.d.ts → worker.BIVMnzXw.d.ts} +1 -1
- package/dist/chunks/{worker.XbtCXEXv.d.ts → worker.Hz_LAzfd.d.ts} +1 -1
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +4 -4
- package/dist/coverage.d.ts +2 -2
- package/dist/coverage.js +2 -2
- package/dist/execute.d.ts +3 -3
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +2 -2
- package/dist/node.d.ts +5 -5
- package/dist/node.js +8 -9
- package/dist/reporters.d.ts +2 -2
- package/dist/reporters.js +3 -7
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +3 -10
- package/dist/workers/forks.js +2 -2
- package/dist/workers/runVmTests.js +7 -5
- package/dist/workers/threads.js +2 -2
- package/dist/workers/vmForks.js +3 -3
- package/dist/workers/vmThreads.js +3 -3
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +4 -4
- package/package.json +15 -17
- package/dist/chunks/index.CzkCSFCy.js +0 -5455
|
@@ -5,7 +5,7 @@ import { TestError, ParsedStack, Arrayable, ErrorWithDiff, Awaitable as Awaitabl
|
|
|
5
5
|
import { Writable } from 'node:stream';
|
|
6
6
|
import { TransformResult as TransformResult$1, ServerOptions, DepOptimizationConfig, AliasOptions, UserConfig as UserConfig$1, ConfigEnv, ViteDevServer, ModuleNode } from 'vite';
|
|
7
7
|
import { StackTraceParserOptions } from '@vitest/utils/source-map';
|
|
8
|
-
import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.
|
|
8
|
+
import { S as SerializedConfig, F as FakeTimerInstallOpts } from './config.BRtC-JeT.js';
|
|
9
9
|
import { PrettyFormatOptions } from '@vitest/pretty-format';
|
|
10
10
|
import { SnapshotSummary, SnapshotStateOptions } from '@vitest/snapshot';
|
|
11
11
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
@@ -29,7 +29,7 @@ type SerializedTestSpecification = [
|
|
|
29
29
|
|
|
30
30
|
declare class ReportedTaskImplementation {
|
|
31
31
|
/**
|
|
32
|
-
* The project
|
|
32
|
+
* The project associated with the test or suite.
|
|
33
33
|
*/
|
|
34
34
|
readonly project: TestProject;
|
|
35
35
|
/**
|
|
@@ -332,6 +332,9 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
332
332
|
relative(path: string): string;
|
|
333
333
|
onFinished(files?: File[], errors?: unknown[]): void;
|
|
334
334
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
335
|
+
/**
|
|
336
|
+
* Callback invoked with a single `Task` from `onTaskUpdate`
|
|
337
|
+
*/
|
|
335
338
|
protected printTask(task: Task): void;
|
|
336
339
|
private getDurationPrefix;
|
|
337
340
|
onWatcherStart(files?: File[], errors?: unknown[]): void;
|
|
@@ -624,166 +627,38 @@ declare class TapFlatReporter extends TapReporter {
|
|
|
624
627
|
declare class VerboseReporter extends DefaultReporter {
|
|
625
628
|
protected verbose: boolean;
|
|
626
629
|
renderSucceed: boolean;
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
declare class TypeCheckError extends Error {
|
|
631
|
-
message: string;
|
|
632
|
-
stacks: ParsedStack[];
|
|
633
|
-
name: string;
|
|
634
|
-
constructor(message: string, stacks: ParsedStack[]);
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
interface PrintErrorResult {
|
|
638
|
-
nearest?: ParsedStack;
|
|
630
|
+
printTask(task: Task): void;
|
|
639
631
|
}
|
|
640
632
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
Show the cursor. This can be useful when a CLI accepts input from a user.
|
|
644
|
-
|
|
645
|
-
@example
|
|
646
|
-
```
|
|
647
|
-
import {createLogUpdate} from 'log-update';
|
|
648
|
-
|
|
649
|
-
// Write output but don't hide the cursor
|
|
650
|
-
const log = createLogUpdate(process.stdout, {
|
|
651
|
-
showCursor: true
|
|
652
|
-
});
|
|
653
|
-
```
|
|
654
|
-
*/
|
|
655
|
-
readonly showCursor?: boolean;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
type LogUpdateMethods = {
|
|
659
|
-
/**
|
|
660
|
-
Clear the logged output.
|
|
661
|
-
*/
|
|
662
|
-
clear(): void;
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
Persist the logged output. Useful if you want to start a new log session below the current one.
|
|
666
|
-
*/
|
|
667
|
-
done(): void;
|
|
633
|
+
type FormattedBenchmarkResult = BenchmarkResult & {
|
|
634
|
+
id: string;
|
|
668
635
|
};
|
|
669
636
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
@example
|
|
676
|
-
```
|
|
677
|
-
import logUpdate from 'log-update';
|
|
678
|
-
|
|
679
|
-
const frames = ['-', '\\', '|', '/'];
|
|
680
|
-
let index = 0;
|
|
681
|
-
|
|
682
|
-
setInterval(() => {
|
|
683
|
-
const frame = frames[index = ++index % frames.length];
|
|
684
|
-
|
|
685
|
-
logUpdate(
|
|
686
|
-
`
|
|
687
|
-
♥♥
|
|
688
|
-
${frame} unicorns ${frame}
|
|
689
|
-
♥♥
|
|
690
|
-
`
|
|
691
|
-
);
|
|
692
|
-
}, 80);
|
|
693
|
-
```
|
|
694
|
-
*/
|
|
695
|
-
declare const logUpdate: ((...text: string[]) => void) & LogUpdateMethods;
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
/**
|
|
699
|
-
Get a `logUpdate` method that logs to the specified stream.
|
|
700
|
-
|
|
701
|
-
@param stream - The stream to log to.
|
|
702
|
-
|
|
703
|
-
@example
|
|
704
|
-
```
|
|
705
|
-
import {createLogUpdate} from 'log-update';
|
|
706
|
-
|
|
707
|
-
// Write output but don't hide the cursor
|
|
708
|
-
const log = createLogUpdate(process.stdout);
|
|
709
|
-
```
|
|
710
|
-
*/
|
|
711
|
-
declare function createLogUpdate(
|
|
712
|
-
stream: NodeJS.WritableStream,
|
|
713
|
-
options?: Options
|
|
714
|
-
): typeof logUpdate;
|
|
715
|
-
|
|
716
|
-
interface ErrorOptions {
|
|
717
|
-
type?: string;
|
|
718
|
-
fullStack?: boolean;
|
|
719
|
-
project?: TestProject;
|
|
720
|
-
verbose?: boolean;
|
|
721
|
-
screenshotPaths?: string[];
|
|
722
|
-
task?: Task;
|
|
723
|
-
showCodeFrame?: boolean;
|
|
724
|
-
}
|
|
725
|
-
declare class Logger {
|
|
726
|
-
ctx: Vitest;
|
|
727
|
-
outputStream: NodeJS.WriteStream | Writable;
|
|
728
|
-
errorStream: NodeJS.WriteStream | Writable;
|
|
729
|
-
logUpdate: ReturnType<typeof createLogUpdate>;
|
|
730
|
-
private _clearScreenPending;
|
|
731
|
-
private _highlights;
|
|
732
|
-
console: Console;
|
|
733
|
-
constructor(ctx: Vitest, outputStream?: NodeJS.WriteStream | Writable, errorStream?: NodeJS.WriteStream | Writable);
|
|
734
|
-
log(...args: any[]): void;
|
|
735
|
-
error(...args: any[]): void;
|
|
736
|
-
warn(...args: any[]): void;
|
|
737
|
-
clearFullScreen(message?: string): void;
|
|
738
|
-
clearScreen(message: string, force?: boolean): void;
|
|
739
|
-
private _clearScreen;
|
|
740
|
-
printError(err: unknown, options?: ErrorOptions): PrintErrorResult | undefined;
|
|
741
|
-
clearHighlightCache(filename?: string): void;
|
|
742
|
-
highlight(filename: string, source: string): string;
|
|
743
|
-
printNoTestFound(filters?: string[]): void;
|
|
744
|
-
printBanner(): void;
|
|
745
|
-
printBrowserBanner(project: TestProject): void;
|
|
746
|
-
printUnhandledErrors(errors: unknown[]): void;
|
|
747
|
-
printSourceTypeErrors(errors: TypeCheckError[]): void;
|
|
748
|
-
private registerUnhandledRejection;
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
interface TableRendererOptions {
|
|
752
|
-
renderSucceed?: boolean;
|
|
753
|
-
logger: Logger;
|
|
637
|
+
declare function renderTable(options: {
|
|
638
|
+
tasks: Task[];
|
|
639
|
+
level: number;
|
|
640
|
+
shallow?: boolean;
|
|
754
641
|
showHeap: boolean;
|
|
642
|
+
columns: number;
|
|
755
643
|
slowTestThreshold: number;
|
|
756
|
-
compare?:
|
|
757
|
-
}
|
|
758
|
-
declare function createTableRenderer(_tasks: Task[], options: TableRendererOptions): {
|
|
759
|
-
start(): /*elided*/ any;
|
|
760
|
-
update(_tasks: Task[]): /*elided*/ any;
|
|
761
|
-
stop(): /*elided*/ any;
|
|
762
|
-
clear(): void;
|
|
763
|
-
};
|
|
644
|
+
compare?: Record<Task['id'], FormattedBenchmarkResult>;
|
|
645
|
+
}): string;
|
|
764
646
|
|
|
765
|
-
declare class
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
onTestRemoved(trigger?: string): void;
|
|
769
|
-
onCollected(): Promise<void>;
|
|
647
|
+
declare class BenchmarkReporter extends DefaultReporter {
|
|
648
|
+
compare?: Parameters<typeof renderTable>[0]['compare'];
|
|
649
|
+
onInit(ctx: Vitest): Promise<void>;
|
|
770
650
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
stopListRender(): void;
|
|
774
|
-
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
775
|
-
onUserConsoleLog(log: UserConsoleLog): void;
|
|
651
|
+
printTask(task: Task): void;
|
|
652
|
+
onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
|
|
776
653
|
}
|
|
777
|
-
|
|
778
|
-
|
|
654
|
+
|
|
655
|
+
declare class VerboseBenchmarkReporter extends BenchmarkReporter {
|
|
656
|
+
protected verbose: boolean;
|
|
779
657
|
}
|
|
780
|
-
type FormattedBenchmarkResult = BenchmarkResult & {
|
|
781
|
-
id: string;
|
|
782
|
-
};
|
|
783
658
|
|
|
784
659
|
declare const BenchmarkReportsMap: {
|
|
785
|
-
default: typeof
|
|
786
|
-
verbose: typeof
|
|
660
|
+
default: typeof BenchmarkReporter;
|
|
661
|
+
verbose: typeof VerboseBenchmarkReporter;
|
|
787
662
|
};
|
|
788
663
|
type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
|
|
789
664
|
|
|
@@ -825,6 +700,56 @@ interface BuiltinReporterOptions {
|
|
|
825
700
|
'html': HTMLOptions;
|
|
826
701
|
}
|
|
827
702
|
|
|
703
|
+
declare class TypeCheckError extends Error {
|
|
704
|
+
message: string;
|
|
705
|
+
stacks: ParsedStack[];
|
|
706
|
+
name: string;
|
|
707
|
+
constructor(message: string, stacks: ParsedStack[]);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
interface PrintErrorResult {
|
|
711
|
+
nearest?: ParsedStack;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
interface ErrorOptions {
|
|
715
|
+
type?: string;
|
|
716
|
+
fullStack?: boolean;
|
|
717
|
+
project?: TestProject;
|
|
718
|
+
verbose?: boolean;
|
|
719
|
+
screenshotPaths?: string[];
|
|
720
|
+
task?: Task;
|
|
721
|
+
showCodeFrame?: boolean;
|
|
722
|
+
}
|
|
723
|
+
type Listener = () => void;
|
|
724
|
+
declare class Logger {
|
|
725
|
+
ctx: Vitest;
|
|
726
|
+
outputStream: NodeJS.WriteStream | Writable;
|
|
727
|
+
errorStream: NodeJS.WriteStream | Writable;
|
|
728
|
+
private _clearScreenPending;
|
|
729
|
+
private _highlights;
|
|
730
|
+
private cleanupListeners;
|
|
731
|
+
console: Console;
|
|
732
|
+
constructor(ctx: Vitest, outputStream?: NodeJS.WriteStream | Writable, errorStream?: NodeJS.WriteStream | Writable);
|
|
733
|
+
log(...args: any[]): void;
|
|
734
|
+
error(...args: any[]): void;
|
|
735
|
+
warn(...args: any[]): void;
|
|
736
|
+
clearFullScreen(message?: string): void;
|
|
737
|
+
clearScreen(message: string, force?: boolean): void;
|
|
738
|
+
private _clearScreen;
|
|
739
|
+
printError(err: unknown, options?: ErrorOptions): PrintErrorResult | undefined;
|
|
740
|
+
clearHighlightCache(filename?: string): void;
|
|
741
|
+
highlight(filename: string, source: string): string;
|
|
742
|
+
printNoTestFound(filters?: string[]): void;
|
|
743
|
+
printBanner(): void;
|
|
744
|
+
printBrowserBanner(project: TestProject): void;
|
|
745
|
+
printUnhandledErrors(errors: unknown[]): void;
|
|
746
|
+
printSourceTypeErrors(errors: TypeCheckError[]): void;
|
|
747
|
+
getColumns(): number;
|
|
748
|
+
onTerminalCleanup(listener: Listener): void;
|
|
749
|
+
private addCleanupListeners;
|
|
750
|
+
private registerUnhandledRejection;
|
|
751
|
+
}
|
|
752
|
+
|
|
828
753
|
type ChaiConfig = Omit<Partial<typeof chai.config>, 'useProxy' | 'proxyExcludedKeys'>;
|
|
829
754
|
|
|
830
755
|
type BuiltinPool = 'browser' | 'threads' | 'forks' | 'vmThreads' | 'vmForks' | 'typescript';
|
|
@@ -2021,7 +1946,7 @@ interface InlineConfig {
|
|
|
2021
1946
|
/**
|
|
2022
1947
|
* By default, Vitest automatically intercepts console logging during tests for extra formatting of test file, test title, etc...
|
|
2023
1948
|
* This is also required for console log preview on Vitest UI.
|
|
2024
|
-
* However, disabling such interception might help when you want to debug a code with normal
|
|
1949
|
+
* However, disabling such interception might help when you want to debug a code with normal synchronous terminal console logging.
|
|
2025
1950
|
*
|
|
2026
1951
|
* This option has no effect on browser pool since Vitest preserves original logging on browser devtools.
|
|
2027
1952
|
*
|
|
@@ -2043,7 +1968,7 @@ interface InlineConfig {
|
|
|
2043
1968
|
}
|
|
2044
1969
|
interface TypecheckConfig {
|
|
2045
1970
|
/**
|
|
2046
|
-
* Run typechecking tests
|
|
1971
|
+
* Run typechecking tests alongside regular tests.
|
|
2047
1972
|
*/
|
|
2048
1973
|
enabled?: boolean;
|
|
2049
1974
|
/**
|
|
@@ -2607,7 +2532,7 @@ declare class TestProject {
|
|
|
2607
2532
|
getName(): string;
|
|
2608
2533
|
/** @deprecated internal */
|
|
2609
2534
|
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
2610
|
-
private
|
|
2535
|
+
private _serializeOverriddenConfig;
|
|
2611
2536
|
private clearTmpDir;
|
|
2612
2537
|
/** @deprecated */
|
|
2613
2538
|
initBrowserProvider(): Promise<void>;
|
|
@@ -2885,14 +2810,14 @@ declare class Vitest {
|
|
|
2885
2810
|
/** @deprecated */
|
|
2886
2811
|
getFileWorkspaceSpecs(file: string): WorkspaceSpec[];
|
|
2887
2812
|
/**
|
|
2888
|
-
* Get test specifications
|
|
2813
|
+
* Get test specifications associated with the given module. If module is not a test file, an empty array is returned.
|
|
2889
2814
|
*
|
|
2890
2815
|
* **Note:** this method relies on a cache generated by `globTestSpecifications`. If the file was not processed yet, use `project.matchesGlobPattern` instead.
|
|
2891
2816
|
* @param moduleId The module ID to get test specifications for.
|
|
2892
2817
|
*/
|
|
2893
2818
|
getModuleSpecifications(moduleId: string): TestSpecification[];
|
|
2894
2819
|
/**
|
|
2895
|
-
* Vitest automatically caches test specifications for each file. This method clears the cache for the given file or the whole cache
|
|
2820
|
+
* Vitest automatically caches test specifications for each file. This method clears the cache for the given file or the whole cache altogether.
|
|
2896
2821
|
*/
|
|
2897
2822
|
clearSpecificationsCache(moduleId?: string): void;
|
|
2898
2823
|
/**
|
|
@@ -13,7 +13,7 @@ import c from 'tinyrainbow';
|
|
|
13
13
|
import { e as extraInlineDeps, d as defaultPort, a as defaultBrowserPort, b as defaultInspectPort } from './constants.fzPh7AOq.js';
|
|
14
14
|
import * as nodeos from 'node:os';
|
|
15
15
|
import nodeos__default from 'node:os';
|
|
16
|
-
import { h as hash, w as wrapSerializableConfig,
|
|
16
|
+
import { h as hash, w as wrapSerializableConfig, a as Typechecker, b as isWindows, R as RandomSequencer, B as BaseSequencer } from './RandomSequencer.DB__To1b.js';
|
|
17
17
|
import { isCI, provider } from 'std-env';
|
|
18
18
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
|
|
19
19
|
import require$$0 from 'util';
|
|
@@ -2709,9 +2709,9 @@ function requireToRegexRange () {
|
|
|
2709
2709
|
};
|
|
2710
2710
|
|
|
2711
2711
|
function collatePatterns(neg, pos, options) {
|
|
2712
|
-
let onlyNegative = filterPatterns(neg, pos, '-', false)
|
|
2713
|
-
let onlyPositive = filterPatterns(pos, neg, '', false)
|
|
2714
|
-
let intersected = filterPatterns(neg, pos, '-?', true)
|
|
2712
|
+
let onlyNegative = filterPatterns(neg, pos, '-', false);
|
|
2713
|
+
let onlyPositive = filterPatterns(pos, neg, '', false);
|
|
2714
|
+
let intersected = filterPatterns(neg, pos, '-?', true);
|
|
2715
2715
|
let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
|
|
2716
2716
|
return subpatterns.join('|');
|
|
2717
2717
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { startTests, collectTests } from '@vitest/runner';
|
|
3
|
-
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.
|
|
3
|
+
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.B2M9nD1V.js';
|
|
4
4
|
import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.BWeNbfBa.js';
|
|
5
|
-
import { a as globalExpect, v as vi } from './vi.
|
|
5
|
+
import { a as globalExpect, v as vi } from './vi.Da_PT3Vw.js';
|
|
6
6
|
import { c as closeInspector } from './inspector.DKLceBVD.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
8
|
import timers from 'node:timers';
|
|
9
|
+
import timersPromises from 'node:timers/promises';
|
|
9
10
|
import util from 'node:util';
|
|
10
11
|
import { getSafeTimers } from '@vitest/utils';
|
|
11
12
|
import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
|
|
12
13
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
13
|
-
import { V as VitestIndex } from './index.
|
|
14
|
-
import { s as setupCommonEnv } from './setup-common.
|
|
14
|
+
import { V as VitestIndex } from './index.BQbxGbG9.js';
|
|
15
|
+
import { s as setupCommonEnv } from './setup-common.D0zLenuv.js';
|
|
15
16
|
import { g as getWorkerState, r as resetModules } from './utils.C8RiOc4B.js';
|
|
16
17
|
import 'chai';
|
|
17
18
|
import 'node:path';
|
|
@@ -61,7 +62,8 @@ async function setupGlobalEnv(config, { environment }, executor) {
|
|
|
61
62
|
}
|
|
62
63
|
globalThis.__vitest_required__ = {
|
|
63
64
|
util,
|
|
64
|
-
timers
|
|
65
|
+
timers,
|
|
66
|
+
timersPromises
|
|
65
67
|
};
|
|
66
68
|
installSourcemapsSupport({
|
|
67
69
|
getSourceMap: (source) => state.moduleCache.getSourceMap(source)
|
|
@@ -77,7 +79,7 @@ function resolveAsset(mod, url) {
|
|
|
77
79
|
mod.exports = url;
|
|
78
80
|
}
|
|
79
81
|
async function setupConsoleLogSpy() {
|
|
80
|
-
const { createCustomConsole } = await import('./console.
|
|
82
|
+
const { createCustomConsole } = await import('./console.CN7AiMGV.js');
|
|
81
83
|
globalThis.console = createCustomConsole();
|
|
82
84
|
}
|
|
83
85
|
async function withEnv({ environment }, options, fn) {
|
|
@@ -13,7 +13,7 @@ async function setupCommonEnv(config) {
|
|
|
13
13
|
globalSetup = true;
|
|
14
14
|
setSafeTimers();
|
|
15
15
|
if (config.globals) {
|
|
16
|
-
(await import('./globals.
|
|
16
|
+
(await import('./globals.C5RQxaV3.js')).registerApiGlobally();
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
function setupDefines(defines) {
|
|
@@ -14,7 +14,6 @@ const F_LONG_DASH = "\u23AF";
|
|
|
14
14
|
const F_TREE_NODE_MIDDLE = "\u251C\u2500\u2500";
|
|
15
15
|
const F_TREE_NODE_END = "\u2514\u2500\u2500";
|
|
16
16
|
|
|
17
|
-
const spinnerMap = /* @__PURE__ */ new WeakMap();
|
|
18
17
|
const pointer = c.yellow(F_POINTER);
|
|
19
18
|
const skipped = c.dim(c.gray(F_DOWN));
|
|
20
19
|
const benchmarkPass = c.green(F_DOT);
|
|
@@ -130,12 +129,6 @@ function getStateSymbol(task) {
|
|
|
130
129
|
if (task.type === "suite") {
|
|
131
130
|
return pointer;
|
|
132
131
|
}
|
|
133
|
-
let spinner = spinnerMap.get(task);
|
|
134
|
-
if (!spinner) {
|
|
135
|
-
spinner = elegantSpinner();
|
|
136
|
-
spinnerMap.set(task, spinner);
|
|
137
|
-
}
|
|
138
|
-
return c.yellow(spinner());
|
|
139
132
|
}
|
|
140
133
|
if (task.result.state === "pass") {
|
|
141
134
|
return task.meta?.benchmark ? benchmarkPass : testPass;
|
|
@@ -145,14 +138,6 @@ function getStateSymbol(task) {
|
|
|
145
138
|
}
|
|
146
139
|
return " ";
|
|
147
140
|
}
|
|
148
|
-
const spinnerFrames = process.platform === "win32" ? ["-", "\\", "|", "/"] : ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
149
|
-
function elegantSpinner() {
|
|
150
|
-
let index = 0;
|
|
151
|
-
return () => {
|
|
152
|
-
index = ++index % spinnerFrames.length;
|
|
153
|
-
return spinnerFrames[index];
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
141
|
function formatTimeString(date) {
|
|
157
142
|
return date.toTimeString().split(" ")[0];
|
|
158
143
|
}
|
|
@@ -179,18 +164,23 @@ function withLabel(color, label, message) {
|
|
|
179
164
|
function padSummaryTitle(str) {
|
|
180
165
|
return c.dim(`${str.padStart(11)} `);
|
|
181
166
|
}
|
|
167
|
+
function truncateString(text, maxLength) {
|
|
168
|
+
const plainText = stripVTControlCharacters(text);
|
|
169
|
+
if (plainText.length <= maxLength) {
|
|
170
|
+
return text;
|
|
171
|
+
}
|
|
172
|
+
return `${plainText.slice(0, maxLength - 1)}\u2026`;
|
|
173
|
+
}
|
|
182
174
|
|
|
183
175
|
var utils = /*#__PURE__*/Object.freeze({
|
|
184
176
|
__proto__: null,
|
|
185
177
|
benchmarkPass: benchmarkPass,
|
|
186
178
|
countTestErrors: countTestErrors,
|
|
187
179
|
divider: divider,
|
|
188
|
-
elegantSpinner: elegantSpinner,
|
|
189
180
|
formatProjectName: formatProjectName,
|
|
190
181
|
formatTestPath: formatTestPath,
|
|
191
182
|
formatTime: formatTime,
|
|
192
183
|
formatTimeString: formatTimeString,
|
|
193
|
-
getCols: getCols,
|
|
194
184
|
getStateString: getStateString,
|
|
195
185
|
getStateSymbol: getStateSymbol,
|
|
196
186
|
padSummaryTitle: padSummaryTitle,
|
|
@@ -198,12 +188,11 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
198
188
|
pointer: pointer,
|
|
199
189
|
renderSnapshotSummary: renderSnapshotSummary,
|
|
200
190
|
skipped: skipped,
|
|
201
|
-
spinnerFrames: spinnerFrames,
|
|
202
|
-
spinnerMap: spinnerMap,
|
|
203
191
|
suiteFail: suiteFail,
|
|
204
192
|
taskFail: taskFail,
|
|
205
193
|
testPass: testPass,
|
|
194
|
+
truncateString: truncateString,
|
|
206
195
|
withLabel: withLabel
|
|
207
196
|
});
|
|
208
197
|
|
|
209
|
-
export { F_POINTER as F, formatTimeString as a,
|
|
198
|
+
export { F_POINTER as F, formatTimeString as a, taskFail as b, F_RIGHT as c, divider as d, F_CHECK as e, formatProjectName as f, getStateSymbol as g, getStateString as h, formatTime as i, countTestErrors as j, F_TREE_NODE_END as k, F_TREE_NODE_MIDDLE as l, padSummaryTitle as p, renderSnapshotSummary as r, truncateString as t, utils as u, withLabel as w };
|