node icon indicating copy to clipboard operation
node copied to clipboard

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

Open pulkit-30 opened this issue 2 years ago • 4 comments

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

pulkit-30 avatar Dec 19 '23 17:12 pulkit-30

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

juanarbol avatar Dec 19 '23 20:12 juanarbol

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.

sebiniemann avatar Dec 28 '23 18:12 sebiniemann

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.

github-actions[bot] avatar Jun 26 '24 01:06 github-actions[bot]

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

avivkeller avatar Jun 26 '24 01:06 avivkeller