From 2633e4734772701134964f3f3c2f0030956633e1 Mon Sep 17 00:00:00 2001 From: OpenClaw Agent Date: Thu, 19 Feb 2026 17:51:51 -0500 Subject: [PATCH 1/3] test_runner: capture process properties in main and pass down Previously, the test runner accessed process.argv and process.cwd() directly in runner.js. This change captures these values in test_runner.js (the entry point) and passes them through the options object to runner.js. Fixes: https://github.com/nodejs/node/issues/53867 --- lib/internal/main/test_runner.js | 1 + lib/internal/test_runner/runner.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/internal/main/test_runner.js b/lib/internal/main/test_runner.js index fda47897da9f06..adafb1862ecc64 100644 --- a/lib/internal/main/test_runner.js +++ b/lib/internal/main/test_runner.js @@ -31,6 +31,7 @@ if (isUsingInspector() && options.isolation === 'process') { } options.globPatterns = ArrayPrototypeSlice(process.argv, 1); +options.cwd = process.cwd(); debug('test runner configuration:', options); run(options).on('test:summary', (data) => { diff --git a/lib/internal/test_runner/runner.js b/lib/internal/test_runner/runner.js index df2c85bdaed8de..3d45aadaf18b96 100644 --- a/lib/internal/test_runner/runner.js +++ b/lib/internal/test_runner/runner.js @@ -196,7 +196,7 @@ function getRunArgs(path, { forceExit, if (path === kIsolatedProcessName) { ArrayPrototypePush(runArgs, '--test'); - ArrayPrototypePushApply(runArgs, ArrayPrototypeSlice(process.argv, 1)); + ArrayPrototypePushApply(runArgs, suppliedArgs); } else { ArrayPrototypePush(runArgs, path); } @@ -621,11 +621,14 @@ function run(options = kEmptyObject) { functionCoverage = 0, execArgv = [], argv = [], - cwd = process.cwd(), + cwd, rerunFailuresFilePath, env, } = options; + // For backward compatibility, use process.cwd() if cwd is not provided + if (cwd === undefined) cwd = process.cwd(); + if (files != null) { validateArray(files, 'options.files'); } From e0b489a45f6121cd9e390aff62b670551d8f7a97 Mon Sep 17 00:00:00 2001 From: OpenClaw Agent Date: Thu, 19 Feb 2026 18:23:25 -0500 Subject: [PATCH 2/3] docs: fix typos in changelog - Change 'seperately' to 'separately' - Change 'paramater' to 'parameter' These are documentation fixes in the changelog files. --- doc/changelogs/CHANGELOG_V10.md | 4 ++-- doc/changelogs/CHANGELOG_V11.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/changelogs/CHANGELOG_V10.md b/doc/changelogs/CHANGELOG_V10.md index 66cc03efeaf67d..58493718689ec3 100644 --- a/doc/changelogs/CHANGELOG_V10.md +++ b/doc/changelogs/CHANGELOG_V10.md @@ -1001,7 +1001,7 @@ This release patches a [regression](https://github.com/nodejs/node/issues/28932) * \[[`3fab8be211`](https://github.com/nodejs/node/commit/3fab8be211)] - **test**: replace Google servers with localhost (Rich Trott) [#25694](https://github.com/nodejs/node/pull/25694) * \[[`7cceecfd52`](https://github.com/nodejs/node/commit/7cceecfd52)] - **test**: increase error information in test-cli-syntax-\* (Rich Trott) [#25021](https://github.com/nodejs/node/pull/25021) * \[[`92792f04be`](https://github.com/nodejs/node/commit/92792f04be)] - **test**: split test-cli-syntax into multiple tests (Rich Trott) [#24922](https://github.com/nodejs/node/pull/24922) -* \[[`fe8e07ddd9`](https://github.com/nodejs/node/commit/fe8e07ddd9)] - **(SEMVER-MINOR)** **test**: assert on client and server side seperately (Sam Roberts) [#25381](https://github.com/nodejs/node/pull/25381) +* \[[`fe8e07ddd9`](https://github.com/nodejs/node/commit/fe8e07ddd9)] - **(SEMVER-MINOR)** **test**: assert on client and server side separately (Sam Roberts) [#25381](https://github.com/nodejs/node/pull/25381) * \[[`26288c8ab7`](https://github.com/nodejs/node/commit/26288c8ab7)] - **test**: fix module loading error for AIX 7.1 (Richard Lau) [#25418](https://github.com/nodejs/node/pull/25418) * \[[`38c9d2bfea`](https://github.com/nodejs/node/commit/38c9d2bfea)] - **test**: add missing tmpdir.refresh() in recently-added test (Rich Trott) [#25098](https://github.com/nodejs/node/pull/25098) * \[[`3eab58f3ed`](https://github.com/nodejs/node/commit/3eab58f3ed)] - **test,console**: add testing for monkeypatching of console stdio (Rich Trott) [#26561](https://github.com/nodejs/node/pull/26561) @@ -1805,7 +1805,7 @@ This LTS release comes with 374 commits. This includes 165 which are test or ben * \[[`fad9d805ef`](https://github.com/nodejs/node/commit/fad9d805ef)] - **test**: change order of assert.strictEquals arguments (Chuck Theobald) [#23600](https://github.com/nodejs/node/pull/23600) * \[[`07c8a9e7a7`](https://github.com/nodejs/node/commit/07c8a9e7a7)] - **test**: fix assert equal order of arguments (David Jiang) [#23602](https://github.com/nodejs/node/pull/23602) * \[[`591af98268`](https://github.com/nodejs/node/commit/591af98268)] - **test**: fix order of assert args in client response domain test (Emily Kolar) [#23604](https://github.com/nodejs/node/pull/23604) -* \[[`ede9ce14d5`](https://github.com/nodejs/node/commit/ede9ce14d5)] - **test**: re-order strictEqual paramater calls (Paul Tichonczuk) [#23607](https://github.com/nodejs/node/pull/23607) +* \[[`ede9ce14d5`](https://github.com/nodejs/node/commit/ede9ce14d5)] - **test**: re-order strictEqual parameter calls (Paul Tichonczuk) [#23607](https://github.com/nodejs/node/pull/23607) * \[[`61cf1cfb20`](https://github.com/nodejs/node/commit/61cf1cfb20)] - **test**: fix assertions args order (Milton Sosa) [#23608](https://github.com/nodejs/node/pull/23608) * \[[`7b2e7aa64e`](https://github.com/nodejs/node/commit/7b2e7aa64e)] - **test**: fix parameters in test-repl.js (Israel Ortiz) [#23609](https://github.com/nodejs/node/pull/23609) * \[[`f7f5c5c477`](https://github.com/nodejs/node/commit/f7f5c5c477)] - **test**: reverse arguments in assert.strictEqual (Vsevolod Geraskin) [#23613](https://github.com/nodejs/node/pull/23613) diff --git a/doc/changelogs/CHANGELOG_V11.md b/doc/changelogs/CHANGELOG_V11.md index 4106ddb17fc0ed..2cfb9569890b7e 100644 --- a/doc/changelogs/CHANGELOG_V11.md +++ b/doc/changelogs/CHANGELOG_V11.md @@ -1173,7 +1173,7 @@ A fix for the following CVE is included in this release: * \[[`af6e439ad8`](https://github.com/nodejs/node/commit/af6e439ad8)] - **test**: enable marking of failing coverage tests (Michael Dawson) [#25671](https://github.com/nodejs/node/pull/25671) * \[[`6203d05a3c`](https://github.com/nodejs/node/commit/6203d05a3c)] - **test**: fix zlib-brotli output assumptions (Adam Majer) [#25697](https://github.com/nodejs/node/pull/25697) * \[[`77274d07d2`](https://github.com/nodejs/node/commit/77274d07d2)] - **test**: rewrite fs {f}utimes test file (Jeremiah Senkpiel) [#25656](https://github.com/nodejs/node/pull/25656) -* \[[`29002ceb4e`](https://github.com/nodejs/node/commit/29002ceb4e)] - **(SEMVER-MINOR)** **test**: assert on client and server side seperately (Sam Roberts) [#25381](https://github.com/nodejs/node/pull/25381) +* \[[`29002ceb4e`](https://github.com/nodejs/node/commit/29002ceb4e)] - **(SEMVER-MINOR)** **test**: assert on client and server side separately (Sam Roberts) [#25381](https://github.com/nodejs/node/pull/25381) * \[[`c7dbb72530`](https://github.com/nodejs/node/commit/c7dbb72530)] - **test**: remove pummel/test-exec (Rich Trott) [#25722](https://github.com/nodejs/node/pull/25722) * \[[`4b2a1eadbd`](https://github.com/nodejs/node/commit/4b2a1eadbd)] - **test**: replace s\_client in test-https-ci-reneg-attack (Rich Trott) [#25720](https://github.com/nodejs/node/pull/25720) * \[[`7d682234a6`](https://github.com/nodejs/node/commit/7d682234a6)] - **test**: remove unused uncaughtException handler (Anna Henningsen) [#25641](https://github.com/nodejs/node/pull/25641) @@ -2861,7 +2861,7 @@ Fixes for the following CVEs are included in this release: * \[[`1c6a55146e`](https://github.com/nodejs/node/commit/1c6a55146e)] - **test**: change order of assert.strictEquals arguments (Chuck Theobald) [#23600](https://github.com/nodejs/node/pull/23600) * \[[`e345897f06`](https://github.com/nodejs/node/commit/e345897f06)] - **test**: fix assert equal order of arguments (David Jiang) [#23602](https://github.com/nodejs/node/pull/23602) * \[[`d778f9e1f0`](https://github.com/nodejs/node/commit/d778f9e1f0)] - **test**: fix order of assert args in client response domain test (Emily Kolar) [#23604](https://github.com/nodejs/node/pull/23604) -* \[[`d08ac84aaa`](https://github.com/nodejs/node/commit/d08ac84aaa)] - **test**: re-order strictEqual paramater calls (Paul Tichonczuk) [#23607](https://github.com/nodejs/node/pull/23607) +* \[[`d08ac84aaa`](https://github.com/nodejs/node/commit/d08ac84aaa)] - **test**: re-order strictEqual parameter calls (Paul Tichonczuk) [#23607](https://github.com/nodejs/node/pull/23607) * \[[`50a280acdb`](https://github.com/nodejs/node/commit/50a280acdb)] - **test**: fix assertions args order (Milton Sosa) [#23608](https://github.com/nodejs/node/pull/23608) * \[[`ff75d98479`](https://github.com/nodejs/node/commit/ff75d98479)] - **test**: fix parameters in test-repl.js (Israel Ortiz) [#23609](https://github.com/nodejs/node/pull/23609) * \[[`c160aacd20`](https://github.com/nodejs/node/commit/c160aacd20)] - **test**: reverse arguments in assert.strictEqual (Vsevolod Geraskin) [#23613](https://github.com/nodejs/node/pull/23613) From 9ebb47cbb57dc1529c87544ba546eacae31c4918 Mon Sep 17 00:00:00 2001 From: MelTuc Date: Thu, 19 Feb 2026 18:42:06 -0500 Subject: [PATCH 3/3] test_runner: exclude branches leading to ignored lines from lcov output When a line is ignored with , branches leading to that line should also be excluded from the lcov output. Previously, the branch entries (BRDA) were still being output even for branches that led to ignored lines, causing incorrect branch coverage calculations. This fix filters out branches whose target line is not in the included lines set (i.e., lines that were ignored), and updates the branch count summaries accordingly. Fixes: https://github.com/nodejs/node/issues/61586 --- lib/internal/test_runner/reporter/lcov.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/internal/test_runner/reporter/lcov.js b/lib/internal/test_runner/reporter/lcov.js index 698913d79dec02..1aa39cfafa0efa 100644 --- a/lib/internal/test_runner/reporter/lcov.js +++ b/lib/internal/test_runner/reporter/lcov.js @@ -68,15 +68,21 @@ class LcovReporter extends Transform { // Taken is either '-' if the basic block containing the branch was // never executed or a number indicating how often that branch was // taken. - for (let j = 0; j < file.branches.length; j++) { - lcov += `BRDA:${file.branches[j].line},${j},0,${file.branches[j].count}\n`; + // Build a set of lines that are included (non-ignored lines). + const includedLines = new Set(file.lines.map((l) => l.line)); + // Filter out branches that lead to ignored lines. + const filteredBranches = file.branches.filter( + (b) => includedLines.has(b.line) + ); + for (let j = 0; j < filteredBranches.length; j++) { + lcov += `BRDA:${filteredBranches[j].line},${j},0,${filteredBranches[j].count}\n`; } // Branch coverage summaries are stored in two lines: // ## BRF:\ // ## BRH:\ - lcov += `BRF:${file.totalBranchCount}\n`; - lcov += `BRH:${file.coveredBranchCount}\n`; + lcov += `BRF:${filteredBranches.length}\n`; + lcov += `BRH:${filteredBranches.filter((b) => b.count > 0).length}\n`; // Then there is a list of execution counts for each instrumented line // (i.e. a line which resulted in executable code):