vitest 3.2.4 → 4.0.0-beta.10
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 +2 -2
- package/dist/browser.d.ts +13 -16
- package/dist/browser.js +6 -5
- package/dist/chunks/base.Cjha6usc.js +129 -0
- package/dist/chunks/{benchmark.CYdenmiT.js → benchmark.CJUa-Hsa.js} +6 -8
- package/dist/chunks/{benchmark.d.BwvBVTda.d.ts → benchmark.d.DAaHLpsq.d.ts} +4 -4
- package/dist/chunks/browser.d.yFAklsD1.d.ts +18 -0
- package/dist/chunks/{cac.Cb-PYCCB.js → cac.DCxo_nSu.js} +72 -163
- package/dist/chunks/{cli-api.BkDphVBG.js → cli-api.BJJXh9BV.js} +1331 -1678
- package/dist/chunks/{config.d.D2ROskhv.d.ts → config.d.B_LthbQq.d.ts} +59 -65
- package/dist/chunks/{console.CtFJOzRO.js → console.7h5kHUIf.js} +34 -70
- package/dist/chunks/{constants.DnKduX2e.js → constants.D_Q9UYh-.js} +1 -9
- package/dist/chunks/{coverage.DL5VHqXY.js → coverage.BCU-r2QL.js} +538 -765
- package/dist/chunks/{coverage.DVF1vEu8.js → coverage.D_JHT54q.js} +2 -2
- package/dist/chunks/{coverage.d.S9RMNXIe.d.ts → coverage.d.BZtK59WP.d.ts} +10 -8
- package/dist/chunks/{creator.GK6I-cL4.js → creator.08Gi-vCA.js} +93 -77
- package/dist/chunks/{date.Bq6ZW5rf.js → date.-jtEtIeV.js} +6 -17
- package/dist/chunks/{defaults.B7q_naMc.js → defaults.CXFFjsi8.js} +2 -42
- package/dist/chunks/environment.d.BsToaxti.d.ts +65 -0
- package/dist/chunks/{git.BVQ8w_Sw.js → git.BFNcloKD.js} +1 -2
- package/dist/chunks/{global.d.MAmajcmJ.d.ts → global.d.BK3X7FW1.d.ts} +7 -32
- package/dist/chunks/{globals.DEHgCU4V.js → globals.DG-S3xFe.js} +8 -8
- package/dist/chunks/{index.VByaPkjc.js → index.BIP7prJq.js} +472 -803
- package/dist/chunks/{index.B521nVV-.js → index.Bgo3tNWt.js} +23 -4
- package/dist/chunks/{index.BCWujgDG.js → index.BjKEiSn0.js} +14 -24
- package/dist/chunks/{index.CdQS2e2Q.js → index.CMfqw92x.js} +7 -8
- package/dist/chunks/{index.CmSc2RE5.js → index.DIWhzsUh.js} +72 -118
- package/dist/chunks/{inspector.C914Efll.js → inspector.CvQD-Nie.js} +10 -25
- package/dist/chunks/moduleRunner.d.D9nBoC4p.d.ts +201 -0
- package/dist/chunks/moduleTransport.I-bgQy0S.js +19 -0
- package/dist/chunks/{node.fjCdwEIl.js → node.CyipiPvJ.js} +1 -1
- package/dist/chunks/plugin.d.BMVSnsGV.d.ts +9 -0
- package/dist/chunks/{reporters.d.BFLkQcL6.d.ts → reporters.d.BUWjmRYq.d.ts} +2086 -2146
- package/dist/chunks/resolveSnapshotEnvironment.Bkht6Yor.js +81 -0
- package/dist/chunks/resolver.Bx6lE0iq.js +119 -0
- package/dist/chunks/rpc.BKr6mtxz.js +65 -0
- package/dist/chunks/{setup-common.Dd054P77.js → setup-common.uiMcU3cv.js} +17 -29
- package/dist/chunks/startModuleRunner.p67gbNo9.js +665 -0
- package/dist/chunks/{suite.d.FvehnV49.d.ts → suite.d.BJWk38HB.d.ts} +1 -1
- package/dist/chunks/test.BiqSKISg.js +214 -0
- package/dist/chunks/{typechecker.DRKU1-1g.js → typechecker.DB-fIMaH.js} +165 -234
- package/dist/chunks/{utils.CAioKnHs.js → utils.C2YI6McM.js} +5 -14
- package/dist/chunks/{utils.XdZDrNZV.js → utils.D2R2NiOH.js} +8 -27
- package/dist/chunks/{vi.bdSIJ99Y.js → vi.ZPgvtBao.js} +156 -305
- package/dist/chunks/{vm.BThCzidc.js → vm.Ca0Y0W5f.js} +116 -226
- package/dist/chunks/{worker.d.1GmBbd7G.d.ts → worker.d.BDsXGkwh.d.ts} +31 -32
- package/dist/chunks/{worker.d.CKwWzBSj.d.ts → worker.d.BNcX_2mH.d.ts} +1 -1
- package/dist/cli.js +10 -10
- package/dist/config.cjs +5 -58
- package/dist/config.d.ts +72 -71
- package/dist/config.js +3 -9
- package/dist/coverage.d.ts +31 -24
- package/dist/coverage.js +9 -9
- package/dist/environments.d.ts +9 -14
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +52 -213
- package/dist/index.js +7 -9
- package/dist/module-evaluator.d.ts +13 -0
- package/dist/module-evaluator.js +276 -0
- package/dist/module-runner.js +15 -0
- package/dist/node.d.ts +62 -51
- package/dist/node.js +26 -42
- package/dist/reporters.d.ts +11 -12
- package/dist/reporters.js +12 -12
- package/dist/runners.d.ts +3 -4
- package/dist/runners.js +13 -231
- package/dist/snapshot.js +2 -2
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.js +90 -47
- package/dist/workers/forks.js +34 -10
- package/dist/workers/runVmTests.js +36 -56
- package/dist/workers/threads.js +34 -10
- package/dist/workers/vmForks.js +11 -10
- package/dist/workers/vmThreads.js +11 -10
- package/dist/workers.d.ts +5 -7
- package/dist/workers.js +35 -17
- package/globals.d.ts +17 -17
- package/package.json +32 -31
- package/dist/chunks/base.DfmxU-tU.js +0 -38
- package/dist/chunks/environment.d.cL3nLXbE.d.ts +0 -119
- package/dist/chunks/execute.B7h3T_Hc.js +0 -708
- package/dist/chunks/index.CwejwG0H.js +0 -105
- package/dist/chunks/rpc.-pEldfrD.js +0 -83
- package/dist/chunks/runBaseTests.9Ij9_de-.js +0 -129
- package/dist/chunks/vite.d.CMLlLIFP.d.ts +0 -25
- package/dist/execute.d.ts +0 -150
- package/dist/execute.js +0 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { File, TestAnnotation, TaskResultPack, TaskEventPack,
|
|
2
|
-
import {
|
|
3
|
-
import { a as SerializedConfig } from './config.d.
|
|
4
|
-
import {
|
|
1
|
+
import { CancelReason, File, TestAnnotation, TaskResultPack, TaskEventPack, FileSpecification, Task } from '@vitest/runner';
|
|
2
|
+
import { FetchFunctionOptions, FetchResult, EvaluatedModules } from 'vite/module-runner';
|
|
3
|
+
import { a as SerializedConfig } from './config.d.B_LthbQq.js';
|
|
4
|
+
import { F as FetchCachedFileSystemResult, R as ResolveFunctionResult, U as UserConsoleLog, A as AfterSuiteRunMeta, E as Environment } from './environment.d.BsToaxti.js';
|
|
5
5
|
import { SnapshotResult } from '@vitest/snapshot';
|
|
6
6
|
|
|
7
7
|
type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
@@ -93,30 +93,23 @@ type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
|
|
|
93
93
|
$functions: LocalFunctions;
|
|
94
94
|
$close: (error?: Error) => void;
|
|
95
95
|
$closed: boolean;
|
|
96
|
+
$rejectPendingCalls: (handler?: PendingCallHandler) => Promise<void>[];
|
|
96
97
|
};
|
|
98
|
+
type PendingCallHandler = (options: Pick<PromiseEntry, 'method' | 'reject'>) => void | Promise<void>;
|
|
99
|
+
interface PromiseEntry {
|
|
100
|
+
resolve: (arg: any) => void;
|
|
101
|
+
reject: (error: any) => void;
|
|
102
|
+
method: string;
|
|
103
|
+
timeoutId?: ReturnType<typeof setTimeout>;
|
|
104
|
+
}
|
|
105
|
+
declare const setTimeout: typeof globalThis.setTimeout;
|
|
97
106
|
|
|
98
107
|
interface RuntimeRPC {
|
|
99
|
-
fetch: (id: string,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
transform: (id: string, transformMode: TransformMode) => Promise<{
|
|
104
|
-
code?: string
|
|
108
|
+
fetch: (id: string, importer: string | undefined, environment: string, options?: FetchFunctionOptions) => Promise<FetchResult | FetchCachedFileSystemResult>;
|
|
109
|
+
resolve: (id: string, importer: string | undefined, environment: string) => Promise<ResolveFunctionResult | null>;
|
|
110
|
+
transform: (id: string) => Promise<{
|
|
111
|
+
code?: string;
|
|
105
112
|
}>;
|
|
106
|
-
resolveId: (id: string, importer: string | undefined, transformMode: TransformMode) => Promise<{
|
|
107
|
-
external?: boolean | "absolute" | "relative"
|
|
108
|
-
id: string
|
|
109
|
-
/** @deprecated */
|
|
110
|
-
meta?: Record<string, any> | null
|
|
111
|
-
/** @deprecated */
|
|
112
|
-
moduleSideEffects?: boolean | "no-treeshake" | null
|
|
113
|
-
/** @deprecated */
|
|
114
|
-
syntheticNamedExports?: boolean | string | null
|
|
115
|
-
} | null>;
|
|
116
|
-
/**
|
|
117
|
-
* @deprecated unused
|
|
118
|
-
*/
|
|
119
|
-
getSourceMap: (id: string, force?: boolean) => Promise<any>;
|
|
120
113
|
onUserConsoleLog: (log: UserConsoleLog) => void;
|
|
121
114
|
onUnhandledError: (err: unknown, type: string) => void;
|
|
122
115
|
onQueued: (file: File) => void;
|
|
@@ -133,12 +126,9 @@ interface RunnerRPC {
|
|
|
133
126
|
onCancel: (reason: CancelReason) => void;
|
|
134
127
|
}
|
|
135
128
|
|
|
136
|
-
/** @deprecated unused */
|
|
137
|
-
type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
|
|
138
129
|
type WorkerRPC = BirpcReturn<RuntimeRPC, RunnerRPC>;
|
|
139
130
|
interface ContextTestEnvironment {
|
|
140
131
|
name: string;
|
|
141
|
-
transformMode?: TransformMode;
|
|
142
132
|
options: Record<string, any> | null;
|
|
143
133
|
}
|
|
144
134
|
type TestExecutionMethod = "run" | "collect";
|
|
@@ -159,18 +149,27 @@ interface WorkerGlobalState {
|
|
|
159
149
|
rpc: WorkerRPC;
|
|
160
150
|
current?: Task;
|
|
161
151
|
filepath?: string;
|
|
152
|
+
metaEnv: {
|
|
153
|
+
[key: string]: any;
|
|
154
|
+
BASE_URL: string;
|
|
155
|
+
MODE: string;
|
|
156
|
+
DEV: boolean;
|
|
157
|
+
PROD: boolean;
|
|
158
|
+
SSR: boolean;
|
|
159
|
+
};
|
|
162
160
|
environment: Environment;
|
|
163
161
|
environmentTeardownRun?: boolean;
|
|
164
162
|
onCancel: Promise<CancelReason>;
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
evaluatedModules: EvaluatedModules;
|
|
164
|
+
resolvingModules: Set<string>;
|
|
165
|
+
moduleExecutionInfo: Map<string, any>;
|
|
167
166
|
onCleanup: (listener: () => unknown) => void;
|
|
168
167
|
providedContext: Record<string, any>;
|
|
169
168
|
durations: {
|
|
170
|
-
environment: number
|
|
171
|
-
prepare: number
|
|
169
|
+
environment: number;
|
|
170
|
+
prepare: number;
|
|
172
171
|
};
|
|
173
172
|
onFilterStackTrace?: (trace: string) => string;
|
|
174
173
|
}
|
|
175
174
|
|
|
176
|
-
export type { BirpcOptions as B, ContextRPC as C, RuntimeRPC as R, TestExecutionMethod as T, WorkerGlobalState as W, BirpcReturn as a,
|
|
175
|
+
export type { BirpcOptions as B, ContextRPC as C, RuntimeRPC as R, TestExecutionMethod as T, WorkerGlobalState as W, BirpcReturn as a, RunnerRPC as b, ContextTestEnvironment as c };
|
package/dist/cli.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { c as createCLI } from './chunks/cac.
|
|
1
|
+
import { c as createCLI } from './chunks/cac.DCxo_nSu.js';
|
|
2
2
|
import '@vitest/utils';
|
|
3
3
|
import 'events';
|
|
4
4
|
import 'pathe';
|
|
5
5
|
import 'tinyrainbow';
|
|
6
|
-
import './chunks/constants.
|
|
7
|
-
import './chunks/index.
|
|
6
|
+
import './chunks/constants.D_Q9UYh-.js';
|
|
7
|
+
import './chunks/index.BIP7prJq.js';
|
|
8
|
+
import 'node:fs';
|
|
9
|
+
import 'node:fs/promises';
|
|
10
|
+
import './chunks/typechecker.DB-fIMaH.js';
|
|
11
|
+
import 'node:os';
|
|
8
12
|
import 'node:perf_hooks';
|
|
9
|
-
import '@vitest/runner/utils';
|
|
10
13
|
import '@vitest/utils/source-map';
|
|
11
|
-
import './chunks/env.D4Lgay0q.js';
|
|
12
|
-
import 'std-env';
|
|
13
|
-
import './chunks/typechecker.DRKU1-1g.js';
|
|
14
|
-
import 'node:os';
|
|
15
14
|
import 'tinyexec';
|
|
16
15
|
import './path.js';
|
|
17
16
|
import 'node:path';
|
|
18
17
|
import 'node:url';
|
|
18
|
+
import '@vitest/runner/utils';
|
|
19
19
|
import 'vite';
|
|
20
|
+
import './chunks/env.D4Lgay0q.js';
|
|
21
|
+
import 'std-env';
|
|
20
22
|
import 'node:util';
|
|
21
|
-
import 'node:fs';
|
|
22
|
-
import 'node:fs/promises';
|
|
23
23
|
import 'node:console';
|
|
24
24
|
import 'node:stream';
|
|
25
25
|
import 'node:module';
|
package/dist/config.cjs
CHANGED
|
@@ -4,55 +4,24 @@ var os = require('node:os');
|
|
|
4
4
|
var stdEnv = require('std-env');
|
|
5
5
|
var vite = require('vite');
|
|
6
6
|
|
|
7
|
-
// if changed, update also jsdocs and docs
|
|
8
|
-
const defaultBrowserPort = 63315;
|
|
9
|
-
const extraInlineDeps = [
|
|
10
|
-
/^(?!.*node_modules).*\.mjs$/,
|
|
11
|
-
/^(?!.*node_modules).*\.cjs\.js$/,
|
|
12
|
-
/vite\w*\/dist\/client\/env.mjs/
|
|
13
|
-
];
|
|
14
|
-
|
|
15
7
|
const isNode = typeof process < "u" && typeof process.stdout < "u" && !process.versions?.deno && !globalThis.window;
|
|
16
8
|
const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !== void 0;
|
|
17
9
|
(isNode || isDeno) && process.platform === "win32";
|
|
18
10
|
(isNode || isDeno) && process.stdout?.isTTY && !stdEnv.isCI;
|
|
19
11
|
|
|
12
|
+
// if changed, update also jsdocs and docs
|
|
13
|
+
const defaultBrowserPort = 63315;
|
|
14
|
+
|
|
20
15
|
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
|
|
21
|
-
const defaultExclude = [
|
|
22
|
-
"**/node_modules/**",
|
|
23
|
-
"**/dist/**",
|
|
24
|
-
"**/cypress/**",
|
|
25
|
-
"**/.{idea,git,cache,output,temp}/**",
|
|
26
|
-
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*"
|
|
27
|
-
];
|
|
28
|
-
const defaultCoverageExcludes = [
|
|
29
|
-
"coverage/**",
|
|
30
|
-
"dist/**",
|
|
31
|
-
"**/node_modules/**",
|
|
32
|
-
"**/[.]**",
|
|
33
|
-
"packages/*/test?(s)/**",
|
|
34
|
-
"**/*.d.ts",
|
|
35
|
-
"**/virtual:*",
|
|
36
|
-
"**/__x00__*",
|
|
37
|
-
"**/\0*",
|
|
38
|
-
"cypress/**",
|
|
39
|
-
"test?(s)/**",
|
|
40
|
-
"test?(-*).?(c|m)[jt]s?(x)",
|
|
41
|
-
"**/*{.,-}{test,spec,bench,benchmark}?(-d).?(c|m)[jt]s?(x)",
|
|
42
|
-
"**/__tests__/**",
|
|
43
|
-
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*",
|
|
44
|
-
"**/vitest.{workspace,projects}.[jt]s?(on)",
|
|
45
|
-
"**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
|
|
46
|
-
];
|
|
16
|
+
const defaultExclude = ["**/node_modules/**", "**/.git/**"];
|
|
47
17
|
// These are the generic defaults for coverage. Providers may also set some provider specific defaults.
|
|
48
18
|
const coverageConfigDefaults = {
|
|
49
19
|
provider: "v8",
|
|
50
20
|
enabled: false,
|
|
51
|
-
all: true,
|
|
52
21
|
clean: true,
|
|
53
22
|
cleanOnRerun: true,
|
|
54
23
|
reportsDirectory: "./coverage",
|
|
55
|
-
exclude:
|
|
24
|
+
exclude: [],
|
|
56
25
|
reportOnFailure: false,
|
|
57
26
|
reporter: [
|
|
58
27
|
["text", {}],
|
|
@@ -60,22 +29,8 @@ const coverageConfigDefaults = {
|
|
|
60
29
|
["clover", {}],
|
|
61
30
|
["json", {}]
|
|
62
31
|
],
|
|
63
|
-
extension: [
|
|
64
|
-
".js",
|
|
65
|
-
".cjs",
|
|
66
|
-
".mjs",
|
|
67
|
-
".ts",
|
|
68
|
-
".mts",
|
|
69
|
-
".tsx",
|
|
70
|
-
".jsx",
|
|
71
|
-
".vue",
|
|
72
|
-
".svelte",
|
|
73
|
-
".marko",
|
|
74
|
-
".astro"
|
|
75
|
-
],
|
|
76
32
|
allowExternal: false,
|
|
77
33
|
excludeAfterRemap: false,
|
|
78
|
-
ignoreEmptyLines: true,
|
|
79
34
|
processingConcurrency: Math.min(20, os.availableParallelism?.() ?? os.cpus().length)
|
|
80
35
|
};
|
|
81
36
|
const fakeTimersDefaults = {
|
|
@@ -126,12 +81,6 @@ function defineConfig(config) {
|
|
|
126
81
|
function defineProject(config) {
|
|
127
82
|
return config;
|
|
128
83
|
}
|
|
129
|
-
/**
|
|
130
|
-
* @deprecated use the `projects` field in the root config instead
|
|
131
|
-
*/
|
|
132
|
-
function defineWorkspace(config) {
|
|
133
|
-
return config;
|
|
134
|
-
}
|
|
135
84
|
|
|
136
85
|
Object.defineProperty(exports, "mergeConfig", {
|
|
137
86
|
enumerable: true,
|
|
@@ -144,5 +93,3 @@ exports.defaultExclude = defaultExclude;
|
|
|
144
93
|
exports.defaultInclude = defaultInclude;
|
|
145
94
|
exports.defineConfig = defineConfig;
|
|
146
95
|
exports.defineProject = defineProject;
|
|
147
|
-
exports.defineWorkspace = defineWorkspace;
|
|
148
|
-
exports.extraInlineDeps = extraInlineDeps;
|
package/dist/config.d.ts
CHANGED
|
@@ -1,100 +1,101 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HookHandler, ConfigEnv, UserConfig } from 'vite';
|
|
2
2
|
export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
|
|
3
|
-
import { c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport
|
|
4
|
-
export {
|
|
5
|
-
import './chunks/
|
|
6
|
-
import { F as FakeTimerInstallOpts } from './chunks/config.d.
|
|
3
|
+
import { I as InlineConfig, c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.BUWjmRYq.js';
|
|
4
|
+
export { a as TestProjectConfiguration, g as TestProjectInlineConfiguration, f as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.BUWjmRYq.js';
|
|
5
|
+
import { V as VitestPluginContext } from './chunks/plugin.d.BMVSnsGV.js';
|
|
6
|
+
import { F as FakeTimerInstallOpts } from './chunks/config.d.B_LthbQq.js';
|
|
7
7
|
import '@vitest/runner';
|
|
8
|
-
import './chunks/environment.d.cL3nLXbE.js';
|
|
9
|
-
import 'vitest/optional-types.js';
|
|
10
8
|
import '@vitest/utils';
|
|
9
|
+
import './chunks/environment.d.BsToaxti.js';
|
|
11
10
|
import 'node:stream';
|
|
12
|
-
import 'node:console';
|
|
13
11
|
import '@vitest/mocker';
|
|
14
12
|
import '@vitest/utils/source-map';
|
|
15
|
-
import './chunks/
|
|
16
|
-
import '
|
|
13
|
+
import './chunks/browser.d.yFAklsD1.js';
|
|
14
|
+
import './chunks/worker.d.BDsXGkwh.js';
|
|
15
|
+
import 'vite/module-runner';
|
|
17
16
|
import '@vitest/snapshot';
|
|
18
17
|
import '@vitest/pretty-format';
|
|
19
18
|
import '@vitest/utils/diff';
|
|
20
|
-
import '
|
|
21
|
-
import '
|
|
19
|
+
import '@vitest/expect';
|
|
20
|
+
import 'vitest/optional-types.js';
|
|
21
|
+
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
22
22
|
import '@vitest/runner/utils';
|
|
23
23
|
import 'tinybench';
|
|
24
|
-
import './chunks/coverage.d.
|
|
25
|
-
import 'vite-node/client';
|
|
24
|
+
import './chunks/coverage.d.BZtK59WP.js';
|
|
26
25
|
import '@vitest/snapshot/manager';
|
|
27
26
|
import 'node:fs';
|
|
28
|
-
import '
|
|
27
|
+
import 'node:console';
|
|
28
|
+
|
|
29
|
+
type VitestInlineConfig = InlineConfig;
|
|
30
|
+
declare module "vite" {
|
|
31
|
+
interface UserConfig {
|
|
32
|
+
/**
|
|
33
|
+
* Options for Vitest
|
|
34
|
+
*/
|
|
35
|
+
test?: VitestInlineConfig;
|
|
36
|
+
}
|
|
37
|
+
interface Plugin<A = any> {
|
|
38
|
+
configureVitest?: HookHandler<(context: VitestPluginContext) => void>;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
29
41
|
|
|
30
42
|
declare const defaultBrowserPort = 63315;
|
|
31
|
-
declare const extraInlineDeps: RegExp[];
|
|
32
43
|
|
|
33
44
|
declare const defaultInclude: string[];
|
|
34
45
|
declare const defaultExclude: string[];
|
|
35
|
-
// These are the generic defaults for coverage. Providers may also set some provider specific defaults.
|
|
36
46
|
declare const coverageConfigDefaults: ResolvedCoverageOptions;
|
|
37
47
|
declare const configDefaults: Readonly<{
|
|
38
|
-
allowOnly: boolean
|
|
39
|
-
isolate: boolean
|
|
40
|
-
watch: boolean
|
|
41
|
-
globals: boolean
|
|
42
|
-
environment: "node"
|
|
43
|
-
pool: "forks"
|
|
44
|
-
clearMocks: boolean
|
|
45
|
-
restoreMocks: boolean
|
|
46
|
-
mockReset: boolean
|
|
47
|
-
unstubGlobals: boolean
|
|
48
|
-
unstubEnvs: boolean
|
|
49
|
-
include: string[]
|
|
50
|
-
exclude: string[]
|
|
51
|
-
teardownTimeout: number
|
|
52
|
-
forceRerunTriggers: string[]
|
|
53
|
-
update: boolean
|
|
54
|
-
reporters: never[]
|
|
55
|
-
silent: boolean
|
|
56
|
-
hideSkippedTests: boolean
|
|
57
|
-
api: boolean
|
|
58
|
-
ui: boolean
|
|
59
|
-
uiBase: string
|
|
60
|
-
open: boolean
|
|
48
|
+
allowOnly: boolean;
|
|
49
|
+
isolate: boolean;
|
|
50
|
+
watch: boolean;
|
|
51
|
+
globals: boolean;
|
|
52
|
+
environment: "node";
|
|
53
|
+
pool: "forks";
|
|
54
|
+
clearMocks: boolean;
|
|
55
|
+
restoreMocks: boolean;
|
|
56
|
+
mockReset: boolean;
|
|
57
|
+
unstubGlobals: boolean;
|
|
58
|
+
unstubEnvs: boolean;
|
|
59
|
+
include: string[];
|
|
60
|
+
exclude: string[];
|
|
61
|
+
teardownTimeout: number;
|
|
62
|
+
forceRerunTriggers: string[];
|
|
63
|
+
update: boolean;
|
|
64
|
+
reporters: never[];
|
|
65
|
+
silent: boolean;
|
|
66
|
+
hideSkippedTests: boolean;
|
|
67
|
+
api: boolean;
|
|
68
|
+
ui: boolean;
|
|
69
|
+
uiBase: string;
|
|
70
|
+
open: boolean;
|
|
61
71
|
css: {
|
|
62
|
-
include: never[]
|
|
63
|
-
}
|
|
64
|
-
coverage: CoverageV8Options
|
|
65
|
-
fakeTimers: FakeTimerInstallOpts
|
|
66
|
-
maxConcurrency: number
|
|
67
|
-
dangerouslyIgnoreUnhandledErrors: boolean
|
|
72
|
+
include: never[];
|
|
73
|
+
};
|
|
74
|
+
coverage: CoverageV8Options;
|
|
75
|
+
fakeTimers: FakeTimerInstallOpts;
|
|
76
|
+
maxConcurrency: number;
|
|
77
|
+
dangerouslyIgnoreUnhandledErrors: boolean;
|
|
68
78
|
typecheck: {
|
|
69
|
-
checker: "tsc"
|
|
70
|
-
include: string[]
|
|
71
|
-
exclude: string[]
|
|
72
|
-
}
|
|
73
|
-
slowTestThreshold: number
|
|
74
|
-
disableConsoleIntercept: boolean
|
|
79
|
+
checker: "tsc";
|
|
80
|
+
include: string[];
|
|
81
|
+
exclude: string[];
|
|
82
|
+
};
|
|
83
|
+
slowTestThreshold: number;
|
|
84
|
+
disableConsoleIntercept: boolean;
|
|
75
85
|
}>;
|
|
76
86
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
type
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
type UserConfigExport = UserConfig$1 | Promise<UserConfig$1> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
|
|
86
|
-
declare function defineConfig(config: UserConfig$1): UserConfig$1;
|
|
87
|
-
declare function defineConfig(config: Promise<UserConfig$1>): Promise<UserConfig$1>;
|
|
88
|
-
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
89
|
-
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
87
|
+
type ViteUserConfigFnObject = (env: ConfigEnv) => UserConfig;
|
|
88
|
+
type ViteUserConfigFnPromise = (env: ConfigEnv) => Promise<UserConfig>;
|
|
89
|
+
type ViteUserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
|
90
|
+
type ViteUserConfigExport = UserConfig | Promise<UserConfig> | ViteUserConfigFnObject | ViteUserConfigFnPromise | ViteUserConfigFn;
|
|
91
|
+
declare function defineConfig(config: UserConfig): UserConfig;
|
|
92
|
+
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
93
|
+
declare function defineConfig(config: ViteUserConfigFnObject): ViteUserConfigFnObject;
|
|
94
|
+
declare function defineConfig(config: ViteUserConfigExport): ViteUserConfigExport;
|
|
90
95
|
declare function defineProject(config: UserWorkspaceConfig): UserWorkspaceConfig;
|
|
91
96
|
declare function defineProject(config: Promise<UserWorkspaceConfig>): Promise<UserWorkspaceConfig>;
|
|
92
97
|
declare function defineProject(config: UserProjectConfigFn): UserProjectConfigFn;
|
|
93
98
|
declare function defineProject(config: UserProjectConfigExport): UserProjectConfigExport;
|
|
94
|
-
/**
|
|
95
|
-
* @deprecated use the `projects` field in the root config instead
|
|
96
|
-
*/
|
|
97
|
-
declare function defineWorkspace(config: TestProjectConfiguration[]): TestProjectConfiguration[];
|
|
98
99
|
|
|
99
|
-
export {
|
|
100
|
-
export type {
|
|
100
|
+
export { UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig, configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude, defineConfig, defineProject };
|
|
101
|
+
export type { ViteUserConfigExport, ViteUserConfigFn, ViteUserConfigFnObject, ViteUserConfigFnPromise };
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { d as
|
|
2
|
-
export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.B7q_naMc.js';
|
|
1
|
+
export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.CXFFjsi8.js';
|
|
3
2
|
export { mergeConfig } from 'vite';
|
|
3
|
+
export { d as defaultBrowserPort } from './chunks/constants.D_Q9UYh-.js';
|
|
4
4
|
import 'node:os';
|
|
5
5
|
import './chunks/env.D4Lgay0q.js';
|
|
6
6
|
import 'std-env';
|
|
@@ -11,11 +11,5 @@ function defineConfig(config) {
|
|
|
11
11
|
function defineProject(config) {
|
|
12
12
|
return config;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated use the `projects` field in the root config instead
|
|
16
|
-
*/
|
|
17
|
-
function defineWorkspace(config) {
|
|
18
|
-
return config;
|
|
19
|
-
}
|
|
20
14
|
|
|
21
|
-
export { defineConfig, defineProject
|
|
15
|
+
export { defineConfig, defineProject };
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap,
|
|
1
|
+
import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, b as ReportContext } from './chunks/reporters.d.BUWjmRYq.js';
|
|
2
2
|
import { TransformResult } from 'vite';
|
|
3
|
-
import { A as AfterSuiteRunMeta } from './chunks/environment.d.
|
|
3
|
+
import { A as AfterSuiteRunMeta } from './chunks/environment.d.BsToaxti.js';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import '@vitest/utils';
|
|
6
6
|
import 'node:stream';
|
|
7
|
-
import 'node:console';
|
|
8
7
|
import '@vitest/mocker';
|
|
9
8
|
import '@vitest/utils/source-map';
|
|
10
|
-
import './chunks/
|
|
11
|
-
import '
|
|
12
|
-
import '
|
|
9
|
+
import './chunks/browser.d.yFAklsD1.js';
|
|
10
|
+
import './chunks/worker.d.BDsXGkwh.js';
|
|
11
|
+
import 'vite/module-runner';
|
|
12
|
+
import './chunks/config.d.B_LthbQq.js';
|
|
13
13
|
import '@vitest/pretty-format';
|
|
14
14
|
import '@vitest/snapshot';
|
|
15
|
-
import '@vitest/snapshot/environment';
|
|
16
15
|
import '@vitest/utils/diff';
|
|
17
|
-
import '
|
|
18
|
-
import '
|
|
16
|
+
import '@vitest/expect';
|
|
17
|
+
import 'vitest/optional-types.js';
|
|
18
|
+
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
19
19
|
import '@vitest/runner/utils';
|
|
20
20
|
import 'tinybench';
|
|
21
|
-
import './chunks/coverage.d.
|
|
22
|
-
import 'vite-node/client';
|
|
21
|
+
import './chunks/coverage.d.BZtK59WP.js';
|
|
23
22
|
import '@vitest/snapshot/manager';
|
|
24
23
|
import 'node:fs';
|
|
25
|
-
import '
|
|
24
|
+
import 'node:console';
|
|
26
25
|
|
|
27
26
|
type Threshold = "lines" | "functions" | "statements" | "branches";
|
|
28
27
|
interface ResolvedThreshold {
|
|
@@ -46,36 +45,44 @@ interface ResolvedThreshold {
|
|
|
46
45
|
* "project-b": ...
|
|
47
46
|
* ```
|
|
48
47
|
*/
|
|
49
|
-
type CoverageFiles = Map<NonNullable<AfterSuiteRunMeta["projectName"]> | symbol, Record<AfterSuiteRunMeta["
|
|
50
|
-
[TestFilenames: string]: string
|
|
48
|
+
type CoverageFiles = Map<NonNullable<AfterSuiteRunMeta["projectName"]> | symbol, Record<AfterSuiteRunMeta["environment"], {
|
|
49
|
+
[TestFilenames: string]: string;
|
|
51
50
|
}>>;
|
|
52
51
|
declare class BaseCoverageProvider<Options extends ResolvedCoverageOptions<"istanbul" | "v8">> {
|
|
53
52
|
ctx: Vitest;
|
|
54
53
|
readonly name: "v8" | "istanbul";
|
|
55
54
|
version: string;
|
|
56
55
|
options: Options;
|
|
56
|
+
globCache: Map<string, boolean>;
|
|
57
57
|
coverageFiles: CoverageFiles;
|
|
58
58
|
pendingPromises: Promise<void>[];
|
|
59
59
|
coverageFilesDirectory: string;
|
|
60
|
+
roots: string[];
|
|
60
61
|
_initialize(ctx: Vitest): void;
|
|
62
|
+
/**
|
|
63
|
+
* Check if file matches `coverage.include` but not `coverage.exclude`
|
|
64
|
+
*/
|
|
65
|
+
isIncluded(_filename: string, root?: string): boolean;
|
|
66
|
+
private getUntestedFilesByRoot;
|
|
67
|
+
getUntestedFiles(testedFiles: string[]): Promise<string[]>;
|
|
61
68
|
createCoverageMap(): CoverageMap;
|
|
62
69
|
generateReports(_: CoverageMap, __: boolean | undefined): Promise<void>;
|
|
63
70
|
parseConfigModule(_: string): Promise<{
|
|
64
71
|
generate: () => {
|
|
65
|
-
code: string
|
|
66
|
-
}
|
|
72
|
+
code: string;
|
|
73
|
+
};
|
|
67
74
|
}>;
|
|
68
75
|
resolveOptions(): Options;
|
|
69
76
|
clean(clean?: boolean): Promise<void>;
|
|
70
|
-
onAfterSuiteRun({ coverage,
|
|
77
|
+
onAfterSuiteRun({ coverage, environment, projectName, testFiles }: AfterSuiteRunMeta): void;
|
|
71
78
|
readCoverageFiles<CoverageType>({ onFileRead, onFinished, onDebug }: {
|
|
72
79
|
/** Callback invoked with a single coverage result */
|
|
73
|
-
onFileRead: (data: CoverageType) => void
|
|
80
|
+
onFileRead: (data: CoverageType) => void;
|
|
74
81
|
/** Callback invoked once all results of a project for specific transform mode are read */
|
|
75
|
-
onFinished: (project: Vitest["projects"][number],
|
|
82
|
+
onFinished: (project: Vitest["projects"][number], environment: string) => Promise<void>;
|
|
76
83
|
onDebug: ((...logs: any[]) => void) & {
|
|
77
|
-
enabled: boolean
|
|
78
|
-
}
|
|
84
|
+
enabled: boolean;
|
|
85
|
+
};
|
|
79
86
|
}): Promise<void>;
|
|
80
87
|
cleanAfterRun(): Promise<void>;
|
|
81
88
|
onTestFailure(): Promise<void>;
|
|
@@ -95,9 +102,9 @@ declare class BaseCoverageProvider<Options extends ResolvedCoverageOptions<"ista
|
|
|
95
102
|
* Check if current coverage is above configured thresholds and bump the thresholds if needed
|
|
96
103
|
*/
|
|
97
104
|
updateThresholds({ thresholds: allThresholds, onUpdate, configurationFile }: {
|
|
98
|
-
thresholds: ResolvedThreshold[]
|
|
99
|
-
configurationFile: unknown
|
|
100
|
-
onUpdate: () => void
|
|
105
|
+
thresholds: ResolvedThreshold[];
|
|
106
|
+
configurationFile: unknown;
|
|
107
|
+
onUpdate: () => void;
|
|
101
108
|
}): Promise<void>;
|
|
102
109
|
mergeReports(coverageMaps: unknown[]): Promise<void>;
|
|
103
110
|
hasTerminalReporter(reporters: ResolvedCoverageOptions["reporter"]): boolean;
|
package/dist/coverage.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export { B as BaseCoverageProvider } from './chunks/coverage.
|
|
1
|
+
export { B as BaseCoverageProvider } from './chunks/coverage.BCU-r2QL.js';
|
|
2
2
|
import 'node:fs';
|
|
3
|
+
import 'node:path';
|
|
4
|
+
import '@vitest/utils';
|
|
3
5
|
import 'pathe';
|
|
4
6
|
import 'picomatch';
|
|
7
|
+
import 'tinyglobby';
|
|
5
8
|
import 'tinyrainbow';
|
|
6
|
-
import './chunks/defaults.
|
|
9
|
+
import './chunks/defaults.CXFFjsi8.js';
|
|
7
10
|
import 'node:os';
|
|
8
11
|
import './chunks/env.D4Lgay0q.js';
|
|
9
12
|
import 'std-env';
|
|
10
13
|
import 'node:crypto';
|
|
11
|
-
import '@vitest/utils';
|
|
12
14
|
import 'node:module';
|
|
13
|
-
import 'node:path';
|
|
14
15
|
import 'node:process';
|
|
15
16
|
import 'node:fs/promises';
|
|
16
17
|
import 'node:url';
|
|
@@ -18,17 +19,16 @@ import 'node:assert';
|
|
|
18
19
|
import 'node:v8';
|
|
19
20
|
import 'node:util';
|
|
20
21
|
import 'vite';
|
|
21
|
-
import './chunks/constants.
|
|
22
|
+
import './chunks/constants.D_Q9UYh-.js';
|
|
22
23
|
import 'node:tty';
|
|
23
24
|
import 'node:events';
|
|
24
|
-
import './chunks/index.
|
|
25
|
+
import './chunks/index.Bgo3tNWt.js';
|
|
25
26
|
import 'tinypool';
|
|
26
|
-
import './chunks/typechecker.
|
|
27
|
+
import './chunks/typechecker.DB-fIMaH.js';
|
|
27
28
|
import 'node:perf_hooks';
|
|
28
29
|
import '@vitest/utils/source-map';
|
|
29
30
|
import 'tinyexec';
|
|
30
31
|
import './path.js';
|
|
31
32
|
import '@vitest/runner/utils';
|
|
32
33
|
import 'node:worker_threads';
|
|
33
|
-
import '
|
|
34
|
-
import './chunks/coverage.DVF1vEu8.js';
|
|
34
|
+
import './chunks/coverage.D_JHT54q.js';
|
package/dist/environments.d.ts
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
import { E as Environment } from './chunks/environment.d.
|
|
2
|
-
export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d.
|
|
3
|
-
import 'vitest/optional-types.js';
|
|
1
|
+
import { E as Environment } from './chunks/environment.d.BsToaxti.js';
|
|
2
|
+
export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d.BsToaxti.js';
|
|
4
3
|
|
|
5
4
|
declare const environments: {
|
|
6
|
-
"node": Environment
|
|
7
|
-
"jsdom": Environment
|
|
8
|
-
"happy-dom": Environment
|
|
9
|
-
"edge-runtime": Environment
|
|
5
|
+
"node": Environment;
|
|
6
|
+
"jsdom": Environment;
|
|
7
|
+
"happy-dom": Environment;
|
|
8
|
+
"edge-runtime": Environment;
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
interface PopulateOptions {
|
|
13
|
-
// we bind functions such as addEventListener and others
|
|
14
|
-
// because they rely on `this` in happy-dom, and in jsdom it
|
|
15
|
-
// has a priority for getting implementation from symbols
|
|
16
|
-
// (global doesn't have these symbols, but window - does)
|
|
17
12
|
bindFunctions?: boolean;
|
|
18
13
|
additionalKeys?: string[];
|
|
19
14
|
}
|
|
20
15
|
declare function populateGlobal(global: any, win: any, options?: PopulateOptions): {
|
|
21
|
-
keys: Set<string
|
|
22
|
-
skipKeys: string[]
|
|
23
|
-
originals: Map<string | symbol, any
|
|
16
|
+
keys: Set<string>;
|
|
17
|
+
skipKeys: string[];
|
|
18
|
+
originals: Map<string | symbol, any>;
|
|
24
19
|
};
|
|
25
20
|
|
|
26
21
|
export { Environment, environments as builtinEnvironments, populateGlobal };
|
package/dist/environments.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.
|
|
1
|
+
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.DIWhzsUh.js';
|
|
2
2
|
import 'node:console';
|