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

TypeError: expect.addSnapshotSerializer is not a function #71

Closed
willmruzek opened this issue Apr 1, 2017 · 3 comments
Closed

TypeError: expect.addSnapshotSerializer is not a function #71

willmruzek opened this issue Apr 1, 2017 · 3 comments
Labels

Comments

@willmruzek
Copy link

I receive the following error when I try to run my tests with jest-enzyme:

TypeError: expect.addSnapshotSerializer is not a function
@blainekasten
Copy link
Collaborator

I'm assuming you ignored the npm peer dependency warnings :)

Jest added this feature in version 19 hence this [https://github.com/blainekasten/enzyme-matchers/blob/master/packages/jest-enzyme/package.json#L46](peer dep).

You either need to upgrade jest or use a 2.x version of jest-enzyme that supports older versions of jest.

@andrei-e-random
Copy link
Contributor

Created a PR to add what you mentioned in the README.

I'm expecting people new to the ecosystem to use create-react-app a lot and stumble upon enzyme eventually. And I'm not really expecting many of them to read peer dependency warnings :).

@blainekasten
Copy link
Collaborator

Awesome! Thanks so much!

blainekasten pushed a commit that referenced this issue Apr 6, 2017
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants