-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Feature: ability to add async matchers using expect.extend #4223
Comments
This seems quite complex, I don't think we'll be adding this at this time. You can already use |
That's not quite the use case here.
|
I also would want this if possible. The problem is that I want to abstract away some test logic into a custom jest matcher. However, unfortunately, some API's that I need to use return promises, so I cannot possibly make it a sync matcher |
This would actually be useful for me and my team as well. Does someone has any plans to implement this? |
If you can provide a PR which is not super complex, we might be able to merge it. No guarantees, though. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
A custom matcher add using
expect.extend
needs to synchronously return an object containingpass
andmessage
fields.What is the expected behavior?
Allow async functions to be used as matchers that return a promise which eventually resolves to an object containing
pass
andmessage
. These would be subject to the usual timeout.My use case would be to execute async operations on a custom snapshot inside the matcher in a way that's transparent to the user.
The text was updated successfully, but these errors were encountered: