vitest 4.1.1 → 4.1.3
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 +1 -1
- package/dist/browser.js +1 -1
- package/dist/chunks/{base.C9_VThnT.js → base.C3wvLFNM.js} +7 -7
- package/dist/chunks/{benchmark.D0SlKNbZ.js → benchmark.CX_oY03V.js} +1 -1
- package/dist/chunks/{browser.d.X3SXoOCV.d.ts → browser.d.C0zGu1u9.d.ts} +1 -1
- package/dist/chunks/{cac.CHfKU_gf.js → cac.Bb7YBzMA.js} +24 -10
- package/dist/chunks/{cli-api.BUXBO6jS.js → cli-api.CaPRsymo.js} +47 -14
- package/dist/chunks/{config.d.EJLVE3es.d.ts → config.d.ChUh6-ad.d.ts} +2 -0
- package/dist/chunks/{coverage.CJ2HXVIG.js → coverage.CwUlQe0s.js} +13 -3
- package/dist/chunks/{defaults.CdU2lD-q.js → defaults.9aQKnqFk.js} +13 -5
- package/dist/chunks/{global.d.x-ILCfAE.d.ts → global.d.D74z04P1.d.ts} +2 -0
- package/dist/chunks/{globals.8mibwXRO.js → globals.7B-4LHAF.js} +4 -4
- package/dist/chunks/{index.Dkvtd-Ku.js → index.4L3g53iW.js} +3 -2
- package/dist/chunks/{index.6q6giCZO.js → index.Cj9kDiDi.js} +2 -2
- package/dist/chunks/{index.DXMFO5MJ.js → index.DICur-LY.js} +628 -586
- package/dist/chunks/{init-forks.B4YYSIj4.js → init-forks.UV3ZQGQH.js} +1 -1
- package/dist/chunks/{init-threads.Bd2Hsaex.js → init-threads.D3eCsY76.js} +1 -1
- package/dist/chunks/{init.BVxhC4nR.js → init.D98-gwRW.js} +3 -1
- package/dist/chunks/{nativeModuleMocker.Dd1Q1VIw.js → nativeModuleMocker.BRN2oBJd.js} +1 -1
- package/dist/chunks/{plugin.d.Dx0ozo6e.d.ts → plugin.d.BssAumYw.d.ts} +1 -1
- package/dist/chunks/{reporters.d.CZ5E0GCT.d.ts → reporters.d.yJ2fBir5.d.ts} +17 -8
- package/dist/chunks/{setup-common.CB31_KSV.js → setup-common.NdrZGMhw.js} +1 -1
- package/dist/chunks/{startVitestModuleRunner.C3FXk5Gv.js → startVitestModuleRunner.bRl2_oI_.js} +16 -2
- package/dist/chunks/{test.CBQUpOM3.js → test.BmQO5GaM.js} +402 -336
- package/dist/chunks/utils.DK8FXp4T.js +189 -0
- package/dist/chunks/{vm.DId8XBJa.js → vm.DVLYObm9.js} +7 -6
- package/dist/chunks/{worker.d.B84sVRy0.d.ts → worker.d.CckNUvI5.d.ts} +1 -1
- package/dist/cli.js +2 -20
- package/dist/config.cjs +13 -5
- package/dist/config.d.ts +8 -8
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +4 -4
- package/dist/coverage.js +2 -2
- package/dist/index.d.ts +79 -9
- package/dist/index.js +4 -4
- package/dist/node.d.ts +8 -8
- package/dist/node.js +8 -8
- package/dist/reporters.d.ts +4 -4
- package/dist/reporters.js +6 -6
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +3 -3
- package/dist/runtime.js +1 -1
- package/dist/suite.js +1 -1
- package/dist/worker.d.ts +2 -2
- package/dist/worker.js +9 -8
- package/dist/workers/forks.js +10 -9
- package/dist/workers/runVmTests.js +5 -5
- package/dist/workers/threads.js +10 -9
- package/dist/workers/vmForks.js +5 -5
- package/dist/workers/vmThreads.js +5 -5
- package/package.json +22 -14
- package/dist/chunks/index.CEzQDJGb.js +0 -231
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.d.
|
|
1
|
+
import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.d.ChUh6-ad.js';
|
|
2
2
|
import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.BZtK59WP.js';
|
|
3
3
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
4
4
|
export { O as OTELCarrier, T as Traces } from './chunks/traces.d.402V_yFI.js';
|
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.NdrZGMhw.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,22 +1,22 @@
|
|
|
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.
|
|
4
|
-
import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.
|
|
3
|
+
import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.Cj9kDiDi.js';
|
|
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';
|
|
7
7
|
import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
|
|
8
|
-
import { s as startVitestModuleRunner, c as createNodeImportMeta } from './startVitestModuleRunner.
|
|
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.NdrZGMhw.js';
|
|
12
|
+
import { g as globalExpect, v as vi } from './test.BmQO5GaM.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.4L3g53iW.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
|
|
@@ -115,7 +115,7 @@ async function startModuleRunner(options) {
|
|
|
115
115
|
let mocker;
|
|
116
116
|
if (options.state.config.experimental.nodeLoader !== false) {
|
|
117
117
|
// this additionally imports acorn/magic-string
|
|
118
|
-
const { NativeModuleMocker } = await import('./nativeModuleMocker.
|
|
118
|
+
const { NativeModuleMocker } = await import('./nativeModuleMocker.BRN2oBJd.js');
|
|
119
119
|
mocker = new NativeModuleMocker({
|
|
120
120
|
async resolveId(id, importer) {
|
|
121
121
|
// TODO: use import.meta.resolve instead
|
|
@@ -20,7 +20,7 @@ const bench = createBenchmark(function(name, fn = noop, options = {}) {
|
|
|
20
20
|
benchFns.set(task, fn);
|
|
21
21
|
benchOptsMap.set(task, options);
|
|
22
22
|
// vitest runner sets mode to `todo` if handler is not passed down
|
|
23
|
-
// but we store handler
|
|
23
|
+
// but we store handler separately
|
|
24
24
|
if (!this.todo && task.mode === "todo") task.mode = "run";
|
|
25
25
|
});
|
|
26
26
|
function createBenchmark(fn) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FileSpecification } from '@vitest/runner';
|
|
2
2
|
import { O as OTELCarrier } from './traces.d.402V_yFI.js';
|
|
3
|
-
import { T as TestExecutionMethod } from './worker.d.
|
|
3
|
+
import { T as TestExecutionMethod } from './worker.d.CckNUvI5.js';
|
|
4
4
|
|
|
5
5
|
type SerializedTestSpecification = [project: {
|
|
6
6
|
name: string | undefined;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { toArray } from '@vitest/utils/helpers';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { normalize } from 'pathe';
|
|
4
|
-
import c$2 from 'tinyrainbow';
|
|
4
|
+
import c$2, { disableDefaultColors } from 'tinyrainbow';
|
|
5
|
+
import './env.D4Lgay0q.js';
|
|
5
6
|
import { b as defaultPort, d as defaultBrowserPort } from './constants.CPYnjOGj.js';
|
|
6
|
-
import { R as ReportersMap } from './index.DXMFO5MJ.js';
|
|
7
7
|
import assert from 'node:assert';
|
|
8
|
+
import { isAgent } from 'std-env';
|
|
8
9
|
|
|
9
10
|
function toArr(any) {
|
|
10
11
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -620,7 +621,7 @@ class CAC extends EventEmitter {
|
|
|
620
621
|
|
|
621
622
|
const cac = (name = "") => new CAC(name);
|
|
622
623
|
|
|
623
|
-
var version = "4.1.
|
|
624
|
+
var version = "4.1.3";
|
|
624
625
|
|
|
625
626
|
const apiConfig = (port) => ({
|
|
626
627
|
port: {
|
|
@@ -700,7 +701,7 @@ const cliOptionsConfig = {
|
|
|
700
701
|
hideSkippedTests: { description: "Hide logs for skipped tests" },
|
|
701
702
|
reporters: {
|
|
702
703
|
alias: "reporter",
|
|
703
|
-
description: `Specify reporters (
|
|
704
|
+
description: `Specify reporters (default, agent, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)`,
|
|
704
705
|
argument: "<name>",
|
|
705
706
|
subcommands: null,
|
|
706
707
|
array: true
|
|
@@ -890,7 +891,18 @@ const cliOptionsConfig = {
|
|
|
890
891
|
viewport: null,
|
|
891
892
|
screenshotDirectory: null,
|
|
892
893
|
screenshotFailures: null,
|
|
893
|
-
locators:
|
|
894
|
+
locators: {
|
|
895
|
+
description: "Options for how locators should be handled by default",
|
|
896
|
+
argument: "<options>",
|
|
897
|
+
subcommands: {
|
|
898
|
+
testIdAttribute: null,
|
|
899
|
+
exact: { description: "Should locators match the text exactly by default (default: `false`)" }
|
|
900
|
+
},
|
|
901
|
+
transform(val) {
|
|
902
|
+
if (typeof val !== "object" || val == null) return {};
|
|
903
|
+
return val;
|
|
904
|
+
}
|
|
905
|
+
},
|
|
894
906
|
testerHtmlPath: null,
|
|
895
907
|
instances: null,
|
|
896
908
|
expect: null,
|
|
@@ -1242,7 +1254,8 @@ const cliOptionsConfig = {
|
|
|
1242
1254
|
argument: "<path>",
|
|
1243
1255
|
description: "Custom provider for detecting changed files. (default: `git`)",
|
|
1244
1256
|
subcommands: null
|
|
1245
|
-
}
|
|
1257
|
+
},
|
|
1258
|
+
preParse: { description: "Parse test specifications before running them. This will apply `.only` flag and test name pattern across all files without running them. (default: `false`)" }
|
|
1246
1259
|
}
|
|
1247
1260
|
},
|
|
1248
1261
|
cliExclude: null,
|
|
@@ -2200,6 +2213,7 @@ function addCliOptions(cli, options) {
|
|
|
2200
2213
|
for (const [optionName, option] of Object.entries(options)) if (option) addCommand(cli, optionName, option);
|
|
2201
2214
|
}
|
|
2202
2215
|
function createCLI(options = {}) {
|
|
2216
|
+
if (isAgent) disableDefaultColors();
|
|
2203
2217
|
const cli = cac("vitest");
|
|
2204
2218
|
cli.version(version);
|
|
2205
2219
|
addCliOptions(cli, cliOptionsConfig);
|
|
@@ -2322,11 +2336,11 @@ function normalizeCliOptions(cliFilters, argv) {
|
|
|
2322
2336
|
}
|
|
2323
2337
|
async function start(mode, cliFilters, options) {
|
|
2324
2338
|
try {
|
|
2325
|
-
const { startVitest } = await import('./cli-api.
|
|
2339
|
+
const { startVitest } = await import('./cli-api.CaPRsymo.js').then(function (n) { return n.q; });
|
|
2326
2340
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
2327
2341
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
2328
2342
|
} catch (e) {
|
|
2329
|
-
const { errorBanner } = await import('./
|
|
2343
|
+
const { errorBanner } = await import('./utils.DK8FXp4T.js').then(function (n) { return n.u; });
|
|
2330
2344
|
console.error(`\n${errorBanner("Startup Error")}`);
|
|
2331
2345
|
console.error(e);
|
|
2332
2346
|
console.error("\n\n");
|
|
@@ -2344,7 +2358,7 @@ async function init(project) {
|
|
|
2344
2358
|
}
|
|
2345
2359
|
async function collect(mode, cliFilters, options) {
|
|
2346
2360
|
try {
|
|
2347
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
2361
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.CaPRsymo.js').then(function (n) { return n.q; });
|
|
2348
2362
|
const ctx = await prepareVitest(mode, {
|
|
2349
2363
|
...normalizeCliOptions(cliFilters, options),
|
|
2350
2364
|
watch: false,
|
|
@@ -2366,7 +2380,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
2366
2380
|
} else outputFileList(await ctx.getRelevantTestSpecifications(cliFilters.map(normalize)), options);
|
|
2367
2381
|
await ctx.close();
|
|
2368
2382
|
} catch (e) {
|
|
2369
|
-
const { errorBanner } = await import('./
|
|
2383
|
+
const { errorBanner } = await import('./utils.DK8FXp4T.js').then(function (n) { return n.u; });
|
|
2370
2384
|
console.error(`\n${errorBanner("Collect Error")}`);
|
|
2371
2385
|
console.error(e);
|
|
2372
2386
|
console.error("\n\n");
|
|
@@ -10,22 +10,23 @@ import { parseAst, searchForWorkspaceRoot, fetchModule, version, createServer, i
|
|
|
10
10
|
import { A as API_PATH, c as configFiles, d as defaultBrowserPort, b as defaultPort } from './constants.CPYnjOGj.js';
|
|
11
11
|
import * as nodeos from 'node:os';
|
|
12
12
|
import nodeos__default, { tmpdir } from 'node:os';
|
|
13
|
-
import { generateHash as generateHash$1, createTaskName, validateTags, calculateSuiteHash,
|
|
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.Bb7YBzMA.js';
|
|
17
17
|
import { rootDir, distDir } from '../path.js';
|
|
18
|
-
import {
|
|
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.DICur-LY.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.CwUlQe0s.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.DK8FXp4T.js';
|
|
29
30
|
import { createRequire, builtinModules, isBuiltin as isBuiltin$1 } from 'node:module';
|
|
30
31
|
import url, { fileURLToPath, pathToFileURL } from 'node:url';
|
|
31
32
|
import { i as isTTY, a as isWindows } from './env.D4Lgay0q.js';
|
|
@@ -49,13 +50,13 @@ import require$$0$2 from 'stream';
|
|
|
49
50
|
import require$$7 from 'url';
|
|
50
51
|
import require$$0 from 'zlib';
|
|
51
52
|
import require$$0$1 from 'buffer';
|
|
52
|
-
import { c as configDefaults } from './defaults.
|
|
53
|
+
import { c as configDefaults } from './defaults.9aQKnqFk.js';
|
|
54
|
+
import { isAgent } from 'std-env';
|
|
53
55
|
import MagicString from 'magic-string';
|
|
54
56
|
import { hoistMocksPlugin, automockPlugin } from '@vitest/mocker/node';
|
|
55
57
|
import { KNOWN_ASSET_RE } from '@vitest/utils/constants';
|
|
56
58
|
import { findNearestPackageData } from '@vitest/utils/resolver';
|
|
57
59
|
import * as esModuleLexer from 'es-module-lexer';
|
|
58
|
-
import { a as BenchmarkReportsMap } from './index.CEzQDJGb.js';
|
|
59
60
|
import assert$1 from 'node:assert';
|
|
60
61
|
import { parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
61
62
|
import { extractSourcemapFromFile } from '@vitest/utils/source-map/node';
|
|
@@ -388,8 +389,6 @@ function createFileTask(testFilepath, code, requestMap, config, filepath, fileTa
|
|
|
388
389
|
latestSuite.tasks.push(task);
|
|
389
390
|
});
|
|
390
391
|
calculateSuiteHash(file);
|
|
391
|
-
const hasOnly = someTasksAreOnly(file);
|
|
392
|
-
interpretTaskModes(file, config.testNamePattern, void 0, void 0, void 0, hasOnly, false, config.allowOnly);
|
|
393
392
|
markDynamicTests(file.tasks);
|
|
394
393
|
if (!file.tasks.length) file.result = {
|
|
395
394
|
state: "fail",
|
|
@@ -9227,7 +9226,10 @@ function serializeConfig(project) {
|
|
|
9227
9226
|
detailsPanelPosition: browser.detailsPanelPosition ?? "right",
|
|
9228
9227
|
viewport: browser.viewport,
|
|
9229
9228
|
screenshotFailures: browser.screenshotFailures,
|
|
9230
|
-
locators: {
|
|
9229
|
+
locators: {
|
|
9230
|
+
testIdAttribute: browser.locators.testIdAttribute,
|
|
9231
|
+
exact: browser.locators.exact
|
|
9232
|
+
},
|
|
9231
9233
|
providerOptions: provider?.name === "playwright" ? { actionTimeout: provider?.options?.actionTimeout } : {},
|
|
9232
9234
|
trackUnhandledErrors: browser.trackUnhandledErrors ?? true,
|
|
9233
9235
|
trace: browser.trace.mode
|
|
@@ -9247,7 +9249,8 @@ function serializeConfig(project) {
|
|
|
9247
9249
|
tags: config.tags || [],
|
|
9248
9250
|
tagsFilter: config.tagsFilter,
|
|
9249
9251
|
strictTags: config.strictTags ?? true,
|
|
9250
|
-
slowTestThreshold: config.slowTestThreshold ?? globalConfig.slowTestThreshold ?? configDefaults.slowTestThreshold
|
|
9252
|
+
slowTestThreshold: config.slowTestThreshold ?? globalConfig.slowTestThreshold ?? configDefaults.slowTestThreshold,
|
|
9253
|
+
isAgent
|
|
9251
9254
|
};
|
|
9252
9255
|
}
|
|
9253
9256
|
|
|
@@ -11219,7 +11222,10 @@ function cloneConfig(project, { browser, ...config }) {
|
|
|
11219
11222
|
...clonedConfig,
|
|
11220
11223
|
browser: {
|
|
11221
11224
|
...project.config.browser,
|
|
11222
|
-
locators: locators ? {
|
|
11225
|
+
locators: locators ? {
|
|
11226
|
+
testIdAttribute: locators.testIdAttribute ?? currentConfig.locators.testIdAttribute,
|
|
11227
|
+
exact: locators.exact ?? currentConfig.locators.exact
|
|
11228
|
+
} : project.config.browser.locators,
|
|
11223
11229
|
viewport: viewport ?? currentConfig.viewport,
|
|
11224
11230
|
testerHtmlPath: testerHtmlPath ?? currentConfig.testerHtmlPath,
|
|
11225
11231
|
screenshotDirectory: screenshotDirectory ?? currentConfig.screenshotDirectory,
|
|
@@ -13411,7 +13417,7 @@ class Vitest {
|
|
|
13411
13417
|
}
|
|
13412
13418
|
this.filenamePattern = filters && filters?.length > 0 ? filters : void 0;
|
|
13413
13419
|
startSpan.setAttribute("vitest.start.filters", this.filenamePattern || []);
|
|
13414
|
-
|
|
13420
|
+
let specifications = await this._traces.$("vitest.config.resolve_include_glob", async () => {
|
|
13415
13421
|
const specifications = await this.specifications.getRelevantTestSpecifications(filters);
|
|
13416
13422
|
startSpan.setAttribute("vitest.start.specifications", specifications.map((s) => {
|
|
13417
13423
|
const relativeModuleId = relative(s.project.config.root, s.moduleId);
|
|
@@ -13420,6 +13426,13 @@ class Vitest {
|
|
|
13420
13426
|
}));
|
|
13421
13427
|
return specifications;
|
|
13422
13428
|
});
|
|
13429
|
+
if (this.config.experimental.preParse) {
|
|
13430
|
+
// This populates specification.testModule with parsed information
|
|
13431
|
+
await this.experimental_parseSpecifications(specifications);
|
|
13432
|
+
specifications = specifications.filter(({ testModule }) => {
|
|
13433
|
+
return !testModule || testModule.task.mode !== "skip";
|
|
13434
|
+
});
|
|
13435
|
+
}
|
|
13423
13436
|
// if run with --changed, don't exit if no tests are found
|
|
13424
13437
|
if (!specifications.length) {
|
|
13425
13438
|
await this._traces.$("vitest.test_run", async () => {
|
|
@@ -13616,14 +13629,34 @@ class Vitest {
|
|
|
13616
13629
|
async experimental_parseSpecifications(specifications, options) {
|
|
13617
13630
|
if (this.mode !== "test") throw new Error(`The \`experimental_parseSpecifications\` does not support "${this.mode}" mode.`);
|
|
13618
13631
|
const limit = limitConcurrency(options?.concurrency ?? (typeof nodeos__default.availableParallelism === "function" ? nodeos__default.availableParallelism() : nodeos__default.cpus().length));
|
|
13619
|
-
|
|
13620
|
-
|
|
13632
|
+
// Phase 1: parse all files in parallel (without mode interpretation)
|
|
13633
|
+
const results = await Promise.all(specifications.map((specification) => limit(async () => {
|
|
13634
|
+
return {
|
|
13635
|
+
file: await astCollectTests(specification.project, specification.moduleId).catch((error) => {
|
|
13636
|
+
return createFailedFileTask(specification.project, specification.moduleId, error);
|
|
13637
|
+
}),
|
|
13638
|
+
specification
|
|
13639
|
+
};
|
|
13640
|
+
})));
|
|
13641
|
+
const tagsFilter = this.config.tagsFilter ? createTagsFilter(this.config.tagsFilter, this.config.tags) : void 0;
|
|
13642
|
+
// Phase 2: cross-file .only resolution
|
|
13643
|
+
const globalHasOnly = results.some(({ file }) => someTasksAreOnly(file));
|
|
13644
|
+
for (const { file, specification } of results) {
|
|
13645
|
+
const config = specification.project.config;
|
|
13646
|
+
interpretTaskModes(file, config.testNamePattern, specification.testLines, specification.testIds, tagsFilter, globalHasOnly, false, config.allowOnly);
|
|
13647
|
+
this.state.collectFiles(specification.project, [file]);
|
|
13648
|
+
}
|
|
13649
|
+
return results.map(({ file }) => this.state.getReportedEntity(file));
|
|
13621
13650
|
}
|
|
13622
13651
|
async experimental_parseSpecification(specification) {
|
|
13623
13652
|
if (this.mode !== "test") throw new Error(`The \`experimental_parseSpecification\` does not support "${this.mode}" mode.`);
|
|
13624
13653
|
const file = await astCollectTests(specification.project, specification.moduleId).catch((error) => {
|
|
13625
13654
|
return createFailedFileTask(specification.project, specification.moduleId, error);
|
|
13626
13655
|
});
|
|
13656
|
+
const config = specification.project.config;
|
|
13657
|
+
const hasOnly = someTasksAreOnly(file);
|
|
13658
|
+
const tagsFilter = this.config.tagsFilter ? createTagsFilter(this.config.tagsFilter, this.config.tags) : void 0;
|
|
13659
|
+
interpretTaskModes(file, config.testNamePattern, specification.testLines, specification.testIds, tagsFilter, hasOnly, false, config.allowOnly);
|
|
13627
13660
|
// register in state, so it can be retrieved by "getReportedEntity"
|
|
13628
13661
|
this.state.collectFiles(specification.project, [file]);
|
|
13629
13662
|
return this.state.getReportedEntity(file);
|
|
@@ -166,6 +166,7 @@ interface SerializedConfig {
|
|
|
166
166
|
};
|
|
167
167
|
locators: {
|
|
168
168
|
testIdAttribute: string;
|
|
169
|
+
exact: boolean;
|
|
169
170
|
};
|
|
170
171
|
screenshotFailures: boolean;
|
|
171
172
|
providerOptions: {
|
|
@@ -206,6 +207,7 @@ interface SerializedConfig {
|
|
|
206
207
|
tagsFilter: string[] | undefined;
|
|
207
208
|
strictTags: boolean;
|
|
208
209
|
slowTestThreshold: number | undefined;
|
|
210
|
+
isAgent: boolean;
|
|
209
211
|
}
|
|
210
212
|
interface SerializedCoverageConfig {
|
|
211
213
|
provider: "istanbul" | "v8" | "custom" | undefined;
|
|
@@ -3,11 +3,11 @@ import module$1 from 'node:module';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
5
5
|
import { slash, shuffle, toArray, cleanUrl } from '@vitest/utils/helpers';
|
|
6
|
-
import { resolve, relative, normalize } from 'pathe';
|
|
6
|
+
import { resolve, relative, normalize, join } from 'pathe';
|
|
7
7
|
import pm from 'picomatch';
|
|
8
8
|
import { glob } from 'tinyglobby';
|
|
9
9
|
import c from 'tinyrainbow';
|
|
10
|
-
import { c as configDefaults, e as benchmarkConfigDefaults, a as coverageConfigDefaults } from './defaults.
|
|
10
|
+
import { c as configDefaults, e as benchmarkConfigDefaults, a as coverageConfigDefaults } from './defaults.9aQKnqFk.js';
|
|
11
11
|
import crypto from 'node:crypto';
|
|
12
12
|
import { r as resolveModule } from './index.BCY_7LL2.js';
|
|
13
13
|
import { mergeConfig } from 'vite';
|
|
@@ -95,7 +95,16 @@ class RandomSequencer extends BaseSequencer {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
function resolvePath(path, root) {
|
|
98
|
-
|
|
98
|
+
// local-pkg (mlly)'s resolveModule("./file", { paths: ["/some/root"] }) tries
|
|
99
|
+
// /some/file
|
|
100
|
+
// /some/file.js
|
|
101
|
+
// /some/root/file
|
|
102
|
+
// /some/root/file.js
|
|
103
|
+
// etc.
|
|
104
|
+
// but we don't want to resolve files from parent directories,
|
|
105
|
+
// so we ensure passing "/" suffix such as "/some/root/"
|
|
106
|
+
// https://github.com/unjs/mlly/blob/401d42983f6f3a9112658d67b0a92ba4fb1d7efa/src/resolve.ts#L104-L110
|
|
107
|
+
return normalize(/* @__PURE__ */ resolveModule(path, { paths: [join(root, "/")] }) ?? resolve(root, path));
|
|
99
108
|
}
|
|
100
109
|
function parseInspector(inspect) {
|
|
101
110
|
if (typeof inspect === "boolean" || inspect === void 0) return {};
|
|
@@ -480,6 +489,7 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
480
489
|
resolved.browser.viewport.height ??= 896;
|
|
481
490
|
resolved.browser.locators ??= {};
|
|
482
491
|
resolved.browser.locators.testIdAttribute ??= "data-testid";
|
|
492
|
+
resolved.browser.locators.exact ??= false;
|
|
483
493
|
if (typeof resolved.browser.provider === "string") {
|
|
484
494
|
const source = `@vitest/browser-${resolved.browser.provider}`;
|
|
485
495
|
throw new TypeError(`The \`browser.provider\` configuration was changed to accept a factory instead of a string. Add an import of "${resolved.browser.provider}" from "${source}" instead. See: https://vitest.dev/config/browser/provider`);
|
|
@@ -21,14 +21,22 @@ const coverageConfigDefaults = {
|
|
|
21
21
|
exclude: [],
|
|
22
22
|
reportOnFailure: false,
|
|
23
23
|
reporter: [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
"text",
|
|
25
|
+
"html",
|
|
26
|
+
"clover",
|
|
27
|
+
"json"
|
|
28
28
|
],
|
|
29
29
|
allowExternal: false,
|
|
30
30
|
excludeAfterRemap: false,
|
|
31
|
-
processingConcurrency: Math.min(20, nodeos__default.availableParallelism?.() ?? nodeos__default.cpus().length)
|
|
31
|
+
processingConcurrency: Math.min(20, nodeos__default.availableParallelism?.() ?? nodeos__default.cpus().length),
|
|
32
|
+
ignoreClassMethods: [],
|
|
33
|
+
skipFull: false,
|
|
34
|
+
watermarks: {
|
|
35
|
+
statements: [50, 80],
|
|
36
|
+
functions: [50, 80],
|
|
37
|
+
branches: [50, 80],
|
|
38
|
+
lines: [50, 80]
|
|
39
|
+
}
|
|
32
40
|
};
|
|
33
41
|
const fakeTimersDefaults = {
|
|
34
42
|
loopLimit: 1e4,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PromisifyAssertion, Tester, ExpectStatic } from '@vitest/expect';
|
|
2
2
|
import { Plugin } from '@vitest/pretty-format';
|
|
3
|
+
import { Test } from '@vitest/runner';
|
|
3
4
|
import { SnapshotState } from '@vitest/snapshot';
|
|
4
5
|
import { B as BenchmarkResult } from './benchmark.d.DAaHLpsq.js';
|
|
5
6
|
import { U as UserConsoleLog } from './rpc.d.BFMWpdph.js';
|
|
@@ -16,6 +17,7 @@ declare module "@vitest/expect" {
|
|
|
16
17
|
interface MatcherState {
|
|
17
18
|
environment: string;
|
|
18
19
|
snapshotState: SnapshotState;
|
|
20
|
+
task?: Readonly<Test>;
|
|
19
21
|
}
|
|
20
22
|
interface ExpectPollOptions {
|
|
21
23
|
interval?: number;
|
|
@@ -1,22 +1,22 @@
|
|
|
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.4L3g53iW.js';
|
|
3
|
+
import './test.BmQO5GaM.js';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import '@vitest/utils/helpers';
|
|
6
6
|
import '@vitest/utils/timers';
|
|
7
|
-
import './benchmark.
|
|
7
|
+
import './benchmark.CX_oY03V.js';
|
|
8
8
|
import '@vitest/runner/utils';
|
|
9
9
|
import './utils.BX5Fg8C4.js';
|
|
10
10
|
import '@vitest/expect';
|
|
11
11
|
import '@vitest/utils/error';
|
|
12
12
|
import 'pathe';
|
|
13
|
-
import '@vitest/snapshot';
|
|
14
13
|
import '@vitest/spy';
|
|
15
14
|
import '@vitest/utils/offset';
|
|
16
15
|
import '@vitest/utils/source-map';
|
|
17
16
|
import './_commonjsHelpers.D26ty3Ew.js';
|
|
18
17
|
import './rpc.MzXet3jl.js';
|
|
19
18
|
import './index.Chj8NDwU.js';
|
|
19
|
+
import '@vitest/snapshot';
|
|
20
20
|
import './evaluatedModules.Dg1zASAC.js';
|
|
21
21
|
import 'vite/module-runner';
|
|
22
22
|
import 'expect-type';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { v as vi, N as NodeBenchmarkRunner, T as TestRunner, a as assert, c as createExpect, g as globalExpect, i as inject, s as should, b as vitest } from './test.
|
|
2
|
-
import { b as bench } from './benchmark.
|
|
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.BmQO5GaM.js';
|
|
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';
|
|
5
5
|
import { afterAll, afterEach, aroundAll, aroundEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, recordArtifact, suite, test } from '@vitest/runner';
|
|
@@ -11,6 +11,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
11
11
|
__proto__: null,
|
|
12
12
|
BenchmarkRunner: NodeBenchmarkRunner,
|
|
13
13
|
EvaluatedModules: VitestEvaluatedModules,
|
|
14
|
+
Snapshots: Snapshots,
|
|
14
15
|
TestRunner: TestRunner,
|
|
15
16
|
afterAll: afterAll,
|
|
16
17
|
afterEach: afterEach,
|
|
@@ -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.NdrZGMhw.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.BmQO5GaM.js';
|
|
7
7
|
|
|
8
8
|
function setupChaiConfig(config) {
|
|
9
9
|
Object.assign(chai.config, config);
|