Skip to content

Commit

Permalink
Fix placeholder missing for implicit else.
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-burlacu-software committed Apr 1, 2022
1 parent 6f45283 commit df116e3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions packages/istanbul-reports/lib/html/annotator.js
Expand Up @@ -142,6 +142,20 @@ function annotateBranches(fileCoverage, structuredText) {
// only highlight if partial branches are missing or if there is a
// single uncovered branch.
if (sumCount > 0 || (sumCount === 0 && branchArray.length === 1)) {
debugger;
// Need to recover the metaArray placeholder item to count an implicit else
if (
branchMeta[branchName].type === 'if' &&
branchArray.length === 2 &&
metaArray.length === 1 &&
branchArray[1] === 0
) {
metaArray[1] = {
"start": {},
"end": {}
};
}

for (
i = 0;
i < branchArray.length && i < metaArray.length;
Expand Down
Binary file modified packages/istanbul-reports/lib/html/assets/favicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions packages/istanbul-reports/test/fixtures/github-649.json
Expand Up @@ -100,11 +100,6 @@
"line": 6,
"column": 5
}
}, {
"start": {
},
"end": {
}
}
],
"line": 4
Expand Down

0 comments on commit df116e3

Please sign in to comment.