vitest 4.0.0-beta.6 → 4.0.0-beta.8
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 +3 -3
- package/dist/chunks/{browser.d.Cawq_X_N.d.ts → browser.d.DOMmqJQx.d.ts} +1 -1
- package/dist/chunks/{cac.WE-urWw5.js → cac.By1HvRIk.js} +7 -7
- package/dist/chunks/{cli-api.CZz3evYC.js → cli-api.C-JHgQgp.js} +383 -210
- package/dist/chunks/{config.d.CKNVOKm0.d.ts → config.d._GBBbReY.d.ts} +1 -0
- package/dist/chunks/{coverage.BPRS6xgn.js → coverage.DarITf6U.js} +7 -7
- package/dist/chunks/{index.VNI-1z5c.js → index.AzwzFtyi.js} +14 -5
- package/dist/chunks/{index.7w0eqmYM.js → index.BuwjkI-q.js} +1 -1
- package/dist/chunks/{index.BG0gqZH-.js → index.DfviD7lX.js} +16 -8
- package/dist/chunks/{moduleRunner.d.8kKUsuDg.d.ts → moduleRunner.d.CX4DuqOx.d.ts} +1 -1
- package/dist/chunks/{plugin.d.DuiQJfUL.d.ts → plugin.d.CHe6slQs.d.ts} +1 -1
- package/dist/chunks/{reporters.d.CqR9-CDJ.d.ts → reporters.d.37tJQ2uV.d.ts} +950 -995
- package/dist/chunks/{typechecker.Cd1wvxUM.js → typechecker.DSo_maXz.js} +1 -1
- package/dist/chunks/{worker.d.Db-UVmXc.d.ts → worker.d.BKu8cnnX.d.ts} +1 -1
- package/dist/chunks/{worker.d.D9QWnzAe.d.ts → worker.d.DYlqbejz.d.ts} +1 -1
- package/dist/cli.js +3 -3
- package/dist/config.d.ts +9 -9
- package/dist/coverage.d.ts +7 -7
- package/dist/coverage.js +2 -2
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/module-evaluator.d.ts +3 -3
- package/dist/node.d.ts +24 -12
- package/dist/node.js +11 -16
- package/dist/reporters.d.ts +7 -7
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +1 -1
- package/dist/worker.js +1 -1
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +1 -1
- package/package.json +10 -11
|
@@ -23,7 +23,7 @@ import { isatty } from 'node:tty';
|
|
|
23
23
|
import EventEmitter from 'node:events';
|
|
24
24
|
import { c as createBirpc } from './index.Bgo3tNWt.js';
|
|
25
25
|
import Tinypool$1, { Tinypool } from 'tinypool';
|
|
26
|
-
import { w as wrapSerializableConfig, a as Typechecker } from './typechecker.
|
|
26
|
+
import { w as wrapSerializableConfig, a as Typechecker } from './typechecker.DSo_maXz.js';
|
|
27
27
|
import { MessageChannel } from 'node:worker_threads';
|
|
28
28
|
import { hasFailed } from '@vitest/runner/utils';
|
|
29
29
|
import { rootDir } from '../path.js';
|
|
@@ -2732,7 +2732,7 @@ function createForksPool(vitest, { execArgv, env }) {
|
|
|
2732
2732
|
vitest.onCancel(() => pool.cancelPendingTasks());
|
|
2733
2733
|
const configs = /* @__PURE__ */ new WeakMap(), getConfig = (project) => {
|
|
2734
2734
|
if (configs.has(project)) return configs.get(project);
|
|
2735
|
-
const _config = project.
|
|
2735
|
+
const _config = project.serializedConfig, config = wrapSerializableConfig(_config);
|
|
2736
2736
|
return configs.set(project, config), config;
|
|
2737
2737
|
}, singleFork = specs.filter((spec) => spec.project.config.poolOptions?.forks?.singleFork), multipleForks = specs.filter((spec) => !spec.project.config.poolOptions?.forks?.singleFork);
|
|
2738
2738
|
if (multipleForks.length) {
|
|
@@ -3301,7 +3301,7 @@ function createPool(ctx) {
|
|
|
3301
3301
|
typescript: () => createTypecheckPool(ctx)
|
|
3302
3302
|
};
|
|
3303
3303
|
for (const spec of files) {
|
|
3304
|
-
const group = spec
|
|
3304
|
+
const group = spec.project.config.sequence.groupOrder ?? 0;
|
|
3305
3305
|
groups.add(group), groupedSpecifications[group] ??= [], groupedSpecifications[group].push(spec);
|
|
3306
3306
|
}
|
|
3307
3307
|
const Sequencer = ctx.config.sequence.sequencer, sequencer = new Sequencer(ctx);
|
|
@@ -3324,7 +3324,7 @@ function createPool(ctx) {
|
|
|
3324
3324
|
typescript: []
|
|
3325
3325
|
};
|
|
3326
3326
|
specifications.forEach((specification) => {
|
|
3327
|
-
const pool = specification
|
|
3327
|
+
const pool = specification.pool;
|
|
3328
3328
|
filesByPool[pool] ??= [], filesByPool[pool].push(specification);
|
|
3329
3329
|
}), await Promise.all(Object.entries(filesByPool).map(async (entry) => {
|
|
3330
3330
|
const [pool, files] = entry;
|
|
@@ -3749,7 +3749,7 @@ class BaseCoverageProvider {
|
|
|
3749
3749
|
if (this.ctx = ctx, ctx.version !== this.version) ctx.logger.warn(c.yellow(`Loaded ${c.inverse(c.yellow(` vitest@${ctx.version} `))} and ${c.inverse(c.yellow(` @vitest/coverage-${this.name}@${this.version} `))}.
|
|
3750
3750
|
Running mixed versions is not supported and may lead into bugs
|
|
3751
3751
|
Update your dependencies and make sure the versions match.`));
|
|
3752
|
-
const config = ctx.
|
|
3752
|
+
const config = ctx._coverageOptions;
|
|
3753
3753
|
this.options = {
|
|
3754
3754
|
...coverageConfigDefaults,
|
|
3755
3755
|
...config,
|
|
@@ -3872,8 +3872,8 @@ Update your dependencies and make sure the versions match.`));
|
|
|
3872
3872
|
async reportThresholds(coverageMap, allTestsRun) {
|
|
3873
3873
|
const resolvedThresholds = this.resolveThresholds(coverageMap);
|
|
3874
3874
|
if (this.checkThresholds(resolvedThresholds), this.options.thresholds?.autoUpdate && allTestsRun) {
|
|
3875
|
-
if (!this.ctx.
|
|
3876
|
-
const configFilePath = this.ctx.
|
|
3875
|
+
if (!this.ctx.vite.config.configFile) throw new Error("Missing configurationFile. The \"coverage.thresholds.autoUpdate\" can only be enabled when configuration file is used.");
|
|
3876
|
+
const configFilePath = this.ctx.vite.config.configFile, configModule = await this.parseConfigModule(configFilePath);
|
|
3877
3877
|
await this.updateThresholds({
|
|
3878
3878
|
thresholds: resolvedThresholds,
|
|
3879
3879
|
configurationFile: configModule,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { existsSync, readFileSync, promises } from 'node:fs';
|
|
2
2
|
import { mkdir, writeFile, readdir, stat, readFile } from 'node:fs/promises';
|
|
3
3
|
import { resolve, dirname, isAbsolute, relative, basename, normalize } from 'pathe';
|
|
4
|
-
import { g as getOutputFile, h as hasFailedSnapshot, T as TypeCheckError } from './typechecker.
|
|
4
|
+
import { g as getOutputFile, h as hasFailedSnapshot, T as TypeCheckError } from './typechecker.DSo_maXz.js';
|
|
5
5
|
import { performance as performance$1 } from 'node:perf_hooks';
|
|
6
6
|
import { getTestName, getFullName, hasFailed, getTests, getSuites, getTasks } from '@vitest/runner/utils';
|
|
7
7
|
import { slash, toArray, isPrimitive, inspect, positionToOffset, lineSplitRE } from '@vitest/utils';
|
|
8
|
-
import { parseStacktrace, parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
8
|
+
import { parseStacktrace, parseErrorStacktrace, defaultStackIgnorePatterns } from '@vitest/utils/source-map';
|
|
9
9
|
import c from 'tinyrainbow';
|
|
10
10
|
import { i as isTTY } from './env.D4Lgay0q.js';
|
|
11
11
|
import { stripVTControlCharacters } from 'node:util';
|
|
@@ -1124,7 +1124,12 @@ function printError(error, ctx, logger, options) {
|
|
|
1124
1124
|
printProperties: options.verbose,
|
|
1125
1125
|
parseErrorStacktrace(error) {
|
|
1126
1126
|
// node.js stack trace already has correct source map locations
|
|
1127
|
-
return
|
|
1127
|
+
return error.stacks ? options.fullStack ? error.stacks : error.stacks.filter((stack) => {
|
|
1128
|
+
return !defaultStackIgnorePatterns.some((p) => stack.file.match(p));
|
|
1129
|
+
}) : options.task?.file.pool === "browser" && project.browser ? project.browser.parseErrorStacktrace(error, {
|
|
1130
|
+
frameFilter: project.config.onStackTrace,
|
|
1131
|
+
ignoreStackEntries: options.fullStack ? [] : void 0
|
|
1132
|
+
}) : parseErrorStacktrace(error, {
|
|
1128
1133
|
frameFilter: project.config.onStackTrace,
|
|
1129
1134
|
ignoreStackEntries: options.fullStack ? [] : void 0
|
|
1130
1135
|
});
|
|
@@ -1151,9 +1156,13 @@ function printErrorInner(error, project, options) {
|
|
|
1151
1156
|
return;
|
|
1152
1157
|
}
|
|
1153
1158
|
const stacks = options.parseErrorStacktrace(e), nearest = error instanceof TypeCheckError ? error.stacks[0] : stacks.find((stack) => {
|
|
1159
|
+
// we are checking that this module was processed by us at one point
|
|
1154
1160
|
try {
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1161
|
+
const environments = [...Object.values(project._vite?.environments || {}), ...Object.values(project.browser?.vite.environments || {})], hasResult = environments.some((environment) => {
|
|
1162
|
+
const modules = environment.moduleGraph.getModulesByFile(stack.file);
|
|
1163
|
+
return [...modules?.values() || []].some((module) => !!module.transformResult);
|
|
1164
|
+
});
|
|
1165
|
+
return hasResult && existsSync(stack.file);
|
|
1157
1166
|
} catch {
|
|
1158
1167
|
return false;
|
|
1159
1168
|
}
|
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import { getTasks, getFullName, getTests } from '@vitest/runner/utils';
|
|
3
3
|
import * as pathe from 'pathe';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
5
|
-
import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName } from './index.
|
|
5
|
+
import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName } from './index.AzwzFtyi.js';
|
|
6
6
|
import { stripVTControlCharacters } from 'node:util';
|
|
7
7
|
import { notNullish } from '@vitest/utils';
|
|
8
8
|
|
|
@@ -3,8 +3,6 @@ import { Console } from 'node:console';
|
|
|
3
3
|
// SEE https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/interfaces.js
|
|
4
4
|
const LIVING_KEYS = [
|
|
5
5
|
"DOMException",
|
|
6
|
-
"URL",
|
|
7
|
-
"URLSearchParams",
|
|
8
6
|
"EventTarget",
|
|
9
7
|
"NamedNodeMap",
|
|
10
8
|
"Node",
|
|
@@ -161,9 +159,6 @@ const LIVING_KEYS = [
|
|
|
161
159
|
"ShadowRoot",
|
|
162
160
|
"MutationObserver",
|
|
163
161
|
"MutationRecord",
|
|
164
|
-
"Headers",
|
|
165
|
-
"AbortController",
|
|
166
|
-
"AbortSignal",
|
|
167
162
|
"Uint8Array",
|
|
168
163
|
"Uint16Array",
|
|
169
164
|
"Uint32Array",
|
|
@@ -402,9 +397,6 @@ var jsdom = {
|
|
|
402
397
|
// https://nodejs.org/dist/latest/docs/api/globals.html
|
|
403
398
|
const globalNames = [
|
|
404
399
|
"structuredClone",
|
|
405
|
-
"fetch",
|
|
406
|
-
"Request",
|
|
407
|
-
"Response",
|
|
408
400
|
"BroadcastChannel",
|
|
409
401
|
"MessageChannel",
|
|
410
402
|
"MessagePort",
|
|
@@ -415,6 +407,22 @@ var jsdom = {
|
|
|
415
407
|
const value = globalThis[name];
|
|
416
408
|
if (typeof value !== "undefined" && typeof dom.window[name] === "undefined") dom.window[name] = value;
|
|
417
409
|
}
|
|
410
|
+
// since we are providing Node.js's Fetch API,
|
|
411
|
+
// we also should override other APIs they use
|
|
412
|
+
const overrideGlobals = [
|
|
413
|
+
"fetch",
|
|
414
|
+
"Request",
|
|
415
|
+
"Response",
|
|
416
|
+
"Headers",
|
|
417
|
+
"AbortController",
|
|
418
|
+
"AbortSignal",
|
|
419
|
+
"URL",
|
|
420
|
+
"URLSearchParams"
|
|
421
|
+
];
|
|
422
|
+
for (const name of overrideGlobals) {
|
|
423
|
+
const value = globalThis[name];
|
|
424
|
+
if (typeof value !== "undefined") dom.window[name] = value;
|
|
425
|
+
}
|
|
418
426
|
return {
|
|
419
427
|
getVmContext() {
|
|
420
428
|
return dom.getInternalVMContext();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import vm from 'node:vm';
|
|
2
2
|
import { ModuleEvaluator, ModuleRunnerImportMeta, ModuleRunnerContext, EvaluatedModuleNode, FetchFunction, ModuleRunner, EvaluatedModules } from 'vite/module-runner';
|
|
3
|
-
import { R as RuntimeRPC, W as WorkerGlobalState } from './worker.d.
|
|
3
|
+
import { R as RuntimeRPC, W as WorkerGlobalState } from './worker.d.DYlqbejz.js';
|
|
4
4
|
import { R as ResolveFunctionResult } from './environment.d.2fYMoz3o.js';
|
|
5
5
|
import { MockedModule, MockedModuleType } from '@vitest/mocker';
|
|
6
6
|
import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './mocker.d.BE_2ls6u.js';
|