https://github.com/benface/jest-matcher-css
Jest matcher to assert that a string of CSS matches another one
https://github.com/benface/jest-matcher-css
Last synced: 8 months ago
JSON representation
Jest matcher to assert that a string of CSS matches another one
- Host: GitHub
- URL: https://github.com/benface/jest-matcher-css
- Owner: benface
- Archived: true
- Created: 2018-11-04T22:56:10.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2022-12-30T17:43:19.000Z (over 3 years ago)
- Last Synced: 2025-01-29T02:15:45.751Z (over 1 year ago)
- Language: JavaScript
- Size: 285 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# CSS Matcher for Jest
## Installation
```bash
npm install jest-matcher-css
```
## Usage
In your Jest config:
```json
"jest": {
"setupTestFrameworkScriptFile": "./setup.js"
}
```
In `setup.js`:
```js
const cssMatcher = require('jest-matcher-css');
expect.extend({
toMatchCss: cssMatcher,
});
```
## Credit
Written by [Adam Wathan](https://github.com/adamwathan) for [Tailwind CSS](https://github.com/tailwindcss/tailwindcss/blob/master/jest/customMatchers.js). I moved it into its own module to use it in a couple of Tailwind plugins.