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

Update enzyme-to-json dependecy to 3.0.0 #15

Open
juan-quiver opened this issue Sep 26, 2017 · 5 comments
Open

Update enzyme-to-json dependecy to 3.0.0 #15

juan-quiver opened this issue Sep 26, 2017 · 5 comments

Comments

@juan-quiver
Copy link

Now that Enzyme v3 has been released along with its enzyme-to-json counter part, this library needs to be updated to use the latest version.

The current version throws this exception:

  Cannot find module 'enzyme/build/ShallowTraversal' from 'shallow.js'
      
      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:192:17)
@adriantoine
Copy link

adriantoine commented Sep 28, 2017

This library is only forwarding to enzyme-to-json/serializer, if you have any issue with jest-serializer-enzyme, it is safe to just remove the dependency, install enzyme-to-json and replace "<rootDir>/node_modules/jest-serializer-enzyme" by "enzyme-to-json/serializer" in your Jest config.

I'm saying that as the maintainer of enzyme-to-json because this repo doesn't seem to be updated regularly, it doesn't add much value to it and people are having issue because of it.

If you have any issues moving from jest-serializer-enzyme to enzyme-to-json, please open an issue on enzyme-to-json's repo and I'd be glad to help!

@eduardomoroni
Copy link

@adriantoine just a question, please don't get me wrong.
Is there a way of enzyme-to-json/serializer be less verbose? The only reason I've choose jest-serializer-enzyme is because I don't have to import each file test a toJson.
The cool stuff of jest-serializer-enzyme that is just plug and play. If it's possible, is there a way I could help you on that?
thanks

@adriantoine
Copy link

adriantoine commented Oct 3, 2017

Hi @eduardomoroni,

If you use the serializer of enzyme-to-json it will be exactly like jest-serializer-enzyme. You don't need the toJson function at all. Have a look at the Readme I updated yesterday, I think it's a lot easier to understand now. Basically you don't need anything that is in the Advanced Usage section, just use the serializer and it will be exactly jest-serializer-enzyme.

Let me know if you need any help!

@StevenXL
Copy link

@adriantoine Thank you for posting in this Repo. I was having a very hard time figuring out how to get this lib to work, and your suggestion on Oct 3 2017 was a great help. Thanks again!

@santanapaulo
Copy link

I am still having issues, even when I tried the solution provided above.

I attached a screenshot that shows the error, my package.json and also, the UT.

Is there anybody that can help me?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants