Created
September 26, 2019 06:32
-
-
Save isaacs/987fc367e2422ba782de9298586ea5c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const test = n => { | |
if (n === 1) { | |
console.log(n) | |
} else if (n === 2) { | |
console.log(2) | |
} /* istanbul ignore next */ else if (1 === 2) { | |
console.log('math is broken') | |
} else { | |
console.log('n is some other thing') | |
} | |
} | |
test(1) | |
test(2) | |
test(3) | |
// gets 100% coverage, but STILL gets 100% coverage if test(3) removed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const test = n => { | |
if (n === 1) { | |
console.log(n) | |
} else if (n === 2) { | |
console.log(2) | |
} else /* istanbul ignore if */ if (1 === 2) { | |
console.log('math is broken') | |
} else { | |
console.log('n is some other thing') | |
} | |
} | |
test(1) | |
test(2) | |
test(3) | |
// does not get 100% coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const test = n => { | |
if (n === 1) { | |
console.log(n) | |
} else if (n === 2) { | |
console.log(2) | |
} else { | |
/* istanbul ignore if */ | |
if (1 === 2) { | |
console.log('math is broken') | |
} else { | |
console.log('n is some other thing') | |
} | |
} | |
} | |
test(1) | |
test(2) | |
test(3) | |
// gets 100% coverage, fails 100% coverage if test(3) omitted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment