Skip to content
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

expect('null').toContain(null) should fail #8023

Closed
jeysal opened this issue Mar 2, 2019 · 4 comments · Fixed by #10119
Closed

expect('null').toContain(null) should fail #8023

jeysal opened this issue Mar 2, 2019 · 4 comments · Fixed by #10119
Milestone

Comments

@jeysal
Copy link
Contributor

jeysal commented Mar 2, 2019

In #8008 (comment), 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

@pedrottimark
Copy link
Contributor

pedrottimark commented Mar 2, 2019

Let’s also remember #8008 (comment)

Breaking change to require .exec method in addition to .test method for RegExp

EDIT also for .toThrow and .toThrowError see #8033 (comment)

Or to get to the root of the problem, see #8033 (comment)

@pedrottimark
Copy link
Contributor

Please critique 3 possible matcher error messages. Or suggest your own Goldilocks message :)

Baby bear is direct parallel with other error messages:

baby

baby-not

Mama bear makes the conditional requirement explicit:

mama

mama-not

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

papa

papa-not

@jeysal
Copy link
Contributor Author

jeysal commented Mar 2, 2019

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 😅

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@cpojer @pedrottimark @jeysal and others