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

Chained conditionals break branch ignore hints #468

Closed
coreyfarrell opened this issue Sep 14, 2019 · 0 comments · Fixed by #469
Closed

Chained conditionals break branch ignore hints #468

coreyfarrell opened this issue Sep 14, 2019 · 0 comments · Fixed by #469
Assignees

Comments

@coreyfarrell
Copy link
Member

if (condition1) {
  action1();
} else /* istanbul ignore else */ if (condition2) {
  action2();
} else {
  actionDefault();
}

When if (condition1) is processed the else action is converted to a block. This results in the following code (not including actual coverage counters:

if (condition1) {
  action1();
} else /* istanbul ignore else */ {
  if (condition2) {
    action2();
  } else {
    actionDefault();
  }
}

Due to this separation between the hint and the if (condition2) the ignore else does not get processed. When the else is converted to a block we need to move the comment into the new block so it can be seen by the (no longer chained) if statement. I have this fixed in a local branch, I just need to create a test before submitting.

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

Successfully merging a pull request may close this issue.

1 participant