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

test_runner: report covered lines, functions and branches to reporters #49320

Merged

Conversation

philnash
Copy link
Contributor

Fixes #49303.

This is a breaking change for the format of test:coverage events. But the test coverage is still experimental, so I don't believe it requires a semver-major bump.

@nodejs-github-bot
Copy link
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 Aug 25, 2023
@philnash philnash force-pushed the test-runner-coverage-covered-lines branch from ada1bd1 to 7a1b7f4 Compare August 25, 2023 05:52
lib/internal/test_runner/coverage.js Outdated Show resolved Hide resolved
lib/internal/test_runner/coverage.js Show resolved Hide resolved
lib/internal/test_runner/coverage.js Show resolved Hide resolved
lib/internal/test_runner/coverage.js Outdated Show resolved Hide resolved
lib/internal/test_runner/coverage.js Outdated Show resolved Hide resolved
Comment on lines +344 to +345
if (count > 0 && startOffset <= line.startOffset &&
endOffset >= line.endOffset) {
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
if (count > 0 && startOffset <= line.startOffset &&
endOffset >= line.endOffset) {
if (
count > 0
&& startOffset <= line.startOffset
&& endOffset >= line.endOffset
) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This matches the existing style, in particular the conditional directly above it. I've tried to stay away from changing formatting too much.

lib/internal/test_runner/utils.js Outdated Show resolved Hide resolved
This is a breaking change for the format of test:coverage events. But
the test coverage is still experimental, so I don't believe it requires
a semver-major bump.

Fixes nodejs#49303
@philnash philnash force-pushed the test-runner-coverage-covered-lines branch from 7a1b7f4 to 9dba88a Compare August 25, 2023 05:56
@rluvaton
Copy link
Member

rluvaton commented Aug 25, 2023

Can you please add a test? It's weird that no tests broke...

Copy link
Member

@benjamingr benjamingr left a comment

Choose a reason for hiding this comment

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

Mostly looks good, a test is missing

@philnash
Copy link
Contributor Author

Thanks for the reviews so far. It shouldn't be weird that the tests didn't break, they currently only test the output of the test reporters and each reporter that handles coverage was also refactored to handle this change.

I'll add a test now that checks the full coverage output.

Removed additional loop from calculating max counts for functions.
Simplified reporting of count for each line.
Returned arrow function to implicit return.
@philnash philnash force-pushed the test-runner-coverage-covered-lines branch from b023ec4 to e0dd2d4 Compare August 28, 2023 00:53
Copy link
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.

I think we might want to mark this as a notable-change PRs with changes that should be highlighted in changelogs. .
@cjihrig @MoLow WDYT?

@atlowChemi atlowChemi added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 28, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 28, 2023
@nodejs-github-bot
Copy link
Collaborator

@philnash
Copy link
Contributor Author

I think this needs the request-ci tag again. I think it was my fault that the Jenkins CI failed, and it should be fine this time.

@rluvaton rluvaton added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 29, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 29, 2023
@nodejs-github-bot
Copy link
Collaborator

@atlowChemi
Copy link
Member

I think it was my fault that the Jenkins CI failed, and it should be fine this time.

There was a downtime with one of the CI jobs, that why I didn't bother rerunning after your new commit 🙂

@philnash
Copy link
Contributor Author

I think it was my fault that the Jenkins CI failed, and it should be fine this time.

There was a downtime with one of the CI jobs, that why I didn't bother rerunning after your new commit 🙂

Ah, I see. Good to see that it's not down any more and all the builds ran successfully!

Does this mean we can remove the needs-ci label and consider merging?

@atlowChemi
Copy link
Member

Does this mean we can remove the needs-ci label and consider merging?

No need to remove the label 🙂
The rule about merging is a minimum of 48 hours with 2 approvers, or 7 days with 1, so unfortunately this can't be merged yet...

Copy link
Member

@MoLow MoLow left a comment

Choose a reason for hiding this comment

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

LGTM, since coverage is experimental we are good in terms of semver-major

@MoLow
Copy link
Member

MoLow commented Aug 30, 2023

I think we might want to mark this as a notable-change .

@atlowChemi why?

@atlowChemi
Copy link
Member

I think we might want to mark this as a notable-change .

@atlowChemi why?

This is breaking the behavior of an existing feature, which is ok as it is experimental, but I find it worth noting

@atlowChemi atlowChemi added experimental Issues and PRs related to experimental features. commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Aug 30, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 30, 2023
@nodejs-github-bot nodejs-github-bot merged commit 3a6a80a into nodejs:main Aug 30, 2023
33 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 3a6a80a

@rluvaton
Copy link
Member

Thank you @philnash for your contribution! We hope to see you again 😀

@philnash
Copy link
Contributor Author

Thanks @rluvaton, I'm working on one more thing at the moment, so you're going to see more of me 😄

UlisesGascon pushed a commit that referenced this pull request Sep 10, 2023
This is a breaking change for the format of test:coverage events. But
the test coverage is still experimental, so I don't believe it requires
a semver-major bump.

Fixes #49303

PR-URL: #49320
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
@UlisesGascon UlisesGascon mentioned this pull request Sep 10, 2023
alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
This is a breaking change for the format of test:coverage events. But
the test coverage is still experimental, so I don't believe it requires
a semver-major bump.

Fixes nodejs#49303

PR-URL: nodejs#49320
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. experimental Issues and PRs related to experimental features. 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.

More detail from test_runner coverage report
7 participants