In https://github.com/facebook/jest/pull/8008#discussion_r261748762, we discovered that expect('asdf null asdf').toContain(null) passes and agreed that it shouldn't. This breaking change should be included in the next major. @SimenB
Let鈥檚 also remember https://github.com/facebook/jest/pull/8008#issue-257184687
Breaking change to require
.execmethod in addition to.testmethod for RegExp
EDIT also for .toThrow and .toThrowError see https://github.com/facebook/jest/pull/8033#issue-257769410
Or to get to the root of the problem, see https://github.com/facebook/jest/pull/8033#discussion_r
Please critique 3 possible matcher error messages. Or suggest your own Goldilocks message :)
Baby bear is direct parallel with other error messages:


Mama bear makes the conditional requirement explicit:


Papa bear also displays received value because the message refers to it:


I vote 3 ("Papa bear").
This is the only really helpful message in case received turns out to be a string when the user actually thought it was an array and intended to use the array version of toContain.
Also, TIL where the term Goldilocks zone originates 馃槄
Most helpful comment
I vote 3 ("Papa bear").
This is the only really helpful message in case
receivedturns out to be a string when the user actually thought it was an array and intended to use the array version oftoContain.Also, TIL where the term Goldilocks zone originates 馃槄