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

[valid-expect]: support specifying custom async matchers #488

Closed
yatki opened this issue Nov 29, 2019 · 4 comments · Fixed by #1018
Closed

[valid-expect]: support specifying custom async matchers #488

yatki opened this issue Nov 29, 2019 · 4 comments · Fixed by #1018

Comments

@yatki
Copy link
Contributor

yatki commented Nov 29, 2019

A bit similar to #54, when we don't await .toReject(), the test returns false positive.

Maybe it's better to have a rule like await-async-matchers to cover all this cases.

@SimenB
Copy link
Member

SimenB commented Nov 29, 2019

toReject is not part of Jest core, so I don't think built-in support makes sense. We can however maybe take some config either globally er per rule for asyncMatchers or some such?

@yatki
Copy link
Contributor Author

yatki commented Nov 30, 2019

Ah yes it was part of the jest-extended, wasn't it? Sorry for the issue then.

However, I really liked the idea of accepting a config parameter. What I understood from that is: I can add .toMyCustomMatcher() as an async matcher to my .eslintrc config and valid-expect rule or a new rule can make sure that those matchers are awaited.

Please let me know if it make sense this way, or did you mean something else?
🖖

@G-Rath
Copy link
Collaborator

G-Rath commented Jan 1, 2022

Have made #1018 implementing this, with the jest-extended matchers as the default for the option.

@G-Rath G-Rath changed the title Warn unawaited .toReject() & .toResolve() matchers. [valid-expect]: support specifying custom async matchers Jan 1, 2022
@github-actions
Copy link

🎉 This issue has been resolved in version 25.7.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
3 participants