-
-
Couldn't load subscription status.
- Fork 26
Actionable error message for large json documents #45
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
Conversation
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 for the contribution, @hibikiledo! 👍 Full ACK that this is an entirely sensible change to make -- the validation messages, especially for larger assertions, are currently not optimal and can be improved significantly.
I'm just having one thought regarding the statefulness of the JsonValueMatchesAny constraint (see the respective comment). Let me know your thoughts on this.
8cbab51 to
dcea800
Compare
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.
👍 Looking good! I just added (and already applied) one quick suggestion (whitespace only) to make codeclimate stop complaining.
Uh oh!
There was an error while loading. Please reload this page.
Problem
When using
assertJsonDocumentMatches, it is hard to navigate the error message when the assertion fails.The message only states that the given JSON document is not a match of the provided constraints.
It would be great to also tell which constraint(s) the JSON document fails to satisfy.
Solution
I implement
additionalFailureDescriptioninJsonValueMatchesManyconstraint to return a string representation of constraints that fail during evaluations.The result would look like this.
Screen Shot 2564年03月21日 at 07 41 33
I think this would greatly simplify investigation when the tests fail.
Thank you