-
Notifications
You must be signed in to change notification settings - Fork 236
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(rules): no-expect-resolves #364
Conversation
}, | ||
}); | ||
|
||
ruleTester.run('no-expect-resolves', rule, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this rule should probably have more tests, but I ran it against Jest and found no errors (at least no false positives and no crashes)
Thanks for the contribution @eranshabi! |
🎉 This PR is included in version 22.15.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@SimenB Hi, I have just a silly question - what is the recommended style? Is it |
@mrtnzlml I'm no Simen, but can weight in :) While I'm not part of the jest team, so can't say this "Officially", I don't think they'll be deprecating The idea behind this rule is to encourage the usage of It's easy to write passing tests that don't actually test promised values, but from all angles look like they are. The other thing is that The writeup for this rule could use some refinement, as as you've found it's example jumps straight to using We'd welcome some more examples & tests, so feel free to make a PR if you'd like :) |
We won't be removing As to what you should use - up to you! I generally prefer Note that after Hope that clears things up 🙂 |
This rule prevents the use of
await expect(promise).resolves
in favor ofexpect(await promise)
,for consistency and readability.