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

feat(prefer-expect-assertions): support requiring only if expect is used in a loop #1013

Merged
merged 6 commits into from Jan 15, 2022

Conversation

G-Rath
Copy link
Collaborator

@G-Rath G-Rath commented Dec 30, 2021

This only checks for native loops - while we could try and check for calls to methods with names like forEach, I realised it actually makes sense to just have a whole third option for if expect is in a callback since they represent the same sort of situation as with promises and would cover forEach, reduce, map, etc without as many edge-cases or false negatives.

I'll do a follow-up PR for that option.

Resolves #540

@G-Rath G-Rath force-pushed the prefer-expect-assertions-support-loops branch from d897e81 to 9374168 Compare January 14, 2022 18:57
@G-Rath G-Rath force-pushed the prefer-expect-assertions-support-loops branch from 487c2eb to ab99a4e Compare January 15, 2022 19:50
@G-Rath G-Rath merged commit e6f4f8a into main Jan 15, 2022
@G-Rath G-Rath deleted the prefer-expect-assertions-support-loops branch January 15, 2022 20:24
github-actions bot pushed a commit that referenced this pull request Jan 15, 2022
# [25.4.0](v25.3.4...v25.4.0) (2022-01-15)

### Features

* **prefer-expect-assertions:** support requiring only if `expect` is used in a loop ([#1013](#1013)) ([e6f4f8a](e6f4f8a))
@github-actions
Copy link

🎉 This PR is included in version 25.4.0 🎉

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[prefer-expect-assertions]: ensure expect.assertions is used when an expect is found to be within a loop
1 participant