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.