Skip to content

Commit

Permalink
Document that src/setupTests.js doesn't work if created after ejecting
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored and Pavel Zhytko committed Jul 10, 2018
1 parent 3bf167e commit 6cb0d3a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react-scripts/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,8 @@ import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
```

(Note that **if you already ejected** before creating `src/setupTests.js`, this won’t work unless you set [this Jest option](https://facebook.github.io/jest/docs/en/configuration.html#setuptestframeworkscriptfile-string) to point to `src/setupTests.js`.)

Now you can write a smoke test with it:

```js
Expand Down Expand Up @@ -1412,6 +1414,8 @@ const localStorageMock = {
global.localStorage = localStorageMock
```

Note that **if you already ejected** before creating `src/setupTests.js`, this won’t work unless you set [this Jest option](https://facebook.github.io/jest/docs/en/configuration.html#setuptestframeworkscriptfile-string) to point to `src/setupTests.js`.

### Focusing and Excluding Tests

You can replace `it()` with `xit()` to temporarily exclude a test from being executed.<br>
Expand Down

0 comments on commit 6cb0d3a

Please sign in to comment.