[WIP] Make toBe matcher error message more helpful for objects and arrays#4277
[WIP] Make toBe matcher error message more helpful for objects and arrays#4277cpojer merged 2 commits intojestjs:masterfrom
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.
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.
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.
Yeah, I think that is preferable. Can you keep it on the same line as the "no visual difference" sentence?
|
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
