Ignore if without else
vldwbx opened this issue · 0 comments
vldwbx commented
I am doing code coverage of an app running live and need to ignore some guard conditions that never are covered when app is running live. I tried all options below and still have red flag near my if statement:
1: Ignore if and else in one tag
/* istanbul ignore if|else */
if (A) {
throw new Error("..null or undefined.");
}
2: Ignore if and else in two tags
/* istanbul ignore if */
/* istanbul ignore else */
if (A) {
throw new Error("..null or undefined.");
}
3: Ignore else, then ignore code inside if with 'next':
/* istanbul ignore else */
if (A) {
/* istanbul ignore next */
throw new Error("..null or undefined.");
}
4: Ignore if:
/* istanbul ignore if */
if (A) {
throw new Error("..null or undefined.");
}
5: Ignore with multiple next's:
/* istanbul ignore next */
if (A) {
/* istanbul ignore next */
throw new Error("..null or undefined.");
}