Skip to content

Commit 54350e2

Browse files
authored
Make the global installation clearer (#323)
Add the other necessary part of the setup for global use.
1 parent b01cd89 commit 54350e2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,12 +471,18 @@ import 'jest-styled-components/native'
471471

472472
# Global installation
473473

474-
It is possible to setup this package for all the tests. Import the library once in the `src/setupTests.js` as follows:
474+
It is possible to setup this package for all the tests. For Example: import the library once in the `src/setupTests.js` as follows:
475475

476476
```js
477477
import 'jest-styled-components'
478478
```
479479

480+
...then add the following to `test.config.js`:
481+
482+
```js
483+
setupFilesAfterEnv: ['<rootDir>/src/setupTests.js']
484+
```
485+
480486
# Working with multiple packages
481487

482488
If Jest Styled Components is not working, it is likely caused by loading multiple instances of `styled-components`. This can happen especially when working with a Lerna monorepo. Starting with `[email protected]`, a warning will be logged when multiple instances of it are being included and run as part of the Jest tests. Using `[email protected]` and lower with multiple instances will cause a silent error with unexpected results.

0 commit comments

Comments
 (0)