vitest 4.0.4 → 4.0.5
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/chunks/{base.B04-CjXH.js → base.RFExFinv.js} +1 -1
- package/dist/chunks/{cac.39_DDnyx.js → cac.Be29vze6.js} +3 -3
- package/dist/chunks/{cli-api.BxbUFDR6.js → cli-api.6GYRwzrM.js} +66 -23
- package/dist/chunks/{coverage.CSfvENE1.js → coverage.DT47gDHj.js} +2 -10
- package/dist/chunks/{init-forks.D3tMfiuX.js → init-forks.WSf5dRNP.js} +1 -1
- package/dist/chunks/{init-threads.yLRZD8Id.js → init-threads.CgZguQvI.js} +1 -1
- package/dist/chunks/{init.CfeGZ8J3.js → init.CpZMjXJJ.js} +1 -1
- package/dist/chunks/{startModuleRunner.iF1E9Bt4.js → startModuleRunner.BqQUfEjB.js} +5 -3
- package/dist/chunks/{vm.CuMWYx_F.js → vm.CqZQkf-M.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/coverage.js +1 -1
- package/dist/module-runner.js +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +5 -5
- package/dist/worker.js +3 -3
- package/dist/workers/forks.js +4 -4
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +4 -4
- package/dist/workers/vmThreads.js +4 -4
- package/package.json +12 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { runInThisContext } from 'node:vm';
|
|
2
2
|
import * as spyModule from '@vitest/spy';
|
|
3
3
|
import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
|
|
4
|
-
import { s as startVitestModuleRunner, c as createNodeImportMeta } from './startModuleRunner.
|
|
4
|
+
import { s as startVitestModuleRunner, c as createNodeImportMeta } from './startModuleRunner.BqQUfEjB.js';
|
|
5
5
|
import { performance } from 'node:perf_hooks';
|
|
6
6
|
import { startTests, collectTests } from '@vitest/runner';
|
|
7
7
|
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './resolveSnapshotEnvironment.BZzLjzkh.js';
|
|
@@ -619,7 +619,7 @@ class CAC extends EventEmitter {
|
|
|
619
619
|
|
|
620
620
|
const cac = (name = "") => new CAC(name);
|
|
621
621
|
|
|
622
|
-
var version = "4.0.
|
|
622
|
+
var version = "4.0.5";
|
|
623
623
|
|
|
624
624
|
const apiConfig = (port) => ({
|
|
625
625
|
port: {
|
|
@@ -1294,7 +1294,7 @@ function normalizeCliOptions(cliFilters, argv) {
|
|
|
1294
1294
|
}
|
|
1295
1295
|
async function start(mode, cliFilters, options) {
|
|
1296
1296
|
try {
|
|
1297
|
-
const { startVitest } = await import('./cli-api.
|
|
1297
|
+
const { startVitest } = await import('./cli-api.6GYRwzrM.js').then(function (n) { return n.p; }), ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1298
1298
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
1299
1299
|
} catch (e) {
|
|
1300
1300
|
const { errorBanner } = await import('./index.CcRZ6fUh.js').then(function (n) { return n.u; });
|
|
@@ -1309,7 +1309,7 @@ async function init(project) {
|
|
|
1309
1309
|
}
|
|
1310
1310
|
async function collect(mode, cliFilters, options) {
|
|
1311
1311
|
try {
|
|
1312
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
1312
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.6GYRwzrM.js').then(function (n) { return n.p; }), ctx = await prepareVitest(mode, {
|
|
1313
1313
|
...normalizeCliOptions(cliFilters, options),
|
|
1314
1314
|
watch: false,
|
|
1315
1315
|
run: true
|
|
@@ -4,6 +4,7 @@ import { C as CoverageProviderMap } from './coverage.D_JHT54q.js';
|
|
|
4
4
|
import path, { resolve as resolve$1 } from 'node:path';
|
|
5
5
|
import { noop, createDefer, slash, isExternalUrl, unwrapId, nanoid, withTrailingSlash, cleanUrl, wrapId, toArray, deepMerge, deepClone, isPrimitive, notNullish } from '@vitest/utils/helpers';
|
|
6
6
|
import { a as any, p as prompt } from './index.Dc3xnDvT.js';
|
|
7
|
+
import { h as hash, R as RandomSequencer, i as isPackageExists, c as isBrowserEnabled, r as resolveConfig, g as getCoverageProvider, a as resolveApiServerConfig, d as resolveModule } from './coverage.DT47gDHj.js';
|
|
7
8
|
import * as vite from 'vite';
|
|
8
9
|
import { parseAst, fetchModule, version, searchForWorkspaceRoot, mergeConfig, createServer } from 'vite';
|
|
9
10
|
import { A as API_PATH, c as configFiles, d as defaultBrowserPort, a as defaultPort } from './constants.D_Q9UYh-.js';
|
|
@@ -11,7 +12,7 @@ import * as nodeos from 'node:os';
|
|
|
11
12
|
import nodeos__default, { tmpdir } from 'node:os';
|
|
12
13
|
import { generateHash as generateHash$1, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, hasFailed, generateFileHash, limitConcurrency, createFileTask as createFileTask$1, getTasks, isTestCase } from '@vitest/runner/utils';
|
|
13
14
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
14
|
-
import { v as version$1 } from './cac.
|
|
15
|
+
import { v as version$1 } from './cac.Be29vze6.js';
|
|
15
16
|
import { c as createBirpc } from './index.Bgo3tNWt.js';
|
|
16
17
|
import { p as parse, d as stringify, e as TraceMap, o as originalPositionFor, h as ancestor, i as printError, f as formatProjectName, w as withLabel, j as errorBanner, k as divider, l as Typechecker, m as generateCodeFrame, n as createDefinesScript, R as ReportersMap, B as BlobReporter, r as readBlobs, q as convertTasksToEvents, H as HangingProcessReporter } from './index.CcRZ6fUh.js';
|
|
17
18
|
import require$$0$3 from 'events';
|
|
@@ -28,14 +29,13 @@ import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
|
|
|
28
29
|
import crypto, { createHash } from 'node:crypto';
|
|
29
30
|
import { rootDir, distDir } from '../path.js';
|
|
30
31
|
import createDebug from 'debug';
|
|
31
|
-
import { h as hash, R as RandomSequencer, i as isPackageExists, c as isBrowserEnabled, r as resolveConfig, g as getCoverageProvider, a as resolveApiServerConfig } from './coverage.CSfvENE1.js';
|
|
32
32
|
import { readFile, writeFile, rename, stat, unlink, rm, mkdir, copyFile } from 'node:fs/promises';
|
|
33
|
-
import { builtinModules, createRequire, isBuiltin } from 'node:module';
|
|
34
33
|
import { VitestModuleEvaluator } from '#module-evaluator';
|
|
35
34
|
import { ModuleRunner } from 'vite/module-runner';
|
|
36
35
|
import { Console } from 'node:console';
|
|
37
36
|
import c from 'tinyrainbow';
|
|
38
37
|
import { highlight } from '@vitest/utils/highlight';
|
|
38
|
+
import { createRequire, isBuiltin, builtinModules } from 'node:module';
|
|
39
39
|
import url, { fileURLToPath, pathToFileURL } from 'node:url';
|
|
40
40
|
import { i as isTTY, a as isWindows } from './env.D4Lgay0q.js';
|
|
41
41
|
import { isatty } from 'node:tty';
|
|
@@ -5817,7 +5817,6 @@ function normalizeResolvedIdToUrl(environment, resolvedId) {
|
|
|
5817
5817
|
return url;
|
|
5818
5818
|
}
|
|
5819
5819
|
|
|
5820
|
-
const nodeBuiltins = builtinModules.filter((id) => !id.includes(":"));
|
|
5821
5820
|
class ServerModuleRunner extends ModuleRunner {
|
|
5822
5821
|
constructor(environment, fetcher, config) {
|
|
5823
5822
|
super({
|
|
@@ -5825,7 +5824,7 @@ class ServerModuleRunner extends ModuleRunner {
|
|
|
5825
5824
|
transport: { async invoke(event) {
|
|
5826
5825
|
if (event.type !== "custom") throw new Error(`Vitest Module Runner doesn't support Vite HMR events.`);
|
|
5827
5826
|
const { name, data } = event.data;
|
|
5828
|
-
if (name === "getBuiltins") return
|
|
5827
|
+
if (name === "getBuiltins") return await environment.hot.handleInvoke(event);
|
|
5829
5828
|
if (name !== "fetchModule") return { error: /* @__PURE__ */ new Error(`Unknown method: ${name}. Expected "fetchModule".`) };
|
|
5830
5829
|
try {
|
|
5831
5830
|
return { result: await fetcher(data[0], data[1], environment, false, data[2]) };
|
|
@@ -6980,7 +6979,7 @@ function createPool(ctx) {
|
|
|
6980
6979
|
}
|
|
6981
6980
|
const taskGroups = [];
|
|
6982
6981
|
let workerId = 0;
|
|
6983
|
-
const sorted = await sequencer.sort(specs), environments = await getSpecificationsEnvironments(specs), groups = groupSpecs(sorted), projectEnvs = /* @__PURE__ */ new WeakMap(), projectExecArgvs = /* @__PURE__ */ new WeakMap();
|
|
6982
|
+
const sorted = await sequencer.sort(specs), environments = await getSpecificationsEnvironments(specs), groups = groupSpecs(sorted, environments), projectEnvs = /* @__PURE__ */ new WeakMap(), projectExecArgvs = /* @__PURE__ */ new WeakMap();
|
|
6984
6983
|
for (const group of groups) {
|
|
6985
6984
|
if (!group) continue;
|
|
6986
6985
|
const taskGroup = [], browserSpecs = [];
|
|
@@ -7104,27 +7103,42 @@ function getMemoryLimit(config, pool) {
|
|
|
7104
7103
|
// just ignore "memoryLimit" value because we cannot detect memory limit
|
|
7105
7104
|
return typeof memory === "number" ? stringToBytes(limit, config.watch ? memory / 2 : memory) : typeof limit === "number" && limit > 1 || typeof limit === "string" && limit.at(-1) !== "%" ? stringToBytes(limit) : null;
|
|
7106
7105
|
}
|
|
7107
|
-
function groupSpecs(specs) {
|
|
7106
|
+
function groupSpecs(specs, environments) {
|
|
7108
7107
|
const groups = [], sequential = {
|
|
7109
7108
|
specs: [],
|
|
7110
7109
|
maxWorkers: 1
|
|
7111
|
-
}, typechecks = {};
|
|
7110
|
+
}, typechecks = {}, serializedEnvironmentOptions = /* @__PURE__ */ new Map();
|
|
7111
|
+
function getSerializedOptions(env) {
|
|
7112
|
+
const options = serializedEnvironmentOptions.get(env);
|
|
7113
|
+
if (options) return options;
|
|
7114
|
+
const serialized = JSON.stringify(env.options);
|
|
7115
|
+
return serializedEnvironmentOptions.set(env, serialized), serialized;
|
|
7116
|
+
}
|
|
7117
|
+
function isEqualEnvironments(a, b) {
|
|
7118
|
+
const aEnv = environments.get(a), bEnv = environments.get(b);
|
|
7119
|
+
return !aEnv && !bEnv ? true : !aEnv || !bEnv || aEnv.name !== bEnv.name ? false : !aEnv.options && !bEnv.options ? true : !aEnv.options || !bEnv.options ? false : getSerializedOptions(aEnv) === getSerializedOptions(bEnv);
|
|
7120
|
+
}
|
|
7112
7121
|
specs.forEach((spec) => {
|
|
7113
7122
|
if (spec.pool === "typescript") {
|
|
7114
7123
|
typechecks[spec.project.name] ||= [], typechecks[spec.project.name].push(spec);
|
|
7115
7124
|
return;
|
|
7116
7125
|
}
|
|
7117
7126
|
const order = spec.project.config.sequence.groupOrder;
|
|
7118
|
-
// Files that have disabled parallelism and default
|
|
7127
|
+
// Files that have disabled parallelism and default groupOrder are set into their own group
|
|
7119
7128
|
if (order === 0 && spec.project.config.fileParallelism === false) return sequential.specs.push([spec]);
|
|
7120
|
-
const maxWorkers = resolveMaxWorkers(spec.project);
|
|
7121
|
-
// Multiple projects with different maxWorkers but same
|
|
7129
|
+
const maxWorkers = resolveMaxWorkers(spec.project), isolate = spec.project.config.isolate;
|
|
7130
|
+
// Multiple projects with different maxWorkers but same groupOrder
|
|
7122
7131
|
if (groups[order] ||= {
|
|
7123
7132
|
specs: [],
|
|
7124
7133
|
maxWorkers
|
|
7125
7134
|
}, groups[order].maxWorkers !== maxWorkers) {
|
|
7126
7135
|
const last = groups[order].specs.at(-1)?.at(-1)?.project.name;
|
|
7127
|
-
throw new Error(`Projects "${last}" and "${spec.project.name}" have different 'maxWorkers' but same 'sequence.
|
|
7136
|
+
throw new Error(`Projects "${last}" and "${spec.project.name}" have different 'maxWorkers' but same 'sequence.groupOrder'.\nProvide unique 'sequence.groupOrder' for them.`);
|
|
7137
|
+
}
|
|
7138
|
+
// Non-isolated single worker can receive all files at once
|
|
7139
|
+
if (isolate === false && maxWorkers === 1) {
|
|
7140
|
+
const previous = groups[order].specs[0]?.[0];
|
|
7141
|
+
if (previous && previous.project.name === spec.project.name && isEqualEnvironments(spec, previous)) return groups[order].specs[0].push(spec);
|
|
7128
7142
|
}
|
|
7129
7143
|
groups[order].specs.push([spec]);
|
|
7130
7144
|
});
|
|
@@ -8058,6 +8072,15 @@ function ModuleRunnerTransform() {
|
|
|
8058
8072
|
names.add("client"), names.add("ssr");
|
|
8059
8073
|
const pool = config.test?.pool;
|
|
8060
8074
|
if (pool === "vmForks" || pool === "vmThreads") names.add("__vitest_vm__");
|
|
8075
|
+
let moduleDirectories = testConfig.deps?.moduleDirectories || [];
|
|
8076
|
+
const envModuleDirectories = process.env.VITEST_MODULE_DIRECTORIES || process.env.npm_config_VITEST_MODULE_DIRECTORIES;
|
|
8077
|
+
if (envModuleDirectories) moduleDirectories.push(...envModuleDirectories.split(","));
|
|
8078
|
+
if (moduleDirectories = moduleDirectories.map((dir) => {
|
|
8079
|
+
if (dir[0] !== "/") dir = `/${dir}`;
|
|
8080
|
+
if (!dir.endsWith("/")) dir += "/";
|
|
8081
|
+
return normalize(dir);
|
|
8082
|
+
}), !moduleDirectories.includes("/node_modules/")) moduleDirectories.push("/node_modules/");
|
|
8083
|
+
testConfig.deps ??= {}, testConfig.deps.moduleDirectories = moduleDirectories;
|
|
8061
8084
|
const external = [], noExternal = [];
|
|
8062
8085
|
let noExternalAll;
|
|
8063
8086
|
for (const name of names) {
|
|
@@ -8070,11 +8093,20 @@ function ModuleRunnerTransform() {
|
|
|
8070
8093
|
const resolveExternal = name === "client" ? config.resolve?.external : [], resolveNoExternal = name === "client" ? config.resolve?.noExternal : [], topLevelResolveOptions = {};
|
|
8071
8094
|
if (resolveExternal != null) topLevelResolveOptions.external = resolveExternal;
|
|
8072
8095
|
if (resolveNoExternal != null) topLevelResolveOptions.noExternal = resolveNoExternal;
|
|
8073
|
-
const currentResolveOptions = mergeConfig(topLevelResolveOptions, environment.resolve || {}), envNoExternal = resolveViteResolveOptions("noExternal", currentResolveOptions);
|
|
8096
|
+
const currentResolveOptions = mergeConfig(topLevelResolveOptions, environment.resolve || {}), envNoExternal = resolveViteResolveOptions("noExternal", currentResolveOptions, moduleDirectories);
|
|
8074
8097
|
if (envNoExternal === true) noExternalAll = true;
|
|
8075
|
-
else noExternal.push(...envNoExternal);
|
|
8076
|
-
|
|
8077
|
-
|
|
8098
|
+
else if (envNoExternal.length) noExternal.push(...envNoExternal);
|
|
8099
|
+
else if (name === "client" || name === "ssr") {
|
|
8100
|
+
const deprecatedNoExternal = resolveDeprecatedOptions(name === "client" ? config.resolve?.noExternal : config.ssr?.noExternal, moduleDirectories);
|
|
8101
|
+
if (deprecatedNoExternal === true) noExternalAll = true;
|
|
8102
|
+
else noExternal.push(...deprecatedNoExternal);
|
|
8103
|
+
}
|
|
8104
|
+
const envExternal = resolveViteResolveOptions("external", currentResolveOptions, moduleDirectories);
|
|
8105
|
+
if (envExternal !== true && envExternal.length) external.push(...envExternal);
|
|
8106
|
+
else if (name === "client" || name === "ssr") {
|
|
8107
|
+
const deprecatedExternal = resolveDeprecatedOptions(name === "client" ? config.resolve?.external : config.ssr?.external, moduleDirectories);
|
|
8108
|
+
if (deprecatedExternal !== true) external.push(...deprecatedExternal);
|
|
8109
|
+
}
|
|
8078
8110
|
if (environment.resolve ??= {}, environment.resolve.external = [...builtinModules, ...builtinModules.map((m) => `node:${m}`)], environment.resolve.noExternal = true, name === "__vitest_vm__" || name === "__vitest__") continue;
|
|
8079
8111
|
const currentOptimizeDeps = environment.optimizeDeps || (name === "client" ? config.optimizeDeps : name === "ssr" ? config.ssr?.optimizeDeps : void 0), optimizeDeps = resolveOptimizerConfig(testConfig.deps?.optimizer?.[name], currentOptimizeDeps);
|
|
8080
8112
|
// Vite respects the root level optimize deps, so we override it instead
|
|
@@ -8091,8 +8123,19 @@ function ModuleRunnerTransform() {
|
|
|
8091
8123
|
}
|
|
8092
8124
|
};
|
|
8093
8125
|
}
|
|
8094
|
-
function resolveViteResolveOptions(key, options) {
|
|
8095
|
-
return Array.isArray(options[key]) ? options[key] : typeof options[key] === "string" || options[key] instanceof RegExp ? [options[key]] : typeof options[key] === "boolean" ? true : [];
|
|
8126
|
+
function resolveViteResolveOptions(key, options, moduleDirectories) {
|
|
8127
|
+
return Array.isArray(options[key]) ? options[key].some((p) => p === true) ? true : options[key].map((dep) => processWildcard(dep, moduleDirectories)) : typeof options[key] === "string" || options[key] instanceof RegExp ? [options[key]].map((dep) => processWildcard(dep, moduleDirectories)) : typeof options[key] === "boolean" ? true : [];
|
|
8128
|
+
}
|
|
8129
|
+
function resolveDeprecatedOptions(options, moduleDirectories) {
|
|
8130
|
+
return options === true ? true : Array.isArray(options) ? options.map((dep) => processWildcard(dep, moduleDirectories)) : options == null ? [] : [processWildcard(options, moduleDirectories)];
|
|
8131
|
+
}
|
|
8132
|
+
function processWildcard(dep, moduleDirectories) {
|
|
8133
|
+
if (typeof dep !== "string") return dep;
|
|
8134
|
+
if (typeof dep === "string" && dep.includes("*")) {
|
|
8135
|
+
const directories = (moduleDirectories || ["/node_modules/"]).map((r) => escapeRegExp(r));
|
|
8136
|
+
return /* @__PURE__ */ new RegExp(`(${directories.join("|")})${dep.replace(/\*/g, "[\\w/]+")}`);
|
|
8137
|
+
}
|
|
8138
|
+
return dep;
|
|
8096
8139
|
}
|
|
8097
8140
|
|
|
8098
8141
|
function VitestProjectResolver(ctx) {
|
|
@@ -8324,14 +8367,14 @@ async function _shouldExternalize(id, options) {
|
|
|
8324
8367
|
// also externalize network imports since nodejs allows it when --experimental-network-imports
|
|
8325
8368
|
if (isBuiltin(id) || id.startsWith("data:") || /^(?:https?:)?\/\//.test(id)) return id;
|
|
8326
8369
|
const moduleDirectories = options?.moduleDirectories || ["/node_modules/"];
|
|
8327
|
-
if (
|
|
8370
|
+
if (matchPattern(id, moduleDirectories, options?.inline) || options?.inlineFiles && options?.inlineFiles.includes(id)) return false;
|
|
8328
8371
|
// Unless the user explicitly opted to inline them, externalize Vite deps.
|
|
8329
8372
|
// They are too big to inline by default.
|
|
8330
|
-
if (
|
|
8373
|
+
if (matchPattern(id, moduleDirectories, options?.external) || options?.cacheDir && id.includes(options.cacheDir)) return id;
|
|
8331
8374
|
const isLibraryModule = moduleDirectories.some((dir) => id.includes(dir));
|
|
8332
|
-
return id = isLibraryModule && options?.fallbackCJS ? guessCJSversion(id) || id : id,
|
|
8375
|
+
return id = isLibraryModule && options?.fallbackCJS ? guessCJSversion(id) || id : id, matchPattern(id, moduleDirectories, defaultInline) ? false : matchPattern(id, moduleDirectories, depsExternal) || isLibraryModule && await isValidNodeImport(id) ? id : false;
|
|
8333
8376
|
}
|
|
8334
|
-
function
|
|
8377
|
+
function matchPattern(id, moduleDirectories, patterns) {
|
|
8335
8378
|
if (patterns == null) return false;
|
|
8336
8379
|
if (patterns === true) return true;
|
|
8337
8380
|
for (const ex of patterns) if (typeof ex === "string") {
|
|
@@ -11164,7 +11207,7 @@ function removeUndefinedValues(obj) {
|
|
|
11164
11207
|
}
|
|
11165
11208
|
|
|
11166
11209
|
async function createVitest(mode, options, viteOverrides = {}, vitestOptions = {}) {
|
|
11167
|
-
const ctx = new Vitest(mode, deepClone(options), vitestOptions), root = slash(resolve$1(options.root || process.cwd())), configPath = options.config === false ? false : options.config ? resolve$1(root, options.config) : any(configFiles, { cwd: root });
|
|
11210
|
+
const ctx = new Vitest(mode, deepClone(options), vitestOptions), root = slash(resolve$1(options.root || process.cwd())), configPath = options.config === false ? false : options.config ? resolveModule(options.config, { paths: [root] }) ?? resolve$1(root, options.config) : any(configFiles, { cwd: root });
|
|
11168
11211
|
options.config = configPath;
|
|
11169
11212
|
const { browser: _removeBrowser,...restOptions } = options, config = {
|
|
11170
11213
|
configFile: configPath,
|
|
@@ -2539,15 +2539,7 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
2539
2539
|
if (reportsDirectory === resolved.root || reportsDirectory === process.cwd()) throw new Error(`You cannot set "coverage.reportsDirectory" as ${reportsDirectory}. Vitest needs to be able to remove this directory before test run`);
|
|
2540
2540
|
}
|
|
2541
2541
|
if (resolved.coverage.enabled && resolved.coverage.provider === "custom" && resolved.coverage.customProviderModule) resolved.coverage.customProviderModule = resolvePath(resolved.coverage.customProviderModule, resolved.root);
|
|
2542
|
-
resolved.expect ??= {}, resolved.deps ??= {}, resolved.deps.moduleDirectories ??= []
|
|
2543
|
-
const envModuleDirectories = process.env.VITEST_MODULE_DIRECTORIES || process.env.npm_config_VITEST_MODULE_DIRECTORIES;
|
|
2544
|
-
if (envModuleDirectories) resolved.deps.moduleDirectories.push(...envModuleDirectories.split(","));
|
|
2545
|
-
if (resolved.deps.moduleDirectories = resolved.deps.moduleDirectories.map((dir) => {
|
|
2546
|
-
if (dir[0] !== "/") dir = `/${dir}`;
|
|
2547
|
-
if (!dir.endsWith("/")) dir += "/";
|
|
2548
|
-
return normalize(dir);
|
|
2549
|
-
}), !resolved.deps.moduleDirectories.includes("/node_modules/")) resolved.deps.moduleDirectories.push("/node_modules/");
|
|
2550
|
-
if (resolved.deps.optimizer ??= {}, resolved.deps.optimizer.ssr ??= {}, resolved.deps.optimizer.ssr.enabled ??= false, resolved.deps.optimizer.client ??= {}, resolved.deps.optimizer.client.enabled ??= false, resolved.deps.web ??= {}, resolved.deps.web.transformAssets ??= true, resolved.deps.web.transformCss ??= true, resolved.deps.web.transformGlobPattern ??= [], resolved.setupFiles = toArray(resolved.setupFiles || []).map((file) => resolvePath(file, resolved.root)), resolved.globalSetup = toArray(resolved.globalSetup || []).map((file) => resolvePath(file, resolved.root)), resolved.coverage.exclude = [
|
|
2542
|
+
if (resolved.expect ??= {}, resolved.deps ??= {}, resolved.deps.moduleDirectories ??= [], resolved.deps.optimizer ??= {}, resolved.deps.optimizer.ssr ??= {}, resolved.deps.optimizer.ssr.enabled ??= false, resolved.deps.optimizer.client ??= {}, resolved.deps.optimizer.client.enabled ??= false, resolved.deps.web ??= {}, resolved.deps.web.transformAssets ??= true, resolved.deps.web.transformCss ??= true, resolved.deps.web.transformGlobPattern ??= [], resolved.setupFiles = toArray(resolved.setupFiles || []).map((file) => resolvePath(file, resolved.root)), resolved.globalSetup = toArray(resolved.globalSetup || []).map((file) => resolvePath(file, resolved.root)), resolved.coverage.exclude = [
|
|
2551
2543
|
...resolved.coverage.exclude,
|
|
2552
2544
|
...resolved.setupFiles.map((file) => `${resolved.coverage.allowExternal ? "**/" : ""}${relative(resolved.root, file)}`),
|
|
2553
2545
|
...resolved.include,
|
|
@@ -3113,4 +3105,4 @@ function resolveMergeConfig(mod) {
|
|
|
3113
3105
|
}
|
|
3114
3106
|
}
|
|
3115
3107
|
|
|
3116
|
-
export { BaseCoverageProvider as B, RandomSequencer as R, resolveApiServerConfig as a, BaseSequencer as b, isBrowserEnabled as c, getCoverageProvider as g, hash as h, isPackageExists as i, resolveConfig$1 as r };
|
|
3108
|
+
export { BaseCoverageProvider as B, RandomSequencer as R, resolveApiServerConfig as a, BaseSequencer as b, isBrowserEnabled as c, resolveModule as d, getCoverageProvider as g, hash as h, isPackageExists as i, resolveConfig$1 as r };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isMainThread, parentPort } from 'node:worker_threads';
|
|
2
|
-
import { i as init } from './init.
|
|
2
|
+
import { i as init } from './init.CpZMjXJJ.js';
|
|
3
3
|
|
|
4
4
|
if (isMainThread || !parentPort) throw new Error("Expected worker to be run in node:worker_threads");
|
|
5
5
|
function workerInit(options) {
|
|
@@ -5,7 +5,7 @@ import { isBuiltin } from 'node:module';
|
|
|
5
5
|
import { pathToFileURL } from 'node:url';
|
|
6
6
|
import { resolve } from 'pathe';
|
|
7
7
|
import { ModuleRunner } from 'vite/module-runner';
|
|
8
|
-
import { b as VitestTransport } from './startModuleRunner.
|
|
8
|
+
import { b as VitestTransport } from './startModuleRunner.BqQUfEjB.js';
|
|
9
9
|
import { e as environments } from './index.DON9WL-E.js';
|
|
10
10
|
import { s as setupInspect } from './inspector.DLZxSeU3.js';
|
|
11
11
|
import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
|
-
import nodeModule, {
|
|
2
|
+
import nodeModule, { isBuiltin } from 'node:module';
|
|
3
3
|
import { isBareImport } from '@vitest/utils/helpers';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import { normalize as normalize$1, join as join$1 } from 'pathe';
|
|
@@ -428,7 +428,6 @@ function fixLeadingSlashes(id) {
|
|
|
428
428
|
return id.startsWith("//") ? id.replace(multipleSlashRe, "/") : id;
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
-
const nodeBuiltins = builtinModules.filter((id) => !id.includes(":"));
|
|
432
431
|
class VitestTransport {
|
|
433
432
|
constructor(options) {
|
|
434
433
|
this.options = options;
|
|
@@ -437,7 +436,10 @@ class VitestTransport {
|
|
|
437
436
|
if (event.type !== "custom") return { error: /* @__PURE__ */ new Error(`Vitest Module Runner doesn't support Vite HMR events.`) };
|
|
438
437
|
if (event.event !== "vite:invoke") return { error: /* @__PURE__ */ new Error(`Vitest Module Runner doesn't support ${event.event} event.`) };
|
|
439
438
|
const { name, data } = event.data;
|
|
440
|
-
if (name === "getBuiltins")
|
|
439
|
+
if (name === "getBuiltins")
|
|
440
|
+
// we return an empty array here to avoid client-side builtin check,
|
|
441
|
+
// as we need builtins to go through `fetchModule`
|
|
442
|
+
return { result: [] };
|
|
441
443
|
if (name !== "fetchModule") return { error: /* @__PURE__ */ new Error(`Unknown method: ${name}. Expected "fetchModule".`) };
|
|
442
444
|
try {
|
|
443
445
|
return { result: await this.options.fetchModule(...data) };
|
|
@@ -10,7 +10,7 @@ import { findNearestPackageData } from '@vitest/utils/resolver';
|
|
|
10
10
|
import { dirname as dirname$1 } from 'node:path';
|
|
11
11
|
import { CSS_LANGS_RE, KNOWN_ASSET_RE } from '@vitest/utils/constants';
|
|
12
12
|
import { getDefaultRequestStubs } from '../module-evaluator.js';
|
|
13
|
-
import { s as startVitestModuleRunner, c as createNodeImportMeta, a as VITEST_VM_CONTEXT_SYMBOL } from './startModuleRunner.
|
|
13
|
+
import { s as startVitestModuleRunner, c as createNodeImportMeta, a as VITEST_VM_CONTEXT_SYMBOL } from './startModuleRunner.BqQUfEjB.js';
|
|
14
14
|
import { p as provideWorkerState } from './utils.CG9h5ccR.js';
|
|
15
15
|
|
|
16
16
|
function interopCommonJsModule(interopDefault, mod) {
|
package/dist/cli.js
CHANGED
package/dist/coverage.js
CHANGED
package/dist/module-runner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { VitestModuleEvaluator } from './module-evaluator.js';
|
|
2
|
-
export { a as VITEST_VM_CONTEXT_SYMBOL, V as VitestModuleRunner, s as startVitestModuleRunner } from './chunks/startModuleRunner.
|
|
2
|
+
export { a as VITEST_VM_CONTEXT_SYMBOL, V as VitestModuleRunner, s as startVitestModuleRunner } from './chunks/startModuleRunner.BqQUfEjB.js';
|
|
3
3
|
export { g as getWorkerState } from './chunks/utils.CG9h5ccR.js';
|
|
4
4
|
import 'node:module';
|
|
5
5
|
import 'node:url';
|
package/dist/node.d.ts
CHANGED
|
@@ -237,4 +237,4 @@ declare const createViteServer: typeof vite.createServer;
|
|
|
237
237
|
declare const rolldownVersion: string | undefined;
|
|
238
238
|
|
|
239
239
|
export { ApiConfig, BaseSequencer, ForksPoolWorker, GitNotFoundError, PoolOptions, PoolWorker, ResolvedConfig, TestProject, TestSequencer, TestSpecification, UserConfig as TestUserConfig, FilesNotFoundError as TestsNotFoundError, ThreadsPoolWorker, TypecheckPoolWorker, Vitest, VitestOptions, VitestPlugin, VitestRunMode, VmForksPoolWorker, VmThreadsPoolWorker, WorkerRequest, createDebugger, createMethodsRPC, createViteLogger, createViteServer, createVitest, distDir, escapeTestName, getFilePoolName, isValidApiRequest, parseCLI, registerConsoleShortcuts, resolveApiServerConfig, resolveConfig, resolveFsAllow, rolldownVersion, rootDir, startVitest, version };
|
|
240
|
-
export type { CliParseOptions, ProcessPool, CollectLineNumbers as TypeCheckCollectLineNumbers, CollectLines as TypeCheckCollectLines, Context as TypeCheckContext, TscErrorInfo as TypeCheckErrorInfo, RawErrsMap as TypeCheckRawErrorsMap, RootAndTarget as TypeCheckRootAndTarget, WorkerContext };
|
|
240
|
+
export type { CliOptions, CliParseOptions, ProcessPool, CollectLineNumbers as TypeCheckCollectLineNumbers, CollectLines as TypeCheckCollectLines, Context as TypeCheckContext, TscErrorInfo as TypeCheckErrorInfo, RawErrsMap as TypeCheckRawErrorsMap, RootAndTarget as TypeCheckRootAndTarget, WorkerContext };
|
package/dist/node.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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 } from './chunks/cli-api.
|
|
5
|
-
export { f as ForksPoolWorker, G as GitNotFoundError, F as TestsNotFoundError, T as ThreadsPoolWorker, h as TypecheckPoolWorker, b as VitestPackageInstaller, j as VmForksPoolWorker, k as VmThreadsPoolWorker, o as createDebugger, d as createMethodsRPC, n as createViteLogger, c as createVitest, e as escapeTestName, l as experimental_getRunnerTask, g as getFilePoolName, i as isValidApiRequest, m as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.
|
|
6
|
-
export { p as parseCLI } from './chunks/cac.
|
|
7
|
-
import { r as resolveConfig$2 } from './chunks/coverage.
|
|
8
|
-
export { b as BaseSequencer, a as resolveApiServerConfig } from './chunks/coverage.
|
|
4
|
+
import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.6GYRwzrM.js';
|
|
5
|
+
export { f as ForksPoolWorker, G as GitNotFoundError, F as TestsNotFoundError, T as ThreadsPoolWorker, h as TypecheckPoolWorker, b as VitestPackageInstaller, j as VmForksPoolWorker, k as VmThreadsPoolWorker, o as createDebugger, d as createMethodsRPC, n as createViteLogger, c as createVitest, e as escapeTestName, l as experimental_getRunnerTask, g as getFilePoolName, i as isValidApiRequest, m as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.6GYRwzrM.js';
|
|
6
|
+
export { p as parseCLI } from './chunks/cac.Be29vze6.js';
|
|
7
|
+
import { r as resolveConfig$2 } from './chunks/coverage.DT47gDHj.js';
|
|
8
|
+
export { b as BaseSequencer, a as resolveApiServerConfig } from './chunks/coverage.DT47gDHj.js';
|
|
9
9
|
import { slash, deepClone } from '@vitest/utils/helpers';
|
|
10
10
|
import { a as any } from './chunks/index.Dc3xnDvT.js';
|
|
11
11
|
import { resolve } from 'pathe';
|
package/dist/worker.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { r as runBaseTests } from './chunks/base.
|
|
2
|
-
export { i as init } from './chunks/init.
|
|
1
|
+
export { r as runBaseTests } from './chunks/base.RFExFinv.js';
|
|
2
|
+
export { i as init } from './chunks/init.CpZMjXJJ.js';
|
|
3
3
|
import 'node:vm';
|
|
4
4
|
import '@vitest/spy';
|
|
5
5
|
import './chunks/evaluatedModules.Dg1zASAC.js';
|
|
6
6
|
import 'pathe';
|
|
7
7
|
import 'vite/module-runner';
|
|
8
|
-
import './chunks/startModuleRunner.
|
|
8
|
+
import './chunks/startModuleRunner.BqQUfEjB.js';
|
|
9
9
|
import 'node:fs';
|
|
10
10
|
import 'node:module';
|
|
11
11
|
import '@vitest/utils/helpers';
|
package/dist/workers/forks.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { r as runBaseTests } from '../chunks/base.
|
|
2
|
-
import { w as workerInit } from '../chunks/init-forks.
|
|
1
|
+
import { r as runBaseTests } from '../chunks/base.RFExFinv.js';
|
|
2
|
+
import { w as workerInit } from '../chunks/init-forks.WSf5dRNP.js';
|
|
3
3
|
import 'node:vm';
|
|
4
4
|
import '@vitest/spy';
|
|
5
5
|
import '../chunks/evaluatedModules.Dg1zASAC.js';
|
|
6
6
|
import 'pathe';
|
|
7
7
|
import 'vite/module-runner';
|
|
8
|
-
import '../chunks/startModuleRunner.
|
|
8
|
+
import '../chunks/startModuleRunner.BqQUfEjB.js';
|
|
9
9
|
import 'node:fs';
|
|
10
10
|
import 'node:module';
|
|
11
11
|
import '@vitest/utils/helpers';
|
|
@@ -43,7 +43,7 @@ import '@vitest/utils/constants';
|
|
|
43
43
|
import '../chunks/index.RwjEGCQ0.js';
|
|
44
44
|
import 'expect-type';
|
|
45
45
|
import 'node:v8';
|
|
46
|
-
import '../chunks/init.
|
|
46
|
+
import '../chunks/init.CpZMjXJJ.js';
|
|
47
47
|
import '../chunks/index.DON9WL-E.js';
|
|
48
48
|
import 'node:console';
|
|
49
49
|
|
package/dist/workers/threads.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { r as runBaseTests } from '../chunks/base.
|
|
2
|
-
import { w as workerInit } from '../chunks/init-threads.
|
|
1
|
+
import { r as runBaseTests } from '../chunks/base.RFExFinv.js';
|
|
2
|
+
import { w as workerInit } from '../chunks/init-threads.CgZguQvI.js';
|
|
3
3
|
import 'node:vm';
|
|
4
4
|
import '@vitest/spy';
|
|
5
5
|
import '../chunks/evaluatedModules.Dg1zASAC.js';
|
|
6
6
|
import 'pathe';
|
|
7
7
|
import 'vite/module-runner';
|
|
8
|
-
import '../chunks/startModuleRunner.
|
|
8
|
+
import '../chunks/startModuleRunner.BqQUfEjB.js';
|
|
9
9
|
import 'node:fs';
|
|
10
10
|
import 'node:module';
|
|
11
11
|
import '@vitest/utils/helpers';
|
|
@@ -43,7 +43,7 @@ import '@vitest/utils/constants';
|
|
|
43
43
|
import '../chunks/index.RwjEGCQ0.js';
|
|
44
44
|
import 'expect-type';
|
|
45
45
|
import 'node:worker_threads';
|
|
46
|
-
import '../chunks/init.
|
|
46
|
+
import '../chunks/init.CpZMjXJJ.js';
|
|
47
47
|
import '../chunks/index.DON9WL-E.js';
|
|
48
48
|
import 'node:console';
|
|
49
49
|
|
package/dist/workers/vmForks.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { w as workerInit } from '../chunks/init-forks.
|
|
2
|
-
import { r as runVmTests } from '../chunks/vm.
|
|
1
|
+
import { w as workerInit } from '../chunks/init-forks.WSf5dRNP.js';
|
|
2
|
+
import { r as runVmTests } from '../chunks/vm.CqZQkf-M.js';
|
|
3
3
|
import 'node:v8';
|
|
4
|
-
import '../chunks/init.
|
|
4
|
+
import '../chunks/init.CpZMjXJJ.js';
|
|
5
5
|
import '@vitest/utils/error';
|
|
6
6
|
import '@vitest/utils/source-map';
|
|
7
7
|
import 'node:fs';
|
|
@@ -9,7 +9,7 @@ import 'node:module';
|
|
|
9
9
|
import 'node:url';
|
|
10
10
|
import 'pathe';
|
|
11
11
|
import 'vite/module-runner';
|
|
12
|
-
import '../chunks/startModuleRunner.
|
|
12
|
+
import '../chunks/startModuleRunner.BqQUfEjB.js';
|
|
13
13
|
import '@vitest/utils/helpers';
|
|
14
14
|
import '../path.js';
|
|
15
15
|
import 'node:path';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { w as workerInit } from '../chunks/init-threads.
|
|
2
|
-
import { r as runVmTests } from '../chunks/vm.
|
|
1
|
+
import { w as workerInit } from '../chunks/init-threads.CgZguQvI.js';
|
|
2
|
+
import { r as runVmTests } from '../chunks/vm.CqZQkf-M.js';
|
|
3
3
|
import 'node:worker_threads';
|
|
4
|
-
import '../chunks/init.
|
|
4
|
+
import '../chunks/init.CpZMjXJJ.js';
|
|
5
5
|
import '@vitest/utils/error';
|
|
6
6
|
import '@vitest/utils/source-map';
|
|
7
7
|
import 'node:fs';
|
|
@@ -9,7 +9,7 @@ import 'node:module';
|
|
|
9
9
|
import 'node:url';
|
|
10
10
|
import 'pathe';
|
|
11
11
|
import 'vite/module-runner';
|
|
12
|
-
import '../chunks/startModuleRunner.
|
|
12
|
+
import '../chunks/startModuleRunner.BqQUfEjB.js';
|
|
13
13
|
import '@vitest/utils/helpers';
|
|
14
14
|
import '../path.js';
|
|
15
15
|
import 'node:path';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.5",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -134,10 +134,10 @@
|
|
|
134
134
|
"@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0",
|
|
135
135
|
"happy-dom": "*",
|
|
136
136
|
"jsdom": "*",
|
|
137
|
-
"@vitest/browser-
|
|
138
|
-
"@vitest/browser-webdriverio": "4.0.
|
|
139
|
-
"@vitest/
|
|
140
|
-
"@vitest/
|
|
137
|
+
"@vitest/browser-preview": "4.0.5",
|
|
138
|
+
"@vitest/browser-webdriverio": "4.0.5",
|
|
139
|
+
"@vitest/browser-playwright": "4.0.5",
|
|
140
|
+
"@vitest/ui": "4.0.5"
|
|
141
141
|
},
|
|
142
142
|
"peerDependenciesMeta": {
|
|
143
143
|
"@edge-runtime/vm": {
|
|
@@ -182,13 +182,13 @@
|
|
|
182
182
|
"tinyrainbow": "^3.0.3",
|
|
183
183
|
"vite": "^6.0.0 || ^7.0.0",
|
|
184
184
|
"why-is-node-running": "^2.3.0",
|
|
185
|
-
"@vitest/
|
|
186
|
-
"@vitest/
|
|
187
|
-
"@vitest/
|
|
188
|
-
"@vitest/
|
|
189
|
-
"@vitest/snapshot": "4.0.
|
|
190
|
-
"@vitest/
|
|
191
|
-
"@vitest/
|
|
185
|
+
"@vitest/expect": "4.0.5",
|
|
186
|
+
"@vitest/runner": "4.0.5",
|
|
187
|
+
"@vitest/spy": "4.0.5",
|
|
188
|
+
"@vitest/utils": "4.0.5",
|
|
189
|
+
"@vitest/snapshot": "4.0.5",
|
|
190
|
+
"@vitest/mocker": "4.0.5",
|
|
191
|
+
"@vitest/pretty-format": "4.0.5"
|
|
192
192
|
},
|
|
193
193
|
"devDependencies": {
|
|
194
194
|
"@antfu/install-pkg": "^1.1.0",
|