vitest 4.1.12 → 5.1.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/LICENSE.md +192 -10
- package/browser/context.d.ts +7 -1
- package/browser/context.js +5 -5
- package/config.d.ts +0 -2
- package/dist/browser.d.ts +52 -21
- package/dist/browser.js +12 -13
- package/dist/chunks/{acorn.B2iPLyUM.js → acorn.C1kjbUFw.js} +30 -30
- package/dist/chunks/{base.B6Opl8PE.js → base.Cof-UHJf.js} +81 -52
- package/dist/chunks/{browser.d.BcoexmFG.d.ts → browser.d.C7tWgUvw.d.ts} +17 -14
- package/dist/chunks/{cac.DzDtg8hz.js → cac.BYbt0aJp.js} +143 -87
- package/dist/chunks/{cli-api.B0Pz1_R7.js → cli-api.COfZo8lK.js} +7160 -7189
- package/dist/chunks/config.d.B3YV4t0O.d.ts +3873 -0
- package/dist/chunks/{console.3WNpx0tS.js → console.CQZ877Hi.js} +69 -63
- package/dist/chunks/{constants.CPYnjOGj.js → constants.DLYM6cZY.js} +2 -2
- package/dist/chunks/coverage.9iqXE2gN.js +26 -0
- package/dist/chunks/{coverage.CTzCuANN.js → coverage.jGCktcGP.js} +7 -2
- package/dist/chunks/{creator.DgVhQm5q.js → creator.DHWmytIK.js} +65 -28
- package/dist/chunks/{defaults.9aQKnqFk.js → defaults.B1FCaFfh.js} +16 -9
- package/dist/chunks/display.BlTmubjj.js +194 -0
- package/dist/chunks/doctor.B-oPbwps.js +465 -0
- package/dist/chunks/{env.D4Lgay0q.js → env.BKKtU2WC.js} +2 -1
- package/dist/chunks/{environment.d.CrsxCzP1.d.ts → environment.d.BFQtFKdZ.d.ts} +9 -1
- package/dist/chunks/globals.ZKtKSkEf.js +29 -0
- package/dist/chunks/index.Bi0NXYPf.js +1708 -0
- package/dist/chunks/{index.CMESou6r.js → index.BoyTG_B7.js} +82 -81
- package/dist/chunks/index.CZzC1gGg.js +8501 -0
- package/dist/chunks/index.D0heQG4v.js +1318 -0
- package/dist/chunks/index.Di8au7q4.js +15665 -0
- package/dist/chunks/{index.Chj8NDwU.js → index.DmDMHCg8.js} +6 -12
- package/dist/chunks/{index.DXx9Dtk7.js → index.w_oBZ9N8.js} +25 -12
- package/dist/chunks/{init-forks.H5ZuobOQ.js → init-forks.BaDXQSD8.js} +7 -10
- package/dist/chunks/{init-threads.6kl1khcL.js → init-threads.ZX_Vov0z.js} +1 -1
- package/dist/chunks/{init.k9zZ9sLh.js → init.CO4AB7HZ.js} +113 -38
- package/dist/chunks/module-dependencies._2Eei3FO.js +71 -0
- package/dist/chunks/{native.DPzPHdi5.js → native.upB-V0CK.js} +50 -37
- package/dist/chunks/{nativeModuleMocker.BkNfQMkH.js → nativeModuleMocker.Dh5azSB4.js} +48 -19
- package/dist/chunks/{index.BCY_7LL2.js → nativeModuleRunner.9xPIMzi7.js} +110 -42
- package/dist/chunks/node.B9mkVmLH.js +47 -0
- package/dist/chunks/offset.Dy-5Fdfn.js +24 -0
- package/dist/chunks/pathe.M-eThtNZ.zq3TM4NT.js +492 -0
- package/dist/chunks/{reporters.d.DtoKVV2s.d.ts → plugin.d.LRFSN46m.d.ts} +2573 -1453
- package/dist/chunks/plugins.DPQHVT0p.js +37 -0
- package/dist/chunks/rawSnapshot.DqSiqIEx.js +356 -0
- package/dist/chunks/resolver.BzpmeQeT.js +48 -0
- package/dist/chunks/rpc.Uhkwr2NM.js +93 -0
- package/dist/chunks/rpc.d.3FOhdFx8.d.ts +75 -0
- package/dist/chunks/run.CjdgFZiW.js +4231 -0
- package/dist/chunks/setup-common.CqAQCXzx.js +36 -0
- package/dist/chunks/source-map.DakdQc29.js +1788 -0
- package/dist/chunks/source-map.d.BkG8YK_3.d.ts +89 -0
- package/dist/chunks/spy.DDMXghXv.js +509 -0
- package/dist/chunks/task-utils.d.D-gFPNFi.d.ts +144 -0
- package/dist/chunks/tinyrainbow.Do8I1XRG.js +88 -0
- package/dist/chunks/{utils.BS4fH3nR.js → utils.BBk_icFG.js} +50 -52
- package/dist/chunks/{utils.BX5Fg8C4.js → utils.DYj33du9.js} +1 -17
- package/dist/chunks/vm.b4MbCAJQ.js +1329 -0
- package/dist/chunks/{worker.d.ZpHpO4yb.d.ts → worker.d.CyJRpyfZ.d.ts} +34 -19
- package/dist/cli.js +5 -6
- package/dist/config.cjs +9 -6
- package/dist/config.d.ts +27 -25
- package/dist/config.js +3 -3
- package/dist/index.d.ts +471 -38
- package/dist/index.js +18 -19
- package/dist/module-evaluator.d.ts +64 -5
- package/dist/module-evaluator.js +122 -62
- package/dist/node.d.ts +355 -87
- package/dist/node.js +49 -73
- package/dist/runtime.d.ts +43 -6
- package/dist/runtime.js +7 -9
- package/dist/spy.js +1 -1
- package/dist/task-utils.js +290 -0
- package/dist/{chunks/traces.DT5aQ62U.js → traces.js} +3 -2
- package/dist/worker.d.ts +8 -10
- package/dist/worker.js +33 -43
- package/dist/workers/forks.js +30 -40
- package/dist/workers/runVmTests.js +66 -43
- package/dist/workers/threads.js +30 -40
- package/dist/workers/vmForks.js +19 -20
- package/dist/workers/vmThreads.js +19 -20
- package/globals.d.ts +19 -19
- package/index.cjs +3 -3
- package/optional-runtime-types.d.ts +1 -1
- package/optional-types.d.ts +1 -1
- package/package.json +59 -74
- package/suppress-warnings.cjs +1 -1
- package/dist/chunks/_commonjsHelpers.D26ty3Ew.js +0 -6
- package/dist/chunks/benchmark.CX_oY03V.js +0 -40
- package/dist/chunks/benchmark.d.DAaHLpsq.d.ts +0 -24
- package/dist/chunks/config.d.A1h_Y6Jt.d.ts +0 -232
- package/dist/chunks/coverage.DM_a_rWm.js +0 -1087
- package/dist/chunks/coverage.d.BZtK59WP.d.ts +0 -37
- package/dist/chunks/evaluatedModules.Dg1zASAC.js +0 -17
- package/dist/chunks/global.d.DVsSRdQ5.d.ts +0 -100
- package/dist/chunks/globals.Dj1TGiMC.js +0 -31
- package/dist/chunks/index.DC7d2Pf8.js +0 -729
- package/dist/chunks/index.DdgEv5B1.js +0 -42
- package/dist/chunks/index.UpGiHP7g.js +0 -4255
- package/dist/chunks/index.og1WyBLx.js +0 -6358
- package/dist/chunks/nativeModuleRunner.BIakptoF.js +0 -36
- package/dist/chunks/node.COQbm6gK.js +0 -14
- package/dist/chunks/plugin.d.DwFIiJ7i.d.ts +0 -38
- package/dist/chunks/rpc.MzXet3jl.js +0 -144
- package/dist/chunks/rpc.d.B_8sPU0w.d.ts +0 -30
- package/dist/chunks/setup-common.DYx3LtFI.js +0 -60
- package/dist/chunks/startVitestModuleRunner.DB-7oCpn.js +0 -740
- package/dist/chunks/suite.d.udJtyAgw.d.ts +0 -10
- package/dist/chunks/test.DNmyFkvJ.js +0 -4430
- package/dist/chunks/traces.d.D2T_R8rx.d.ts +0 -60
- package/dist/chunks/vm.CXMd5FHa.js +0 -785
- package/dist/coverage.d.ts +0 -123
- package/dist/coverage.js +0 -27
- package/dist/environments.d.ts +0 -22
- package/dist/environments.js +0 -5
- package/dist/reporters.d.ts +0 -27
- package/dist/reporters.js +0 -26
- package/dist/runners.d.ts +0 -70
- package/dist/runners.js +0 -19
- package/dist/snapshot.d.ts +0 -9
- package/dist/snapshot.js +0 -6
- package/dist/suite.d.ts +0 -5
- package/dist/suite.js +0 -8
package/dist/node.d.ts
CHANGED
|
@@ -1,41 +1,35 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
|
-
import {
|
|
2
|
+
import { UserConfig as UserConfig$1, ResolvedConfig as ResolvedConfig$1, TransformResult, ViteDevServer, LogLevel, LoggerOptions, Logger as Logger$1 } from 'vite';
|
|
3
3
|
export { vite as Vite };
|
|
4
4
|
export { esbuildVersion, isCSSRequest, isFileLoadingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
5
5
|
import { IncomingMessage } from 'node:http';
|
|
6
|
-
import { R as ResolvedConfig, e as UserConfig,
|
|
7
|
-
export { M as AgentReporter, B as BaseCoverageOptions,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
export { SerializedError } from '
|
|
12
|
-
import {
|
|
6
|
+
import { R as ResolvedConfig, e as CliOptions, d as UserConfig, L as Logger, A as ApiConfig, P as PluginHarness, f as Vitest, g as ResolvedCoverageOptions, h as CoverageMap, i as TestSpecification, j as ReportContext, k as TestProject, l as VitestOptions, m as VitestRunMode, n as VCSProvider, o as VCSProviderOptions, p as PoolWorker, q as PoolOptions, r as WorkerRequest, s as TestSequencer } from './chunks/plugin.d.LRFSN46m.js';
|
|
7
|
+
export { M as AgentReporter, B as BaseCoverageOptions, t as BaseReporter, u as BenchmarkUserOptions, v as BrowserBuiltinProvider, w as BrowserCommand, x as BrowserCommandContext, y as BrowserConfigOptions, z as BrowserInstanceOption, D as BrowserModuleMocker, E as BrowserOrchestrator, G as BrowserProvider, H as BrowserProviderCloseOptions, J as BrowserProviderOption, K as BrowserScript, N as BrowserServerContribution, O as BrowserServerFactory, Q as BrowserServerState, S as BrowserServerStateSession, X as BrowserTraceViewOptions, Y as BuiltinEnvironment, Z as BuiltinReporterOptions, _ as BuiltinReporters, $ as CSSModuleScopeStrategy, a0 as CacheKeyIdGenerator, a1 as CacheKeyIdGeneratorContext, a2 as CachedTestFileResult, a3 as CoverageInstrumenter, a4 as CoverageIstanbulOptions, C as CoverageOptions, a5 as CoverageProvider, a6 as CoverageProviderModule, a7 as CoverageReporter, a8 as CoverageV8Options, a9 as CustomProviderOptions, aa as DefaultReporter, ab as DepsOptimizationOptions, ac as DotReporter, ad as EnvironmentOptions, ae as GithubActionsReporter, af as HTMLOptions, ag as HangingProcessReporter, I as InlineConfig, ah as InstrumenterOptions, ai as JUnitOptions, aj as JUnitReporter, ak as JsonAssertionResult, al as JsonOptions, am as JsonReporter, an as JsonTestResult, ao as JsonTestResults, M as MinimalReporter, ap as ModuleDependency, aq as ModuleDiagnostic, ar as ModulesResolver, as as OnServerRestartHandler, at as OnTestsRerunHandler, au as ParentProjectBrowser, av as Pool, aw as PoolRunnerInitializer, ax as PoolTask, ay as ProjectBrowser, az as ProjectConfig, aA as Report, aB as ReportedHookContext, aC as Reporter, aD as ReportersMap, aE as ResolveSnapshotPathHandler, aF as ResolveSnapshotPathHandlerContext, aG as ResolvedBrowserOptions, aH as ResolvedProjectConfig, aI as SerializedTestProject, aJ as SuiteNameTemplateVariables, aK as TapFlatReporter, aL as TapReporter, aM as TaskOptions, aN as TestAttempt, aO as TestAttemptState, aP as TestCase, aQ as TestCollection, aR as TestDiagnostic, aS as TestModule, aT as TestModuleState, aU as TestResult, aV as TestResultFailed, aW as TestResultPassed, aX as TestResultPending, aY as TestResultSkipped, aZ as TestRunEndReason, a_ as TestRunResult, a$ as TestSequencerConstructor, b0 as TestSpecificationOptions, b1 as TestState, b2 as TestSuite, b3 as TestSuiteState, b4 as ToMatchScreenshotComparators, b5 as ToMatchScreenshotOptions, b6 as TypecheckConfig, b7 as UIOptions, U as UserWorkspaceConfig, b8 as VerboseReporter, b9 as VitestEnvironment, ba as VitestPackageInstaller, V as VitestPluginContext, W as WatcherTriggerPattern, bb as WorkerResponse, bc as _BrowserNames, bd as experimental_getRunnerTask, be as startVitest } from './chunks/plugin.d.LRFSN46m.js';
|
|
8
|
+
import { EventEmitter } from 'events';
|
|
9
|
+
import { A as Awaitable } from './chunks/config.d.B3YV4t0O.js';
|
|
10
|
+
import { AfterSuiteRunMeta } from './index.js';
|
|
11
|
+
export { Y as RunnerTask, aI as RunnerTaskResult, k as RunnerTaskResultPack, n as RunnerTestCase, a as RunnerTestFile, Q as RunnerTestSuite, aK as RuntimeConfig, bh as SequenceHooks, bi as SequenceSetupFiles, aL as SerializedError, bj as disableDefaultColors } from './chunks/config.d.B3YV4t0O.js';
|
|
12
|
+
import { RuntimeRPC } from './index.js';
|
|
13
13
|
import { Writable } from 'node:stream';
|
|
14
|
-
import {
|
|
15
|
-
export { T as TestExecutionType } from './chunks/worker.d.
|
|
14
|
+
import { ContextRPC } from './index.js';
|
|
15
|
+
export { T as TestExecutionType } from './chunks/worker.d.CyJRpyfZ.js';
|
|
16
16
|
import { Debugger } from 'obug';
|
|
17
|
-
|
|
18
|
-
export { Task as RunnerTask, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
19
|
-
export { c as RuntimeConfig } from './chunks/config.d.A1h_Y6Jt.js';
|
|
20
|
-
export { generateFileHash } from '@vitest/runner/utils';
|
|
17
|
+
export { g as generateFileHash } from './chunks/task-utils.d.D-gFPNFi.js';
|
|
21
18
|
export { CDPSession } from 'vitest/browser';
|
|
22
|
-
import './chunks/
|
|
23
|
-
import '
|
|
24
|
-
import '@vitest/pretty-format';
|
|
25
|
-
import '@vitest/snapshot';
|
|
26
|
-
import '@vitest/utils/diff';
|
|
27
|
-
import '@vitest/expect';
|
|
19
|
+
import './chunks/browser.d.C7tWgUvw.js';
|
|
20
|
+
import 'chai';
|
|
28
21
|
import 'vitest/optional-types.js';
|
|
29
|
-
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
30
|
-
import 'tinybench';
|
|
31
22
|
import '@vitest/mocker';
|
|
32
|
-
import '
|
|
33
|
-
import '
|
|
34
|
-
import '@vitest/snapshot/manager';
|
|
23
|
+
import './chunks/source-map.d.BkG8YK_3.js';
|
|
24
|
+
import 'node:path';
|
|
35
25
|
import 'node:console';
|
|
36
|
-
import 'node:fs';
|
|
26
|
+
import 'node:fs/promises';
|
|
27
|
+
import 'vitest/optional-runtime-types.js';
|
|
28
|
+
import 'tinybench';
|
|
37
29
|
import 'vite/module-runner';
|
|
38
|
-
import './chunks/environment.d.
|
|
30
|
+
import './chunks/environment.d.BFQtFKdZ.js';
|
|
31
|
+
|
|
32
|
+
declare function escapeTestName(label: string, dynamic: boolean): string;
|
|
39
33
|
|
|
40
34
|
type RawErrsMap = Map<string, TscErrorInfo[]>;
|
|
41
35
|
interface TscErrorInfo {
|
|
@@ -50,7 +44,7 @@ interface CollectLineNumbers {
|
|
|
50
44
|
next: number;
|
|
51
45
|
prev?: number;
|
|
52
46
|
}
|
|
53
|
-
type CollectLines = { [key in keyof CollectLineNumbers]
|
|
47
|
+
type CollectLines = { [key in keyof CollectLineNumbers]: string };
|
|
54
48
|
interface RootAndTarget {
|
|
55
49
|
root: string;
|
|
56
50
|
targetAbsPath: string;
|
|
@@ -63,82 +57,335 @@ type Context = RootAndTarget & {
|
|
|
63
57
|
|
|
64
58
|
declare function isValidApiRequest(config: ResolvedConfig, req: IncomingMessage): boolean;
|
|
65
59
|
|
|
66
|
-
|
|
60
|
+
interface OptionConfig {
|
|
61
|
+
default?: any;
|
|
62
|
+
type?: any;
|
|
63
|
+
}
|
|
64
|
+
declare class Option {
|
|
65
|
+
rawName: string;
|
|
66
|
+
description: string;
|
|
67
|
+
/** Option name */
|
|
68
|
+
name: string;
|
|
69
|
+
/** Option name and aliases */
|
|
70
|
+
names: string[];
|
|
71
|
+
isBoolean?: boolean;
|
|
72
|
+
required?: boolean;
|
|
73
|
+
config: OptionConfig;
|
|
74
|
+
negated: boolean;
|
|
75
|
+
constructor(rawName: string, description: string, config?: OptionConfig);
|
|
76
|
+
}
|
|
67
77
|
|
|
68
|
-
interface
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
interface CommandArg {
|
|
79
|
+
required: boolean;
|
|
80
|
+
value: string;
|
|
81
|
+
variadic: boolean;
|
|
82
|
+
}
|
|
83
|
+
interface HelpSection {
|
|
84
|
+
title?: string;
|
|
85
|
+
body: string;
|
|
86
|
+
}
|
|
87
|
+
interface CommandConfig {
|
|
88
|
+
allowUnknownOptions?: boolean;
|
|
89
|
+
ignoreOptionDefaultValue?: boolean;
|
|
90
|
+
}
|
|
91
|
+
declare type HelpCallback = (sections: HelpSection[]) => void | HelpSection[];
|
|
92
|
+
declare type CommandExample = ((bin: string) => string) | string;
|
|
93
|
+
declare class Command {
|
|
94
|
+
rawName: string;
|
|
95
|
+
description: string;
|
|
96
|
+
config: CommandConfig;
|
|
97
|
+
cli: CAC;
|
|
98
|
+
options: Option[];
|
|
99
|
+
aliasNames: string[];
|
|
100
|
+
name: string;
|
|
101
|
+
args: CommandArg[];
|
|
102
|
+
commandAction?: (...args: any[]) => any;
|
|
103
|
+
usageText?: string;
|
|
104
|
+
versionNumber?: string;
|
|
105
|
+
examples: CommandExample[];
|
|
106
|
+
helpCallback?: HelpCallback;
|
|
107
|
+
globalCommand?: GlobalCommand;
|
|
108
|
+
constructor(rawName: string, description: string, config: CommandConfig, cli: CAC);
|
|
109
|
+
usage(text: string): this;
|
|
110
|
+
allowUnknownOptions(): this;
|
|
111
|
+
ignoreOptionDefaultValue(): this;
|
|
112
|
+
version(version: string, customFlags?: string): this;
|
|
113
|
+
example(example: CommandExample): this;
|
|
114
|
+
/**
|
|
115
|
+
* Add a option for this command
|
|
116
|
+
* @param rawName Raw option name(s)
|
|
117
|
+
* @param description Option description
|
|
118
|
+
* @param config Option config
|
|
119
|
+
*/
|
|
120
|
+
option(rawName: string, description: string, config?: OptionConfig): this;
|
|
121
|
+
alias(name: string): this;
|
|
122
|
+
action(callback: (...args: any[]) => any): this;
|
|
123
|
+
/**
|
|
124
|
+
* Check if a command name is matched by this command
|
|
125
|
+
* @param name Command name
|
|
126
|
+
*/
|
|
127
|
+
isMatched(name: string): boolean;
|
|
128
|
+
get isDefaultCommand(): boolean;
|
|
129
|
+
get isGlobalCommand(): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Check if an option is registered in this command
|
|
132
|
+
* @param name Option name
|
|
133
|
+
*/
|
|
134
|
+
hasOption(name: string): Option | undefined;
|
|
135
|
+
outputHelp(): void;
|
|
136
|
+
outputVersion(): void;
|
|
137
|
+
checkRequiredArgs(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Check if the parsed options contain any unknown options
|
|
140
|
+
*
|
|
141
|
+
* Exit and output error when true
|
|
142
|
+
*/
|
|
143
|
+
checkUnknownOptions(): void;
|
|
144
|
+
/**
|
|
145
|
+
* Check if the required string-type options exist
|
|
146
|
+
*/
|
|
147
|
+
checkOptionValue(): void;
|
|
148
|
+
}
|
|
149
|
+
declare class GlobalCommand extends Command {
|
|
150
|
+
constructor(cli: CAC);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
interface ParsedArgv {
|
|
154
|
+
args: ReadonlyArray<string>;
|
|
155
|
+
options: {
|
|
156
|
+
[k: string]: any;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
declare class CAC extends EventEmitter {
|
|
160
|
+
/** The program name to display in help and version message */
|
|
161
|
+
name: string;
|
|
162
|
+
commands: Command[];
|
|
163
|
+
globalCommand: GlobalCommand;
|
|
164
|
+
matchedCommand?: Command;
|
|
165
|
+
matchedCommandName?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Raw CLI arguments
|
|
168
|
+
*/
|
|
169
|
+
rawArgs: string[];
|
|
170
|
+
/**
|
|
171
|
+
* Parsed CLI arguments
|
|
172
|
+
*/
|
|
173
|
+
args: ParsedArgv['args'];
|
|
174
|
+
/**
|
|
175
|
+
* Parsed CLI options, camelCased
|
|
176
|
+
*/
|
|
177
|
+
options: ParsedArgv['options'];
|
|
178
|
+
showHelpOnExit?: boolean;
|
|
179
|
+
showVersionOnExit?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* @param name The program name to display in help and version message
|
|
182
|
+
*/
|
|
183
|
+
constructor(name?: string);
|
|
184
|
+
/**
|
|
185
|
+
* Add a global usage text.
|
|
186
|
+
*
|
|
187
|
+
* This is not used by sub-commands.
|
|
188
|
+
*/
|
|
189
|
+
usage(text: string): this;
|
|
190
|
+
/**
|
|
191
|
+
* Add a sub-command
|
|
192
|
+
*/
|
|
193
|
+
command(rawName: string, description?: string, config?: CommandConfig): Command;
|
|
194
|
+
/**
|
|
195
|
+
* Add a global CLI option.
|
|
196
|
+
*
|
|
197
|
+
* Which is also applied to sub-commands.
|
|
198
|
+
*/
|
|
199
|
+
option(rawName: string, description: string, config?: OptionConfig): this;
|
|
200
|
+
/**
|
|
201
|
+
* Show help message when `-h, --help` flags appear.
|
|
202
|
+
*
|
|
203
|
+
*/
|
|
204
|
+
help(callback?: HelpCallback): this;
|
|
205
|
+
/**
|
|
206
|
+
* Show version number when `-v, --version` flags appear.
|
|
207
|
+
*
|
|
208
|
+
*/
|
|
209
|
+
version(version: string, customFlags?: string): this;
|
|
210
|
+
/**
|
|
211
|
+
* Add a global example.
|
|
212
|
+
*
|
|
213
|
+
* This example added here will not be used by sub-commands.
|
|
214
|
+
*/
|
|
215
|
+
example(example: CommandExample): this;
|
|
216
|
+
/**
|
|
217
|
+
* Output the corresponding help message
|
|
218
|
+
* When a sub-command is matched, output the help message for the command
|
|
219
|
+
* Otherwise output the global one.
|
|
220
|
+
*
|
|
221
|
+
*/
|
|
222
|
+
outputHelp(): void;
|
|
223
|
+
/**
|
|
224
|
+
* Output the version number.
|
|
225
|
+
*
|
|
226
|
+
*/
|
|
227
|
+
outputVersion(): void;
|
|
228
|
+
private setParsedInfo;
|
|
229
|
+
unsetMatchedCommand(): void;
|
|
230
|
+
/**
|
|
231
|
+
* Parse argv
|
|
232
|
+
*/
|
|
233
|
+
parse(argv?: string[], {
|
|
234
|
+
/** Whether to run the action for matched command */
|
|
235
|
+
run, }?: {
|
|
236
|
+
run?: boolean | undefined;
|
|
237
|
+
}): ParsedArgv;
|
|
238
|
+
private mri;
|
|
239
|
+
runMatchedCommand(): any;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
interface CliParseOptions {
|
|
243
|
+
allowUnknownOptions?: boolean;
|
|
244
|
+
}
|
|
245
|
+
declare function createCLI(options?: CliParseOptions): CAC;
|
|
246
|
+
declare function parseCLI(argv: string | string[], config?: CliParseOptions): {
|
|
247
|
+
filter: string[];
|
|
248
|
+
options: CliOptions;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
declare function resolveApiServerConfig(config: UserConfig, defaultPort: number, logger: Logger): ApiConfig;
|
|
252
|
+
declare function resolveConfig(options?: UserConfig, viteOverrides?: UserConfig$1, pluginsHarness?: PluginHarness, cliFilters?: string[]): Promise<ResolvedConfig$1>;
|
|
253
|
+
|
|
254
|
+
type Threshold = "lines" | "functions" | "statements" | "branches";
|
|
255
|
+
interface ResolvedThreshold {
|
|
256
|
+
coverageMap: CoverageMap;
|
|
257
|
+
name: string;
|
|
258
|
+
thresholds: Partial<Record<Threshold, number | undefined>>;
|
|
259
|
+
/** When `true`, check `thresholds` against each file instead of the aggregate. */
|
|
260
|
+
perFile: boolean;
|
|
261
|
+
/** Additional per-file-only minimums (object form of `perFile`), or `null`. */
|
|
262
|
+
perFileThresholds: Partial<Record<Threshold, number | undefined>> | null;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Holds info about raw coverage results that are stored on file system:
|
|
266
|
+
*
|
|
267
|
+
* ```json
|
|
268
|
+
* "project-a": {
|
|
269
|
+
* "web": {
|
|
270
|
+
* "tests/math.test.ts": "coverage-1.json",
|
|
271
|
+
* "tests/utils.test.ts": "coverage-2.json",
|
|
272
|
+
* // ^^^^^^^^^^^^^^^ Raw coverage on file system
|
|
273
|
+
* },
|
|
274
|
+
* "ssr": { ... },
|
|
275
|
+
* "browser": { ... },
|
|
276
|
+
* },
|
|
277
|
+
* "project-b": ...
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
type CoverageFiles = Map<NonNullable<AfterSuiteRunMeta["projectName"]> | symbol, Record<AfterSuiteRunMeta["environment"], {
|
|
281
|
+
[TestFilenames: string]: string;
|
|
282
|
+
}>>;
|
|
283
|
+
declare class BaseCoverageProvider {
|
|
284
|
+
ctx: Vitest;
|
|
285
|
+
readonly name: "v8" | "istanbul";
|
|
286
|
+
version: string;
|
|
287
|
+
options: ResolvedCoverageOptions;
|
|
288
|
+
globCache: Map<string, boolean>;
|
|
289
|
+
autoUpdateMarker: string;
|
|
290
|
+
globMatchers?: {
|
|
291
|
+
matchExclude: (file: string) => boolean;
|
|
292
|
+
matchInclude: (file: string) => boolean;
|
|
293
|
+
};
|
|
294
|
+
coverageFiles: CoverageFiles;
|
|
295
|
+
coverageFilesDirectory: string;
|
|
296
|
+
reportsDirectoryLock: ReportsDirectoryLock;
|
|
297
|
+
roots: string[];
|
|
298
|
+
changedFiles?: string[];
|
|
299
|
+
_initialize(ctx: Vitest): void;
|
|
77
300
|
/**
|
|
78
|
-
*
|
|
301
|
+
* Check if file matches `coverage.include` but not `coverage.exclude`
|
|
79
302
|
*/
|
|
80
|
-
|
|
303
|
+
isIncluded(_filename: string, root?: string): boolean;
|
|
81
304
|
/**
|
|
82
|
-
*
|
|
305
|
+
* Compile `coverage.include`/`coverage.exclude` into reusable matchers once.
|
|
306
|
+
* `picomatch.isMatch(file, patterns, options)` recompiles the patterns on
|
|
307
|
+
* every call, which dominates the filtering step on large test suites.
|
|
83
308
|
*/
|
|
84
|
-
|
|
309
|
+
private getGlobMatchers;
|
|
310
|
+
private getUntestedFilesByRoot;
|
|
311
|
+
getUntestedFiles(testedFiles: string[]): Promise<string[]>;
|
|
312
|
+
createCoverageMap(): CoverageMap;
|
|
313
|
+
generateReports(_: CoverageMap, __: boolean | undefined): Promise<void>;
|
|
314
|
+
parseConfigModule(_: string): Promise<{
|
|
315
|
+
generate: () => {
|
|
316
|
+
code: string;
|
|
317
|
+
};
|
|
318
|
+
}>;
|
|
319
|
+
resolveOptions(): ResolvedCoverageOptions;
|
|
320
|
+
clean(clean?: boolean): Promise<void>;
|
|
321
|
+
onAfterSuiteRun({ coverage, environment, projectName, testFiles }: AfterSuiteRunMeta): void;
|
|
322
|
+
readCoverageFiles<CoverageType>({ onFileRead, onFinished, onDebug }: {
|
|
323
|
+
/** Callback invoked with a single coverage result */
|
|
324
|
+
onFileRead: (data: CoverageType) => void;
|
|
325
|
+
/** Callback invoked once all results of a project for specific transform mode are read */
|
|
326
|
+
onFinished: (project: Vitest["projects"][number], environment: string) => Promise<void>;
|
|
327
|
+
onDebug: ((...logs: any[]) => void) & {
|
|
328
|
+
enabled: boolean;
|
|
329
|
+
};
|
|
330
|
+
}): Promise<void>;
|
|
331
|
+
cleanAfterRun(): Promise<void>;
|
|
332
|
+
onTestRunStart(specifications: ReadonlyArray<TestSpecification>): Promise<void>;
|
|
333
|
+
onTestFailure(): Promise<void>;
|
|
334
|
+
reportCoverage(coverageMap: unknown, { allTestsRun }: ReportContext): Promise<void>;
|
|
335
|
+
reportThresholds(coverageMap: CoverageMap, allTestsRun: boolean | undefined): Promise<void>;
|
|
85
336
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
337
|
+
* Constructs collected coverage and users' threshold options into separate sets
|
|
338
|
+
* where each threshold set holds their own coverage maps. Threshold set is either
|
|
339
|
+
* for specific files defined by glob pattern or global for all other files.
|
|
88
340
|
*/
|
|
89
|
-
|
|
341
|
+
private resolveThresholds;
|
|
90
342
|
/**
|
|
91
|
-
*
|
|
92
|
-
* @experimental
|
|
343
|
+
* Check collected coverage against configured thresholds. Sets exit code to 1 when thresholds not reached.
|
|
93
344
|
*/
|
|
94
|
-
|
|
345
|
+
private checkThresholds;
|
|
346
|
+
private reportThresholdViolations;
|
|
95
347
|
/**
|
|
96
|
-
*
|
|
97
|
-
* Use `bundle` to bundle the config with esbuild or `runner` (experimental) to process it on the fly (default: `bundle`).
|
|
98
|
-
* This is only available with **vite version 6.1.0** and above.
|
|
99
|
-
* @experimental
|
|
348
|
+
* Check if current coverage is above configured thresholds and bump the thresholds if needed
|
|
100
349
|
*/
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
350
|
+
updateThresholds({ thresholds: allThresholds, onUpdate, configurationFile }: {
|
|
351
|
+
thresholds: ResolvedThreshold[];
|
|
352
|
+
configurationFile: unknown;
|
|
353
|
+
onUpdate: () => void;
|
|
354
|
+
}): Promise<void>;
|
|
355
|
+
mergeReports(coverageMaps: unknown[]): Promise<void>;
|
|
356
|
+
hasTerminalReporter(reporters: ResolvedCoverageOptions["reporter"]): boolean;
|
|
357
|
+
toSlices<T>(array: T[], size: number): T[][];
|
|
358
|
+
transformFile(url: string, project: TestProject, viteEnvironment: string, isTransformedByVite?: boolean): Promise<TransformResult | null | undefined>;
|
|
359
|
+
createUncoveredFileTransformer(ctx: Vitest): (filename: string) => Promise<TransformResult | null | undefined>;
|
|
104
360
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
361
|
+
declare class ReportsDirectoryLock {
|
|
362
|
+
private readonly reportsDirectory;
|
|
363
|
+
readonly lockFile: string;
|
|
364
|
+
constructor(reportsDirectory: string);
|
|
365
|
+
acquire(): Promise<void>;
|
|
366
|
+
release(): Promise<void>;
|
|
367
|
+
private tryWrite;
|
|
368
|
+
private readOwner;
|
|
369
|
+
private inUseError;
|
|
114
370
|
}
|
|
115
|
-
declare function parseCLI(argv: string | string[], config?: CliParseOptions): {
|
|
116
|
-
filter: string[];
|
|
117
|
-
options: CliOptions;
|
|
118
|
-
};
|
|
119
371
|
|
|
372
|
+
declare function createVitest(options: CliOptions, viteOverrides?: UserConfig$1, vitestOptions?: VitestOptions): Promise<Vitest>;
|
|
120
373
|
/**
|
|
121
|
-
* @deprecated
|
|
374
|
+
* @deprecated The `mode` argument is no longer used. Use `createVitest(options, viteOverrides?, vitestOptions?)` instead.
|
|
122
375
|
*/
|
|
123
|
-
declare function resolveApiServerConfig<Options extends ApiConfig & Omit<UserConfig, "expect">>(options: Options, defaultPort: number, parentApi?: ApiConfig, logger?: Logger): ApiConfig | undefined;
|
|
124
|
-
|
|
125
376
|
declare function createVitest(mode: VitestRunMode, options: CliOptions, viteOverrides?: UserConfig$1, vitestOptions?: VitestOptions): Promise<Vitest>;
|
|
126
377
|
|
|
127
378
|
declare class FilesNotFoundError extends Error {
|
|
128
379
|
code: string;
|
|
129
|
-
constructor(
|
|
380
|
+
constructor();
|
|
130
381
|
}
|
|
131
382
|
declare class GitNotFoundError extends Error {
|
|
132
383
|
code: string;
|
|
133
384
|
constructor();
|
|
134
385
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
declare function resolveConfig(options?: UserConfig, viteOverrides?: UserConfig$1): Promise<{
|
|
139
|
-
vitestConfig: ResolvedConfig;
|
|
140
|
-
viteConfig: ResolvedConfig$1;
|
|
141
|
-
}>;
|
|
386
|
+
declare class BrowserConnectionError extends Error {
|
|
387
|
+
code: string;
|
|
388
|
+
}
|
|
142
389
|
|
|
143
390
|
declare function resolveFsAllow(projectRoot: string, rootConfigFile: string | false | undefined): string[];
|
|
144
391
|
|
|
@@ -157,6 +404,24 @@ interface MethodsOptions {
|
|
|
157
404
|
}
|
|
158
405
|
declare function createMethodsRPC(project: TestProject, methodsOptions?: MethodsOptions): RuntimeRPC;
|
|
159
406
|
|
|
407
|
+
declare class GitVCSProvider implements VCSProvider {
|
|
408
|
+
private root;
|
|
409
|
+
private resolveFilesWithGitCommand;
|
|
410
|
+
findChangedFiles(options: VCSProviderOptions): Promise<string[]>;
|
|
411
|
+
private getFilesSince;
|
|
412
|
+
private getStagedFiles;
|
|
413
|
+
private getUnstagedFiles;
|
|
414
|
+
getRoot(cwd: string): Promise<string | null>;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Reports a dependency as changed when its modification time is newer than the run that recorded it.
|
|
419
|
+
* A dependency without a recorded time is always changed.
|
|
420
|
+
*/
|
|
421
|
+
declare class MtimeVCSProvider implements VCSProvider {
|
|
422
|
+
findChangedFiles(options: VCSProviderOptions): Promise<string[]>;
|
|
423
|
+
}
|
|
424
|
+
|
|
160
425
|
/** @experimental */
|
|
161
426
|
declare class ForksPoolWorker implements PoolWorker {
|
|
162
427
|
readonly name: string;
|
|
@@ -167,13 +432,16 @@ declare class ForksPoolWorker implements PoolWorker {
|
|
|
167
432
|
private _fork?;
|
|
168
433
|
private stdout;
|
|
169
434
|
private stderr;
|
|
435
|
+
private _errorEmitter;
|
|
436
|
+
private _pipeErrorTimer;
|
|
170
437
|
constructor(options: PoolOptions);
|
|
171
|
-
on(event: string, callback: (
|
|
172
|
-
off(event: string, callback: (
|
|
438
|
+
on(event: string, callback: (...args: any[]) => void): void;
|
|
439
|
+
off(event: string, callback: (...args: any[]) => void): void;
|
|
173
440
|
send(message: WorkerRequest): void;
|
|
174
441
|
start(): Promise<void>;
|
|
175
442
|
stop(): Promise<void>;
|
|
176
443
|
deserialize(data: unknown): unknown;
|
|
444
|
+
private emitError;
|
|
177
445
|
private get fork();
|
|
178
446
|
}
|
|
179
447
|
|
|
@@ -187,8 +455,8 @@ declare class ThreadsPoolWorker implements PoolWorker {
|
|
|
187
455
|
private stdout;
|
|
188
456
|
private stderr;
|
|
189
457
|
constructor(options: PoolOptions);
|
|
190
|
-
on(event: string, callback: (
|
|
191
|
-
off(event: string, callback: (
|
|
458
|
+
on(event: string, callback: (...args: any[]) => void): void;
|
|
459
|
+
off(event: string, callback: (...args: any[]) => void): void;
|
|
192
460
|
send(message: WorkerRequest): void;
|
|
193
461
|
start(): Promise<void>;
|
|
194
462
|
stop(): Promise<void>;
|
|
@@ -214,7 +482,7 @@ declare class TypecheckPoolWorker implements PoolWorker {
|
|
|
214
482
|
/** @experimental */
|
|
215
483
|
declare class VmForksPoolWorker extends ForksPoolWorker {
|
|
216
484
|
readonly name = "vmForks";
|
|
217
|
-
readonly reportMemory
|
|
485
|
+
readonly reportMemory = true;
|
|
218
486
|
protected readonly entrypoint: string;
|
|
219
487
|
constructor(options: PoolOptions);
|
|
220
488
|
canReuse(): boolean;
|
|
@@ -223,7 +491,7 @@ declare class VmForksPoolWorker extends ForksPoolWorker {
|
|
|
223
491
|
/** @experimental */
|
|
224
492
|
declare class VmThreadsPoolWorker extends ThreadsPoolWorker {
|
|
225
493
|
readonly name = "vmThreads";
|
|
226
|
-
readonly reportMemory
|
|
494
|
+
readonly reportMemory = true;
|
|
227
495
|
protected readonly entrypoint: string;
|
|
228
496
|
constructor(options: PoolOptions);
|
|
229
497
|
canReuse(): boolean;
|
|
@@ -261,5 +529,5 @@ declare const createViteServer: typeof vite.createServer;
|
|
|
261
529
|
|
|
262
530
|
declare const rolldownVersion: string | undefined;
|
|
263
531
|
|
|
264
|
-
export { ApiConfig, BaseSequencer, ForksPoolWorker, GitNotFoundError, PoolOptions, PoolWorker, ResolvedConfig, TestProject, TestSequencer, TestSpecification, UserConfig as TestUserConfig, FilesNotFoundError as TestsNotFoundError, ThreadsPoolWorker, TypecheckPoolWorker, Vitest, VitestOptions,
|
|
265
|
-
export type {
|
|
532
|
+
export { ApiConfig, BaseCoverageProvider, BaseSequencer, BrowserConnectionError, CliOptions, ForksPoolWorker, GitNotFoundError, GitVCSProvider, Logger, MtimeVCSProvider, PluginHarness, PoolOptions, PoolWorker, ReportContext, ResolvedConfig, ResolvedCoverageOptions, TestProject, TestSequencer, TestSpecification, UserConfig as TestUserConfig, FilesNotFoundError as TestsNotFoundError, ThreadsPoolWorker, TypecheckPoolWorker, VCSProvider, VCSProviderOptions, Vitest, VitestOptions, VitestRunMode, VmForksPoolWorker, VmThreadsPoolWorker, WorkerRequest, createCLI, createDebugger, createMethodsRPC, createViteLogger, createViteServer, createVitest, distDir, escapeTestName, getFilePoolName, isFileServingAllowed, isValidApiRequest, parseCLI, registerConsoleShortcuts, resolveApiServerConfig, resolveConfig, resolveFsAllow, rolldownVersion, rootDir, version };
|
|
533
|
+
export type { CliParseOptions, ProcessPool, CollectLineNumbers as TypeCheckCollectLineNumbers, CollectLines as TypeCheckCollectLines, Context as TypeCheckContext, TscErrorInfo as TypeCheckErrorInfo, RawErrsMap as TypeCheckRawErrorsMap, RootAndTarget as TypeCheckRootAndTarget, WorkerContext };
|