Open Ranguro opened 5 years ago
I just saw the same behavior.
For me, wrappers created by render
worked fine with the serializer, but ones created by mount
and shallow
gave the above error. In all cases, using the toJson
method directly worked as expected.
Error
Libraries Versions
How to reproduce?
This is a quite clean repro-case with only the essential parts.
https://gist.github.com/Ranguro/a14b6b8e6868ff508b80f29df8a99971
I believe the problem is linked to this specific line in my package.json
When I add this line - the Enzyme Internal Error is being thrown. If I remove it and instead- run the following, it doesn't throw the error:
https://gist.github.com/Ranguro/f318b60054f415fd2a418900c2562742
See how I added toJson from enzyme-to-json there and the test passes.
This is my setupTests.js for the enzyme adapter.
This is how I setup my setupTests.js
Other Comments
I tried throw new Error('fail') to check if the configurations was being run when running tests and it showed the output well.