Skip to content

Commit

Permalink
Update README.md (fixes styled-components#125) (styled-components#131)
Browse files Browse the repository at this point in the history
* Update README.md (fixes styled-components#125)

Added an FAQ section that outlines why Jest Styled Components might not be working.

* Update README.md (fixes styled-components#125)
  • Loading branch information
dfrankland authored and MicheleBertoli committed Apr 1, 2018
1 parent 233d935 commit 3d3a945
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Table of Contents
* [Preact](#preact)
* [toHaveStyleRule](#tohavestylerule)
* [Global installation](#global-installation)
* [Working with multiple packages](#working-with-multiple-packages)
* [Contributing](#contributing)

# Snapshot Testing
Expand Down Expand Up @@ -384,6 +385,12 @@ And import the library once in the `setupTest.js` as follows:
import 'jest-styled-components'
```

# Working with multiple packages

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 `styled-components@3.2.0`, a warning will be logged when multiple instances of it are being included and run as part of the Jest tests. Using `styled-components@3.1.6` and lower with multiple instances will cause a silent error with unexpected results.

To debug and fix multiple instances of `styled-components` see the FAQ on ["Why am I getting a warning about several instances of module on the page?"](https://www.styled-components.com/docs/faqs#why-am-i-getting-a-warning-about-several-instances-of-module-on-the-page).

# Contributing

Please [open an issue](https://github.com/styled-components/jest-styled-components/issues/new) and discuss with us before submitting a PR.

0 comments on commit 3d3a945

Please sign in to comment.