Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(learn): Collecting code coverage #7006

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

avivkeller
Copy link
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.

Copy link

vercel bot commented Aug 24, 2024

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

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Sep 26, 2024 5:03pm

@avivkeller
Copy link
Member Author

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

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

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.

@avivkeller avivkeller force-pushed the code-coverage-learn branch from ee241d0 to f26b449 Compare August 24, 2024 17:12
Copy link

vercel bot commented Aug 24, 2024

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.

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

LGTM !

Signed-off-by: Aviv Keller <[email protected]>
Copy link
Member

@mikeesto mikeesto left a comment

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

Co-authored-by: Michael Esteban <[email protected]>
Signed-off-by: Aviv Keller <[email protected]>
@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 owner August 25, 2024 23:35
@avivkeller
Copy link
Member Author

avivkeller commented Aug 25, 2024

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

Copy link
Contributor

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 92%
90.54% (594/656) 76.29% (177/232) 94.57% (122/129)

Unit Test Report

Tests Skipped Failures Errors Time
131 0 💤 0 ❌ 0 🔥 6.027s ⏱️

Copy link
Collaborator

@bmuenzenmeyer bmuenzenmeyer left a comment

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
Member

Can we have last review form @nodejs/test_runner

Copy link
Member

@mcollina mcollina left a comment

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.

Copy link
Member

@mcollina mcollina left a comment

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
Member Author

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
Member

mcollina commented Sep 2, 2024

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

@AugustinMauroy AugustinMauroy added content Issues/pr concerning content learn Issues/pr concerning the learn section labels Sep 12, 2024
Signed-off-by: Aviv Keller <[email protected]>
@ovflowd
Copy link
Member

ovflowd commented Oct 28, 2024

Is there an ETA for the stabilization of it?

@avivkeller
Copy link
Member Author

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
Member

ovflowd commented Nov 17, 2024

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

@avivkeller
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked content Issues/pr concerning content learn Issues/pr concerning the learn section
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants