Skip to content

Fix code coverage line mapping#20665

Merged
timvandermeij merged 1 commit intomozilla:masterfrom
calixteman:fix_coverage
Feb 17, 2026
Merged

Fix code coverage line mapping#20665
timvandermeij merged 1 commit intomozilla:masterfrom
calixteman:fix_coverage

Conversation

@calixteman
Copy link
Contributor

When checking the code coverage report, it was noticed that the line numbers were off. It was due to the fact that the files used for coverage were the transpiled ones, when the ones used by Codecov were the original ones. So this patches adds the source maps to the transpiled files, and also updates the license header in the original files in using a babel plugin in order to make sure the line numbers are correct.
As a side effect of this work, it's now possible to have the correct line numbers in the stack traces when running tests with the transpiled files.

@codecov-commenter
Copy link

codecov-commenter commented Feb 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.69%. Comparing base (c574694) to head (2b57ef4).
⚠️ Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20665      +/-   ##
==========================================
+ Coverage   59.79%   62.69%   +2.90%     
==========================================
  Files         169      169              
  Lines       90158   119614   +29456     
==========================================
+ Hits        53907    74996   +21089     
- Misses      36251    44618    +8367     
Flag Coverage Δ
unittestcli 62.69% <ø> (+2.90%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@Snuffleupagus
Copy link
Collaborator

[...] and also updates the license header in the original files in using a babel plugin in order to make sure the line numbers are correct.

Would it perhaps work to just generate the lib target files with the following license header instead, since that may avoid having to do the replacement mentioned above?

const licenseHeader = fs.readFileSync("./src/license_header.js").toString();

Note that originally the lib target was distributed via pdfjs-dist, but that was removed years ago and now we only use it for the Node.js unit-tests so the "simpler" license header file ought to suffice now.

When checking the code coverage report, it was noticed that the line numbers were off.
It was due to the fact that the files used for coverage were the transpiled ones,
when the ones used by Codecov were the original ones.
So this patches adds the source maps to the transpiled files, and also updates
the license header in the original files in using a babel plugin in order
to make sure the line numbers are correct.
As a side effect of this work, it's now possible to have the correct line
numbers in the stack traces when running tests with the transpiled files.
@timvandermeij
Copy link
Contributor

/botio-linux preview

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://54.241.84.105:8877/b7509042696054e/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/b7509042696054e/output.txt

Total script time: 1.07 mins

Published

@timvandermeij timvandermeij merged commit cfc93e2 into mozilla:master Feb 17, 2026
12 checks passed
@timvandermeij
Copy link
Contributor

Nice find! I went over the new coverage report and the previously identified issues are no longer there, so this looks a lot better.

@Snuffleupagus Snuffleupagus removed their request for review March 3, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants