-
Notifications
You must be signed in to change notification settings - Fork 148
Extend prefer-explicit-assert
to report findBy*
and waitFor
#409
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
Comments
prefer-explicit-assert
to report findBy* and waitForprefer-explicit-assert
to report findBy*
and waitFor
Hey @zaicevas! Few comments about this improvement idea. What about Not really sure about reporting I'd go just for reporting |
Makes sense to me, since
Can you give an example to better understand what you have in mind?
Sure, I'd imagine these 2 cases having separate PRs anyway. |
I don't have a really clear example in mind, to be honest. This is similar to This is a stupid example, but I'm not sure it should be reported: const promiseA = new Promise()
const promiseB = new Promise()
// ...
await waitFor(async () => {
await promiseA;
await promiseB;
screen.getByRole('button')
}) It's obvious it should be rewritten to just do What do you think? |
* feat: extend prefer-explicit-assert to report standalone findBy* queries * feat: add comments to make if branches more clear * feat: update README * fix: add tests and fix bug when return statements are reported * refactor: rule description, add TODO Co-authored-by: Mario Beltrán Alarcón <[email protected]> Relates to #409
With
prefer-explicit-assert
enabled,getBy*
usages withoutexpect
are reported, butfindBy*
andwaitFor
are not reported:What if we extended
prefer-explicit-assert
to report all of the above cases? 🤔The text was updated successfully, but these errors were encountered: