From f1f42ff32d42437f266106194a21be215accc09c Mon Sep 17 00:00:00 2001 From: andrei-e-random Date: Thu, 6 Apr 2017 22:01:46 +0300 Subject: [PATCH] Updated Usage with Create React App - avoiding #71 (#72) 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. --- packages/jest-enzyme/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/jest-enzyme/README.md b/packages/jest-enzyme/README.md index bb20168..99ec20a 100644 --- a/packages/jest-enzyme/README.md +++ b/packages/jest-enzyme/README.md @@ -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 +```