vitest 4.1.3 → 4.1.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/browser.d.ts +2 -2
- package/dist/browser.js +1 -1
- package/dist/chunks/{base.C3wvLFNM.js → base.RR7zL1h0.js} +4 -4
- package/dist/chunks/{browser.d.C0zGu1u9.d.ts → browser.d.BcoexmFG.d.ts} +2 -2
- package/dist/chunks/{cac.Bb7YBzMA.js → cac.DJJmV0dT.js} +6 -6
- package/dist/chunks/{cli-api.CaPRsymo.js → cli-api.Cjt90eJu.js} +28 -15
- package/dist/chunks/{config.d.ChUh6-ad.d.ts → config.d.A1h_Y6Jt.d.ts} +6 -1
- package/dist/chunks/{coverage.CwUlQe0s.js → coverage.DM_a_rWm.js} +25 -4
- package/dist/chunks/{global.d.D74z04P1.d.ts → global.d.DVsSRdQ5.d.ts} +1 -1
- package/dist/chunks/{globals.7B-4LHAF.js → globals.Dj1TGiMC.js} +2 -2
- package/dist/chunks/{index.Cj9kDiDi.js → index.DXx9Dtk7.js} +2 -2
- package/dist/chunks/{index.4L3g53iW.js → index.DdgEv5B1.js} +1 -1
- package/dist/chunks/{index.DICur-LY.js → index.UpGiHP7g.js} +36 -27
- package/dist/chunks/{plugin.d.BssAumYw.d.ts → plugin.d.BM2TCi12.d.ts} +1 -1
- package/dist/chunks/{reporters.d.yJ2fBir5.d.ts → reporters.d.CEnv6XRv.d.ts} +79 -20
- package/dist/chunks/{rpc.d.BFMWpdph.d.ts → rpc.d.B_8sPU0w.d.ts} +2 -44
- package/dist/chunks/{setup-common.NdrZGMhw.js → setup-common.DYx3LtFI.js} +1 -1
- package/dist/chunks/{test.BmQO5GaM.js → test.DNmyFkvJ.js} +107 -20
- package/dist/chunks/traces.d.D2T_R8rx.d.ts +60 -0
- package/dist/chunks/{utils.DK8FXp4T.js → utils.BS4fH3nR.js} +1 -1
- package/dist/chunks/{worker.d.CckNUvI5.d.ts → worker.d.ZpHpO4yb.d.ts} +2 -2
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +10 -10
- package/dist/coverage.d.ts +8 -7
- package/dist/coverage.js +2 -1
- package/dist/index.d.ts +36 -14
- package/dist/index.js +2 -2
- package/dist/module-evaluator.d.ts +2 -2
- package/dist/node.d.ts +10 -10
- package/dist/node.js +7 -7
- package/dist/reporters.d.ts +8 -8
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +2 -2
- package/dist/runners.js +1 -1
- package/dist/worker.d.ts +4 -4
- package/dist/worker.js +5 -5
- package/dist/workers/forks.js +5 -5
- package/dist/workers/runVmTests.js +4 -4
- package/dist/workers/threads.js +5 -5
- package/package.json +14 -14
- package/dist/chunks/traces.d.402V_yFI.d.ts +0 -18
package/dist/browser.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.d.
|
|
1
|
+
import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.d.A1h_Y6Jt.js';
|
|
2
2
|
import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.BZtK59WP.js';
|
|
3
3
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
4
|
-
export { O as OTELCarrier, T as Traces } from './chunks/traces.d.
|
|
4
|
+
export { O as OTELCarrier, T as Traces } from './chunks/traces.d.D2T_R8rx.js';
|
|
5
5
|
export { collectTests, startTests } from '@vitest/runner';
|
|
6
6
|
import * as _vitest_spy from '@vitest/spy';
|
|
7
7
|
export { _vitest_spy as SpyModule };
|
package/dist/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.
|
|
1
|
+
export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.DYx3LtFI.js';
|
|
2
2
|
export { T as Traces } from './chunks/traces.DT5aQ62U.js';
|
|
3
3
|
export { collectTests, startTests } from '@vitest/runner';
|
|
4
4
|
import * as spyModule from '@vitest/spy';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { runInThisContext } from 'node:vm';
|
|
2
2
|
import * as spyModule from '@vitest/spy';
|
|
3
|
-
import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.
|
|
3
|
+
import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.DXx9Dtk7.js';
|
|
4
4
|
import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.D98-gwRW.js';
|
|
5
5
|
import { N as NativeModuleRunner } from './nativeModuleRunner.BIakptoF.js';
|
|
6
6
|
import { T as Traces } from './traces.DT5aQ62U.js';
|
|
@@ -8,15 +8,15 @@ import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
|
|
|
8
8
|
import { s as startVitestModuleRunner, c as createNodeImportMeta } from './startVitestModuleRunner.bRl2_oI_.js';
|
|
9
9
|
import { performance as performance$1 } from 'node:perf_hooks';
|
|
10
10
|
import { startTests, collectTests } from '@vitest/runner';
|
|
11
|
-
import { s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker } from './setup-common.
|
|
12
|
-
import { g as globalExpect, v as vi } from './test.
|
|
11
|
+
import { s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker } from './setup-common.DYx3LtFI.js';
|
|
12
|
+
import { g as globalExpect, v as vi } from './test.DNmyFkvJ.js';
|
|
13
13
|
import { c as closeInspector } from './inspector.CvyFGlXm.js';
|
|
14
14
|
import { createRequire } from 'node:module';
|
|
15
15
|
import timers from 'node:timers';
|
|
16
16
|
import timersPromises from 'node:timers/promises';
|
|
17
17
|
import util from 'node:util';
|
|
18
18
|
import { KNOWN_ASSET_TYPES } from '@vitest/utils/constants';
|
|
19
|
-
import { i as index } from './index.
|
|
19
|
+
import { i as index } from './index.DdgEv5B1.js';
|
|
20
20
|
import { g as getWorkerState, r as resetModules, p as provideWorkerState, a as getSafeWorkerState } from './utils.BX5Fg8C4.js';
|
|
21
21
|
|
|
22
22
|
// this should only be used in Node
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FileSpecification } from '@vitest/runner';
|
|
2
|
-
import { O as OTELCarrier } from './traces.d.
|
|
3
|
-
import { T as TestExecutionMethod } from './worker.d.
|
|
2
|
+
import { O as OTELCarrier } from './traces.d.D2T_R8rx.js';
|
|
3
|
+
import { T as TestExecutionMethod } from './worker.d.ZpHpO4yb.js';
|
|
4
4
|
|
|
5
5
|
type SerializedTestSpecification = [project: {
|
|
6
6
|
name: string | undefined;
|
|
@@ -621,7 +621,7 @@ class CAC extends EventEmitter {
|
|
|
621
621
|
|
|
622
622
|
const cac = (name = "") => new CAC(name);
|
|
623
623
|
|
|
624
|
-
var version = "4.1.
|
|
624
|
+
var version = "4.1.5";
|
|
625
625
|
|
|
626
626
|
const apiConfig = (port) => ({
|
|
627
627
|
port: {
|
|
@@ -701,7 +701,7 @@ const cliOptionsConfig = {
|
|
|
701
701
|
hideSkippedTests: { description: "Hide logs for skipped tests" },
|
|
702
702
|
reporters: {
|
|
703
703
|
alias: "reporter",
|
|
704
|
-
description: `Specify reporters (default, agent, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)`,
|
|
704
|
+
description: `Specify reporters (default, agent, minimal, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)`,
|
|
705
705
|
argument: "<name>",
|
|
706
706
|
subcommands: null,
|
|
707
707
|
array: true
|
|
@@ -2336,11 +2336,11 @@ function normalizeCliOptions(cliFilters, argv) {
|
|
|
2336
2336
|
}
|
|
2337
2337
|
async function start(mode, cliFilters, options) {
|
|
2338
2338
|
try {
|
|
2339
|
-
const { startVitest } = await import('./cli-api.
|
|
2339
|
+
const { startVitest } = await import('./cli-api.Cjt90eJu.js').then(function (n) { return n.q; });
|
|
2340
2340
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
2341
2341
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
2342
2342
|
} catch (e) {
|
|
2343
|
-
const { errorBanner } = await import('./utils.
|
|
2343
|
+
const { errorBanner } = await import('./utils.BS4fH3nR.js').then(function (n) { return n.u; });
|
|
2344
2344
|
console.error(`\n${errorBanner("Startup Error")}`);
|
|
2345
2345
|
console.error(e);
|
|
2346
2346
|
console.error("\n\n");
|
|
@@ -2358,7 +2358,7 @@ async function init(project) {
|
|
|
2358
2358
|
}
|
|
2359
2359
|
async function collect(mode, cliFilters, options) {
|
|
2360
2360
|
try {
|
|
2361
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
2361
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.Cjt90eJu.js').then(function (n) { return n.q; });
|
|
2362
2362
|
const ctx = await prepareVitest(mode, {
|
|
2363
2363
|
...normalizeCliOptions(cliFilters, options),
|
|
2364
2364
|
watch: false,
|
|
@@ -2380,7 +2380,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
2380
2380
|
} else outputFileList(await ctx.getRelevantTestSpecifications(cliFilters.map(normalize)), options);
|
|
2381
2381
|
await ctx.close();
|
|
2382
2382
|
} catch (e) {
|
|
2383
|
-
const { errorBanner } = await import('./utils.
|
|
2383
|
+
const { errorBanner } = await import('./utils.BS4fH3nR.js').then(function (n) { return n.u; });
|
|
2384
2384
|
console.error(`\n${errorBanner("Collect Error")}`);
|
|
2385
2385
|
console.error(e);
|
|
2386
2386
|
console.error("\n\n");
|
|
@@ -13,20 +13,20 @@ import nodeos__default, { tmpdir } from 'node:os';
|
|
|
13
13
|
import { generateHash as generateHash$1, createTaskName, validateTags, calculateSuiteHash, hasFailed, generateFileHash, limitConcurrency, createFileTask as createFileTask$1, createTagsFilter, someTasksAreOnly, interpretTaskModes, getTasks, isTestCase } from '@vitest/runner/utils';
|
|
14
14
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
15
15
|
import { serializeValue } from '@vitest/utils/serialize';
|
|
16
|
-
import { v as version$1 } from './cac.
|
|
16
|
+
import { v as version$1 } from './cac.DJJmV0dT.js';
|
|
17
17
|
import { rootDir, distDir } from '../path.js';
|
|
18
|
-
import { f as createIndexLocationsMap, g as TraceMap, o as originalPositionFor, h as ancestor, s as stringify, p as parse, i as printError, j as Typechecker, k as generateCodeFrame, l as escapeRegExp, m as createDefinesScript, a as BenchmarkReportsMap, R as ReportersMap, n as groupBy, q as BlobReporter, r as readBlobs, t as convertTasksToEvents, H as HangingProcessReporter, w as wildcardPatternToRegExp, u as stdout } from './index.
|
|
18
|
+
import { f as createIndexLocationsMap, g as TraceMap, o as originalPositionFor, h as ancestor, s as stringify, p as parse, i as printError, j as Typechecker, k as generateCodeFrame, l as escapeRegExp, m as createDefinesScript, a as BenchmarkReportsMap, R as ReportersMap, n as groupBy, q as BlobReporter, r as readBlobs, t as convertTasksToEvents, H as HangingProcessReporter, w as wildcardPatternToRegExp, u as stdout } from './index.UpGiHP7g.js';
|
|
19
19
|
import { N as NativeModuleRunner } from './nativeModuleRunner.BIakptoF.js';
|
|
20
20
|
import { T as Traces } from './traces.DT5aQ62U.js';
|
|
21
21
|
import { createDebug } from 'obug';
|
|
22
|
-
import { h as hash, R as RandomSequencer, i as isBrowserEnabled, r as resolveConfig, g as getCoverageProvider, b as resolveApiServerConfig } from './coverage.
|
|
22
|
+
import { h as hash, R as RandomSequencer, i as isBrowserEnabled, r as resolveConfig, g as getCoverageProvider, b as resolveApiServerConfig } from './coverage.DM_a_rWm.js';
|
|
23
23
|
import { rm, readFile, writeFile, rename, stat, unlink, mkdir, copyFile } from 'node:fs/promises';
|
|
24
24
|
import c from 'tinyrainbow';
|
|
25
25
|
import { VitestModuleEvaluator } from '#module-evaluator';
|
|
26
26
|
import { ModuleRunner } from 'vite/module-runner';
|
|
27
27
|
import { Console } from 'node:console';
|
|
28
28
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers.D26ty3Ew.js';
|
|
29
|
-
import { g as formatProjectName, w as withLabel, e as errorBanner, d as divider } from './utils.
|
|
29
|
+
import { g as formatProjectName, w as withLabel, e as errorBanner, d as divider } from './utils.BS4fH3nR.js';
|
|
30
30
|
import { createRequire, builtinModules, isBuiltin as isBuiltin$1 } from 'node:module';
|
|
31
31
|
import url, { fileURLToPath, pathToFileURL } from 'node:url';
|
|
32
32
|
import { i as isTTY, a as isWindows } from './env.D4Lgay0q.js';
|
|
@@ -137,7 +137,7 @@ function astParseFile(filepath, code) {
|
|
|
137
137
|
if (callee.type === "TaggedTemplateExpression") return getName(callee.tag);
|
|
138
138
|
if (callee.type === "MemberExpression") {
|
|
139
139
|
if (callee.object?.type === "Identifier" && isVitestFunctionName(callee.object.name)) return callee.object?.name;
|
|
140
|
-
if (callee.object?.name?.startsWith("__vite_ssr_") || callee.object?.object?.name?.startsWith("__vite_ssr_") && callee.object?.property?.name === "Vitest") return getName(callee.property);
|
|
140
|
+
if (callee.object?.name?.startsWith("__vite_ssr_") || callee.object?.name?.startsWith("__vi_import_") || callee.object?.object?.name?.startsWith("__vite_ssr_") && callee.object?.property?.name === "Vitest") return getName(callee.property);
|
|
141
141
|
// call as `__vite_ssr__.test.skip()` or `describe.concurrent.each()`
|
|
142
142
|
return getName(callee.object);
|
|
143
143
|
}
|
|
@@ -2320,7 +2320,7 @@ class VitestPackageInstaller {
|
|
|
2320
2320
|
} catch {}
|
|
2321
2321
|
}
|
|
2322
2322
|
if (/* @__PURE__ */ isPackageExists(dependency, { paths: [root, __dirname$1] })) return true;
|
|
2323
|
-
process.stderr.write(
|
|
2323
|
+
process.stderr.write(withLabel("red", "MISSING DEPENDENCY", `Cannot find dependency '${dependency}'\n\n`));
|
|
2324
2324
|
if (!isTTY) return false;
|
|
2325
2325
|
const { install } = await (await import('./index.og1WyBLx.js').then(function (n) { return n.i; })).default({
|
|
2326
2326
|
type: "confirm",
|
|
@@ -8971,7 +8971,7 @@ function setup(ctx, _server) {
|
|
|
8971
8971
|
await ctx.rerunTask(id);
|
|
8972
8972
|
},
|
|
8973
8973
|
getConfig() {
|
|
8974
|
-
return ctx.
|
|
8974
|
+
return ctx.serializedRootConfig;
|
|
8975
8975
|
},
|
|
8976
8976
|
getResolvedProjectLabels() {
|
|
8977
8977
|
return ctx.projects.map((p) => ({
|
|
@@ -9170,6 +9170,7 @@ function serializeConfig(project) {
|
|
|
9170
9170
|
disableConsoleIntercept: config.disableConsoleIntercept,
|
|
9171
9171
|
root: config.root,
|
|
9172
9172
|
name: config.name,
|
|
9173
|
+
color: config.color,
|
|
9173
9174
|
globals: config.globals,
|
|
9174
9175
|
snapshotEnvironment: config.snapshotEnvironment,
|
|
9175
9176
|
passWithNoTests: config.passWithNoTests,
|
|
@@ -11173,13 +11174,14 @@ async function resolveBrowserProjects(vitest, names, resolvedProjects) {
|
|
|
11173
11174
|
const removeProjects = /* @__PURE__ */ new Set();
|
|
11174
11175
|
resolvedProjects.forEach((project) => {
|
|
11175
11176
|
if (!project.config.browser.enabled) return;
|
|
11177
|
+
const originalName = project.config.name;
|
|
11176
11178
|
const instances = project.config.browser.instances || [];
|
|
11177
|
-
if (instances.length === 0) {
|
|
11179
|
+
if (instances.length === 0 || vitest.isExcludedByProjectFilter(originalName)) {
|
|
11178
11180
|
removeProjects.add(project);
|
|
11179
11181
|
return;
|
|
11180
11182
|
}
|
|
11181
|
-
|
|
11182
|
-
//
|
|
11183
|
+
// if original name matches a positive filter, keep all instances
|
|
11184
|
+
// otherwise, filter instances individually (user may target a specific instance name)
|
|
11183
11185
|
const filteredInstances = vitest.matchesProjectFilter(originalName) ? instances : instances.filter((instance) => {
|
|
11184
11186
|
const newName = instance.name;
|
|
11185
11187
|
return vitest.matchesProjectFilter(newName);
|
|
@@ -13248,6 +13250,12 @@ class Vitest {
|
|
|
13248
13250
|
if (!this.coreWorkspaceProject) throw new Error(`Root project is not initialized. This means that the Vite server was not established yet and the the workspace config is not resolved.`);
|
|
13249
13251
|
return this.coreWorkspaceProject;
|
|
13250
13252
|
}
|
|
13253
|
+
get serializedRootConfig() {
|
|
13254
|
+
return {
|
|
13255
|
+
...this.getRootProject().serializedConfig,
|
|
13256
|
+
projects: this.projects.map((project) => project.serializedConfig)
|
|
13257
|
+
};
|
|
13258
|
+
}
|
|
13251
13259
|
getProjectByName(name) {
|
|
13252
13260
|
const project = this.projects.find((p) => p.name === name) || this.coreWorkspaceProject || this.projects[0];
|
|
13253
13261
|
if (!project) throw new Error(`Project "${name}" was not found.`);
|
|
@@ -14025,6 +14033,15 @@ class Vitest {
|
|
|
14025
14033
|
return wildcardPatternToRegExp(project).test(name);
|
|
14026
14034
|
});
|
|
14027
14035
|
}
|
|
14036
|
+
/** @internal */
|
|
14037
|
+
isExcludedByProjectFilter(name) {
|
|
14038
|
+
const projects = this._config?.project || this._cliOptions?.project;
|
|
14039
|
+
if (!projects || !projects.length) return false;
|
|
14040
|
+
return toArray(projects).some((project) => {
|
|
14041
|
+
if (!project.startsWith("!")) return false;
|
|
14042
|
+
return wildcardPatternToRegExp(project.slice(1)).test(name);
|
|
14043
|
+
});
|
|
14044
|
+
}
|
|
14028
14045
|
}
|
|
14029
14046
|
function assert(condition, property, name = property) {
|
|
14030
14047
|
if (!condition) throw new Error(`The ${name} was not set. It means that \`vitest.${property}\` was called before the Vite server was established. Await the Vitest promise before accessing \`vitest.${property}\`.`);
|
|
@@ -14051,7 +14068,7 @@ async function VitestPlugin(options = {}, vitest = new Vitest("test", deepClone(
|
|
|
14051
14068
|
// preliminary merge of options to be able to create server options for vite
|
|
14052
14069
|
// however to allow vitest plugins to modify vitest config values
|
|
14053
14070
|
// this is repeated in configResolved where the config is final
|
|
14054
|
-
const testConfig = deepMerge({}, configDefaults,
|
|
14071
|
+
const testConfig = deepMerge({}, configDefaults, viteConfig.test ?? {}, options);
|
|
14055
14072
|
testConfig.api = resolveApiServerConfig(testConfig, defaultPort);
|
|
14056
14073
|
// store defines for globalThis to make them
|
|
14057
14074
|
// reassignable when running in worker in src/runtime/setup.ts
|
|
@@ -14171,10 +14188,6 @@ async function VitestPlugin(options = {}, vitest = new Vitest("test", deepClone(
|
|
|
14171
14188
|
ModuleRunnerTransform()
|
|
14172
14189
|
].filter(notNullish);
|
|
14173
14190
|
}
|
|
14174
|
-
function removeUndefinedValues(obj) {
|
|
14175
|
-
for (const key in Object.keys(obj)) if (obj[key] === void 0) delete obj[key];
|
|
14176
|
-
return obj;
|
|
14177
|
-
}
|
|
14178
14191
|
|
|
14179
14192
|
async function createVitest(mode, options, viteOverrides = {}, vitestOptions = {}) {
|
|
14180
14193
|
const ctx = new Vitest(mode, deepClone(options), vitestOptions);
|
|
@@ -2,6 +2,7 @@ import { PrettyFormatOptions } from '@vitest/pretty-format';
|
|
|
2
2
|
import { SequenceHooks, SequenceSetupFiles, SerializableRetry, TestTagDefinition } from '@vitest/runner';
|
|
3
3
|
import { SnapshotUpdateState, SnapshotEnvironment } from '@vitest/snapshot';
|
|
4
4
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
5
|
+
import { L as LabelColor } from './traces.d.D2T_R8rx.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Names of clock methods that may be faked by install.
|
|
@@ -69,6 +70,7 @@ interface FakeTimerInstallOpts {
|
|
|
69
70
|
*/
|
|
70
71
|
interface SerializedConfig {
|
|
71
72
|
name: string | undefined;
|
|
73
|
+
color?: LabelColor;
|
|
72
74
|
globals: boolean;
|
|
73
75
|
base: string | undefined;
|
|
74
76
|
snapshotEnvironment?: string;
|
|
@@ -216,6 +218,9 @@ interface SerializedCoverageConfig {
|
|
|
216
218
|
enabled: boolean;
|
|
217
219
|
customProviderModule: string | undefined;
|
|
218
220
|
}
|
|
221
|
+
interface SerializedRootConfig extends SerializedConfig {
|
|
222
|
+
projects: SerializedConfig[];
|
|
223
|
+
}
|
|
219
224
|
type RuntimeConfig = Pick<SerializedConfig, "allowOnly" | "testTimeout" | "hookTimeout" | "clearMocks" | "mockReset" | "restoreMocks" | "fakeTimers" | "maxConcurrency" | "expect" | "printConsoleTrace"> & {
|
|
220
225
|
sequence?: {
|
|
221
226
|
hooks?: SequenceHooks;
|
|
@@ -224,4 +229,4 @@ type RuntimeConfig = Pick<SerializedConfig, "allowOnly" | "testTimeout" | "hookT
|
|
|
224
229
|
type RuntimeOptions = Partial<RuntimeConfig>;
|
|
225
230
|
type BrowserTraceViewMode = "on" | "off" | "on-first-retry" | "on-all-retries" | "retain-on-failure";
|
|
226
231
|
|
|
227
|
-
export type { BrowserTraceViewMode as B, FakeTimerInstallOpts as F, RuntimeOptions as R, SerializedConfig as S, SerializedCoverageConfig as a,
|
|
232
|
+
export type { BrowserTraceViewMode as B, FakeTimerInstallOpts as F, RuntimeOptions as R, SerializedConfig as S, SerializedCoverageConfig as a, SerializedRootConfig as b, RuntimeConfig as c };
|
|
@@ -14,7 +14,8 @@ import { mergeConfig } from 'vite';
|
|
|
14
14
|
import { c as configFiles, d as defaultBrowserPort, a as defaultInspectPort, b as defaultPort } from './constants.CPYnjOGj.js';
|
|
15
15
|
import './env.D4Lgay0q.js';
|
|
16
16
|
import nodeos__default from 'node:os';
|
|
17
|
-
import {
|
|
17
|
+
import { w as withLabel } from './utils.BS4fH3nR.js';
|
|
18
|
+
import { isAgent, isCI, provider } from 'std-env';
|
|
18
19
|
import { r as resolveCoverageProviderModule } from './coverage.CTzCuANN.js';
|
|
19
20
|
|
|
20
21
|
const hash = crypto.hash ?? ((algorithm, data, outputEncoding) => crypto.createHash(algorithm).update(data).digest(outputEncoding));
|
|
@@ -155,7 +156,7 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
155
156
|
const mode = vitest.mode;
|
|
156
157
|
const logger = vitest.logger;
|
|
157
158
|
if (options.dom) {
|
|
158
|
-
if (viteConfig.test?.environment != null && viteConfig.test.environment !== "happy-dom") logger.console.warn(
|
|
159
|
+
if (viteConfig.test?.environment != null && viteConfig.test.environment !== "happy-dom") logger.console.warn(withLabel("yellow", "Vitest", `Your config.test.environment ("${viteConfig.test.environment}") conflicts with --dom flag ("happy-dom"), ignoring "${viteConfig.test.environment}"`));
|
|
159
160
|
options.environment = "happy-dom";
|
|
160
161
|
}
|
|
161
162
|
const resolved = {
|
|
@@ -296,6 +297,18 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
296
297
|
}
|
|
297
298
|
}
|
|
298
299
|
resolved.coverage.reporter = resolveCoverageReporters(resolved.coverage.reporter);
|
|
300
|
+
if (isAgent) {
|
|
301
|
+
// default to `skipFull` and add `text-summary` reporter when `text` reporter is used on agents
|
|
302
|
+
const text = resolved.coverage.reporter.find(([name]) => name === "text");
|
|
303
|
+
const textSummary = resolved.coverage.reporter.find(([name]) => name === "text-summary");
|
|
304
|
+
if (text) {
|
|
305
|
+
text[1] = {
|
|
306
|
+
skipFull: true,
|
|
307
|
+
...text[1]
|
|
308
|
+
};
|
|
309
|
+
if (!textSummary) resolved.coverage.reporter.push(["text-summary", {}]);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
299
312
|
if (resolved.coverage.changed === void 0 && resolved.changed !== void 0) resolved.coverage.changed = resolved.changed;
|
|
300
313
|
if (resolved.coverage.enabled && resolved.coverage.reportsDirectory) {
|
|
301
314
|
const reportsDirectory = resolve(resolved.root, resolved.coverage.reportsDirectory);
|
|
@@ -712,6 +725,10 @@ Update your dependencies and make sure the versions match.`));
|
|
|
712
725
|
this.coverageFiles = /* @__PURE__ */ new Map();
|
|
713
726
|
this.pendingPromises = [];
|
|
714
727
|
}
|
|
728
|
+
normalizeCoverageFileError(error) {
|
|
729
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT" && !existsSync(this.coverageFilesDirectory)) return new Error(`Something removed the coverage directory "${this.coverageFilesDirectory}" Vitest created earlier. Make sure you are not running multiple Vitests with the same "coverage.reportsDirectory" at the same time.`, { cause: error });
|
|
730
|
+
return error;
|
|
731
|
+
}
|
|
715
732
|
onAfterSuiteRun({ coverage, environment, projectName, testFiles }) {
|
|
716
733
|
if (!coverage) return;
|
|
717
734
|
let entry = this.coverageFiles.get(projectName || DEFAULT_PROJECT);
|
|
@@ -724,7 +741,9 @@ Update your dependencies and make sure the versions match.`));
|
|
|
724
741
|
entry[environment] ??= {};
|
|
725
742
|
// If there's a result from previous run, overwrite it
|
|
726
743
|
entry[environment][testFilenames] = filename;
|
|
727
|
-
const promise = promises.writeFile(filename, JSON.stringify(coverage), "utf-8")
|
|
744
|
+
const promise = promises.writeFile(filename, JSON.stringify(coverage), "utf-8").catch((error) => {
|
|
745
|
+
throw this.normalizeCoverageFileError(error);
|
|
746
|
+
});
|
|
728
747
|
this.pendingPromises.push(promise);
|
|
729
748
|
}
|
|
730
749
|
async readCoverageFiles({ onFileRead, onFinished, onDebug }) {
|
|
@@ -741,7 +760,9 @@ Update your dependencies and make sure the versions match.`));
|
|
|
741
760
|
onDebug(`Reading coverage results ${index}/${total}`);
|
|
742
761
|
}
|
|
743
762
|
await Promise.all(chunk.map(async (filename) => {
|
|
744
|
-
const contents = await promises.readFile(filename, "utf-8")
|
|
763
|
+
const contents = await promises.readFile(filename, "utf-8").catch((error) => {
|
|
764
|
+
throw this.normalizeCoverageFileError(error);
|
|
765
|
+
});
|
|
745
766
|
onFileRead(JSON.parse(contents));
|
|
746
767
|
}));
|
|
747
768
|
}
|
|
@@ -3,7 +3,7 @@ import { Plugin } from '@vitest/pretty-format';
|
|
|
3
3
|
import { Test } from '@vitest/runner';
|
|
4
4
|
import { SnapshotState } from '@vitest/snapshot';
|
|
5
5
|
import { B as BenchmarkResult } from './benchmark.d.DAaHLpsq.js';
|
|
6
|
-
import { U as UserConsoleLog } from './
|
|
6
|
+
import { U as UserConsoleLog } from './traces.d.D2T_R8rx.js';
|
|
7
7
|
|
|
8
8
|
interface SnapshotMatcher<T> {
|
|
9
9
|
<U extends { [P in keyof T] : any }>(snapshot: Partial<U>, hint?: string): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as globalApis } from './constants.CPYnjOGj.js';
|
|
2
|
-
import { i as index } from './index.
|
|
3
|
-
import './test.
|
|
2
|
+
import { i as index } from './index.DdgEv5B1.js';
|
|
3
|
+
import './test.DNmyFkvJ.js';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import '@vitest/utils/helpers';
|
|
6
6
|
import '@vitest/utils/timers';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { chai } from '@vitest/expect';
|
|
2
2
|
import { createHook } from 'node:async_hooks';
|
|
3
|
-
import { l as loadDiffConfig, a as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.
|
|
3
|
+
import { l as loadDiffConfig, a as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.DYx3LtFI.js';
|
|
4
4
|
import { r as rpc } from './rpc.MzXet3jl.js';
|
|
5
5
|
import { g as getWorkerState } from './utils.BX5Fg8C4.js';
|
|
6
|
-
import { T as TestRunner, N as NodeBenchmarkRunner } from './test.
|
|
6
|
+
import { T as TestRunner, N as NodeBenchmarkRunner } from './test.DNmyFkvJ.js';
|
|
7
7
|
|
|
8
8
|
function setupChaiConfig(config) {
|
|
9
9
|
Object.assign(chai.config, config);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as vi, N as NodeBenchmarkRunner, S as Snapshots, T as TestRunner, a as assert, c as createExpect, g as globalExpect, i as inject, s as should, b as vitest } from './test.
|
|
1
|
+
import { v as vi, N as NodeBenchmarkRunner, S as Snapshots, T as TestRunner, a as assert, c as createExpect, g as globalExpect, i as inject, s as should, b as vitest } from './test.DNmyFkvJ.js';
|
|
2
2
|
import { b as bench } from './benchmark.CX_oY03V.js';
|
|
3
3
|
import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
|
|
4
4
|
import { expectTypeOf } from 'expect-type';
|
|
@@ -3,9 +3,10 @@ import { getTests, generateHash, createTaskName, calculateSuiteHash, someTasksAr
|
|
|
3
3
|
import * as pathe from 'pathe';
|
|
4
4
|
import { relative, basename, resolve as resolve$1, join, normalize, dirname } from 'pathe';
|
|
5
5
|
import c from 'tinyrainbow';
|
|
6
|
-
import { t as truncateString, e as errorBanner, F as F_POINTER, d as divider, f as formatTimeString, a as taskFail, s as separator, b as F_CHECK, c as F_DOWN_RIGHT, g as formatProjectName, h as getStateSymbol, w as withLabel, r as renderSnapshotSummary, p as padSummaryTitle, i as getStateString$1, j as formatTime, k as countTestErrors, l as F_TREE_NODE_END, m as F_TREE_NODE_MIDDLE, n as noun, o as F_RIGHT } from './utils.
|
|
6
|
+
import { t as truncateString, e as errorBanner, F as F_POINTER, d as divider, f as formatTimeString, a as taskFail, s as separator, b as F_CHECK, c as F_DOWN_RIGHT, g as formatProjectName, h as getStateSymbol, w as withLabel, r as renderSnapshotSummary, p as padSummaryTitle, i as getStateString$1, j as formatTime, k as countTestErrors, l as F_TREE_NODE_END, m as F_TREE_NODE_MIDDLE, n as noun, o as F_RIGHT } from './utils.BS4fH3nR.js';
|
|
7
7
|
import { stripVTControlCharacters } from 'node:util';
|
|
8
8
|
import { isPrimitive, toArray, deepMerge, notNullish } from '@vitest/utils/helpers';
|
|
9
|
+
import { readdir, stat, readFile, mkdir, writeFile } from 'node:fs/promises';
|
|
9
10
|
import { performance as performance$1 } from 'node:perf_hooks';
|
|
10
11
|
import { defaultStackIgnorePatterns, parseErrorStacktrace, parseStacktrace } from '@vitest/utils/source-map';
|
|
11
12
|
import { i as isTTY } from './env.D4Lgay0q.js';
|
|
@@ -17,7 +18,6 @@ import { x } from 'tinyexec';
|
|
|
17
18
|
import { distDir } from '../path.js';
|
|
18
19
|
import { parseAstAsync } from 'vite';
|
|
19
20
|
import { positionToOffset, lineSplitRE } from '@vitest/utils/offset';
|
|
20
|
-
import { readdir, stat, readFile, mkdir, writeFile } from 'node:fs/promises';
|
|
21
21
|
import { createRequire } from 'node:module';
|
|
22
22
|
|
|
23
23
|
function groupBy(collection, iteratee) {
|
|
@@ -3135,28 +3135,6 @@ class DefaultReporter extends BaseReporter {
|
|
|
3135
3135
|
}
|
|
3136
3136
|
}
|
|
3137
3137
|
|
|
3138
|
-
class AgentReporter extends DefaultReporter {
|
|
3139
|
-
renderSucceed = false;
|
|
3140
|
-
constructor(options = {}) {
|
|
3141
|
-
super({
|
|
3142
|
-
silent: "passed-only",
|
|
3143
|
-
...options,
|
|
3144
|
-
summary: false
|
|
3145
|
-
});
|
|
3146
|
-
}
|
|
3147
|
-
onTestRunStart(specifications) {
|
|
3148
|
-
super.onTestRunStart(specifications);
|
|
3149
|
-
this.renderSucceed = false;
|
|
3150
|
-
}
|
|
3151
|
-
printTestModule(testModule) {
|
|
3152
|
-
if (testModule.state() !== "failed") return;
|
|
3153
|
-
super.printTestModule(testModule);
|
|
3154
|
-
}
|
|
3155
|
-
printTestCase(moduleState, test) {
|
|
3156
|
-
if (test.result().state === "failed") super.printTestCase(moduleState, test);
|
|
3157
|
-
}
|
|
3158
|
-
}
|
|
3159
|
-
|
|
3160
3138
|
class DotReporter extends BaseReporter {
|
|
3161
3139
|
renderer;
|
|
3162
3140
|
tests = /* @__PURE__ */ new Map();
|
|
@@ -3572,6 +3550,7 @@ class JsonReporter {
|
|
|
3572
3550
|
const numTodoTests = tests.filter((t) => t.mode === "todo").length;
|
|
3573
3551
|
const testResults = [];
|
|
3574
3552
|
const success = !!(files.length > 0 || this.ctx.config.passWithNoTests) && numFailedTestSuites === 0 && numFailedTests === 0;
|
|
3553
|
+
const { filterMeta } = this.options;
|
|
3575
3554
|
for (const file of files) {
|
|
3576
3555
|
const tests = getTests([file]);
|
|
3577
3556
|
let startTime = tests.reduce((prev, next) => Math.min(prev, next.result?.startTime ?? Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY);
|
|
@@ -3593,7 +3572,14 @@ class JsonReporter {
|
|
|
3593
3572
|
duration: t.result?.duration,
|
|
3594
3573
|
failureMessages: t.result?.errors?.map((e) => e.stack || e.message) || [],
|
|
3595
3574
|
location: t.location,
|
|
3596
|
-
meta:
|
|
3575
|
+
meta: filterMeta ? (() => {
|
|
3576
|
+
const filtered = {};
|
|
3577
|
+
for (const key in t.meta) {
|
|
3578
|
+
const value = t.meta[key];
|
|
3579
|
+
if (filterMeta(key, value)) filtered[key] = value;
|
|
3580
|
+
}
|
|
3581
|
+
return filtered;
|
|
3582
|
+
})() : t.meta,
|
|
3597
3583
|
tags: t.tags || []
|
|
3598
3584
|
};
|
|
3599
3585
|
});
|
|
@@ -3878,6 +3864,28 @@ class JUnitReporter {
|
|
|
3878
3864
|
}
|
|
3879
3865
|
}
|
|
3880
3866
|
|
|
3867
|
+
class MinimalReporter extends DefaultReporter {
|
|
3868
|
+
renderSucceed = false;
|
|
3869
|
+
constructor(options = {}) {
|
|
3870
|
+
super({
|
|
3871
|
+
silent: "passed-only",
|
|
3872
|
+
...options,
|
|
3873
|
+
summary: false
|
|
3874
|
+
});
|
|
3875
|
+
}
|
|
3876
|
+
onTestRunStart(specifications) {
|
|
3877
|
+
super.onTestRunStart(specifications);
|
|
3878
|
+
this.renderSucceed = false;
|
|
3879
|
+
}
|
|
3880
|
+
printTestModule(testModule) {
|
|
3881
|
+
if (testModule.state() !== "failed") return;
|
|
3882
|
+
super.printTestModule(testModule);
|
|
3883
|
+
}
|
|
3884
|
+
printTestCase(moduleState, test) {
|
|
3885
|
+
if (test.result().state === "failed") super.printTestCase(moduleState, test);
|
|
3886
|
+
}
|
|
3887
|
+
}
|
|
3888
|
+
|
|
3881
3889
|
function yamlString(str) {
|
|
3882
3890
|
if (!str) return "";
|
|
3883
3891
|
return `"${str.replace(/"/g, "\\\"")}"`;
|
|
@@ -4230,7 +4238,8 @@ const BenchmarkReportsMap = {
|
|
|
4230
4238
|
|
|
4231
4239
|
const ReportersMap = {
|
|
4232
4240
|
"default": DefaultReporter,
|
|
4233
|
-
"agent":
|
|
4241
|
+
"agent": MinimalReporter,
|
|
4242
|
+
"minimal": MinimalReporter,
|
|
4234
4243
|
"blob": BlobReporter,
|
|
4235
4244
|
"verbose": VerboseReporter,
|
|
4236
4245
|
"dot": DotReporter,
|
|
@@ -4243,4 +4252,4 @@ const ReportersMap = {
|
|
|
4243
4252
|
"github-actions": GithubActionsReporter
|
|
4244
4253
|
};
|
|
4245
4254
|
|
|
4246
|
-
export {
|
|
4255
|
+
export { BenchmarkReporter as B, DefaultReporter as D, GithubActionsReporter as G, HangingProcessReporter as H, JUnitReporter as J, MinimalReporter as M, ReportersMap as R, TapFlatReporter as T, VerboseBenchmarkReporter as V, BenchmarkReportsMap as a, DotReporter as b, JsonReporter as c, TapReporter as d, VerboseReporter as e, createIndexLocationsMap as f, TraceMap as g, ancestor as h, printError as i, Typechecker as j, generateCodeFrame as k, escapeRegExp as l, createDefinesScript as m, groupBy as n, originalPositionFor as o, parse as p, BlobReporter as q, readBlobs as r, stringify as s, convertTasksToEvents as t, stdout as u, wildcardPatternToRegExp as w };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DevEnvironment } from 'vite';
|
|
2
|
-
import { V as Vitest, T as TestProject, a as TestProjectConfiguration } from './reporters.d.
|
|
2
|
+
import { V as Vitest, T as TestProject, a as TestProjectConfiguration } from './reporters.d.CEnv6XRv.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Generate a unique cache identifier.
|