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

[no-if]: Works with arrow function, fails in standard function #670

Closed
dtom90 opened this issue Sep 17, 2020 · 1 comment · Fixed by #672
Closed

[no-if]: Works with arrow function, fails in standard function #670

dtom90 opened this issue Sep 17, 2020 · 1 comment · Fixed by #672
Labels

Comments

@dtom90
Copy link

dtom90 commented Sep 17, 2020

When jest/no-if is enabled, An if statement within () => { is caught no problem. But when it's inside function () {, it is not caught.

Example:

const condition = true

test('arrow function with condition', () => {
  let sum = 0
  if (condition) { // this fails jest/no-if
    sum = 1 + 2
  }
  expect(sum).toBe(3);
});

test('standard function with condition', function () {
  let sum = 0
  if (condition) { // this is not caught by jest/no-if
    sum = 1 + 2
  }
  expect(sum).toBe(3);
});

Reproducible Code

github-actions bot pushed a commit that referenced this issue Sep 20, 2020
## [24.0.2](v24.0.1...v24.0.2) (2020-09-20)

### Bug Fixes

* **no-if:** check both types of function expression ([#672](#672)) ([d462d50](d462d50)), closes [#670](#670)
@github-actions
Copy link

🎉 This issue has been resolved in version 24.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

1 participant