Skip to content

Commit 1c8a7f3

Browse files
authored
Document that src/setupTests.js doesn't work if created after ejecting
1 parent 21d0723 commit 1c8a7f3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/react-scripts/template/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,8 @@ import Adapter from 'enzyme-adapter-react-16';
13231323
configure({ adapter: new Adapter() });
13241324
```
13251325

1326+
(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`.)
1327+
13261328
Now you can write a smoke test with it:
13271329

13281330
```js
@@ -1412,6 +1414,8 @@ const localStorageMock = {
14121414
global.localStorage = localStorageMock
14131415
```
14141416

1417+
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`.
1418+
14151419
### Focusing and Excluding Tests
14161420

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

0 commit comments

Comments
 (0)