Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant