postcss-test-fixtures
Test your postcss plugin with Jest easily.
Installation
npm i -D postcss-test-fixtures
Usage
- Create this simple test file inside
__tests__
// ES6
import test from 'postcss-test-fixtures'
test.run();
// or ES5
var test = require('postcss-test-fixtures').default;
test.run();
-
Create your fixtures directory (
/__tests__/fixtures
). -
Add your input and expected output tests (
[fixtureName].css
+[fixtureName].expected.css
) -
Install jest
npm i -D jest
- And add a test script to your package.json
"scripts": {
"test": "jest"
}
- If you want to report each fixture add turn on jest's
verbose
mode.
"jest": {
"verbose": true
}
// Output
✓ Transforms fixture: [fixtureName] (Xms)
- Enjoy
License
MIT © dmarchena