Skip to content

test_runner: ignore erased TS lines in coverage#63510

Open
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:fix-test-coverage-import-type
Open

test_runner: ignore erased TS lines in coverage#63510
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:fix-test-coverage-import-type

Conversation

@mcollina
Copy link
Copy Markdown
Member

@mcollina mcollina commented May 23, 2026

  • ignore TypeScript lines that are erased before runtime when source-map coverage is reported
  • use the internal TypeScript stripper to detect type-only lines in mapped sources
  • add a regression test for import type coverage with --enable-source-maps

Fixes: #54753

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/loaders
  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels May 23, 2026
@mcollina mcollina marked this pull request as ready for review May 23, 2026 13:27
Fixes: nodejs#54753
Signed-off-by: Matteo Collina <matteo.collina@gmail.com>
@mcollina mcollina force-pushed the fix-test-coverage-import-type branch from ea0e334 to afed6fc Compare May 23, 2026 13:30
@codecov
Copy link
Copy Markdown

codecov Bot commented May 23, 2026

Codecov Report

❌ Patch coverage is 14.10256% with 67 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.11%. Comparing base (8d3245e) to head (afed6fc).
⚠️ Report is 32 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/test_runner/coverage.js 12.50% 63 Missing ⚠️
lib/internal/modules/typescript.js 33.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63510      +/-   ##
==========================================
- Coverage   90.14%   90.11%   -0.04%     
==========================================
  Files         718      718              
  Lines      227984   228059      +75     
  Branches    42835    42832       -3     
==========================================
- Hits       205522   205520       -2     
- Misses      14235    14318      +83     
+ Partials     8227     8221       -6     
Files with missing lines Coverage Δ
lib/internal/modules/typescript.js 90.65% <33.33%> (-1.66%) ⬇️
lib/internal/test_runner/coverage.js 59.58% <12.50%> (-4.61%) ⬇️

... and 49 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.

Copy link
Copy Markdown
Member

@atlowChemi atlowChemi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcollina what would be the performance price of this change?

@mcollina
Copy link
Copy Markdown
Member Author

I have no idea tbh, do we have any bench for coverage? I'm mostly focusing on correctness/getting coverage out of experimental.

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label May 24, 2026
@atlowChemi
Copy link
Copy Markdown
Member

I have no idea tbh, do we have any bench for coverage? I'm mostly focusing on correctness/getting coverage out of experimental.

I recalled @avivkeller added one, but I can't find one, so I guess we don't 🤷🏽‍♂️

@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 24, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@trivikr
Copy link
Copy Markdown
Member

trivikr commented May 25, 2026

The merge conflict in debian12-x64 CI is reported in nodejs/build#4345

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

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

Labels

module Issues and PRs related to the module subsystem. 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.

--experimental-test-coverage falsely reports missing coverage where TS source is import type

6 participants