danvk / source-map-explorer

Analyze and debug space usage through source maps
Apache License 2.0
3.82k stars 100 forks source link

Fix coverages for inlined code exclusion #160

Closed aholachek closed 4 years ago

aholachek commented 4 years ago

Hi, I very well might be missing something, but I believe using a filter to remove coverage entries with an empty "pathParts" array can interfere with the use of coverageIndex to index into the coverages array on line 110 of coverage.ts.

Before I made this change, I was getting inconsistent and sometimes surprising coverage visualizations. After I made the change, the coverage visualizations aligned more closely with what I was seeing in the chrome devtools.

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.01%) to 96.649% when pulling 0f1090a497ea1fcf34877236451ff062493c1f53 on aholachek:coverage-index into 2b0583a387464777b55e63ddc690a29398b5d59c on danvk:master.

aholachek commented 4 years ago

Here's an example coverage.json file that I think demonstrates the problem. The first entry is "https://www.reddit.com/", which is filtered out of the array on line 98 of coverage.ts, causing coverageIndex to shift one back.

Here is the visualization that i get from this coverage file before the fix:

Screen Shot 2020-02-03 at 11 33 26 AM

And after the fix:

Screen Shot 2020-02-03 at 11 26 05 AM

nikolay-borzov commented 4 years ago

Thanks for the contribution