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

Updated Usage with Create React App - avoiding #71 #72

Merged
merged 1 commit into from
Apr 6, 2017
Merged

Updated Usage with Create React App - avoiding #71 #72

merged 1 commit into from
Apr 6, 2017

Conversation

andrei-e-random
Copy link
Contributor

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.

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):
Copy link
Collaborator

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

Copy link
Contributor Author

@andrei-e-random andrei-e-random Apr 6, 2017

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.

Copy link
Collaborator

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!

@blainekasten
Copy link
Collaborator

Thanks for this!

@blainekasten blainekasten merged commit f1f42ff into enzymejs:master Apr 6, 2017
@gaearon
Copy link

gaearon commented Apr 9, 2017

Please send a PR to CRA in this cases too 😉
Otherwise our docs turn out to be misleading.

facebook/create-react-app#1957

This pull request was closed.
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

Successfully merging this pull request may close these issues.

3 participants