-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Updated Usage with Create React App - avoiding #71 #72
Conversation
Using jest-enzyme@3.0.0+ with Create React App is causing "TypeError: expect.addSnapshotSerializer is not a function" error. This is happening because jest-enzyme@3.0.0+ depends on jest@19.0.0 while Create React App is currently using jest@18.1.0. Added README warning - pending to be modified when Create React App updates their Jest dependency. See also #71.
@@ -50,3 +50,9 @@ If you are using Create React App, instead of adding to your `package.json` as a | |||
``` | |||
|
|||
This is documented on Create React App at the bottom of the [Testing Components](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#testing-components) section. There is also more information about [Initializing Test Environment](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#initializing-test-environment). | |||
|
|||
Also, instead of installing the latest version you should stick with versions below 3, because Create React App currently [uses](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/package.json#L50) a version of jest which will cause [this issue](https://github.com/blainekasten/enzyme-matchers/issues/71): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe instead of using verbage like currently uses
you could say something like.
If you use a version of create-react-app less then X, it depends on a previous version of jest.. blah blah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good wording, but create react app currently uses 18.1.0. Until they upgrade to 19.0.0, we can't put a number on X.
So I guess the proposed wording is accurate right now, pending rewording when CRA is upgrading their dependency. I have subscribed to the relevant issue in the CRA repo, so I'll be able to know when to create a new PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k. This is fine for now. I subscribed to that issue also. Thanks for doing this!
Thanks for this! |
Please send a PR to CRA in this cases too 😉 |
Using jest-enzyme@3.0.0+ with Create React App is causing "TypeError: expect.addSnapshotSerializer is not a function" error.
This is happening because jest-enzyme@3.0.0+ depends on jest@19.0.0 while Create React App is currently using jest@18.1.0.
Added README warning - pending to be modified when Create React App updates their Jest dependency.
See also #71.