Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Better documentation for setupTests.js when ejecting
When running `npm run eject` before creating `src/setupTests.js`, the resulting `package.json` file, won't contain any entry for it - and this is correct in my opinion, since otherwise Jest will crash - but it's useful to have it documented and avoid pointless waste of time.
  • Loading branch information
dannycalleri authored Dec 28, 2017
commit c5dfeda24a06ef8f76c6a3f8e5a73305e2f8fdf1
12 changes: 12 additions & 0 deletions packages/react-scripts/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,18 @@ const localStorageMock = {
global.localStorage = localStorageMock
```

>Note: Please keep in mind that, if you decide to `npm run eject` before creating `src/setupTests.js`, the resulting package.json file won't contain any reference to it, so you should manually create the property `setupTestFrameworkScriptFile` in the configuration for Jest, something like the following:
>```
>"jest": {
> ...
> "setupFiles": [
> "<rootDir>/config/polyfills.js"
> ],
> "setupTestFrameworkScriptFile": "<rootDir>/src/setupTests.js",
> ...
> }
> ```

### Focusing and Excluding Tests

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