-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
Description
Do you want to request a feature or report a bug?
Feature (it is more like a fix)
What is the current behavior?
Sometimes developer may want to check for identity.
Currently, expect.toBe
does this.
But the error message is misleading:
Compared values have no visual difference. Looks like you wanted to test for object/array equality with strict `toBe` matcher. You probably need to use `toEqual` instead.
Because the message suggests to change toBe
-> toEqual
. So new developer may make this change which may lead to a bug in the project (or deoptimization).
I also think, that toBe
and toEqual
do not communicate the difference between each other clearly.
Suggestion
- Maybe change name
toBe
->toBeExact
ortoShallowEqual
. - Maybe change message
You probably need to use 'toEqual' instead.
->If you want to check for deep equality, pease, use 'toEqual' instead
. - Maybe change
toEqual
->toDeepEqual