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
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { isBuiltin, createRequire } from 'node:module';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
import vm from 'node:vm';
|
|
4
|
+
import { isAbsolute } from 'pathe';
|
|
5
|
+
import { ssrModuleExportsKey, ssrImportMetaKey, ssrImportKey, ssrDynamicImportKey, ssrExportAllKey } from 'vite/module-runner';
|
|
6
|
+
|
|
7
|
+
const performanceNow = performance.now.bind(performance);
|
|
8
|
+
class ModuleDebug {
|
|
9
|
+
executionStack = [];
|
|
10
|
+
startCalculateModuleExecutionInfo(filename, startOffset) {
|
|
11
|
+
const startTime = performanceNow();
|
|
12
|
+
return this.executionStack.push({
|
|
13
|
+
filename,
|
|
14
|
+
startTime,
|
|
15
|
+
subImportTime: 0
|
|
16
|
+
}), () => {
|
|
17
|
+
const duration = performanceNow() - startTime, currentExecution = this.executionStack.pop();
|
|
18
|
+
if (currentExecution == null) throw new Error("Execution stack is empty, this should never happen");
|
|
19
|
+
const selfTime = duration - currentExecution.subImportTime;
|
|
20
|
+
if (this.executionStack.length > 0) this.executionStack.at(-1).subImportTime += duration;
|
|
21
|
+
return {
|
|
22
|
+
startOffset,
|
|
23
|
+
duration,
|
|
24
|
+
selfTime
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const isWindows = process.platform === "win32";
|
|
31
|
+
class VitestModuleEvaluator {
|
|
32
|
+
stubs = {};
|
|
33
|
+
env = createImportMetaEnvProxy();
|
|
34
|
+
vm;
|
|
35
|
+
compiledFunctionArgumentsNames;
|
|
36
|
+
compiledFunctionArgumentsValues = [];
|
|
37
|
+
primitives;
|
|
38
|
+
debug = new ModuleDebug();
|
|
39
|
+
constructor(vmOptions, options = {}) {
|
|
40
|
+
if (this.options = options, this.vm = vmOptions, this.stubs = getDefaultRequestStubs(vmOptions?.context), options.compiledFunctionArgumentsNames) this.compiledFunctionArgumentsNames = options.compiledFunctionArgumentsNames;
|
|
41
|
+
if (options.compiledFunctionArgumentsValues) this.compiledFunctionArgumentsValues = options.compiledFunctionArgumentsValues;
|
|
42
|
+
if (vmOptions) this.primitives = vm.runInContext("({ Object, Proxy, Reflect })", vmOptions.context);
|
|
43
|
+
else this.primitives = {
|
|
44
|
+
Object,
|
|
45
|
+
Proxy,
|
|
46
|
+
Reflect
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
convertIdToImportUrl(id) {
|
|
50
|
+
// TODO: vitest returns paths for external modules, but Vite returns file://
|
|
51
|
+
// unfortunetly, there is a bug in Vite where ID is resolved incorrectly, so we can't return files until the fix is merged
|
|
52
|
+
// https://github.com/vitejs/vite/pull/20449
|
|
53
|
+
if (!isWindows || isBuiltin(id) || /^(?:node:|data:|http:|https:|file:)/.test(id)) return id;
|
|
54
|
+
const [filepath, query] = id.split("?");
|
|
55
|
+
return query ? `${pathToFileURL(filepath).toString()}?${query}` : pathToFileURL(filepath).toString();
|
|
56
|
+
}
|
|
57
|
+
async runExternalModule(id) {
|
|
58
|
+
if (id in this.stubs) return this.stubs[id];
|
|
59
|
+
const file = this.convertIdToImportUrl(id), namespace = this.vm ? await this.vm.externalModulesExecutor.import(file) : await import(file);
|
|
60
|
+
if (!this.shouldInterop(file, namespace)) return namespace;
|
|
61
|
+
const { mod, defaultExport } = interopModule(namespace), { Proxy, Reflect } = this.primitives, proxy = new Proxy(mod, {
|
|
62
|
+
get(mod, prop) {
|
|
63
|
+
return prop === "default" ? defaultExport : mod[prop] ?? defaultExport?.[prop];
|
|
64
|
+
},
|
|
65
|
+
has(mod, prop) {
|
|
66
|
+
return prop === "default" ? defaultExport !== void 0 : prop in mod || defaultExport && prop in defaultExport;
|
|
67
|
+
},
|
|
68
|
+
getOwnPropertyDescriptor(mod, prop) {
|
|
69
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(mod, prop);
|
|
70
|
+
if (descriptor) return descriptor;
|
|
71
|
+
if (prop === "default" && defaultExport !== void 0) return {
|
|
72
|
+
value: defaultExport,
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return proxy;
|
|
79
|
+
}
|
|
80
|
+
async runInlinedModule(context, code, module) {
|
|
81
|
+
context.__vite_ssr_import_meta__.env = this.env;
|
|
82
|
+
const { Reflect, Proxy, Object } = this.primitives, exportsObject = context[ssrModuleExportsKey], SYMBOL_NOT_DEFINED = Symbol("not defined");
|
|
83
|
+
let moduleExports = SYMBOL_NOT_DEFINED;
|
|
84
|
+
// this proxy is triggered only on exports.{name} and module.exports access
|
|
85
|
+
// inside the module itself. imported module is always "exports"
|
|
86
|
+
const cjsExports = new Proxy(exportsObject, {
|
|
87
|
+
get: (target, p, receiver) => {
|
|
88
|
+
return Reflect.has(target, p) ? Reflect.get(target, p, receiver) : Reflect.get(Object.prototype, p, receiver);
|
|
89
|
+
},
|
|
90
|
+
getPrototypeOf: () => Object.prototype,
|
|
91
|
+
set: (_, p, value) => {
|
|
92
|
+
// treat "module.exports =" the same as "exports.default =" to not have nested "default.default",
|
|
93
|
+
// so "exports.default" becomes the actual module
|
|
94
|
+
if (p === "default" && this.shouldInterop(module.file, { default: value }) && cjsExports !== value) return exportAll(cjsExports, value), exportsObject.default = value, true;
|
|
95
|
+
if (!Reflect.has(exportsObject, "default")) exportsObject.default = {};
|
|
96
|
+
// returns undefined, when accessing named exports, if default is not an object
|
|
97
|
+
// but is still present inside hasOwnKeys, this is Node behaviour for CJS
|
|
98
|
+
if (moduleExports !== SYMBOL_NOT_DEFINED && isPrimitive(moduleExports)) return defineExport(exportsObject, p, () => void 0), true;
|
|
99
|
+
if (!isPrimitive(exportsObject.default)) exportsObject.default[p] = value;
|
|
100
|
+
if (p !== "default") defineExport(exportsObject, p, () => value);
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
}), moduleProxy = {
|
|
104
|
+
set exports(value) {
|
|
105
|
+
exportAll(cjsExports, value), exportsObject.default = value, moduleExports = value;
|
|
106
|
+
},
|
|
107
|
+
get exports() {
|
|
108
|
+
return cjsExports;
|
|
109
|
+
}
|
|
110
|
+
}, meta = context[ssrImportMetaKey], testFilepath = this.options.getCurrentTestFilepath?.();
|
|
111
|
+
if (testFilepath === module.file) {
|
|
112
|
+
const globalNamespace = this.vm?.context || globalThis;
|
|
113
|
+
Object.defineProperty(meta, "vitest", { get: () => globalNamespace.__vitest_index__ });
|
|
114
|
+
}
|
|
115
|
+
const filename = meta.filename, dirname = meta.dirname, require = this.createRequire(filename), argumentsList = [
|
|
116
|
+
ssrModuleExportsKey,
|
|
117
|
+
ssrImportMetaKey,
|
|
118
|
+
ssrImportKey,
|
|
119
|
+
ssrDynamicImportKey,
|
|
120
|
+
ssrExportAllKey,
|
|
121
|
+
"__vite_ssr_exportName__",
|
|
122
|
+
"__filename",
|
|
123
|
+
"__dirname",
|
|
124
|
+
"module",
|
|
125
|
+
"exports",
|
|
126
|
+
"require"
|
|
127
|
+
];
|
|
128
|
+
if (this.compiledFunctionArgumentsNames) argumentsList.push(...this.compiledFunctionArgumentsNames);
|
|
129
|
+
// add 'use strict' since ESM enables it by default
|
|
130
|
+
const codeDefinition = `'use strict';async (${argumentsList.join(",")})=>{{`, wrappedCode = `${codeDefinition}${code}\n}}`, options = {
|
|
131
|
+
filename: module.id,
|
|
132
|
+
lineOffset: 0,
|
|
133
|
+
columnOffset: -codeDefinition.length
|
|
134
|
+
}, finishModuleExecutionInfo = this.debug.startCalculateModuleExecutionInfo(options.filename, codeDefinition.length);
|
|
135
|
+
try {
|
|
136
|
+
const initModule = this.vm ? vm.runInContext(wrappedCode, this.vm.context, options) : vm.runInThisContext(wrappedCode, options), dynamicRequest = async (dep, options) => {
|
|
137
|
+
return dep = String(dep), dep[0] === "#" ? context[ssrDynamicImportKey](wrapId(dep), options) : context[ssrDynamicImportKey](dep, options);
|
|
138
|
+
};
|
|
139
|
+
await initModule(
|
|
140
|
+
context[ssrModuleExportsKey],
|
|
141
|
+
context[ssrImportMetaKey],
|
|
142
|
+
context[ssrImportKey],
|
|
143
|
+
dynamicRequest,
|
|
144
|
+
context[ssrExportAllKey],
|
|
145
|
+
// vite 7 support, remove when vite 7+ is supported
|
|
146
|
+
context.__vite_ssr_exportName__ || ((name, getter) => Object.defineProperty(exportsObject, name, {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
configurable: true,
|
|
149
|
+
get: getter
|
|
150
|
+
})),
|
|
151
|
+
filename,
|
|
152
|
+
dirname,
|
|
153
|
+
moduleProxy,
|
|
154
|
+
cjsExports,
|
|
155
|
+
require,
|
|
156
|
+
...this.compiledFunctionArgumentsValues
|
|
157
|
+
);
|
|
158
|
+
} finally {
|
|
159
|
+
// moduleExecutionInfo needs to use Node filename instead of the normalized one
|
|
160
|
+
// because we rely on this behaviour in coverage-v8, for example
|
|
161
|
+
this.options.moduleExecutionInfo?.set(options.filename, finishModuleExecutionInfo());
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
createRequire(filename) {
|
|
165
|
+
return filename.startsWith("\0") || !isAbsolute(filename) ? () => ({}) : this.vm ? this.vm.externalModulesExecutor.createRequire(filename) : createRequire(filename);
|
|
166
|
+
}
|
|
167
|
+
shouldInterop(path, mod) {
|
|
168
|
+
// never interop ESM modules
|
|
169
|
+
// TODO: should also skip for `.js` with `type="module"`
|
|
170
|
+
return this.options.interopDefault === false ? false : !path.endsWith(".mjs") && "default" in mod;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function createImportMetaEnvProxy() {
|
|
174
|
+
// packages/vitest/src/node/plugins/index.ts:146
|
|
175
|
+
const booleanKeys = [
|
|
176
|
+
"DEV",
|
|
177
|
+
"PROD",
|
|
178
|
+
"SSR"
|
|
179
|
+
];
|
|
180
|
+
return new Proxy(process.env, {
|
|
181
|
+
get(_, key) {
|
|
182
|
+
return typeof key === "string" ? booleanKeys.includes(key) ? !!process.env[key] : process.env[key] : void 0;
|
|
183
|
+
},
|
|
184
|
+
set(_, key, value) {
|
|
185
|
+
if (typeof key !== "string") return true;
|
|
186
|
+
if (booleanKeys.includes(key)) process.env[key] = value ? "1" : "";
|
|
187
|
+
else process.env[key] = value;
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function updateStyle(id, css) {
|
|
193
|
+
if (typeof document === "undefined") return;
|
|
194
|
+
const element = document.querySelector(`[data-vite-dev-id="${id}"]`);
|
|
195
|
+
if (element) {
|
|
196
|
+
element.textContent = css;
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const head = document.querySelector("head"), style = document.createElement("style");
|
|
200
|
+
style.setAttribute("type", "text/css"), style.setAttribute("data-vite-dev-id", id), style.textContent = css, head?.appendChild(style);
|
|
201
|
+
}
|
|
202
|
+
function removeStyle(id) {
|
|
203
|
+
if (typeof document === "undefined") return;
|
|
204
|
+
const sheet = document.querySelector(`[data-vite-dev-id="${id}"]`);
|
|
205
|
+
if (sheet) document.head.removeChild(sheet);
|
|
206
|
+
}
|
|
207
|
+
const defaultClientStub = {
|
|
208
|
+
injectQuery: (id) => id,
|
|
209
|
+
createHotContext: () => {
|
|
210
|
+
return {
|
|
211
|
+
accept: () => {},
|
|
212
|
+
prune: () => {},
|
|
213
|
+
dispose: () => {},
|
|
214
|
+
decline: () => {},
|
|
215
|
+
invalidate: () => {},
|
|
216
|
+
on: () => {},
|
|
217
|
+
send: () => {}
|
|
218
|
+
};
|
|
219
|
+
},
|
|
220
|
+
updateStyle: () => {},
|
|
221
|
+
removeStyle: () => {}
|
|
222
|
+
};
|
|
223
|
+
function getDefaultRequestStubs(context) {
|
|
224
|
+
if (!context) {
|
|
225
|
+
const clientStub = {
|
|
226
|
+
...defaultClientStub,
|
|
227
|
+
updateStyle,
|
|
228
|
+
removeStyle
|
|
229
|
+
};
|
|
230
|
+
return { "/@vite/client": clientStub };
|
|
231
|
+
}
|
|
232
|
+
const clientStub = vm.runInContext(`(defaultClient) => ({ ...defaultClient, updateStyle: ${updateStyle.toString()}, removeStyle: ${removeStyle.toString()} })`, context)(defaultClientStub);
|
|
233
|
+
return { "/@vite/client": clientStub };
|
|
234
|
+
}
|
|
235
|
+
function exportAll(exports, sourceModule) {
|
|
236
|
+
if (exports !== sourceModule && !(isPrimitive(sourceModule) || Array.isArray(sourceModule) || sourceModule instanceof Promise)) {
|
|
237
|
+
for (const key in sourceModule) if (key !== "default" && !(key in exports)) try {
|
|
238
|
+
defineExport(exports, key, () => sourceModule[key]);
|
|
239
|
+
} catch {}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// keep consistency with Vite on how exports are defined
|
|
243
|
+
function defineExport(exports, key, value) {
|
|
244
|
+
Object.defineProperty(exports, key, {
|
|
245
|
+
enumerable: true,
|
|
246
|
+
configurable: true,
|
|
247
|
+
get: value
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function isPrimitive(v) {
|
|
251
|
+
const isObject = typeof v === "object" || typeof v === "function";
|
|
252
|
+
return !isObject || v == null;
|
|
253
|
+
}
|
|
254
|
+
function interopModule(mod) {
|
|
255
|
+
if (isPrimitive(mod)) return {
|
|
256
|
+
mod: { default: mod },
|
|
257
|
+
defaultExport: mod
|
|
258
|
+
};
|
|
259
|
+
let defaultExport = "default" in mod ? mod.default : mod;
|
|
260
|
+
if (!isPrimitive(defaultExport) && "__esModule" in defaultExport) {
|
|
261
|
+
if (mod = defaultExport, "default" in defaultExport) defaultExport = defaultExport.default;
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
mod,
|
|
265
|
+
defaultExport
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
const VALID_ID_PREFIX = `/@id/`, NULL_BYTE_PLACEHOLDER = `__x00__`;
|
|
269
|
+
function wrapId(id) {
|
|
270
|
+
return id.startsWith(VALID_ID_PREFIX) ? id : VALID_ID_PREFIX + id.replace("\0", NULL_BYTE_PLACEHOLDER);
|
|
271
|
+
}
|
|
272
|
+
function unwrapId(id) {
|
|
273
|
+
return id.startsWith(VALID_ID_PREFIX) ? id.slice(VALID_ID_PREFIX.length).replace(NULL_BYTE_PLACEHOLDER, "\0") : id;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export { VitestModuleEvaluator, createImportMetaEnvProxy, getDefaultRequestStubs, isPrimitive, unwrapId, wrapId };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { VitestModuleEvaluator } from './module-evaluator.js';
|
|
2
|
+
export { a as VITEST_VM_CONTEXT_SYMBOL, V as VitestModuleRunner, s as startVitestModuleRunner } from './chunks/startModuleRunner.p67gbNo9.js';
|
|
3
|
+
export { g as getWorkerState } from './chunks/utils.D2R2NiOH.js';
|
|
4
|
+
import 'node:module';
|
|
5
|
+
import 'node:url';
|
|
6
|
+
import 'node:vm';
|
|
7
|
+
import 'pathe';
|
|
8
|
+
import 'vite/module-runner';
|
|
9
|
+
import 'node:fs';
|
|
10
|
+
import '@vitest/utils';
|
|
11
|
+
import './path.js';
|
|
12
|
+
import 'node:path';
|
|
13
|
+
import '@vitest/utils/error';
|
|
14
|
+
import '@vitest/mocker';
|
|
15
|
+
import './chunks/moduleTransport.I-bgQy0S.js';
|
package/dist/node.d.ts
CHANGED
|
@@ -1,43 +1,68 @@
|
|
|
1
|
-
import { z as ResolvedConfig, y as UserConfig, v as VitestRunMode, H as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, J as TestSequencer, K as TestSpecification, L as Logger, M as TestModule, N as ModuleDiagnostic } from './chunks/reporters.d.BFLkQcL6.js';
|
|
2
|
-
export { B as BaseCoverageOptions, F as BenchmarkUserOptions, ag as BrowserBuiltinProvider, ah as BrowserCommand, ai as BrowserCommandContext, q as BrowserConfigOptions, aj as BrowserInstanceOption, ak as BrowserModuleMocker, al as BrowserOrchestrator, am as BrowserProvider, an as BrowserProviderInitializationOptions, ao as BrowserProviderModule, ap as BrowserProviderOptions, p as BrowserScript, aq as BrowserServerState, ar as BrowserServerStateSession, r as BuiltinEnvironment, as as CDPSession, u as CSSModuleScopeStrategy, m as CoverageIstanbulOptions, l as CoverageOptions, h as CoverageProvider, i as CoverageProviderModule, j as CoverageReporter, c as CoverageV8Options, n as CustomProviderOptions, D as DepsOptimizationOptions, a0 as HTMLOptions, I as InlineConfig, a2 as JUnitOptions, a1 as JsonOptions, O as OnServerRestartHandler, Q as OnTestsRerunHandler, at as ParentProjectBrowser, P as Pool, t as PoolOptions, Y as ProcessPool, au as ProjectBrowser, E as ProjectConfig, a as ReportContext, aA as ReportedHookContext, o as Reporter, ax as ResolveSnapshotPathHandler, ay as ResolveSnapshotPathHandlerContext, av as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aw as ResolvedProjectConfig, $ as SerializedTestProject, a3 as TaskOptions, a4 as TestCase, a5 as TestCollection, a6 as TestDiagnostic, a7 as TestModuleState, a8 as TestResult, a9 as TestResultFailed, aa as TestResultPassed, ab as TestResultSkipped, aB as TestRunEndReason, az as TestRunResult, af as TestSequencerConstructor, ac as TestState, ad as TestSuite, ae as TestSuiteState, w as TransformModePatterns, x as TypecheckConfig, U as UserWorkspaceConfig, s as VitestEnvironment, X as VitestPackageInstaller, g as WatcherTriggerPattern, Z as WorkspaceSpec, _ as getFilePoolName } from './chunks/reporters.d.BFLkQcL6.js';
|
|
3
1
|
import * as vite from 'vite';
|
|
4
2
|
import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as ResolvedConfig$1, LogLevel, LoggerOptions, Logger as Logger$1 } from 'vite';
|
|
5
3
|
export { vite as Vite };
|
|
6
4
|
export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
7
5
|
import { IncomingMessage } from 'node:http';
|
|
8
|
-
import {
|
|
9
|
-
export {
|
|
6
|
+
import { h as ResolvedConfig, f as UserConfig, i as VitestRunMode, j as VitestOptions, V as Vitest, A as ApiConfig, k as TestSpecification, T as TestProject, P as Pool, l as TestSequencer, L as Logger } from './chunks/reporters.d.BUWjmRYq.js';
|
|
7
|
+
export { al as BaseCoverageOptions, G as BenchmarkUserOptions, K as BrowserBuiltinProvider, N as BrowserCommand, Q as BrowserCommandContext, X as BrowserConfigOptions, Y as BrowserInstanceOption, Z as BrowserModuleMocker, _ as BrowserOrchestrator, $ as BrowserProvider, a0 as BrowserProviderOption, a1 as BrowserScript, a2 as BrowserServerState, a3 as BrowserServerStateSession, aa as BuiltinEnvironment, a4 as CDPSession, ab as CSSModuleScopeStrategy, am as CoverageIstanbulOptions, an as CoverageOptions, ao as CoverageProvider, ap as CoverageProviderModule, aq as CoverageReporter, c as CoverageV8Options, ar as CustomProviderOptions, ac as DepsOptimizationOptions, ad as EnvironmentOptions, H as HTMLOptions, I as InlineConfig, o as JUnitOptions, J as JsonOptions, M as ModuleDiagnostic, O as OnServerRestartHandler, m as OnTestsRerunHandler, a5 as ParentProjectBrowser, ae as PoolOptions, a6 as ProjectBrowser, af as ProjectConfig, b as ReportContext, at as ReportedHookContext, au as Reporter, ah as ResolveSnapshotPathHandler, ai as ResolveSnapshotPathHandlerContext, a7 as ResolvedBrowserOptions, R as ResolvedCoverageOptions, ag as ResolvedProjectConfig, S as SerializedTestProject, p as TaskOptions, q as TestCase, r as TestCollection, s as TestDiagnostic, t as TestModule, u as TestModuleState, v as TestResult, w as TestResultFailed, x as TestResultPassed, y as TestResultSkipped, av as TestRunEndReason, as as TestRunResult, F as TestSequencerConstructor, z as TestState, B as TestSuite, D as TestSuiteState, a8 as ToMatchScreenshotComparators, a9 as ToMatchScreenshotOptions, aj as TypecheckConfig, U as UserWorkspaceConfig, ak as VitestEnvironment, n as VitestPackageInstaller, W as WatcherTriggerPattern, E as experimental_getRunnerTask } from './chunks/reporters.d.BUWjmRYq.js';
|
|
8
|
+
import { Awaitable } from '@vitest/utils';
|
|
9
|
+
export { SerializedError } from '@vitest/utils';
|
|
10
|
+
import { R as RuntimeRPC } from './chunks/worker.d.BDsXGkwh.js';
|
|
11
|
+
export { T as TestExecutionType } from './chunks/worker.d.BDsXGkwh.js';
|
|
10
12
|
import { Writable } from 'node:stream';
|
|
11
|
-
export { V as VitestPluginContext } from './chunks/
|
|
12
|
-
export { W as WorkerContext } from './chunks/worker.d.
|
|
13
|
-
export { C as TypeCheckCollectLineNumbers, a as TypeCheckCollectLines, c as TypeCheckContext, T as TypeCheckErrorInfo, R as TypeCheckRawErrorsMap, b as TypeCheckRootAndTarget } from './chunks/global.d.MAmajcmJ.js';
|
|
13
|
+
export { V as VitestPluginContext } from './chunks/plugin.d.BMVSnsGV.js';
|
|
14
|
+
export { W as WorkerContext } from './chunks/worker.d.BNcX_2mH.js';
|
|
14
15
|
import { Debugger } from 'debug';
|
|
16
|
+
import './chunks/global.d.BK3X7FW1.js';
|
|
15
17
|
export { Task as RunnerTask, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
|
|
16
|
-
export {
|
|
17
|
-
export { SerializedError } from '@vitest/utils';
|
|
18
|
-
export { b as RuntimeConfig } from './chunks/config.d.D2ROskhv.js';
|
|
18
|
+
export { b as RuntimeConfig } from './chunks/config.d.B_LthbQq.js';
|
|
19
19
|
export { generateFileHash } from '@vitest/runner/utils';
|
|
20
|
-
import '
|
|
20
|
+
import './chunks/environment.d.BsToaxti.js';
|
|
21
21
|
import '@vitest/mocker';
|
|
22
22
|
import '@vitest/utils/source-map';
|
|
23
|
+
import './chunks/browser.d.yFAklsD1.js';
|
|
23
24
|
import '@vitest/pretty-format';
|
|
24
25
|
import '@vitest/snapshot';
|
|
25
26
|
import '@vitest/utils/diff';
|
|
26
|
-
import '
|
|
27
|
-
import '
|
|
28
|
-
import './chunks/benchmark.d.
|
|
27
|
+
import '@vitest/expect';
|
|
28
|
+
import 'vitest/optional-types.js';
|
|
29
|
+
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
29
30
|
import 'tinybench';
|
|
30
|
-
import './chunks/coverage.d.
|
|
31
|
-
import 'vite-node/client';
|
|
31
|
+
import './chunks/coverage.d.BZtK59WP.js';
|
|
32
32
|
import '@vitest/snapshot/manager';
|
|
33
33
|
import 'node:fs';
|
|
34
|
+
import 'node:console';
|
|
35
|
+
import 'vite/module-runner';
|
|
34
36
|
import 'node:worker_threads';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
type RawErrsMap = Map<string, TscErrorInfo[]>;
|
|
39
|
+
interface TscErrorInfo {
|
|
40
|
+
filePath: string;
|
|
41
|
+
errCode: number;
|
|
42
|
+
errMsg: string;
|
|
43
|
+
line: number;
|
|
44
|
+
column: number;
|
|
45
|
+
}
|
|
46
|
+
interface CollectLineNumbers {
|
|
47
|
+
target: number;
|
|
48
|
+
next: number;
|
|
49
|
+
prev?: number;
|
|
50
|
+
}
|
|
51
|
+
type CollectLines = { [key in keyof CollectLineNumbers] : string };
|
|
52
|
+
interface RootAndTarget {
|
|
53
|
+
root: string;
|
|
54
|
+
targetAbsPath: string;
|
|
55
|
+
}
|
|
56
|
+
type Context = RootAndTarget & {
|
|
57
|
+
rawErrsMap: RawErrsMap;
|
|
58
|
+
openedDirs: Set<string>;
|
|
59
|
+
lastActivePath?: string;
|
|
60
|
+
};
|
|
38
61
|
|
|
39
62
|
declare function isValidApiRequest(config: ResolvedConfig, req: IncomingMessage): boolean;
|
|
40
63
|
|
|
64
|
+
declare function escapeTestName(label: string, dynamic: boolean): string;
|
|
65
|
+
|
|
41
66
|
interface CliOptions extends UserConfig {
|
|
42
67
|
/**
|
|
43
68
|
* Override the watch mode
|
|
@@ -62,7 +87,7 @@ interface CliOptions extends UserConfig {
|
|
|
62
87
|
* @experimental
|
|
63
88
|
*/
|
|
64
89
|
configLoader?: InlineConfig extends {
|
|
65
|
-
configLoader?: infer T
|
|
90
|
+
configLoader?: infer T;
|
|
66
91
|
} ? T : never;
|
|
67
92
|
}
|
|
68
93
|
/**
|
|
@@ -76,11 +101,11 @@ interface CliParseOptions {
|
|
|
76
101
|
allowUnknownOptions?: boolean;
|
|
77
102
|
}
|
|
78
103
|
declare function parseCLI(argv: string | string[], config?: CliParseOptions): {
|
|
79
|
-
filter: string[]
|
|
80
|
-
options: CliOptions
|
|
104
|
+
filter: string[];
|
|
105
|
+
options: CliOptions;
|
|
81
106
|
};
|
|
82
107
|
|
|
83
|
-
declare function resolveApiServerConfig<Options extends ApiConfig & UserConfig
|
|
108
|
+
declare function resolveApiServerConfig<Options extends ApiConfig & Omit<UserConfig, "expect">>(options: Options, defaultPort: number): ApiConfig | undefined;
|
|
84
109
|
|
|
85
110
|
declare function createVitest(mode: VitestRunMode, options: CliOptions, viteOverrides?: UserConfig$1, vitestOptions?: VitestOptions): Promise<Vitest>;
|
|
86
111
|
|
|
@@ -93,22 +118,26 @@ declare class GitNotFoundError extends Error {
|
|
|
93
118
|
constructor();
|
|
94
119
|
}
|
|
95
120
|
|
|
96
|
-
/** @deprecated use `TestProject` instead */
|
|
97
|
-
type GlobalSetupContext = TestProject;
|
|
98
|
-
|
|
99
121
|
declare function VitestPlugin(options?: UserConfig, vitest?: Vitest): Promise<Plugin[]>;
|
|
100
122
|
|
|
101
|
-
// this is only exported as a public function and not used inside vitest
|
|
102
123
|
declare function resolveConfig(options?: UserConfig, viteOverrides?: UserConfig$1): Promise<{
|
|
103
|
-
vitestConfig: ResolvedConfig
|
|
104
|
-
viteConfig: ResolvedConfig$1
|
|
124
|
+
vitestConfig: ResolvedConfig;
|
|
125
|
+
viteConfig: ResolvedConfig$1;
|
|
105
126
|
}>;
|
|
106
127
|
|
|
107
128
|
declare function resolveFsAllow(projectRoot: string, rootConfigFile: string | false | undefined): string[];
|
|
108
129
|
|
|
130
|
+
type RunWithFiles = (files: TestSpecification[], invalidates?: string[]) => Awaitable<void>;
|
|
131
|
+
interface ProcessPool {
|
|
132
|
+
name: string;
|
|
133
|
+
runTests: RunWithFiles;
|
|
134
|
+
collectTests: RunWithFiles;
|
|
135
|
+
close?: () => Awaitable<void>;
|
|
136
|
+
}
|
|
137
|
+
declare function getFilePoolName(project: TestProject): Pool;
|
|
138
|
+
|
|
109
139
|
interface MethodsOptions {
|
|
110
140
|
cacheFs?: boolean;
|
|
111
|
-
// do not report files
|
|
112
141
|
collect?: boolean;
|
|
113
142
|
}
|
|
114
143
|
declare function createMethodsRPC(project: TestProject, options?: MethodsOptions): RuntimeRPC;
|
|
@@ -116,18 +145,13 @@ declare function createMethodsRPC(project: TestProject, options?: MethodsOptions
|
|
|
116
145
|
declare class BaseSequencer implements TestSequencer {
|
|
117
146
|
protected ctx: Vitest;
|
|
118
147
|
constructor(ctx: Vitest);
|
|
119
|
-
// async so it can be extended by other sequelizers
|
|
120
148
|
shard(files: TestSpecification[]): Promise<TestSpecification[]>;
|
|
121
|
-
// async so it can be extended by other sequelizers
|
|
122
149
|
sort(files: TestSpecification[]): Promise<TestSpecification[]>;
|
|
150
|
+
private calculateShardRange;
|
|
123
151
|
}
|
|
124
152
|
|
|
125
153
|
declare function registerConsoleShortcuts(ctx: Vitest, stdin: NodeJS.ReadStream | undefined, stdout: NodeJS.WriteStream | Writable): () => void;
|
|
126
154
|
|
|
127
|
-
// This is copy-pasted and needs to be synced from time to time. Ideally, Vite's `createLogger` should accept a custom `console`
|
|
128
|
-
// https://github.com/vitejs/vite/blob/main/packages/vite/src/node/logger.ts?rgh-link-date=2024-10-16T23%3A29%3A19Z
|
|
129
|
-
// When Vitest supports only Vite 6 and above, we can use Vite's `createLogger({ console })`
|
|
130
|
-
// https://github.com/vitejs/vite/pull/18379
|
|
131
155
|
declare function createViteLogger(console: Logger, level?: LogLevel, options?: LoggerOptions): Logger$1;
|
|
132
156
|
|
|
133
157
|
declare const rootDir: string;
|
|
@@ -137,22 +161,9 @@ declare function createDebugger(namespace: `vitest:${string}`): Debugger | undef
|
|
|
137
161
|
|
|
138
162
|
declare const version: string;
|
|
139
163
|
|
|
140
|
-
/** @deprecated use `createViteServer` instead */
|
|
141
|
-
declare const createServer: typeof vite.createServer;
|
|
142
164
|
declare const createViteServer: typeof vite.createServer;
|
|
143
165
|
|
|
144
|
-
/**
|
|
145
|
-
* @deprecated Use `TestModule` instead
|
|
146
|
-
*/
|
|
147
|
-
declare const TestFile: typeof TestModule;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* @deprecated Use `ModuleDiagnostic` instead
|
|
151
|
-
*/
|
|
152
|
-
type FileDiagnostic = ModuleDiagnostic;
|
|
153
|
-
|
|
154
|
-
// rolldownVersion is exported only by rolldown-vite
|
|
155
166
|
declare const rolldownVersion: string | undefined;
|
|
156
167
|
|
|
157
|
-
export { ApiConfig, BaseSequencer, GitNotFoundError,
|
|
158
|
-
export type { CliParseOptions,
|
|
168
|
+
export { ApiConfig, BaseSequencer, GitNotFoundError, Pool, ResolvedConfig, TestProject, TestSequencer, TestSpecification, UserConfig as TestUserConfig, FilesNotFoundError as TestsNotFoundError, Vitest, VitestOptions, VitestPlugin, VitestRunMode, createDebugger, createMethodsRPC, createViteLogger, createViteServer, createVitest, distDir, escapeTestName, getFilePoolName, isValidApiRequest, parseCLI, registerConsoleShortcuts, resolveApiServerConfig, resolveConfig, resolveFsAllow, rolldownVersion, rootDir, startVitest, version };
|
|
169
|
+
export type { CliParseOptions, ProcessPool, CollectLineNumbers as TypeCheckCollectLineNumbers, CollectLines as TypeCheckCollectLines, Context as TypeCheckContext, TscErrorInfo as TypeCheckErrorInfo, RawErrsMap as TypeCheckRawErrorsMap, RootAndTarget as TypeCheckRootAndTarget };
|
package/dist/node.js
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import { resolveConfig as resolveConfig$1, mergeConfig } from 'vite';
|
|
3
3
|
export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
|
|
4
|
-
import { V as Vitest, a as VitestPlugin
|
|
5
|
-
export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller,
|
|
6
|
-
export { p as parseCLI } from './chunks/cac.
|
|
7
|
-
import { r as resolveConfig$2 } from './chunks/coverage.
|
|
8
|
-
export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.
|
|
4
|
+
import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.BJJXh9BV.js';
|
|
5
|
+
export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, h as createDebugger, g as createViteLogger, c as createVitest, e as escapeTestName, d as experimental_getRunnerTask, i as isValidApiRequest, f as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.BJJXh9BV.js';
|
|
6
|
+
export { p as parseCLI } from './chunks/cac.DCxo_nSu.js';
|
|
7
|
+
import { r as resolveConfig$2 } from './chunks/coverage.BCU-r2QL.js';
|
|
8
|
+
export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.BCU-r2QL.js';
|
|
9
9
|
import { slash, deepClone } from '@vitest/utils';
|
|
10
10
|
import { f as findUp } from './chunks/index.X0nbfr6-.js';
|
|
11
11
|
import { resolve } from 'pathe';
|
|
12
|
-
import { c as configFiles } from './chunks/constants.
|
|
12
|
+
import { c as configFiles } from './chunks/constants.D_Q9UYh-.js';
|
|
13
13
|
export { distDir, rootDir } from './path.js';
|
|
14
|
-
import createDebug from 'debug';
|
|
15
14
|
export { generateFileHash } from '@vitest/runner/utils';
|
|
16
15
|
import 'node:fs';
|
|
17
|
-
import './chunks/coverage.
|
|
16
|
+
import './chunks/coverage.D_JHT54q.js';
|
|
18
17
|
import 'node:path';
|
|
18
|
+
import 'node:os';
|
|
19
19
|
import '@vitest/snapshot/manager';
|
|
20
|
-
import '
|
|
21
|
-
import '
|
|
22
|
-
import '
|
|
23
|
-
import './chunks/
|
|
20
|
+
import './chunks/index.Bgo3tNWt.js';
|
|
21
|
+
import './chunks/index.BIP7prJq.js';
|
|
22
|
+
import 'node:fs/promises';
|
|
23
|
+
import './chunks/typechecker.DB-fIMaH.js';
|
|
24
24
|
import 'node:perf_hooks';
|
|
25
25
|
import '@vitest/utils/source-map';
|
|
26
|
+
import 'tinyexec';
|
|
26
27
|
import 'tinyrainbow';
|
|
27
28
|
import './chunks/env.D4Lgay0q.js';
|
|
28
29
|
import 'std-env';
|
|
29
|
-
import './chunks/typechecker.DRKU1-1g.js';
|
|
30
|
-
import 'node:os';
|
|
31
|
-
import 'tinyexec';
|
|
32
30
|
import 'node:util';
|
|
33
|
-
import 'node:fs/promises';
|
|
34
31
|
import 'node:console';
|
|
35
32
|
import 'node:stream';
|
|
36
33
|
import 'node:module';
|
|
@@ -46,14 +43,18 @@ import 'zlib';
|
|
|
46
43
|
import 'buffer';
|
|
47
44
|
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
48
45
|
import 'node:crypto';
|
|
46
|
+
import 'debug';
|
|
47
|
+
import '#module-evaluator';
|
|
48
|
+
import 'vite/module-runner';
|
|
49
49
|
import 'node:url';
|
|
50
50
|
import 'picomatch';
|
|
51
51
|
import 'tinyglobby';
|
|
52
|
-
import 'vite-node/utils';
|
|
53
|
-
import '@vitest/mocker/node';
|
|
54
|
-
import './chunks/defaults.B7q_naMc.js';
|
|
55
52
|
import 'magic-string';
|
|
56
|
-
import '
|
|
53
|
+
import '@vitest/mocker/node';
|
|
54
|
+
import './chunks/defaults.CXFFjsi8.js';
|
|
55
|
+
import './chunks/resolver.Bx6lE0iq.js';
|
|
56
|
+
import 'es-module-lexer';
|
|
57
|
+
import './chunks/index.BjKEiSn0.js';
|
|
57
58
|
import 'node:assert';
|
|
58
59
|
import '@vitest/utils/error';
|
|
59
60
|
import 'node:readline';
|
|
@@ -67,39 +68,22 @@ import 'readline';
|
|
|
67
68
|
|
|
68
69
|
// this is only exported as a public function and not used inside vitest
|
|
69
70
|
async function resolveConfig(options = {}, viteOverrides = {}) {
|
|
70
|
-
const root = slash(resolve(options.root || process.cwd()));
|
|
71
|
-
const configPath = options.config === false ? false : options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
|
|
71
|
+
const root = slash(resolve(options.root || process.cwd())), configPath = options.config === false ? false : options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
|
|
72
72
|
options.config = configPath;
|
|
73
|
-
const vitest = new Vitest("test", deepClone(options))
|
|
74
|
-
const config = await resolveConfig$1(mergeConfig({
|
|
73
|
+
const vitest = new Vitest("test", deepClone(options)), config = await resolveConfig$1(mergeConfig({
|
|
75
74
|
configFile: configPath,
|
|
76
75
|
mode: options.mode || "test",
|
|
77
76
|
plugins: [await VitestPlugin(options, vitest)]
|
|
78
|
-
}, mergeConfig(viteOverrides, { root: options.root })), "serve");
|
|
79
|
-
|
|
80
|
-
const updatedOptions = Reflect.get(config, "_vitest");
|
|
81
|
-
const vitestConfig = resolveConfig$2(vitest, updatedOptions, config);
|
|
82
|
-
await vitest.close();
|
|
83
|
-
return {
|
|
77
|
+
}, mergeConfig(viteOverrides, { root: options.root })), "serve"), updatedOptions = Reflect.get(config, "_vitest"), vitestConfig = resolveConfig$2(vitest, updatedOptions, config);
|
|
78
|
+
return await vitest.close(), {
|
|
84
79
|
viteConfig: config,
|
|
85
80
|
vitestConfig
|
|
86
81
|
};
|
|
87
82
|
}
|
|
88
83
|
|
|
89
|
-
function createDebugger(namespace) {
|
|
90
|
-
const debug = createDebug(namespace);
|
|
91
|
-
if (debug.enabled) return debug;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
84
|
const version = Vitest.version;
|
|
95
|
-
/** @deprecated use `createViteServer` instead */
|
|
96
|
-
const createServer = vite.createServer;
|
|
97
85
|
const createViteServer = vite.createServer;
|
|
98
|
-
/**
|
|
99
|
-
* @deprecated Use `TestModule` instead
|
|
100
|
-
*/
|
|
101
|
-
const TestFile = TestModule;
|
|
102
86
|
// rolldownVersion is exported only by rolldown-vite
|
|
103
87
|
const rolldownVersion = vite.rolldownVersion;
|
|
104
88
|
|
|
105
|
-
export {
|
|
89
|
+
export { VitestPlugin, createViteServer, resolveConfig, rolldownVersion, version };
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aJ as BaseReporter, aK as BenchmarkBuiltinReporters, aw as BenchmarkReporter, ax as BenchmarkReportsMap, aL as BuiltinReporterOptions, aM as BuiltinReporters, ay as DefaultReporter, az as DotReporter, aA as GithubActionsReporter, aB as HangingProcessReporter, aD as JUnitReporter, aN as JsonAssertionResult, aC as JsonReporter, aO as JsonTestResult, aP as JsonTestResults, at as ReportedHookContext, au as Reporter, aE as ReportersMap, aF as TapFlatReporter, aG as TapReporter, av as TestRunEndReason, aH as VerboseBenchmarkReporter, aI as VerboseReporter } from './chunks/reporters.d.BUWjmRYq.js';
|
|
2
2
|
import '@vitest/runner';
|
|
3
|
-
import './chunks/environment.d.cL3nLXbE.js';
|
|
4
|
-
import 'vitest/optional-types.js';
|
|
5
3
|
import '@vitest/utils';
|
|
4
|
+
import './chunks/environment.d.BsToaxti.js';
|
|
6
5
|
import 'node:stream';
|
|
7
6
|
import 'vite';
|
|
8
|
-
import 'node:console';
|
|
9
7
|
import '@vitest/mocker';
|
|
10
8
|
import '@vitest/utils/source-map';
|
|
11
|
-
import './chunks/
|
|
12
|
-
import '
|
|
13
|
-
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';
|
|
14
13
|
import '@vitest/pretty-format';
|
|
15
14
|
import '@vitest/snapshot';
|
|
16
|
-
import '@vitest/snapshot/environment';
|
|
17
15
|
import '@vitest/utils/diff';
|
|
18
|
-
import '
|
|
19
|
-
import '
|
|
16
|
+
import '@vitest/expect';
|
|
17
|
+
import 'vitest/optional-types.js';
|
|
18
|
+
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
20
19
|
import '@vitest/runner/utils';
|
|
21
20
|
import 'tinybench';
|
|
22
|
-
import './chunks/coverage.d.
|
|
23
|
-
import 'vite-node/client';
|
|
21
|
+
import './chunks/coverage.d.BZtK59WP.js';
|
|
24
22
|
import '@vitest/snapshot/manager';
|
|
25
23
|
import 'node:fs';
|
|
24
|
+
import 'node:console';
|