c8
c8 copied to clipboard
bug: finally block in async function indicates incorrect missing block coverage
Observed Behavior
The following code:
async function abc() {
try {
return 'abc';
} finally {
console.log('in finally');
} // this is a covered line but uncovered branch
}
abc()
Ends up having the following coverage output:
{
"functionName": "abc",
"ranges": [
{
"startOffset": 0,
"endOffset": 146,
"count": 1
},
{
"startOffset": 97,
"endOffset": 145,
"count": 0
}
],
"isBlockCoverage": true
}
}
This indicates that the following characters were tracked as an uncovered block:
// this is a covered line but uncovered branch\n
Expected behavior
Coverage should be 100% in the above example.