vitest 5.1.0 → 5.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +6 -5
- package/dist/browser.js +7 -7
- package/dist/chunks/{base.Cof-UHJf.js → base.DCg6Jh4N.js} +12 -12
- package/dist/chunks/{browser.d.C7tWgUvw.d.ts → browser.d.B-QwH_F6.d.ts} +3 -3
- package/dist/chunks/{cac.BYbt0aJp.js → cac.DnNTZKhD.js} +15 -10
- package/dist/chunks/{cli-api.COfZo8lK.js → cli-api.9v9AxcPO.js} +444 -161
- package/dist/chunks/{config.d.B3YV4t0O.d.ts → config.d.BpJq6tRA.d.ts} +7 -1
- package/dist/chunks/{console.CQZ877Hi.js → console.DdxlsSsm.js} +4 -4
- package/dist/chunks/{creator.DHWmytIK.js → creator.B-BIoERb.js} +13 -11
- package/dist/chunks/{display.BlTmubjj.js → display.Cj2h2zsY.js} +1 -1
- package/dist/chunks/{doctor.B-oPbwps.js → doctor.DBFXC86z.js} +1 -1
- package/dist/chunks/{environment.d.BFQtFKdZ.d.ts → environment.d.rlpAM-ON.d.ts} +1 -1
- package/dist/chunks/{globals.ZKtKSkEf.js → globals.Cz5RAf6U.js} +10 -10
- package/dist/chunks/{index.Di8au7q4.js → index.6pLw0FLK.js} +220 -91
- package/dist/chunks/{index.w_oBZ9N8.js → index.BSqmIH9v.js} +3 -3
- package/dist/chunks/{index.Bi0NXYPf.js → index.C7Nn66Gy.js} +21 -9
- package/dist/chunks/{index.DmDMHCg8.js → index.CAmut2NG.js} +25 -1
- package/dist/chunks/{index.CZzC1gGg.js → index.D5jWOaqm.js} +35 -22
- package/dist/chunks/{index.D0heQG4v.js → index.Or9psEGe.js} +1 -1
- package/dist/chunks/{init-forks.BaDXQSD8.js → init-forks.q4IoGYZe.js} +7 -1
- package/dist/chunks/{init-threads.ZX_Vov0z.js → init-threads.Bf1Frg9S.js} +1 -1
- package/dist/chunks/{init.CO4AB7HZ.js → init.dGO4K2C0.js} +16 -8
- package/dist/chunks/{inspector.CvyFGlXm.js → inspector.D6o1NPo1.js} +12 -1
- package/dist/chunks/{modules.BJuCwlRJ.js → moduleSourceMap.Dp1WduWi.js} +31 -1
- package/dist/chunks/{native.upB-V0CK.js → native.D5q1ylZC.js} +2 -1
- package/dist/chunks/{nativeModuleMocker.Dh5azSB4.js → nativeModuleMocker.ihb3q7Cg.js} +4 -2
- package/dist/chunks/{plugin.d.LRFSN46m.d.ts → plugin.d.Bx2wJglX.d.ts} +58 -75
- package/dist/chunks/{plugins.DPQHVT0p.js → plugins.BPruPOR8.js} +1 -1
- package/dist/chunks/{rawSnapshot.DqSiqIEx.js → rawSnapshot.DvoRLRNr.js} +2 -2
- package/dist/chunks/{rpc.Uhkwr2NM.js → rpc.CNYWPa97.js} +3 -19
- package/dist/chunks/{rpc.d.3FOhdFx8.d.ts → rpc.d.DHfuwqP0.d.ts} +2 -2
- package/dist/chunks/{run.CjdgFZiW.js → run.zBhXlcZQ.js} +113 -49
- package/dist/chunks/{setup-common.CqAQCXzx.js → setup-common.kEGtNVHG.js} +3 -3
- package/dist/chunks/{source-map.DakdQc29.js → source-map.DPHGMWvM.js} +3 -1
- package/dist/chunks/{source-map.d.BkG8YK_3.d.ts → source-map.d.xB6_75fl.d.ts} +2 -1
- package/dist/chunks/{spy.DDMXghXv.js → spy.BO0hTE3G.js} +76 -53
- package/dist/chunks/{task-utils.d.D-gFPNFi.d.ts → task-utils.d.DgSjIb7r.d.ts} +1 -1
- package/dist/chunks/{utils.BBk_icFG.js → utils.sAsh2ClK.js} +2 -6
- package/dist/chunks/{vm.b4MbCAJQ.js → vm.DNr3Eju_.js} +4 -4
- package/dist/chunks/{worker.d.CyJRpyfZ.d.ts → worker.d.BigfbIsH.d.ts} +3 -3
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +8 -8
- package/dist/index.d.ts +10 -10
- package/dist/index.js +10 -10
- package/dist/module-evaluator.d.ts +3 -3
- package/dist/module-evaluator.js +1 -1
- package/dist/node.d.ts +11 -10
- package/dist/node.js +18 -15
- package/dist/runtime.d.ts +5 -4
- package/dist/runtime.js +5 -3
- package/dist/spy.js +1 -1
- package/dist/worker.d.ts +4 -4
- package/dist/worker.js +19 -18
- package/dist/workers/forks.js +20 -19
- package/dist/workers/runVmTests.js +14 -14
- package/dist/workers/threads.js +20 -19
- package/dist/workers/vmForks.js +14 -13
- package/dist/workers/vmThreads.js +14 -13
- package/dist/workers/watchdog.js +20 -0
- package/package.json +21 -21
- /package/dist/chunks/{index.BoyTG_B7.js → dist.BoyTG_B7.js} +0 -0
|
@@ -8,23 +8,25 @@ import * as vite from 'vite';
|
|
|
8
8
|
import { createServer, normalizePath, isFileLoadingAllowed, fetchModule, parseAst, searchForWorkspaceRoot, version, isRunnableDevEnvironment, mergeConfig, resolveConfig as resolveConfig$1 } from 'vite';
|
|
9
9
|
import { a as defaultPort, c as configFiles, d as defaultBrowserPort, b as defaultInspectPort } from './constants.DLYM6cZY.js';
|
|
10
10
|
import { c as configDefaults, e as benchmarkConfigDefaults } from './defaults.B1FCaFfh.js';
|
|
11
|
+
import { i as isInspectorOpen } from './inspector.D6o1NPo1.js';
|
|
11
12
|
import { b as isWindows, i as isForceColor, a as isTTY } from './env.BKKtU2WC.js';
|
|
12
13
|
import * as os from 'node:os';
|
|
13
14
|
import os__default, { availableParallelism, homedir, tmpdir } from 'node:os';
|
|
14
|
-
import crypto from 'node:crypto';
|
|
15
|
+
import crypto, { hash } from 'node:crypto';
|
|
15
16
|
import { isBuiltin, builtinModules, createRequire } from 'node:module';
|
|
16
17
|
import { rootDir, distDir } from '../path.js';
|
|
17
|
-
import { i as isBuiltin$1, a as isBrowserExternal, t as toBuiltin } from './
|
|
18
|
+
import { i as isBuiltin$1, a as isBrowserExternal, s as splitSourceMap, w as withInlineSourceMap, t as toBuiltin } from './moduleSourceMap.Dp1WduWi.js';
|
|
18
19
|
import MagicString from 'magic-string';
|
|
19
20
|
import { findMockRedirect, hoistMocksPlugin, automockPlugin } from '@vitest/mocker/node';
|
|
20
21
|
import { Console } from 'node:console';
|
|
21
22
|
import { Writable } from 'node:stream';
|
|
22
23
|
import { stripVTControlCharacters } from 'node:util';
|
|
23
|
-
import { i as inspect } from './display.
|
|
24
|
+
import { i as inspect } from './display.Cj2h2zsY.js';
|
|
25
|
+
import { execFile, fork } from 'node:child_process';
|
|
24
26
|
import { performance as performance$1 } from 'node:perf_hooks';
|
|
25
|
-
import { T as TraceMap, o as originalPositionFor, i as generatedPositionFor, j as eachMapping, k as stackIgnorePatterns, e as parseErrorStacktrace } from './source-map.
|
|
27
|
+
import { T as TraceMap, o as originalPositionFor, i as generatedPositionFor, j as eachMapping, k as stackIgnorePatterns, e as parseErrorStacktrace } from './source-map.DPHGMWvM.js';
|
|
26
28
|
import { x } from 'tinyexec';
|
|
27
|
-
import {
|
|
29
|
+
import { D as validateTags, B as limitConcurrency, E as shuffle } from './run.zBhXlcZQ.js';
|
|
28
30
|
import { createDebug } from 'obug';
|
|
29
31
|
import { createFileTask as createFileTask$1, createTaskName, calculateSuiteHash, convertTasksToEvents, hasFailed, generateFileHash } from '../task-utils.js';
|
|
30
32
|
import { readFile, mkdir, writeFile, rm, stat } from 'node:fs/promises';
|
|
@@ -33,8 +35,9 @@ import * as esModuleLexer from 'es-module-lexer';
|
|
|
33
35
|
import { ssrImportKey, ssrModuleExportsKey, ssrExportAllKey, ssrImportMetaKey, ModuleRunner } from 'vite/module-runner';
|
|
34
36
|
import path, { resolve as resolve$1 } from 'node:path';
|
|
35
37
|
import { p as positionToOffset, l as lineSplitRE } from './offset.Dy-5Fdfn.js';
|
|
36
|
-
import {
|
|
38
|
+
import { j as errorBanner, c as F_POINTER, k as divider, o as truncateString, w as withLabel, e as formatProjectName } from './utils.sAsh2ClK.js';
|
|
37
39
|
import { VitestModuleEvaluator } from '#module-evaluator';
|
|
40
|
+
import { V as VitestEvaluatedModules, c as createBirpc } from './index.CAmut2NG.js';
|
|
38
41
|
import pm from 'picomatch';
|
|
39
42
|
import { t as trackNativeImports, c as collectDependencies, n as nativeImports, g as getEvaluatedImports } from './module-dependencies._2Eei3FO.js';
|
|
40
43
|
import { g as getCoverageFilesDirectory } from './coverage.jGCktcGP.js';
|
|
@@ -42,11 +45,9 @@ import { isAgent, isCI, provider } from 'std-env';
|
|
|
42
45
|
import process$1 from 'node:process';
|
|
43
46
|
import { isatty } from 'node:tty';
|
|
44
47
|
import EventEmitter$1, { EventEmitter } from 'node:events';
|
|
45
|
-
import { c as createBirpc } from './index.DmDMHCg8.js';
|
|
46
|
-
import { fork } from 'node:child_process';
|
|
47
48
|
import { Worker } from 'node:worker_threads';
|
|
48
|
-
import { v as version$1 } from './cac.
|
|
49
|
-
import { g as getDefaultExportFromCjs } from './index.
|
|
49
|
+
import { v as version$1 } from './cac.DnNTZKhD.js';
|
|
50
|
+
import { g as getDefaultExportFromCjs } from './index.Or9psEGe.js';
|
|
50
51
|
import require$$0 from 'readline';
|
|
51
52
|
import require$$0$1 from 'events';
|
|
52
53
|
|
|
@@ -637,8 +638,6 @@ function detectCodeBlock(content) {
|
|
|
637
638
|
};
|
|
638
639
|
}
|
|
639
640
|
|
|
640
|
-
const hash = crypto.hash ?? ((algorithm, data, outputEncoding) => crypto.createHash(algorithm).update(data).digest(outputEncoding));
|
|
641
|
-
|
|
642
641
|
class VitestResolver {
|
|
643
642
|
options;
|
|
644
643
|
externalizeConcurrentCache = /* @__PURE__ */ new Map();
|
|
@@ -959,10 +958,13 @@ class ModuleTransformService {
|
|
|
959
958
|
if (moduleGraphModule.file) trace.setAttribute("code.file.path", moduleGraphModule.file);
|
|
960
959
|
if (options?.cached && cached) return { cache: true };
|
|
961
960
|
const externalize = await this.resolver.shouldExternalize(moduleGraphModule.id);
|
|
962
|
-
if (externalize)
|
|
963
|
-
externalize
|
|
964
|
-
|
|
965
|
-
|
|
961
|
+
if (externalize) {
|
|
962
|
+
if (this.fsCacheEnabled) this.fsCache.recordManifestExternal(this.config, environment, moduleGraphModule.url, externalize);
|
|
963
|
+
return {
|
|
964
|
+
externalize,
|
|
965
|
+
type: "module"
|
|
966
|
+
};
|
|
967
|
+
}
|
|
966
968
|
const cachePath = await this.getCachePath(environment, moduleGraphModule);
|
|
967
969
|
// full fs caching is disabled, but we still want to keep tmp files if makeTmpCopies is enabled
|
|
968
970
|
// this is primarily used by the forks pool to avoid using process.send(bigBuffer)
|
|
@@ -984,6 +986,7 @@ class ModuleTransformService {
|
|
|
984
986
|
return result;
|
|
985
987
|
});
|
|
986
988
|
}
|
|
989
|
+
this.fsCache.recordManifestModule(this.config, environment, moduleGraphModule.url, cachePath);
|
|
987
990
|
if (saveCachePromises.has(cachePath)) return saveCachePromises.get(cachePath).then((result) => {
|
|
988
991
|
this.recordResult(trace, result);
|
|
989
992
|
return result;
|
|
@@ -1074,10 +1077,11 @@ class ModuleTransformService {
|
|
|
1074
1077
|
if (!cachedModule) return;
|
|
1075
1078
|
const importedModules = await this.resolveCachedImports(environment, cachedModule);
|
|
1076
1079
|
if (!importedModules) return;
|
|
1080
|
+
if (cachedModule.file) this.fsCache.watchFile(cachedModule.file);
|
|
1077
1081
|
// Notify coverage provider that cached results were read
|
|
1078
1082
|
if (cachedModule.hasCoverageData) this.fsCache.restoreCoverageData(environment, cachedModule.id, cachedModule.coverageData);
|
|
1079
1083
|
// keep the module graph in sync
|
|
1080
|
-
let map =
|
|
1084
|
+
let map = cachedModule.sourceMap ? parseSourceMap(cachedModule.sourceMap) : null;
|
|
1081
1085
|
if (map && cachedModule.file) map.file = cachedModule.file;
|
|
1082
1086
|
// mappings is a special source map identifier in rollup
|
|
1083
1087
|
if (!map && cachedModule.mappings) map = { mappings: "" };
|
|
@@ -1090,7 +1094,8 @@ class ModuleTransformService {
|
|
|
1090
1094
|
dynamicDeps: cachedModule.dynamicDeps,
|
|
1091
1095
|
__vitestTmp: cachePath,
|
|
1092
1096
|
__vitestModuleType: moduleType,
|
|
1093
|
-
__vitestStaticMocks: cachedModule.staticMocks
|
|
1097
|
+
__vitestStaticMocks: cachedModule.staticMocks,
|
|
1098
|
+
__vitestSourceMap: cachedModule.sourceMap ?? null
|
|
1094
1099
|
};
|
|
1095
1100
|
// we populate the module graph to make the watch mode work because it relies on importers
|
|
1096
1101
|
if (importer) {
|
|
@@ -1195,41 +1200,38 @@ function getSafeModulePaths(environment) {
|
|
|
1195
1200
|
}
|
|
1196
1201
|
let SOURCEMAPPING_URL = "sourceMa";
|
|
1197
1202
|
SOURCEMAPPING_URL += "ppingURL";
|
|
1198
|
-
|
|
1203
|
+
// the source map is sent next to the code, so V8 doesn't compile it with every module
|
|
1199
1204
|
function processResultSource(environment, result) {
|
|
1200
1205
|
if (!("code" in result)) return result;
|
|
1201
1206
|
const node = environment.moduleGraph.getModuleById(result.id);
|
|
1202
|
-
|
|
1203
|
-
// this also overrides node.transformResult.code which is also what the module
|
|
1204
|
-
// runner does under the hood by default (we disable source maps inlining)
|
|
1205
|
-
inlineSourceMap(node.transformResult);
|
|
1207
|
+
const sourceMap = node?.transformResult ? getSourceMap(node.transformResult) : void 0;
|
|
1206
1208
|
return {
|
|
1207
1209
|
...result,
|
|
1208
|
-
code: node?.transformResult?.code || result.code
|
|
1210
|
+
code: node?.transformResult?.code || result.code,
|
|
1211
|
+
sourceMap
|
|
1209
1212
|
};
|
|
1210
1213
|
}
|
|
1211
1214
|
const OTHER_SOURCE_MAP_REGEXP = new RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json[^,]+base64,([A-Za-z0-9+/=]+)$`, "gm");
|
|
1212
|
-
// we
|
|
1215
|
+
// we don't let Vite inline the source map, because
|
|
1213
1216
|
// - we don't need //# sourceURL since we are running code in VM
|
|
1214
1217
|
// - important in stack traces and the V8 coverage
|
|
1215
1218
|
// - we need to inject an empty line for --inspect-brk
|
|
1216
|
-
function
|
|
1219
|
+
function getSourceMap(result) {
|
|
1220
|
+
if (result.__vitestSourceMap !== void 0) return result.__vitestSourceMap ?? void 0;
|
|
1217
1221
|
const map = result.map;
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1222
|
+
if (!map || !("version" in map)) {
|
|
1223
|
+
result.__vitestSourceMap = null;
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
// to reduce the payload size, we only keep vite node source map, because it's also the only one we use
|
|
1221
1227
|
OTHER_SOURCE_MAP_REGEXP.lastIndex = 0;
|
|
1222
|
-
if (OTHER_SOURCE_MAP_REGEXP.test(code)) code = code.replace(OTHER_SOURCE_MAP_REGEXP, "");
|
|
1228
|
+
if (OTHER_SOURCE_MAP_REGEXP.test(result.code)) result.code = result.code.replace(OTHER_SOURCE_MAP_REGEXP, "");
|
|
1223
1229
|
const sourceMap = { ...map };
|
|
1224
1230
|
// If the first line is not present on source maps, add simple 1:1 mapping ([0,0,0,0], [1,0,0,0])
|
|
1225
1231
|
// so that debuggers can be set to break on first line
|
|
1226
1232
|
if (sourceMap.mappings[0] === ";") sourceMap.mappings = `AAAA,CAAA${sourceMap.mappings}`;
|
|
1227
|
-
result.
|
|
1228
|
-
return result;
|
|
1229
|
-
}
|
|
1230
|
-
function genSourceMapUrl(map) {
|
|
1231
|
-
if (typeof map !== "string") map = JSON.stringify(map);
|
|
1232
|
-
return `data:application/json;base64,${Buffer.from(map).toString("base64")}`;
|
|
1233
|
+
result.__vitestSourceMap = JSON.stringify(sourceMap);
|
|
1234
|
+
return result.__vitestSourceMap;
|
|
1233
1235
|
}
|
|
1234
1236
|
function getCachedResult(result, tmp) {
|
|
1235
1237
|
return {
|
|
@@ -1242,15 +1244,9 @@ function getCachedResult(result, tmp) {
|
|
|
1242
1244
|
moduleType: result.moduleType
|
|
1243
1245
|
};
|
|
1244
1246
|
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
const lastIndex = code.lastIndexOf(pattern);
|
|
1249
|
-
if (lastIndex === -1) return null;
|
|
1250
|
-
const mapString = MODULE_RUNNER_SOURCEMAPPING_REGEXP.exec(code.slice(lastIndex))?.[1];
|
|
1251
|
-
if (!mapString) return null;
|
|
1252
|
-
const sourceMap = JSON.parse(Buffer.from(mapString, "base64").toString("utf-8"));
|
|
1253
|
-
// remove source map mapping added by "inlineSourceMap" to keep the original behaviour of transformRequest
|
|
1247
|
+
function parseSourceMap(map) {
|
|
1248
|
+
const sourceMap = JSON.parse(map);
|
|
1249
|
+
// remove source map mapping added by "getSourceMap" to keep the original behaviour of transformRequest
|
|
1254
1250
|
if (sourceMap.mappings.startsWith("AAAA,CAAA;"))
|
|
1255
1251
|
// 9 because we want to only remove "AAAA,CAAA", but keep ; at the start
|
|
1256
1252
|
sourceMap.mappings = sourceMap.mappings.slice(9);
|
|
@@ -1292,6 +1288,26 @@ function isTestFunctionName(name) {
|
|
|
1292
1288
|
function isVitestFunctionName(name) {
|
|
1293
1289
|
return name === "describe" || name === "suite" || isTestFunctionName(name);
|
|
1294
1290
|
}
|
|
1291
|
+
function isStringNode(node) {
|
|
1292
|
+
return node.type === "Literal" && typeof node.value === "string" || node.type === "TemplateLiteral" || node.type === "BinaryExpression" && node.operator === "+" && (isStringNode(node.left) || isStringNode(node.right));
|
|
1293
|
+
}
|
|
1294
|
+
function isNumberNode(node) {
|
|
1295
|
+
return node.type === "Literal" && typeof node.value === "number" || node.type === "UnaryExpression" && node.operator === "-" && isNumberNode(node.argument);
|
|
1296
|
+
}
|
|
1297
|
+
function isTaskNameNode(node) {
|
|
1298
|
+
switch (node.type) {
|
|
1299
|
+
case "Identifier":
|
|
1300
|
+
case "MemberExpression": return true;
|
|
1301
|
+
case "ConditionalExpression": return isTaskNameNode(node.consequent) && isTaskNameNode(node.alternate);
|
|
1302
|
+
case "LogicalExpression": return node.operator !== "&&" && isTaskNameNode(node.left) && isTaskNameNode(node.right);
|
|
1303
|
+
// an imported binding is transformed into `(0, __vite_ssr_import_0__.name)`
|
|
1304
|
+
case "SequenceExpression": {
|
|
1305
|
+
const [e0, e1] = node.expressions;
|
|
1306
|
+
return node.expressions.length === 2 && e0.type === "Literal" && e0.value === 0 && isTaskNameNode(e1);
|
|
1307
|
+
}
|
|
1308
|
+
default: return isStringNode(node) || isNumberNode(node);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1295
1311
|
function astParseFile(filepath, code) {
|
|
1296
1312
|
const ast = parseAst(code);
|
|
1297
1313
|
if (verbose) verbose("Collecting", filepath, code);
|
|
@@ -1354,12 +1370,13 @@ function astParseFile(filepath, code) {
|
|
|
1354
1370
|
if (callee.type === "CallExpression" || callee.type === "SequenceExpression" || callee.type === "TaggedTemplateExpression") start = callee.end;
|
|
1355
1371
|
else start = node.start;
|
|
1356
1372
|
const messageNode = node.arguments?.[0];
|
|
1357
|
-
if (messageNode == null) {
|
|
1373
|
+
if (messageNode == null || !isTaskNameNode(messageNode)) {
|
|
1358
1374
|
verbose?.(`Skipping node at ${node.start} because it doesn't have a name`);
|
|
1359
1375
|
return;
|
|
1360
1376
|
}
|
|
1361
1377
|
let message;
|
|
1362
|
-
if (messageNode
|
|
1378
|
+
if (messageNode.type === "Literal" && typeof messageNode.value === "number") message = String(messageNode.value);
|
|
1379
|
+
else if (messageNode.type === "Literal" || messageNode.type === "TemplateLiteral") message = code.slice(messageNode.start + 1, messageNode.end - 1);
|
|
1363
1380
|
else {
|
|
1364
1381
|
message = code.slice(messageNode.start, messageNode.end);
|
|
1365
1382
|
if (message.endsWith(".name")) message = message.slice(0, -5);
|
|
@@ -2841,6 +2858,8 @@ function stripLiteral(code, options) {
|
|
|
2841
2858
|
return result;
|
|
2842
2859
|
}
|
|
2843
2860
|
|
|
2861
|
+
// `=`, `||=`, `??=`, `+=`, etc., but not `==` or `===`
|
|
2862
|
+
const ASSIGNMENT_RE = /\s*(?:\*\*|<<|>>>?|&&|\|\||\?\?|[-+*/%&|^])?=(?!=)/y;
|
|
2844
2863
|
// so people can reassign envs at runtime
|
|
2845
2864
|
// import.meta.env.VITE_NAME = 'app' -> process.env.VITE_NAME = 'app'
|
|
2846
2865
|
function MetaEnvReplacerPlugin() {
|
|
@@ -2850,11 +2869,17 @@ function MetaEnvReplacerPlugin() {
|
|
|
2850
2869
|
transform(code, id) {
|
|
2851
2870
|
if (!/\bimport\.meta\.env\b/.test(code)) return null;
|
|
2852
2871
|
let s = null;
|
|
2853
|
-
const
|
|
2872
|
+
const cleanCode = stripLiteral(code);
|
|
2873
|
+
const envs = cleanCode.matchAll(/\bimport\.meta\.env\b/g);
|
|
2854
2874
|
for (const env of envs) {
|
|
2855
|
-
s ||= new MagicString(code);
|
|
2856
2875
|
const startIndex = env.index;
|
|
2857
2876
|
const endIndex = startIndex + env[0].length;
|
|
2877
|
+
// `import.meta.env = ...` is left as is, since `Object.assign(...) = ...`
|
|
2878
|
+
// is not a valid assignment target. Reads and property writes like
|
|
2879
|
+
// `import.meta.env.FOO = 1` are still rewritten.
|
|
2880
|
+
ASSIGNMENT_RE.lastIndex = endIndex;
|
|
2881
|
+
if (ASSIGNMENT_RE.test(cleanCode)) continue;
|
|
2882
|
+
s ||= new MagicString(code);
|
|
2858
2883
|
s.overwrite(startIndex, endIndex, `Object.assign(/* istanbul ignore next */ globalThis.__vitest_worker__?.metaEnv ?? import.meta.env)`);
|
|
2859
2884
|
}
|
|
2860
2885
|
if (s) return {
|
|
@@ -3078,8 +3103,9 @@ Possible solutions:
|
|
|
3078
3103
|
return typesErrors;
|
|
3079
3104
|
}
|
|
3080
3105
|
async stop() {
|
|
3081
|
-
this.process
|
|
3106
|
+
const child = this.process;
|
|
3082
3107
|
this.process = void 0;
|
|
3108
|
+
if (child) await killProcessTree(child);
|
|
3083
3109
|
}
|
|
3084
3110
|
async ensurePackageInstalled(ctx, checker) {
|
|
3085
3111
|
if (checker !== "tsc" && checker !== "vue-tsc") return;
|
|
@@ -3247,6 +3273,24 @@ function findGeneratedPosition(traceMap, { line, column, source }) {
|
|
|
3247
3273
|
column: null
|
|
3248
3274
|
};
|
|
3249
3275
|
}
|
|
3276
|
+
function killProcessTree(child) {
|
|
3277
|
+
// on Windows the checker runs behind a `cmd.exe` shim, and `kill()` stops only the shim
|
|
3278
|
+
if (process.platform !== "win32" || child.pid == null || child.exitCode != null) {
|
|
3279
|
+
child.kill();
|
|
3280
|
+
return Promise.resolve();
|
|
3281
|
+
}
|
|
3282
|
+
return new Promise((resolve) => {
|
|
3283
|
+
execFile("taskkill", [
|
|
3284
|
+
"/pid",
|
|
3285
|
+
String(child.pid),
|
|
3286
|
+
"/T",
|
|
3287
|
+
"/F"
|
|
3288
|
+
], { windowsHide: true }, (error) => {
|
|
3289
|
+
if (error) child.kill();
|
|
3290
|
+
resolve();
|
|
3291
|
+
});
|
|
3292
|
+
});
|
|
3293
|
+
}
|
|
3250
3294
|
|
|
3251
3295
|
// use Logger with custom Console to capture entire error printing
|
|
3252
3296
|
function capturePrintError(error, ctx, options) {
|
|
@@ -3578,21 +3622,23 @@ class ServerModuleRunner extends ModuleRunner {
|
|
|
3578
3622
|
constructor(environment, transformService, config) {
|
|
3579
3623
|
super({
|
|
3580
3624
|
hmr: false,
|
|
3625
|
+
evaluatedModules: new VitestEvaluatedModules(),
|
|
3581
3626
|
transport: { async invoke(event) {
|
|
3582
3627
|
if (event.type !== "custom") throw new Error(`Vitest Module Runner doesn't support Vite HMR events.`);
|
|
3583
3628
|
const { name, data } = event.data;
|
|
3584
3629
|
if (name === "getBuiltins") return await environment.hot.handleInvoke(event);
|
|
3585
3630
|
if (name !== "fetchModule") return { error: /* @__PURE__ */ new Error(`Unknown method: ${name}. Expected "fetchModule".`) };
|
|
3586
3631
|
try {
|
|
3587
|
-
|
|
3632
|
+
let result = await transformService.fetch(data[0], data[1], environment, false, data[2]);
|
|
3588
3633
|
if ("tmp" in result) {
|
|
3589
|
-
const code = await readFile(result.tmp, "utf-8");
|
|
3590
|
-
|
|
3634
|
+
const { code, sourceMap } = splitSourceMap(await readFile(result.tmp, "utf-8"));
|
|
3635
|
+
result = {
|
|
3591
3636
|
...result,
|
|
3592
|
-
code
|
|
3593
|
-
|
|
3637
|
+
code,
|
|
3638
|
+
sourceMap
|
|
3639
|
+
};
|
|
3594
3640
|
}
|
|
3595
|
-
return { result };
|
|
3641
|
+
return { result: config.inspector.openInMainProcess ? withInlineSourceMap(result) : result };
|
|
3596
3642
|
} catch (error) {
|
|
3597
3643
|
return { error };
|
|
3598
3644
|
}
|
|
@@ -3872,7 +3918,7 @@ function processWildcard(dep, moduleDirectories) {
|
|
|
3872
3918
|
if (typeof dep !== "string") return dep;
|
|
3873
3919
|
if (typeof dep === "string" && dep.includes("*")) {
|
|
3874
3920
|
const directories = (moduleDirectories || ["/node_modules/"]).map((r) => escapeRegExp(r));
|
|
3875
|
-
return new RegExp(`(${directories.join("|")})${dep.
|
|
3921
|
+
return new RegExp(`(${directories.join("|")})${escapeRegExp(dep).replaceAll("\\*", "[\\w/.-]+")}`);
|
|
3876
3922
|
}
|
|
3877
3923
|
return dep;
|
|
3878
3924
|
}
|
|
@@ -4411,6 +4457,16 @@ function createBrowserPool(vitest) {
|
|
|
4411
4457
|
isCancelled = true;
|
|
4412
4458
|
cancel();
|
|
4413
4459
|
});
|
|
4460
|
+
// an invalidated module keeps its url, so a browser context that cached it
|
|
4461
|
+
// in an earlier run would serve the old code
|
|
4462
|
+
if (vitest._browserCacheStale) {
|
|
4463
|
+
vitest._browserCacheStale = false;
|
|
4464
|
+
// runs don't overlap (`runFiles` waits for the previous one), so no worker should be
|
|
4465
|
+
// active here; the check only keeps a running worker from being stopped
|
|
4466
|
+
Array.from(workers.values()).filter((worker) => !activeWorkers.has(worker)).forEach((worker) => stopWorker(worker));
|
|
4467
|
+
await Promise.all(exitPromises);
|
|
4468
|
+
if (isCancelled) return;
|
|
4469
|
+
}
|
|
4414
4470
|
const groupedFiles = await groupSpecifications(specs);
|
|
4415
4471
|
const tasks = await Promise.all(Array.from(groupedFiles.entries(), async ([project, files]) => {
|
|
4416
4472
|
await project._initBrowserProvider();
|
|
@@ -4874,13 +4930,7 @@ const warmExternals = /* @__PURE__ */ new WeakMap();
|
|
|
4874
4930
|
function createMethodsRPC(project, methodsOptions = {}) {
|
|
4875
4931
|
const vitest = project.vitest;
|
|
4876
4932
|
const cacheFs = methodsOptions.cacheFs ?? false;
|
|
4877
|
-
project.vitest.state.metadata[project.name] ??= {
|
|
4878
|
-
externalized: {},
|
|
4879
|
-
duration: {},
|
|
4880
|
-
tmps: {}
|
|
4881
|
-
};
|
|
4882
|
-
if (project.config.dumpDir && !existsSync(project.config.dumpDir)) mkdirSync(project.config.dumpDir, { recursive: true });
|
|
4883
|
-
project.vitest.state.metadata[project.name].dumpDir = project.config.dumpDir;
|
|
4933
|
+
project.vitest.state.metadata[project.name] ??= { duration: {} };
|
|
4884
4934
|
function getEnvironment(environmentName) {
|
|
4885
4935
|
const environment = project.vite.environments[environmentName];
|
|
4886
4936
|
if (!environment) throw new Error(`The environment ${environmentName} was not defined in the Vite config.`);
|
|
@@ -4892,7 +4942,6 @@ function createMethodsRPC(project, methodsOptions = {}) {
|
|
|
4892
4942
|
return await project._transformService.fetch(url, importer, environment, cacheFs, options, otelCarrier).then((result) => {
|
|
4893
4943
|
const metadata = state.metadata[project.name];
|
|
4894
4944
|
if ("externalize" in result) {
|
|
4895
|
-
metadata.externalized[url] = result.externalize;
|
|
4896
4945
|
// builtins and network urls are already resolved inside the worker
|
|
4897
4946
|
// without a round-trip, only module externalizations are worth sharing
|
|
4898
4947
|
if (result.type === "module" && url[0] === "/") {
|
|
@@ -4904,7 +4953,6 @@ function createMethodsRPC(project, methodsOptions = {}) {
|
|
|
4904
4953
|
externals[url] = result;
|
|
4905
4954
|
}
|
|
4906
4955
|
}
|
|
4907
|
-
if ("tmp" in result) metadata.tmps[url] = result.tmp;
|
|
4908
4956
|
if (accountModuleDuration) {
|
|
4909
4957
|
const duration = performance.now() - start;
|
|
4910
4958
|
metadata.duration[url] ??= [];
|
|
@@ -5440,6 +5488,62 @@ class PoolRunner {
|
|
|
5440
5488
|
}
|
|
5441
5489
|
}
|
|
5442
5490
|
|
|
5491
|
+
let watchdog;
|
|
5492
|
+
const watched = /* @__PURE__ */ new Set();
|
|
5493
|
+
function watchProcess(child, distPath) {
|
|
5494
|
+
const pid = child.pid;
|
|
5495
|
+
if (pid == null) return;
|
|
5496
|
+
watchdog ??= startWatchdog(distPath);
|
|
5497
|
+
watched.add(pid);
|
|
5498
|
+
send({
|
|
5499
|
+
type: "watch",
|
|
5500
|
+
pid
|
|
5501
|
+
});
|
|
5502
|
+
child.once("exit", () => {
|
|
5503
|
+
watched.delete(pid);
|
|
5504
|
+
send({
|
|
5505
|
+
type: "unwatch",
|
|
5506
|
+
pid
|
|
5507
|
+
});
|
|
5508
|
+
});
|
|
5509
|
+
}
|
|
5510
|
+
function stopWatchdog() {
|
|
5511
|
+
if (watchdog && watched.size === 0) {
|
|
5512
|
+
watchdog.disconnect();
|
|
5513
|
+
watchdog = void 0;
|
|
5514
|
+
}
|
|
5515
|
+
}
|
|
5516
|
+
function send(message) {
|
|
5517
|
+
if (watchdog?.connected) watchdog.send(message);
|
|
5518
|
+
}
|
|
5519
|
+
function startWatchdog(distPath) {
|
|
5520
|
+
/** Loads {@link file://./../../runtime/workers/watchdog.ts} */
|
|
5521
|
+
const child = fork(resolve$1(distPath, "workers/watchdog.js"), [], {
|
|
5522
|
+
stdio: [
|
|
5523
|
+
"ignore",
|
|
5524
|
+
"ignore",
|
|
5525
|
+
"ignore",
|
|
5526
|
+
"ipc"
|
|
5527
|
+
],
|
|
5528
|
+
execArgv: [],
|
|
5529
|
+
env: {
|
|
5530
|
+
...process.env,
|
|
5531
|
+
NODE_OPTIONS: void 0
|
|
5532
|
+
}
|
|
5533
|
+
});
|
|
5534
|
+
// must never keep the main process alive
|
|
5535
|
+
child.unref();
|
|
5536
|
+
// Bun has no `channel.unref`
|
|
5537
|
+
// Revert when https://github.com/oven-sh/bun/issues/33593 is done
|
|
5538
|
+
child.channel?.unref?.();
|
|
5539
|
+
// losing the watchdog only loses the cleanup, the test run is not affected
|
|
5540
|
+
child.on("error", () => {});
|
|
5541
|
+
child.once("exit", () => {
|
|
5542
|
+
if (watchdog === child) watchdog = void 0;
|
|
5543
|
+
});
|
|
5544
|
+
return child;
|
|
5545
|
+
}
|
|
5546
|
+
|
|
5443
5547
|
// After a worker dies, its remaining stdio is drained into the parent-side
|
|
5444
5548
|
// readables asynchronously. Waiting for `end`/`close` before unpiping ensures
|
|
5445
5549
|
// the tail of the output still reaches the shared logger streams.
|
|
@@ -5462,6 +5566,7 @@ class ForksPoolWorker {
|
|
|
5462
5566
|
entrypoint;
|
|
5463
5567
|
execArgv;
|
|
5464
5568
|
env;
|
|
5569
|
+
distPath;
|
|
5465
5570
|
_fork;
|
|
5466
5571
|
stdout;
|
|
5467
5572
|
stderr;
|
|
@@ -5472,6 +5577,7 @@ class ForksPoolWorker {
|
|
|
5472
5577
|
this.env = options.env;
|
|
5473
5578
|
this.stdout = options.project.vitest.logger.outputStream;
|
|
5474
5579
|
this.stderr = options.project.vitest.logger.errorStream;
|
|
5580
|
+
this.distPath = options.distPath;
|
|
5475
5581
|
/** Loads {@link file://./../../../runtime/workers/forks.ts} */
|
|
5476
5582
|
this.entrypoint = resolve$1(options.distPath, "workers/forks.js");
|
|
5477
5583
|
}
|
|
@@ -5504,6 +5610,7 @@ class ForksPoolWorker {
|
|
|
5504
5610
|
this.stderr.setMaxListeners(1 + this.stderr.getMaxListeners());
|
|
5505
5611
|
this._fork.stderr.pipe(this.stderr, { end: false });
|
|
5506
5612
|
}
|
|
5613
|
+
watchProcess(this._fork, this.distPath);
|
|
5507
5614
|
}
|
|
5508
5615
|
async stop() {
|
|
5509
5616
|
const fork = this.fork;
|
|
@@ -5940,7 +6047,7 @@ class Pool {
|
|
|
5940
6047
|
await resolver.promise.catch((error) => span?.recordException(error)).finally(() => span?.end());
|
|
5941
6048
|
const index = this.activeTasks.indexOf(activeTask);
|
|
5942
6049
|
if (index !== -1) this.activeTasks.splice(index, 1);
|
|
5943
|
-
if (!task.isolate &&
|
|
6050
|
+
if (!task.isolate && runner.isStarted && !isMemoryLimitReached && this.queue[0]?.task.isolate === false && isEqualRunner(runner, this.queue[0].task)) {
|
|
5944
6051
|
this.sharedRunners.push(runner);
|
|
5945
6052
|
return this.schedule();
|
|
5946
6053
|
}
|
|
@@ -5948,7 +6055,7 @@ class Pool {
|
|
|
5948
6055
|
// Runner termination can also already start from task cancellation.
|
|
5949
6056
|
if (!runner.isTerminated) {
|
|
5950
6057
|
const id = setTimeout(() => this.logger.error(`[vitest-pool]: Timeout terminating ${task.worker} worker for test files ${formatFiles(task)}.`), this.options.teardownTimeout);
|
|
5951
|
-
this.exitPromises.push(runner.stop({ force: resolver.isRejected }).
|
|
6058
|
+
this.exitPromises.push(runner.stop({ force: resolver.isRejected }).finally(() => clearTimeout(id)).catch((error) => this.logger.error(`[vitest-pool]: Failed to terminate ${task.worker} worker for test files ${formatFiles(task)}.`, error)));
|
|
5952
6059
|
}
|
|
5953
6060
|
workerIds.set(poolId, true);
|
|
5954
6061
|
}
|
|
@@ -5981,6 +6088,7 @@ catch (error) {
|
|
|
5981
6088
|
}
|
|
5982
6089
|
async close() {
|
|
5983
6090
|
await this.cancel();
|
|
6091
|
+
stopWatchdog();
|
|
5984
6092
|
}
|
|
5985
6093
|
getPoolRunner(task, method) {
|
|
5986
6094
|
if (task.isolate === false) {
|
|
@@ -6080,20 +6188,13 @@ function createPool(ctx) {
|
|
|
6080
6188
|
state: ctx.state
|
|
6081
6189
|
}, ctx.logger);
|
|
6082
6190
|
const options = resolveOptions(ctx);
|
|
6083
|
-
const Sequencer = ctx.config.sequence.sequencer;
|
|
6084
|
-
const sequencer = new Sequencer(ctx);
|
|
6085
6191
|
let browserPool;
|
|
6086
6192
|
async function executeTests(method, specs, invalidates) {
|
|
6087
6193
|
ctx.onCancel(() => pool.cancel());
|
|
6088
|
-
if (ctx.config.shard) {
|
|
6089
|
-
if (!ctx.config.passWithNoTests && ctx.config.shard.count > specs.length) throw new Error(`--shard <count> must be a smaller than count of test files. Resolved ${specs.length} test files for --shard=${ctx.config.shard.index}/${ctx.config.shard.count}.`);
|
|
6090
|
-
specs = await sequencer.shard(Array.from(specs));
|
|
6091
|
-
}
|
|
6092
6194
|
const taskGroups = [];
|
|
6093
6195
|
let workerId = 1;
|
|
6094
|
-
const sorted = await sequencer.sort(specs);
|
|
6095
6196
|
const { environments, tags } = await getSpecificationsOptions(specs);
|
|
6096
|
-
const groups = groupSpecs(
|
|
6197
|
+
const groups = groupSpecs(specs, environments);
|
|
6097
6198
|
const projectEnvs = /* @__PURE__ */ new WeakMap();
|
|
6098
6199
|
const projectExecArgvs = /* @__PURE__ */ new WeakMap();
|
|
6099
6200
|
for (const group of groups) {
|
|
@@ -6366,13 +6467,21 @@ async function globProjectTestFiles(include, exclude, includeSource, cwd) {
|
|
|
6366
6467
|
function filterTestFiles(testFiles, filters, dir) {
|
|
6367
6468
|
if (!filters.length) return testFiles;
|
|
6368
6469
|
if (process.platform === "win32") filters = filters.map((f) => slash(f));
|
|
6470
|
+
const patterns = filters.map((f) => {
|
|
6471
|
+
const relativePath = f.endsWith("/") ? join(relative(dir, f), "/") : relative(dir, f);
|
|
6472
|
+
return {
|
|
6473
|
+
filter: f,
|
|
6474
|
+
isAbsolute: isAbsolute(f),
|
|
6475
|
+
lowerCase: f.toLocaleLowerCase(),
|
|
6476
|
+
relativeLowerCase: relativePath.toLocaleLowerCase()
|
|
6477
|
+
};
|
|
6478
|
+
});
|
|
6369
6479
|
return testFiles.filter((t) => {
|
|
6370
6480
|
const testFile = relative(dir, t).toLocaleLowerCase();
|
|
6371
|
-
return
|
|
6481
|
+
return patterns.some((p) => {
|
|
6372
6482
|
// if filter is a full file path, we should include it if it's in the same folder
|
|
6373
|
-
if (isAbsolute
|
|
6374
|
-
|
|
6375
|
-
return testFile.includes(f.toLocaleLowerCase()) || testFile.includes(relativePath.toLocaleLowerCase());
|
|
6483
|
+
if (p.isAbsolute && t.startsWith(p.filter)) return true;
|
|
6484
|
+
return testFile.includes(p.lowerCase) || testFile.includes(p.relativeLowerCase);
|
|
6376
6485
|
});
|
|
6377
6486
|
});
|
|
6378
6487
|
}
|
|
@@ -7859,9 +7968,18 @@ async function getFileSizes(files) {
|
|
|
7859
7968
|
class RandomSequencer extends BaseSequencer {
|
|
7860
7969
|
async sort(files) {
|
|
7861
7970
|
const { sequence } = this.ctx.config;
|
|
7862
|
-
|
|
7971
|
+
// the glob order can change between runs, so only the seed may decide the order
|
|
7972
|
+
const sorted = [...files].sort(compareSpecifications);
|
|
7973
|
+
return shuffle(sorted, sequence.seed);
|
|
7863
7974
|
}
|
|
7864
7975
|
}
|
|
7976
|
+
function compareSpecifications(a, b) {
|
|
7977
|
+
return compareStrings(a.project.name, b.project.name) || compareStrings(a.moduleId, b.moduleId) || compareStrings(a.pool, b.pool);
|
|
7978
|
+
}
|
|
7979
|
+
// `localeCompare` depends on the locale of the machine, which makes `--seed` unreproducible
|
|
7980
|
+
function compareStrings(a, b) {
|
|
7981
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
7982
|
+
}
|
|
7865
7983
|
|
|
7866
7984
|
var jsTokens_1;
|
|
7867
7985
|
var hasRequiredJsTokens;
|
|
@@ -8652,7 +8770,7 @@ class VitestPackageInstaller {
|
|
|
8652
8770
|
});
|
|
8653
8771
|
if (install) {
|
|
8654
8772
|
const packageName = version ? `${dependency}@${version}` : dependency;
|
|
8655
|
-
await (await import('./
|
|
8773
|
+
await (await import('./dist.BoyTG_B7.js')).installPackage(packageName, { dev: true });
|
|
8656
8774
|
// TODO: somehow it fails to load the package after installation, remove this when it's fixed
|
|
8657
8775
|
process.stderr.write($.yellow(`\nPackage ${packageName} installed, re-run the command to start.\n`));
|
|
8658
8776
|
process.exit();
|
|
@@ -8851,7 +8969,8 @@ function resolveTestConfig(logger, options, viteConfig, globalConfig) {
|
|
|
8851
8969
|
...resolved.inspector,
|
|
8852
8970
|
...parseInspector(inspector),
|
|
8853
8971
|
enabled: !!inspector,
|
|
8854
|
-
waitForDebugger: options.inspector?.waitForDebugger ?? !!resolved.inspectBrk
|
|
8972
|
+
waitForDebugger: options.inspector?.waitForDebugger ?? !!resolved.inspectBrk,
|
|
8973
|
+
openInMainProcess: isInspectorOpen()
|
|
8855
8974
|
};
|
|
8856
8975
|
if (viteConfig.base !== "/") resolved.base = viteConfig.base;
|
|
8857
8976
|
resolved.clearScreen = resolved.clearScreen ?? viteConfig.clearScreen ?? true;
|
|
@@ -8943,7 +9062,12 @@ function resolveTestConfig(logger, options, viteConfig, globalConfig) {
|
|
|
8943
9062
|
}
|
|
8944
9063
|
}
|
|
8945
9064
|
// CLI options are merged into the test config
|
|
8946
|
-
|
|
9065
|
+
const { sinceLastRun } = options;
|
|
9066
|
+
if (options.related && (resolved.changed || sinceLastRun)) {
|
|
9067
|
+
const flag = sinceLastRun ? "--since-last-run" : "--changed";
|
|
9068
|
+
throw new Error(`The "${flag}" flag cannot be used with "vitest related". Use "vitest run ${flag}" to run the tests affected by the changed files, or "vitest related <files>" to run the tests affected by the given files.`);
|
|
9069
|
+
}
|
|
9070
|
+
if (sinceLastRun) {
|
|
8947
9071
|
if (resolved.cache === false) throw new Error("The \"--since-last-run\" flag requires the \"cache\" option to store the dependencies of the test files.");
|
|
8948
9072
|
resolved.changed ||= true;
|
|
8949
9073
|
resolved.experimental ??= {};
|
|
@@ -9127,7 +9251,7 @@ function resolveTestConfig(logger, options, viteConfig, globalConfig) {
|
|
|
9127
9251
|
};
|
|
9128
9252
|
resolved.typecheck ??= {};
|
|
9129
9253
|
resolved.typecheck.enabled ??= false;
|
|
9130
|
-
if (resolved.typecheck.enabled && !warnedTypeCheck) {
|
|
9254
|
+
if (resolved.typecheck.enabled && !warnedTypeCheck && !process.env.VITEST_DISABLE_EXPERIMENTAL_LOG) {
|
|
9131
9255
|
warnedTypeCheck = true;
|
|
9132
9256
|
logger.console.warn($.yellow("Testing types with tsc and vue-tsc is an experimental feature.\nBreaking changes might not follow SemVer, please pin Vitest's version when using it."));
|
|
9133
9257
|
}
|
|
@@ -9186,10 +9310,8 @@ function resolveTestConfig(logger, options, viteConfig, globalConfig) {
|
|
|
9186
9310
|
})) resolved.includeTaskLocation ??= true;
|
|
9187
9311
|
resolved.server ??= {};
|
|
9188
9312
|
resolved.server.deps ??= {};
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
resolved.dumpDir = resolve(resolved.root, typeof userFolder === "string" && userFolder !== "true" ? userFolder : ".vitest-dump", resolved.name || "root");
|
|
9192
|
-
}
|
|
9313
|
+
// projects inherit the root option, so they warn only when they set it themselves
|
|
9314
|
+
if (resolved.server.debug && (!globalConfig || !globalConfig.server.debug)) logger.deprecate("`server.debug` is deprecated and has no effect. To inspect or edit the transformed code, look up the module in the `fsModuleCache` manifest: https://vitest.dev/config/fsmodulecache#manifest");
|
|
9193
9315
|
resolved.testTimeout ??= resolved.browser.enabled ? 15e3 : 5e3;
|
|
9194
9316
|
resolved.hookTimeout ??= resolved.browser.enabled ? 3e4 : 1e4;
|
|
9195
9317
|
resolved.experimental ??= {};
|
|
@@ -9236,8 +9358,15 @@ function resolveTestConfig(logger, options, viteConfig, globalConfig) {
|
|
|
9236
9358
|
logger.deprecate("`experimental.fsModuleCachePath` is deprecated. Use the top-level `fsModuleCachePath` option instead.");
|
|
9237
9359
|
if (options.fsModuleCachePath === void 0) resolved.fsModuleCachePath = legacyExperimental.fsModuleCachePath;
|
|
9238
9360
|
}
|
|
9361
|
+
// the config and the CLI take priority over the environment
|
|
9362
|
+
const fsModuleCacheEnv = process.env.VITEST_FS_MODULE_CACHE;
|
|
9363
|
+
if (resolved.fsModuleCache == null && fsModuleCacheEnv) {
|
|
9364
|
+
resolved.fsModuleCache = fsModuleCacheEnv !== "false" && fsModuleCacheEnv !== "0";
|
|
9365
|
+
resolved.providedOptions.fsModuleCache = true;
|
|
9366
|
+
}
|
|
9239
9367
|
resolved.fsModuleCache ??= true;
|
|
9240
|
-
|
|
9368
|
+
const fsModuleCachePath = resolved.fsModuleCachePath || process.env.VITEST_FS_MODULE_CACHE_PATH;
|
|
9369
|
+
if (fsModuleCachePath) resolved.fsModuleCachePath = resolve(resolved.root, fsModuleCachePath);
|
|
9241
9370
|
return resolved;
|
|
9242
9371
|
}
|
|
9243
9372
|
/**
|
|
@@ -15662,4 +15791,4 @@ var index = /*#__PURE__*/_mergeNamespaces({
|
|
|
15662
15791
|
default: prompt
|
|
15663
15792
|
}, [promptsExports]);
|
|
15664
15793
|
|
|
15665
|
-
export {
|
|
15794
|
+
export { printStack as A, BaseSequencer as B, LocationFilterFileNotFoundError as C, GitCommandError as D, VitestResolver as E, ForksPoolWorker as F, GitNotFoundError as G, createClusterServer as H, IncludeTaskLocationDisabledError as I, attachProjectsFromEntries as J, TestProject as K, Logger as L, ModuleTransformService as M, resolveAndAttachProjects as N, RandomSequencer as O, PluginHarness as P, createPool as Q, RangeLocationFilterProvidedError as R, ServerModuleRunner as S, ThreadsPoolWorker as T, astCollectTests as U, VitestPackageInstaller as V, createFailedFileTask as W, matchesProjectFilter as X, nanoid as Y, stdout as Z, BrowserConnectionError as a, FilesNotFoundError as b, TypecheckPoolWorker as c, VmForksPoolWorker as d, VmThreadsPoolWorker as e, createDebugger as f, createMethodsRPC as g, createViteLogger as h, escapeTestName as i, getFilePoolName as j, isFileServingAllowed as k, resolveConfig as l, resolveFsAllow as m, findConfigFile as n, parse as o, prompt as p, getSpecificationDocblock as q, resolveApiServerConfig as r, stringify as s, resolveStaticMocks as t, getStaticMocks as u, resolveCoverageReporters as v, createIndexLocationsMap as w, getOutputFile as x, groupBy as y, generateCodeFrame as z };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as chai from 'chai';
|
|
2
2
|
import { createHook } from 'node:async_hooks';
|
|
3
3
|
import { t as takeCoverageInsideWorker } from './coverage.9iqXE2gN.js';
|
|
4
|
-
import { r as rpc } from './rpc.
|
|
5
|
-
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.
|
|
4
|
+
import { r as rpc } from './rpc.CNYWPa97.js';
|
|
5
|
+
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.kEGtNVHG.js';
|
|
6
6
|
import { g as getWorkerState } from './utils.DYj33du9.js';
|
|
7
|
-
import { T as TestRunner } from './index.
|
|
7
|
+
import { T as TestRunner } from './index.D5jWOaqm.js';
|
|
8
8
|
|
|
9
9
|
function setupChaiConfig(config) {
|
|
10
10
|
Object.assign(chai.config, config);
|