-
-
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
Confusing error on missing toMatchSnapshot() argument #6581
Comments
The most confusing part of this experience was Jest telling me to re-run my snapshots with |
You can do @rickhanlonii we should improve the error message here |
fwiw the docs say that the property matchers are optional I added a better error message here: #6528 |
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. |
🐛 Bug Report
When
toMatchSnapshot(propertyMatchers, snapshotName)
hasnull
as the first argument, Jest prints a confusing error:To Reproduce
Steps to reproduce the behavior:
with Jest 23
Expected behavior
I only wanted to specify
snapshotName
. The docs say it's the second argument: http://jestjs.io/docs/en/expect.html#tomatchsnapshotpropertymatchers-snapshotnameI have no idea what "property matchers" are and am not currently interested in them. (The docs fail to mention their format.) I passed
null
because I don't know what their default value is (the docs fail to mention that too).I couldn't figure out for quite some time why my tests were failing. I expected
null
to be treated as a "missing" value forpropertyMatchers
instead of trying to treat it as some kind of a shape.Link to repl or repo (highly encouraged)
Repl seems to be on an older Jest version without this problem.
But the above repro works for a clear Jest 23 install.
The text was updated successfully, but these errors were encountered: