istanbuljs / nyc

the Istanbul command line interface
https://istanbul.js.org/
ISC License
5.54k stars 353 forks source link

Is there a way to filter files in the stage `nyc report` ? #1551

Open xuzhaocheng opened 3 months ago

xuzhaocheng commented 3 months ago

I want to generate all code coverage data but only show some files' coverage in the final report. I found the --include option doesn't work in the nyc report command. Is there a way to make it work in nyc report ? Or is there any workaround? I found the merged coverage.json contains all files' coverage data. Can I modify the coverage.json' by keeping the file entries I am interested in, removing others, and then using the modified json as the input tonyc report` ?

Link to bug demonstration repository

N/A

Expected Behavior

--include and --exclude options should work in nyc report

Observed Behavior

--include and --exclude options don't work in the command nyc report

Troubleshooting steps

Environment Information

N/A