Skip to content

Commit

Permalink
Updated Usage with Create React App - avoiding #71 (#72)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andrei-e-random authored and blainekasten committed Apr 6, 2017
1 parent 3db9bf3 commit f1f42ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/jest-enzyme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):

```
yarn add jest-enzyme@2.1.2 --dev
```

0 comments on commit f1f42ff

Please sign in to comment.