-
-
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
Snapshot failing with val.forEach is not a function #4580
Comments
Can you please paste output of |
I actually managed to avoid the error getting rid of the code that assigned I'm not sure why it failed when I passed that property down... I guess it has to do with |
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. |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
So, I'm upgrading my project from an older version of Enzyme 2.x to Enzyme 3.x, keeping React 15.
I'm using
enzyme-to-json
to create snapshots tests in Jest, I upgraded it to 3.x as well to work with Enzyme 3.xThe problem I'm noticing is that some snapshot tests fail because of this error:
I tracked this down to
pretty-format
, inside theprintImmutable.js
file.Basically, here it expects
val
to be an array, but an empty object is provided:The output from
enzyme-to-json
looks like this:And it looks good to me, but I think I'm missing something...
Now, why does it happen?
p.s. actually I'm not sure if this is an Enzyme bug or a Jest one...
ps. 2:
This is my component (simplified):
If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.It depends by Enzyme, probably enzyme-to-json and Jest.
What is the expected behavior?
The Jest snapshot should work ust fine
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
It's a basic create-react-app application, with Enzyme 3.x
The text was updated successfully, but these errors were encountered: