Skip to content

Commit

Permalink
Update jest.md
Browse files Browse the repository at this point in the history
Add note about skipping setting 'setupFilesAfterEnv' if using create-react-app. If you try to do so when using create-react-app, you get the following error:

```
(base) ➜  component-library git:(setup) ✗ npm run test

> component-library@0.1.0 test
> react-scripts test

We detected setupFilesAfterEnv in your package.json.

Remove it from Jest configuration, and put the initialization code in src/setupTests.js.
This file will be loaded automatically.
```
  • Loading branch information
wyatt-troia committed Feb 5, 2021
1 parent cdfb1c6 commit 6017756
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/guides/jest.md
Expand Up @@ -2,7 +2,7 @@

## Configure with Jest

To run the setup file to configure Enzyme and the Adapter (as shown in the [Installation docs](https://enzymejs.github.io/enzyme/docs/installation/)) with Jest, set `setupFilesAfterEnv` (previously `setupTestFrameworkScriptFile`) in your config file (check [Jest's documentation](http://jestjs.io/docs/en/configuration) for the possible locations of that config file) to literally the string `<rootDir>` and the path to your setup file.
To run the setup file to configure Enzyme and the Adapter (as shown in the [Installation docs](https://enzymejs.github.io/enzyme/docs/installation/)) with Jest, set `setupFilesAfterEnv` (previously `setupTestFrameworkScriptFile`) in your config file (check [Jest's documentation](http://jestjs.io/docs/en/configuration) for the possible locations of that config file) to literally the string `<rootDir>` and the path to your setup file. If using [create-react-app](https://create-react-app.dev/), skip this step.

```json
{
Expand Down

0 comments on commit 6017756

Please sign in to comment.