cenfun / monocart-coverage-reports

A code coverage tool to generate native V8 reports or Istanbul reports.
MIT License
31 stars 5 forks source link

fix: improve `AddedResults` and `CoverageResults` types #42

Closed mrazauskas closed 2 months ago

mrazauskas commented 2 months ago

Currently CoverageResults needs to be wrapped with NonNullable to be consumed in the user land. Example: https://github.com/tstyche/tstyche/blob/a8479a1641971560eb341222fa184546826beb2b/scripts/merge-coverage-reports.js#L8

Also note that getSnapshot() method does not handle undefined, but reportData is typed as a union with undefined: https://github.com/cenfun/monocart-coverage-reports/blob/6a4360272460b8b5011b0c51a03360cce893fcaa/lib/utils/snapshot.js#L228-L231

This PR fixes both of these issues.