c8
c8 copied to clipboard
Implicit `else` clause is not considered in coverage.
Consider the code below.
const x = 'asdf'
const fn = y => {
if (typeof y !== 'object') {
y = 'yup'
}
console.log(y)
}
fn(x)
The code branches on the if statement and the behavior changes if it’s false, but there isn’t an explicit else clause.
When running nyc this correctly says that only 50% of the branch coverage was detected, but in c8 it reports that 100% of the branch coverage was covered. The output can be found in this gist.
@mikeal I owe you a corresponding bug on the Chrome issue tracker, haven't forgotten about this.
I have opened a corresponding issue in v8 here:
https://bugs.chromium.org/p/v8/issues/detail?id=10627