0.1.0 • Published 4 years ago

jest-postcss v0.1.0

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

jest-postcss

Jest utils for postcss plugins

Installation

npm install --save-dev jest-postcss

Usage

Import jest-postcss into your test setup once.

import "jest-postcss"

Matchers

.toMatchCSS

toMatchCSS(css: string)

Compares the postcss result css against the Provided CSS

expect(
  await postcss(plugins).process()
).toMatchCSS(`
  .your-css {}
`)

Snapshot Serializers

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()