-
Notifications
You must be signed in to change notification settings - Fork 401
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
Add toHaveErrorMessage
matcher
#370
Add toHaveErrorMessage
matcher
#370
Conversation
update test cases to match example
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.
Thanks a lot for this. Very thorough implementation and tests. Thanks.
Codecov Report
@@ Coverage Diff @@
## main #370 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 24 +1
Lines 554 584 +30
Branches 199 215 +16
=========================================
+ Hits 554 584 +30
Continue to review full report at Codecov.
|
@all-contributors please add @SevenOutman for code, test |
I've put up a pull request to add @SevenOutman! 🎉 |
🎉 This PR is included in version 5.13.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
@kentcdodds I'd recommend using this matcher for testing form validation instead of |
Sounds great. What showcase are you referring to? |
I remember seeing several in Testing Javascript courses, but couldn't recall which exactly. |
I'll keep it in mind in the future! Thanks 👍 |
Seeing this after the fact. 😅 Just as a heads up @kentcdodds @SevenOutman, the It seems that for right now, the recommended way of conveying error messages to users is still to use In the meantime, any documentation or examples that use |
What:
feature:
.toHaveErrorMessage
matcher to check whether an invalid element has requested error message.Why:
This PR is basically a replacement of the stale PR #258 which implements proposal #256.
How:
Most implementation and tests are copied from the original PR with some modification to address testing issues.
Checklist: