Skip to content

test_runner: merge call counts of functions without block coverage - #67146

Open
codebytere wants to merge 1 commit into
nodejs:mainfrom
codebytere:test-runner-merge-function-counts
Open

codebytere wants to merge 1 commit into
nodejs:mainfrom
codebytere:test-runner-merge-function-counts

Conversation

@codebytere

Copy link
Copy Markdown
Member

When the test runner merges coverage from several processes, it treats a function entry without block coverage as carrying no data. That holds for a function that was never compiled, which V8 reports with a count of 0. It doesn't hold for a function V8 couldn't instrument, e.g. one deserialized from a code cache: V8 reports those with their call count. Depending on which report is read first, a function that ran is reported as never run.

This adds up the call counts whenever either entry lacks block coverage, and keeps the block ranges if one side has them.

Refs: #67120, which stops the compile cache from producing such entries. vm.Script with cachedData still does.


Disclosure: the code, test and this description were written by Claude Code, directed and reviewed by @codebytere.

When merging the coverage reports of several processes, an entry
without block coverage was treated as carrying no data, and was replaced
outright by an entry with block coverage. That holds for a function that
was never compiled, which V8 reports with a count of 0. It does not hold
for a function that V8 could not instrument, such as one deserialized
from a code cache or compiled before coverage started: V8 reports those
with their real call count. Depending on the order in which the reports
were read, a function that ran could be reported as never run.

Add up the call counts whenever either entry lacks block coverage, and
keep the block level ranges if one of them has them.

Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Oct 30, 2026
@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.67%. Comparing base (502c117) to head (195d2ae).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/test_runner/coverage.js 0.00% 8 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #67146   +/-   ##
=======================================
  Coverage   90.66%   90.67%           
=======================================
  Files         797      797           
  Lines      278791   278771   -20     
  Branches    53620    53610   -10     
=======================================
+ Hits       252768   252772    +4     
+ Misses      16376    16351   -25     
- Partials     9647     9648    +1     
Files with missing lines Coverage Δ
lib/internal/test_runner/coverage.js 59.95% <0.00%> (+0.14%) ⬆️

... and 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants