-
-
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
[WIP] Make toBe matcher error message more helpful for objects and arrays #4277
Conversation
I wonder if that would be some performance hit for large objects |
return ( | ||
matcherHint('.toBe') + | ||
'\n\n' + | ||
'Looks like you wanted to test for object/array equity with strict `toBe` matcher. You probably need to use `toEqual` instead.' |
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.
equity? Shouldn't it be "equality"?
I think it's still useful to keep some of the information from before, at least "Expected value to be (using ===) but they are different objects/arrays. […]”. What do you think?
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.
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.
What if we just add the new message below and leave the rest as it was? Just a new line as extra information
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.
Yeah, I think that is preferable. Can you keep it on the same line as the "no visual difference" sentence?
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
Love it! |
…rays (jestjs#4277) * Make toBe matcher error message more helpful for objects and arrays * Just add a message at the bottom instead of replacing it
This is so bloody fantastic that I searched for the error string "You probably need to use" in the git repo,, found the line, used git blame to find who introduced it, found this PR, all to tell you @rogeliog if we ever meet I shall buy you all the beers! 🍻 I love error messages like this. It's like peer programming with an AI. |
Hehehe I’m glad that it was useful, happy to help! 🙃😀 |
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
See #4228
Test plan