This will cause the for-loop below to never be run; causing false positive because matchingBundles.length will equal to 1.
coveragePaths.forEach((partsA, coverageIndex) => {
let matchingBundles = [...bundlesPaths];
// Start from filename and go up to path root
for (let i = 0; i < partsA.length; i++) {
matchingBundles = matchingBundles.filter(
([partsB]) => i < partsB.length && partsB[i] === partsA[i]
);
// Stop when exact (among bundles) match found or no matches found
if (matchingBundles.length <= 1) {
break;
}
}
if (matchingBundles.length === 1) {
const [[, bundleIndex]] = matchingBundles;
bundles[bundleIndex].coverageRanges = convertRangesToLinesRanges(coverages[coverageIndex]);
}
});
Coverage increased (+0.2%) to 96.552% when pulling 3bf62334f6b953d5952f4c84a38e019d8242cb03 on jackyef:master into 3d3a00735ab1650f722d2f296a5cfb01c48523a6 on danvk:master.
In Chrome-generated coverage.json, scripts inlined to HTML doc will have the url of the HTML document.
Example:
{ url: "https://google.com/", ranges: [...] }
When this happens, we ended up with an empty array inside
coveragePaths
.This will cause the
for-loop
below to never be run; causing false positive because matchingBundles.length will equal to 1.