Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include "jest-styled-components" in test framework script file
This commit integrates jest-styled-components (1), a set of utilities for testing "Styled Components" (2) with Jest () that improves the napshot testing experience and provides a brand new matcher to make expectations on the style rules. This is the officially recommended library styled-components for Jest integration (3). Instead of storing the generated class names in snapshots it allows to track the actual CSS rules and attributes for better comparison what changed and if the change is even really related to the affected component. > Configuration To enable this features the package is simply imported in the test framework setup file defined in Jest's `setupTestFrameworkScriptFile` field (GH-39). > Custom Style Matcher The custom `toHaveStyleRule` matcher (4) is useful to test if a given rule is applied to a component. It will be added to the extended global `except` object when the main package file is being imported. References: (1) https://github.com/styled-components/jest-styled-components (2) https://www.styled-components.com (3) https://jestjs.io (4) https://github.com/styled-components/jest-styled-components#tohavestylerule Associated epics: GH-38 Associated issues: GH-39 GH-76
- Loading branch information