ljharb / istanbul-merge

Merge multiple istanbul coverage reports into one.
MIT License
54 stars 7 forks source link

Out-of-the-box reporter #33

Open jjangga0214 opened 4 years ago

jjangga0214 commented 4 years ago

What if istanbul-merge provides istanbul reporter options??

ljharb commented 4 years ago

Can you elaborate? This project is to merge raw JSON files, that you can then feed into nyc/istanbul yourself with whatever reporters you like.

jjangga0214 commented 4 years ago

Thanks for the response and suggestion :)

Can you elaborate?

For example,

# This would generate not only `coverage.raw.json`, but also merged `html` report. 
istanbul-merge \
  --out coverage.raw.json \ 
  --reporter html \ 
  coverage1/coverage.raw.json \
  coverage2/coverage.raw.json

you can then feed into nyc/istanbul yourself with whatever reporters you like.

May I ask how nyc can generate report by given coverage.raw.json? I couldn't find certain usages from its docs.

ljharb commented 4 years ago

https://github.com/airbnb/jest-wrap/blob/2e5c948a113ce4357d627e2d11ffea6944cfc215/package.json#L70 is how to do it with istanbul. I haven't set it up with nyc yet but I can't imagine it's any different.