Jest utils for postcss plugins
npm install --save-dev jest-postcss
Import jest-postcss
into your test setup once.
import "jest-postcss"
toMatchCSS(css: string)
Compares the postcss result css against the Provided CSS
expect(
await postcss(plugins).process()
).toMatchCSS(`
.your-css {}
`)
Allows use of snapshot testing with postcss results, pretifying the CSS for consistency.
expect(
await postcss(plugins).process()
).toMatchSnapshot()
expect(
await postcss(plugins).process()
).toMatchInlineSnapshot()