Skip to content

feat(learn): Collecting code coverage - #7006

Merged
avivkeller merged 6 commits into
nodejs:mainfrom
avivkeller:code-coverage-learn
Mar 22, 2025
Merged

feat(learn): Collecting code coverage#7006
avivkeller merged 6 commits into
nodejs:mainfrom
avivkeller:code-coverage-learn

Conversation

@avivkeller

Copy link
Copy Markdown
Member

Description

This PR introduces a learning article on collecting code coverage in Node.js. However, it should not be merged until support for thresholds is included in the next semver-minor release, which is expected to be next week.

Related Issues

Support for code coverage: nodejs/node#46017
Support for code coverage inclusion/exclusion: nodejs/node#53553
Support for code coverage thresholds: nodejs/node#54429

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npm run format to ensure the code follows the style guide.
  • I have run npm run test to check if all tests are passing.
  • I have run npx turbo build to check if the website builds without errors.
  • [N/A] I've covered new added functionality with unit tests if necessary.

@vercel

vercelBot commented Aug 24, 2024

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

NameStatusPreviewUpdated (UTC)
nodejs-org✅ Ready (Inspect)Visit PreviewMar 22, 2025 1:36pm

@avivkeller

Copy link
Copy Markdown
MemberAuthor

This is currently marked as draft until the next semver-minor release of Node.js

@avivkeller

Copy link
Copy Markdown
MemberAuthor

@AugustinMauroyAugustinMauroy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is my first feedback, I think the introduction should be improved to put it in context. It should be remembered that the learn section is intended for non-experts.

Comment threadapps/site/pages/en/learn/test-runner/collecting-code-coverage.md Outdated
Comment threadapps/site/pages/en/learn/test-runner/collecting-code-coverage.md Outdated
Comment threadapps/site/pages/en/learn/test-runner/collecting-code-coverage.md Outdated
Comment threadapps/site/pages/en/learn/test-runner/collecting-code-coverage.md Outdated
Comment threadapps/site/pages/en/learn/test-runner/collecting-code-coverage.md Outdated
Comment threadapps/site/pages/en/learn/test-runner/collecting-code-coverage.md Outdated
Comment threadapps/site/pages/en/learn/test-runner/collecting-code-coverage.md Outdated
@vercel

vercelBot commented Aug 24, 2024

Copy link
Copy Markdown

Deployment failed with the following error:

The provided GitHub repository does not contain the requested branch or commit reference. Please ensure the repository is not empty.

@AugustinMauroyAugustinMauroy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM !

Comment threadapps/site/pages/en/learn/test-runner/collecting-code-coverage.md Outdated

@mikeestomikeesto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for writing this, reads well

Comment threadapps/site/pages/en/learn/test-runner/collecting-code-coverage.md Outdated
@avivkeller
avivkeller marked this pull request as ready for review August 25, 2024 23:35
@avivkeller
avivkeller requested a review from a team as a code ownerAugust 25, 2024 23:35
@avivkeller

avivkeller commented Aug 25, 2024

Copy link
Copy Markdown
MemberAuthor

I've undrafted this, as the release proposal for v22.8.0 is ready at nodejs/node#54560, but it still shouldn't land until that does.

The expected release date is 2024-08-26 2024-09-02

@github-actions

github-actionsBot commented Aug 26, 2024

Copy link
Copy Markdown
Contributor

Unit Test Coverage Report

LinesStatementsBranchesFunctions
Coverage: 90%
88.75% (742/836)76.1% (242/318)87.65% (142/162)

Unit Test Report

TestsSkippedFailuresErrorsTime
1820 💤0 ❌0 🔥6.096s ⏱️

@bmuenzenmeyerbmuenzenmeyer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is great - looking forward to it

@AugustinMauroy

Copy link
Copy Markdown
Member

Can we have last review form @nodejs/test_runner

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is amazing. However I'm not sure we should be landing this before having stabilized the code coverage functionality.

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is amazing. However I'm not sure we should be landing this before having stabilized the code coverage functionality.

@avivkeller

Copy link
Copy Markdown
MemberAuthor

I think this is okay to land once v22.8.0 releases, as it specifies that the --experimental-code-coverage command is needed, indicating that it is experimental. Would you like me to add a notice at the beginning that this is experimental, or just hold off until it's stabilized?

@mcollina

Copy link
Copy Markdown
Member

I think it's better to hold off until it's stable.

@AugustinMauroyAugustinMauroy added content Issues/pr concerning content learn Issues/pr concerning the learn section labels Sep 12, 2024
@ovflowd

Copy link
Copy Markdown
Member

Is there an ETA for the stabilization of it?

@avivkeller

Copy link
Copy Markdown
MemberAuthor

IMO code coverage (w/o the --enable-source-maps flag) is pretty stable. I haven't seen many bugs with it in a while.

I asked a few weeks ago, and it was pointed out that statement coverage isn't supported, however, I'm not sure if that's in the plans for the immediate future of code coverage.

The original issue tracking the stability has been closed as completed, as all tasks were completed, which might mean it's ready to be stable. I've left a comment asking.

@ovflowd

Copy link
Copy Markdown
Member

I'm fine keeping this open for the meantime, the problem is it becoming stale.

@avivkeller

Copy link
Copy Markdown
MemberAuthor

I'm also happy to close and reopen it, as chances are there will be some significant changes to the coverage reporter before stabilization, and this only collecting merge conflicts.

@ovflowdovflowd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@avivkeller has there been any change yet? I feel we could merge the PR to be honest.

@avivkeller

avivkeller commented Mar 22, 2025

Copy link
Copy Markdown
MemberAuthor

It's still experimental, but it's more stable, so I also think this can be merged.

@mcollina are you still blocking?

(I'll resolve the conflicts later today)

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

avivkellerand others added 4 commits March 22, 2025 09:26
Signed-off-by: Aviv Keller <38299977+RedYetiDev@users.noreply.github.com>
Co-authored-by: Michael Esteban <mickel13@gmail.com>
Signed-off-by: Aviv Keller <38299977+RedYetiDev@users.noreply.github.com>
Signed-off-by: Aviv Keller <redyetidev@gmail.com>
@github-actions

github-actionsBot commented Mar 22, 2025

Copy link
Copy Markdown
Contributor

Lighthouse Results

URLPerformanceAccessibilityBest PracticesSEOReport
/en🟢 93🟢 100🟢 100🟢 91🔗
/en/about🟢 100🟢 100🟢 100🟢 91🔗
/en/about/previous-releases🟢 100🟢 100🟢 100🟢 92🔗
/en/download🟢 92🟢 100🟢 100🟢 91🔗
/en/blog🟢 99🟢 100🟢 96🟢 92🔗

@avivkelleravivkeller added the github_actions:pull-request Trigger Pull Request Checks label Mar 22, 2025
@github-actionsgithub-actionsBot removed the github_actions:pull-request Trigger Pull Request Checks label Mar 22, 2025
@avivkeller
avivkeller added this pull request to the merge queueMar 22, 2025
Merged via the queue into nodejs:main with commit a42315eMar 22, 2025
@avivkeller
avivkeller deleted the code-coverage-learn branch March 22, 2025 13:44
@avivkeller

Copy link
Copy Markdown
MemberAuthor

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

Labels

contentIssues/pr concerning contentlearnIssues/pr concerning the learn section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@avivkeller@AugustinMauroy@mcollina@ovflowd@bmuenzenmeyer@aymen94@mikeesto