Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Istanbul doesn't ignore nested if, when not executed #948

Open
danziamo opened this issue Dec 15, 2021 · 0 comments
Open

Istanbul doesn't ignore nested if, when not executed #948

danziamo opened this issue Dec 15, 2021 · 0 comments

Comments

@danziamo
Copy link

danziamo commented Dec 15, 2021

Hello,

const wrongbranch = () => {
  const a = 2;
  if (a === 1) {
    console.log("test");
    /* istanbul ignore if */
    if (a === 3) {
      console.log("another test")
    }
  }
  return 3;
}

Saying that second if path is not taken, even though first if was not executed

However when ignore if is replaced with ignore next it displays properly and calculates branches properly

const wrongbranch = () => {
  const a = 2;
  if (a === 1) {
    console.log("test");
    /* istanbul ignore next */
    if (a === 3) {
      console.log("another test")
    }
  }
  return 3;
}

Is this a bug? or it is supposed to be like that?

Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant