nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
105.22k stars 28.5k forks source link

add coverage-path and coverage-ignore-path in test_runner coverage. #51222

Open pulkit-30 opened 6 months ago

pulkit-30 commented 6 months ago

What is the problem this feature will solve?

coverage-path: to specify the path from which the coverage summary should be collected. and coverage-ignore-path: to specify the files and directories that should be ignored while collecting coverage.

these can be two cli flags also, passed along with --test-coverage flag. something like this:

node --test --experimental-test-coverage --coverage-path='./src/**' --coverage-ignore='./src/utils/**' index.test.mjs

What is the feature you are proposing to solve the problem?

currently, there is no way to include or exclude a file or directory from test coverage.

What alternatives have you considered?

No response

juanarbol commented 6 months ago

That's needs to be supported in V8

https://bugs.chromium.org/p/v8/issues/detail?id=12702&q=&start=300; I've proposed two patches for it, still work in progress

sebiniemann commented 6 months ago

I'm uncertain whether this was intended in the original post and if it would be addressed by the chromium ticket.

To evaluate the coverage at the project level, it might be beneficial if the --coverage-path is interpreted such that files without any coverage (files that were unseen by v8) are included in the report with 0% coverage. Minus the files specified via --coverage-ignore.

github-actions[bot] commented 1 week ago

There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the https://github.com/nodejs/node/labels/never-stale label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document.

RedYetiDev commented 1 week ago

FWIW this is implemented with globs in https://github.com/nodejs/node/issues/53553