node
node copied to clipboard
test: support glob matching coverage files
Fixes #53508 Fixes #51222
This Pull Request introduces two new command-line interface flags to Node.js:
--test-coverage-include: Allows users to specify glob patterns to include specific files in the coverage report.--test-coverage-exclude: Allows users to specify glob patterns to exclude specific files from the coverage report.
Notable change text, if any:
Individual file patterns can now be excluded or exclusively included in coverage reports:
- To exclude a specific pattern, use `--test-coverage-exclude`. For example:
```bash
node --experimental-test-coverage --test-coverage-exclude=**/*.test.js path/to/test.js
```
This command excludes all files ending with `.test.js` from the coverage report.
- To include only files that match a specific pattern, use `--test-coverage-include`. For example:
```bash
node --experimental-test-coverage --test-coverage-include=src/**/*.js path/to/test.js
```
This command includes only `.js` files located in the `src` directory and its subdirectories in the coverage report.
Both options can be specified multiple times to match multiple glob patterns. If both options are used in unison, files will need to abide by both guidelines.
Review requested:
- [ ] @nodejs/test_runner
Blocked by #52881 - This PR relies on the path.matchesGlob method to match the coverage files.
(Test failures will disappear once the blocking PR lands)
If a PR relies on a semver-minor change, does it become semver-minor?
please take a look at the test failures
Thanks! I'll made those changes!
I've also unblocked the PR because the blocking PR has landed
Nice one! β€οΈ
About the
runoption, will those new options be supported?Ideally, as we have
filesoption, it'd be nice to be able to pass the coverage exclusion files too.
I'm not planning on that, this is specific to coverage, not all of testing.
I need to review the new test failures, I'll address them when I get a chance
Hey, if someone could approve + CI, that would help this move to author-ready. Thanks!
CI: https://ci.nodejs.org/job/node-test-pull-request/59978/
CI: https://ci.nodejs.org/job/node-test-pull-request/59979/
CI: https://ci.nodejs.org/job/node-test-pull-request/59980/
@RedYetiDev please resolve conflicts
@MoLow I've resolved the conflicts via the Github UI, but I know the bot isn't always happy with that. Let me know if it fails to land, and I'll rebase manually.
@RedYetiDev merge commits tend to cause failures in Jenkins CI, could you rebase?
Just as a side note, please donβt consider this as a blocker for this change. Iβm working on this from the V8 side. Take this discussion as a reference.
https://chromium-review.googlesource.com/c/v8/v8/+/5042949
Maybe once landed this could be potentially easier to implement after cherry picking?
~~:thinking: the CI bot seems to have not picked this up, re-adding label. LMK if I'm missing something.~~
edit: I see the CI is undergoing some changes, I guess it's just waiting.
@RedYetiDev CI is in lock-down for security release & maintenance
CI: https://ci.nodejs.org/job/node-test-pull-request/60046/
I think CI passed, but I don't have permission to verify that.
This needs to land manually to amend the message and squash. I am away from computer so will do when I am back
CI: https://ci.nodejs.org/job/node-test-pull-request/60150/
@MoLow did you ever get a chance to prepare for manually land?
CI: https://ci.nodejs.org/job/node-test-pull-request/60309/
CI passed π
The https://github.com/nodejs/node/labels/notable-change label has been added by @benjamingr.
Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section.
Landed in 4174b731537367db8195da2d1182c90a738fc9f6
This was merged with the wrong subsystem (it should be test_runner: IIUC)
It looks like the commit message was edited when it landed on v22.x: https://github.com/nodejs/node/commit/3a0fcbb17a6dc37ac7463c01cdc0d633e4ac026b
I'm marking this as backported so it doesn't show up in branch-diff's output.
Why should this not land on 20.x?