@depup/vitest 4.1.4-depup.0 → 4.1.11-depup.0
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/README.md +14 -8
- package/changes.json +31 -7
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +1 -1
- package/dist/chunks/{base.Cv_yNPUJ.js → base.B6Opl8PE.js} +7 -7
- package/dist/chunks/{browser.d.C0zGu1u9.d.ts → browser.d.BcoexmFG.d.ts} +2 -2
- package/dist/chunks/{cac.wyYWMVI-.js → cac.uFydS1Z4.js} +4 -4
- package/dist/chunks/{cli-api.lDy4N9kC.js → cli-api.CnMVyzaz.js} +120 -20
- package/dist/chunks/{config.d.ChUh6-ad.d.ts → config.d.A1h_Y6Jt.d.ts} +6 -1
- package/dist/chunks/{coverage.Da5gzbsu.js → coverage.DM_a_rWm.js} +10 -2
- package/dist/chunks/{global.d.D74z04P1.d.ts → global.d.DVsSRdQ5.d.ts} +1 -1
- package/dist/chunks/{globals.BVDtJR67.js → globals.Dj1TGiMC.js} +2 -2
- package/dist/chunks/{index.C3MK_gXn.js → index.DXx9Dtk7.js} +2 -2
- package/dist/chunks/{index.C-zNJvRx.js → index.DdgEv5B1.js} +1 -1
- package/dist/chunks/{index.BMXTnDNz.js → index.UpGiHP7g.js} +26 -25
- package/dist/chunks/{init-forks.UV3ZQGQH.js → init-forks.H5ZuobOQ.js} +1 -1
- package/dist/chunks/{init-threads.D3eCsY76.js → init-threads.6kl1khcL.js} +1 -1
- package/dist/chunks/{init.D98-gwRW.js → init.k9zZ9sLh.js} +1 -1
- package/dist/chunks/{nativeModuleMocker.BRN2oBJd.js → nativeModuleMocker.BkNfQMkH.js} +1 -1
- package/dist/chunks/{plugin.d.CEihBODF.d.ts → plugin.d.DwFIiJ7i.d.ts} +1 -1
- package/dist/chunks/{reporters.d.BwkR0iL5.d.ts → reporters.d.DtoKVV2s.d.ts} +85 -20
- package/dist/chunks/{rpc.d.BFMWpdph.d.ts → rpc.d.B_8sPU0w.d.ts} +2 -44
- package/dist/chunks/{setup-common.BDwxwUWG.js → setup-common.DYx3LtFI.js} +1 -1
- package/dist/chunks/{startVitestModuleRunner.bRl2_oI_.js → startVitestModuleRunner.DB-7oCpn.js} +10 -5
- package/dist/chunks/{test.D1JkM1w4.js → test.DNmyFkvJ.js} +1 -1
- package/dist/chunks/traces.d.D2T_R8rx.d.ts +60 -0
- package/dist/chunks/{vm.DVLYObm9.js → vm.CXMd5FHa.js} +2 -2
- 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 +1 -1
- package/dist/index.d.ts +15 -12
- 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 +6 -6
- package/dist/reporters.d.ts +8 -8
- package/dist/reporters.js +2 -2
- package/dist/runners.d.ts +2 -2
- package/dist/runners.js +1 -1
- package/dist/runtime.js +1 -1
- package/dist/worker.d.ts +4 -4
- package/dist/worker.js +7 -7
- package/dist/workers/forks.js +8 -8
- package/dist/workers/runVmTests.js +4 -4
- package/dist/workers/threads.js +8 -8
- package/dist/workers/vmForks.js +4 -4
- package/dist/workers/vmThreads.js +4 -4
- package/package.json +57 -33
- package/dist/chunks/traces.d.402V_yFI.d.ts +0 -18
package/README.md
CHANGED
|
@@ -13,20 +13,26 @@ npm install @depup/vitest
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [vitest](https://www.npmjs.com/package/vitest) @ 4.1.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [vitest](https://www.npmjs.com/package/vitest) @ 4.1.11 |
|
|
17
|
+
| Processed | 2026-08-23 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
|
-
| Deps updated |
|
|
19
|
+
| Deps updated | 12 |
|
|
20
20
|
|
|
21
21
|
## Dependency Changes
|
|
22
22
|
|
|
23
23
|
| Dependency | From | To |
|
|
24
24
|
|------------|------|-----|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
25
|
+
| es-module-lexer | ^2.0.0 | ^2.3.2 |
|
|
26
|
+
| expect-type | ^1.3.0 | ^1.4.0 |
|
|
27
|
+
| magic-string | ^0.30.21 | ^1.2.2 |
|
|
28
|
+
| obug | ^2.1.1 | ^2.1.4 |
|
|
29
|
+
| picomatch | ^4.0.3 | ^4.0.5 |
|
|
30
|
+
| std-env | ^4.0.0-rc.1 | ^4.2.0 |
|
|
31
|
+
| tinybench | ^2.9.0 | ^6.1.3 |
|
|
32
|
+
| tinyexec | ^1.0.2 | ^1.3.0 |
|
|
33
|
+
| tinyglobby | ^0.2.15 | ^0.2.17 |
|
|
34
|
+
| tinyrainbow | ^3.1.0 | ^3.1.1 |
|
|
35
|
+
| vite | ^6.0.0 || ^7.0.0 || ^8.0.0 | ^8.2.2 |
|
|
30
36
|
| why-is-node-running | ^2.3.0 | ^3.2.2 |
|
|
31
37
|
|
|
32
38
|
---
|
package/changes.json
CHANGED
|
@@ -1,30 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bumped": {
|
|
3
|
+
"es-module-lexer": {
|
|
4
|
+
"from": "^2.0.0",
|
|
5
|
+
"to": "^2.3.2"
|
|
6
|
+
},
|
|
7
|
+
"expect-type": {
|
|
8
|
+
"from": "^1.3.0",
|
|
9
|
+
"to": "^1.4.0"
|
|
10
|
+
},
|
|
11
|
+
"magic-string": {
|
|
12
|
+
"from": "^0.30.21",
|
|
13
|
+
"to": "^1.2.2"
|
|
14
|
+
},
|
|
15
|
+
"obug": {
|
|
16
|
+
"from": "^2.1.1",
|
|
17
|
+
"to": "^2.1.4"
|
|
18
|
+
},
|
|
3
19
|
"picomatch": {
|
|
4
20
|
"from": "^4.0.3",
|
|
5
|
-
"to": "^4.0.
|
|
21
|
+
"to": "^4.0.5"
|
|
22
|
+
},
|
|
23
|
+
"std-env": {
|
|
24
|
+
"from": "^4.0.0-rc.1",
|
|
25
|
+
"to": "^4.2.0"
|
|
6
26
|
},
|
|
7
27
|
"tinybench": {
|
|
8
28
|
"from": "^2.9.0",
|
|
9
|
-
"to": "^6.
|
|
29
|
+
"to": "^6.1.3"
|
|
10
30
|
},
|
|
11
31
|
"tinyexec": {
|
|
12
32
|
"from": "^1.0.2",
|
|
13
|
-
"to": "^1.
|
|
33
|
+
"to": "^1.3.0"
|
|
14
34
|
},
|
|
15
35
|
"tinyglobby": {
|
|
16
36
|
"from": "^0.2.15",
|
|
17
|
-
"to": "^0.2.
|
|
37
|
+
"to": "^0.2.17"
|
|
38
|
+
},
|
|
39
|
+
"tinyrainbow": {
|
|
40
|
+
"from": "^3.1.0",
|
|
41
|
+
"to": "^3.1.1"
|
|
18
42
|
},
|
|
19
43
|
"vite": {
|
|
20
44
|
"from": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
21
|
-
"to": "^8.
|
|
45
|
+
"to": "^8.2.2"
|
|
22
46
|
},
|
|
23
47
|
"why-is-node-running": {
|
|
24
48
|
"from": "^2.3.0",
|
|
25
49
|
"to": "^3.2.2"
|
|
26
50
|
}
|
|
27
51
|
},
|
|
28
|
-
"timestamp": "2026-
|
|
29
|
-
"totalUpdated":
|
|
52
|
+
"timestamp": "2026-08-23T00:30:02.494Z",
|
|
53
|
+
"totalUpdated": 12
|
|
30
54
|
}
|
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,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.DXx9Dtk7.js';
|
|
4
|
+
import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.k9zZ9sLh.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.DB-7oCpn.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
|
|
@@ -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.BkNfQMkH.js');
|
|
119
119
|
mocker = new NativeModuleMocker({
|
|
120
120
|
async resolveId(id, importer) {
|
|
121
121
|
// TODO: use import.meta.resolve instead
|
|
@@ -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.11";
|
|
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,7 +2336,7 @@ 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.CnMVyzaz.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) {
|
|
@@ -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.CnMVyzaz.js').then(function (n) { return n.q; });
|
|
2362
2362
|
const ctx = await prepareVitest(mode, {
|
|
2363
2363
|
...normalizeCliOptions(cliFilters, options),
|
|
2364
2364
|
watch: false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fs, { promises, existsSync, mkdirSync, readFileSync, statSync, readdirSync, writeFileSync } from 'node:fs';
|
|
1
|
+
import fs, { promises, existsSync, mkdirSync, readFileSync, statfsSync, statSync, readdirSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { relative, resolve, dirname, join, extname, normalize, basename, isAbsolute } from 'pathe';
|
|
3
3
|
import { C as CoverageProviderMap } from './coverage.CTzCuANN.js';
|
|
4
4
|
import path, { resolve as resolve$1 } from 'node:path';
|
|
@@ -13,13 +13,13 @@ 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.uFydS1Z4.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';
|
|
@@ -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
|
}
|
|
@@ -456,17 +456,29 @@ class BrowserSessions {
|
|
|
456
456
|
destroySession(sessionId) {
|
|
457
457
|
this.sessions.delete(sessionId);
|
|
458
458
|
}
|
|
459
|
-
createSession(sessionId, project, pool) {
|
|
460
|
-
// this promise
|
|
459
|
+
createSession(sessionId, project, pool, options) {
|
|
460
|
+
// this promise waits until the orchestrator is ready to accept RPC calls
|
|
461
461
|
const defer = createDefer();
|
|
462
|
+
let isConnected = false;
|
|
463
|
+
let isReady = false;
|
|
462
464
|
const timeout = setTimeout(() => {
|
|
463
465
|
defer.reject(/* @__PURE__ */ new Error(`Failed to connect to the browser session "${sessionId}" [${project.name}] within the timeout.`));
|
|
464
466
|
}, project.vitest.config.browser.connectTimeout ?? 6e4).unref();
|
|
467
|
+
const resolveIfReady = () => {
|
|
468
|
+
if (!isConnected || !isReady) return;
|
|
469
|
+
defer.resolve();
|
|
470
|
+
clearTimeout(timeout);
|
|
471
|
+
};
|
|
465
472
|
this.sessions.set(sessionId, {
|
|
466
473
|
project,
|
|
474
|
+
otelCarrier: options?.otelCarrier,
|
|
467
475
|
connected: () => {
|
|
468
|
-
|
|
469
|
-
|
|
476
|
+
isConnected = true;
|
|
477
|
+
resolveIfReady();
|
|
478
|
+
},
|
|
479
|
+
ready: () => {
|
|
480
|
+
isReady = true;
|
|
481
|
+
resolveIfReady();
|
|
470
482
|
},
|
|
471
483
|
fail: (error) => {
|
|
472
484
|
defer.resolve();
|
|
@@ -2610,8 +2622,9 @@ class BrowserPool {
|
|
|
2610
2622
|
providedContext: this._providedContext || "[{}]",
|
|
2611
2623
|
otelCarrier: this._traces.getContextCarrier()
|
|
2612
2624
|
});
|
|
2613
|
-
}).then(() => {
|
|
2625
|
+
}).then(async () => {
|
|
2614
2626
|
debug?.("[%s] test %s finished running", sessionId, file);
|
|
2627
|
+
await maybeCollectChromiumGarbage(this.project, sessionId);
|
|
2615
2628
|
this.runNextTest(method, sessionId);
|
|
2616
2629
|
}).catch((error) => {
|
|
2617
2630
|
// if user cancels the test run manually, ignore the error and exit gracefully
|
|
@@ -2649,6 +2662,72 @@ function shouldIgnoreDebugger(provider, browser) {
|
|
|
2649
2662
|
if (provider === "webdriverio") return browser !== "chrome" && browser !== "edge";
|
|
2650
2663
|
return browser !== "chromium";
|
|
2651
2664
|
}
|
|
2665
|
+
// Best-effort workaround for chromium/playwright bug
|
|
2666
|
+
// https://issues.chromium.org/issues/530892387
|
|
2667
|
+
// Trigger gc on lower disk (default to 4GB)
|
|
2668
|
+
const chromiumGCDiskThreshold = process.env.VITEST_CHROMIUM_GC_DISK_THRESHOLD_GB ? Number(process.env.VITEST_CHROMIUM_GC_DISK_THRESHOLD_GB) * 1024 ** 3 : 4 * 1024 ** 3;
|
|
2669
|
+
const forceChromiumGC = !!process.env.VITEST_CHROMIUM_GC_FORCE;
|
|
2670
|
+
const debugGC = createDebugger("vitest:browser:gc");
|
|
2671
|
+
async function maybeCollectChromiumGarbage(project, sessionId) {
|
|
2672
|
+
// trigger only on linux/chromium/playwright
|
|
2673
|
+
const provider = project.browser.provider;
|
|
2674
|
+
if (!forceChromiumGC && process.platform !== "linux" || provider.name !== "playwright" || project.config.browser.name !== "chromium" || !project.config.browser.isolate || !provider.getCDPSession) return;
|
|
2675
|
+
const start = performance.now();
|
|
2676
|
+
const diagnostics = {
|
|
2677
|
+
statfsBeforeMs: void 0,
|
|
2678
|
+
statfsAfterMs: void 0,
|
|
2679
|
+
cdpSessionMs: void 0,
|
|
2680
|
+
cdpSendMs: void 0,
|
|
2681
|
+
cdpDetachMs: void 0,
|
|
2682
|
+
forced: forceChromiumGC
|
|
2683
|
+
};
|
|
2684
|
+
try {
|
|
2685
|
+
// Playwright enables --disable-dev-shm-usage by default, which makes
|
|
2686
|
+
// Chromium use TMPDIR or /tmp for shared memory files.
|
|
2687
|
+
// https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/chromium/chromiumSwitches.ts
|
|
2688
|
+
// https://source.chromium.org/chromium/chromium/src/+/main:base/files/file_util_posix.cc
|
|
2689
|
+
const tempDirectory = process.env.TMPDIR || "/tmp";
|
|
2690
|
+
let operationStart = performance.now();
|
|
2691
|
+
const fsStats = statfsSync(tempDirectory);
|
|
2692
|
+
diagnostics.statfsBeforeMs = performance.now() - operationStart;
|
|
2693
|
+
const available = fsStats.bavail * fsStats.bsize;
|
|
2694
|
+
diagnostics.availableBytesBefore = available.toString();
|
|
2695
|
+
diagnostics.thresholdBytes = chromiumGCDiskThreshold.toString();
|
|
2696
|
+
diagnostics.tempDirectory = tempDirectory;
|
|
2697
|
+
diagnostics.triggered = available < chromiumGCDiskThreshold;
|
|
2698
|
+
if (available >= chromiumGCDiskThreshold) return;
|
|
2699
|
+
operationStart = performance.now();
|
|
2700
|
+
// `detach` is available only internally and not on CDPSession type
|
|
2701
|
+
const cdp = await provider.getCDPSession(sessionId);
|
|
2702
|
+
diagnostics.cdpSessionMs = performance.now() - operationStart;
|
|
2703
|
+
try {
|
|
2704
|
+
operationStart = performance.now();
|
|
2705
|
+
await cdp.send("HeapProfiler.collectGarbage");
|
|
2706
|
+
diagnostics.cdpSendMs = performance.now() - operationStart;
|
|
2707
|
+
} finally {
|
|
2708
|
+
operationStart = performance.now();
|
|
2709
|
+
await cdp.detach().catch((error) => {
|
|
2710
|
+
debugGC?.("[%s] failed to detach Chromium CDP session: %s", sessionId, error);
|
|
2711
|
+
});
|
|
2712
|
+
diagnostics.cdpDetachMs = performance.now() - operationStart;
|
|
2713
|
+
}
|
|
2714
|
+
if (debugGC?.enabled) {
|
|
2715
|
+
operationStart = performance.now();
|
|
2716
|
+
const fsStatsAfter = statfsSync(tempDirectory);
|
|
2717
|
+
diagnostics.statfsAfterMs = performance.now() - operationStart;
|
|
2718
|
+
diagnostics.availableBytesAfter = (fsStatsAfter.bavail * fsStatsAfter.bsize).toString();
|
|
2719
|
+
}
|
|
2720
|
+
const availableGiB = available / 1024 ** 3;
|
|
2721
|
+
const thresholdGiB = chromiumGCDiskThreshold / 1024 ** 3;
|
|
2722
|
+
debugGC?.("[%s] Low disk space detected in %s (%s GiB available, %s GiB threshold). Vitest triggered Chromium garbage collection to prevent browser crashes.", sessionId, tempDirectory, availableGiB.toFixed(1), thresholdGiB.toFixed(1));
|
|
2723
|
+
} catch (error) {
|
|
2724
|
+
// don't surface if fs or cdp fails
|
|
2725
|
+
debugGC?.("[%s] failed to collect Chromium garbage: %s", sessionId, error);
|
|
2726
|
+
} finally {
|
|
2727
|
+
diagnostics.totalMs = performance.now() - start;
|
|
2728
|
+
debugGC?.("[%s] Chromium garbage collection check: %O", sessionId, diagnostics);
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2652
2731
|
|
|
2653
2732
|
function createMethodsRPC(project, methodsOptions = {}) {
|
|
2654
2733
|
const vitest = project.vitest;
|
|
@@ -3009,6 +3088,7 @@ class PoolRunner {
|
|
|
3009
3088
|
};
|
|
3010
3089
|
emitUnexpectedExit = () => {
|
|
3011
3090
|
const error = /* @__PURE__ */ new Error("Worker exited unexpectedly");
|
|
3091
|
+
this._state = RunnerState.STOPPED;
|
|
3012
3092
|
this._eventEmitter.emit("error", error);
|
|
3013
3093
|
};
|
|
3014
3094
|
waitForStart() {
|
|
@@ -3436,14 +3516,18 @@ class Pool {
|
|
|
3436
3516
|
if (task.memoryLimit && message.usedMemory) isMemoryLimitReached = message.usedMemory >= task.memoryLimit;
|
|
3437
3517
|
if (message.error) this.options.state.catchError(message.error, "Test Run Error");
|
|
3438
3518
|
runner.off("message", onFinished);
|
|
3519
|
+
runner.off("error", onTaskError);
|
|
3439
3520
|
resolver.resolve();
|
|
3440
3521
|
}
|
|
3441
3522
|
};
|
|
3523
|
+
function onTaskError(error) {
|
|
3524
|
+
runner.off("message", onFinished);
|
|
3525
|
+
runner.off("error", onTaskError);
|
|
3526
|
+
resolver.reject(new Error(`[vitest-pool]: Worker ${task.worker} emitted error.`, { cause: error }));
|
|
3527
|
+
}
|
|
3442
3528
|
runner.on("message", onFinished);
|
|
3529
|
+
runner.on("error", onTaskError);
|
|
3443
3530
|
if (!runner.isStarted) {
|
|
3444
|
-
runner.on("error", (error) => {
|
|
3445
|
-
resolver.reject(new Error(`[vitest-pool]: Worker ${task.worker} emitted error.`, { cause: error }));
|
|
3446
|
-
});
|
|
3447
3531
|
const id = setTimeout(() => resolver.reject(/* @__PURE__ */ new Error(`[vitest-pool]: Timeout starting ${task.worker} runner.`)), WORKER_START_TIMEOUT);
|
|
3448
3532
|
await runner.start({ workerId: task.context.workerId }).catch((error) => resolver.reject(new Error(`[vitest-pool]: Failed to start ${task.worker} worker for test files ${formatFiles(task)}.`, { cause: error }))).finally(() => clearTimeout(id));
|
|
3449
3533
|
}
|
|
@@ -3456,7 +3540,7 @@ class Pool {
|
|
|
3456
3540
|
await resolver.promise.catch((error) => span?.recordException(error)).finally(() => span?.end());
|
|
3457
3541
|
const index = this.activeTasks.indexOf(activeTask);
|
|
3458
3542
|
if (index !== -1) this.activeTasks.splice(index, 1);
|
|
3459
|
-
if (!task.isolate && !isMemoryLimitReached && this.queue[0]?.task.isolate === false && isEqualRunner(runner, this.queue[0].task)) {
|
|
3543
|
+
if (!task.isolate && !runner.isTerminated && !isMemoryLimitReached && this.queue[0]?.task.isolate === false && isEqualRunner(runner, this.queue[0].task)) {
|
|
3460
3544
|
this.sharedRunners.push(runner);
|
|
3461
3545
|
return this.schedule();
|
|
3462
3546
|
}
|
|
@@ -8971,7 +9055,7 @@ function setup(ctx, _server) {
|
|
|
8971
9055
|
await ctx.rerunTask(id);
|
|
8972
9056
|
},
|
|
8973
9057
|
getConfig() {
|
|
8974
|
-
return ctx.
|
|
9058
|
+
return ctx.serializedRootConfig;
|
|
8975
9059
|
},
|
|
8976
9060
|
getResolvedProjectLabels() {
|
|
8977
9061
|
return ctx.projects.map((p) => ({
|
|
@@ -9170,6 +9254,7 @@ function serializeConfig(project) {
|
|
|
9170
9254
|
disableConsoleIntercept: config.disableConsoleIntercept,
|
|
9171
9255
|
root: config.root,
|
|
9172
9256
|
name: config.name,
|
|
9257
|
+
color: config.color,
|
|
9173
9258
|
globals: config.globals,
|
|
9174
9259
|
snapshotEnvironment: config.snapshotEnvironment,
|
|
9175
9260
|
passWithNoTests: config.passWithNoTests,
|
|
@@ -10949,9 +11034,8 @@ class TestProject {
|
|
|
10949
11034
|
const url = new URL("/__vitest_test__/", origin);
|
|
10950
11035
|
url.searchParams.set("sessionId", sessionId);
|
|
10951
11036
|
const otelCarrier = this.vitest._traces.getContextCarrier();
|
|
10952
|
-
if (otelCarrier) url.searchParams.set("otelCarrier", JSON.stringify(otelCarrier));
|
|
10953
11037
|
this.vitest._browserSessions.sessionIds.add(sessionId);
|
|
10954
|
-
const sessionPromise = this.vitest._browserSessions.createSession(sessionId, this, pool);
|
|
11038
|
+
const sessionPromise = this.vitest._browserSessions.createSession(sessionId, this, pool, { otelCarrier });
|
|
10955
11039
|
const pagePromise = this.browser.provider.openPage(sessionId, url.toString(), { parallel: pool.parallel ?? false });
|
|
10956
11040
|
await Promise.all([sessionPromise, pagePromise]);
|
|
10957
11041
|
}
|
|
@@ -11173,13 +11257,14 @@ async function resolveBrowserProjects(vitest, names, resolvedProjects) {
|
|
|
11173
11257
|
const removeProjects = /* @__PURE__ */ new Set();
|
|
11174
11258
|
resolvedProjects.forEach((project) => {
|
|
11175
11259
|
if (!project.config.browser.enabled) return;
|
|
11260
|
+
const originalName = project.config.name;
|
|
11176
11261
|
const instances = project.config.browser.instances || [];
|
|
11177
|
-
if (instances.length === 0) {
|
|
11262
|
+
if (instances.length === 0 || vitest.isExcludedByProjectFilter(originalName)) {
|
|
11178
11263
|
removeProjects.add(project);
|
|
11179
11264
|
return;
|
|
11180
11265
|
}
|
|
11181
|
-
|
|
11182
|
-
//
|
|
11266
|
+
// if original name matches a positive filter, keep all instances
|
|
11267
|
+
// otherwise, filter instances individually (user may target a specific instance name)
|
|
11183
11268
|
const filteredInstances = vitest.matchesProjectFilter(originalName) ? instances : instances.filter((instance) => {
|
|
11184
11269
|
const newName = instance.name;
|
|
11185
11270
|
return vitest.matchesProjectFilter(newName);
|
|
@@ -13248,6 +13333,12 @@ class Vitest {
|
|
|
13248
13333
|
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
13334
|
return this.coreWorkspaceProject;
|
|
13250
13335
|
}
|
|
13336
|
+
get serializedRootConfig() {
|
|
13337
|
+
return {
|
|
13338
|
+
...this.getRootProject().serializedConfig,
|
|
13339
|
+
projects: this.projects.map((project) => project.serializedConfig)
|
|
13340
|
+
};
|
|
13341
|
+
}
|
|
13251
13342
|
getProjectByName(name) {
|
|
13252
13343
|
const project = this.projects.find((p) => p.name === name) || this.coreWorkspaceProject || this.projects[0];
|
|
13253
13344
|
if (!project) throw new Error(`Project "${name}" was not found.`);
|
|
@@ -14025,6 +14116,15 @@ class Vitest {
|
|
|
14025
14116
|
return wildcardPatternToRegExp(project).test(name);
|
|
14026
14117
|
});
|
|
14027
14118
|
}
|
|
14119
|
+
/** @internal */
|
|
14120
|
+
isExcludedByProjectFilter(name) {
|
|
14121
|
+
const projects = this._config?.project || this._cliOptions?.project;
|
|
14122
|
+
if (!projects || !projects.length) return false;
|
|
14123
|
+
return toArray(projects).some((project) => {
|
|
14124
|
+
if (!project.startsWith("!")) return false;
|
|
14125
|
+
return wildcardPatternToRegExp(project.slice(1)).test(name);
|
|
14126
|
+
});
|
|
14127
|
+
}
|
|
14028
14128
|
}
|
|
14029
14129
|
function assert(condition, property, name = property) {
|
|
14030
14130
|
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}\`.`);
|
|
@@ -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 };
|
|
@@ -725,6 +725,10 @@ Update your dependencies and make sure the versions match.`));
|
|
|
725
725
|
this.coverageFiles = /* @__PURE__ */ new Map();
|
|
726
726
|
this.pendingPromises = [];
|
|
727
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
|
+
}
|
|
728
732
|
onAfterSuiteRun({ coverage, environment, projectName, testFiles }) {
|
|
729
733
|
if (!coverage) return;
|
|
730
734
|
let entry = this.coverageFiles.get(projectName || DEFAULT_PROJECT);
|
|
@@ -737,7 +741,9 @@ Update your dependencies and make sure the versions match.`));
|
|
|
737
741
|
entry[environment] ??= {};
|
|
738
742
|
// If there's a result from previous run, overwrite it
|
|
739
743
|
entry[environment][testFilenames] = filename;
|
|
740
|
-
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
|
+
});
|
|
741
747
|
this.pendingPromises.push(promise);
|
|
742
748
|
}
|
|
743
749
|
async readCoverageFiles({ onFileRead, onFinished, onDebug }) {
|
|
@@ -754,7 +760,9 @@ Update your dependencies and make sure the versions match.`));
|
|
|
754
760
|
onDebug(`Reading coverage results ${index}/${total}`);
|
|
755
761
|
}
|
|
756
762
|
await Promise.all(chunk.map(async (filename) => {
|
|
757
|
-
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
|
+
});
|
|
758
766
|
onFileRead(JSON.parse(contents));
|
|
759
767
|
}));
|
|
760
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';
|