-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
expect: Improve report when matcher fails, part 16 #8306
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
|
For negative For negative For positive For positive For positive For positive For positive |
SimenB
left a comment
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.
Oh yeah! Especially the "not" changes are sweet
|
|
||
| Expected: <green>[]</> | ||
| Received value has no visual difference" | ||
| Received: has same serialization" |
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.
"serialises to the same string"?
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.
Yes, let’s prefer a verb to a noun. What do you think about the following:
Expected: []
Received: different instance that serializes to the same stringAnd this reminds me to think about a sentence for toEqual and toStrictEqual in ExpectAPI.md to explain that different functions are not deep equal, see #8166
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.
I decided on the shorter statement suggested by Simen.
The called function cannot assume that the longer statement is true.
scotthovestadt
left a comment
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.
if this is merged soon it can go into the next release :)
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |







Summary
For
toEqualandtoStrictEqualmatcher:rejectsorresolvesin matcher hint// deep equalityin dim color at end of matcher hintWhen negative assertion fails:
notbetween expected label and valueWhen positive assertion fails:
Differencelabel) orExpected/Receivedvalues, not bothReceived: has same serializationinstead of redundant valueMoved code added in #8281 from
toBematcher toprint.tsfile and edit message string@jeysal after we have improved reports for all matchers, let’s discuss whether to move the additional logic in
shouldPrintDifftojest-matcher-utilspackageTwo positive reports changed from diff to
Expected/Received:getTypevalueResidue:
stringify(that is,pretty-formatwithminoption)Number(0)andString('abc')Test plan
Updated snapshots:
expect extendtoEquale2e failurestoEqualrejectsandresolvesjest-matcher-utils indextoEqualexpect matcherstoBeReceived: has same serializationexpect matcherstoEqualDifferenceand displayReceived: has same serializationexpect matcherstoEqualReceivedvalueexpect matcherstoStrictEqualDifferenceexpect matcherstoStrictEqualReceivedvalueSee also pictures in following comment with baseline at left and improved at right