An open API service indexing awesome lists of open source software.

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

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.