Jest preset containing all required configuration for writing tests for preact.
Features:
- Transpiles JSX to
h()
- Aaliases for
"react"
imports to point topreact/compat
- Automatically serialize Preact
VNodes
in snapshots - Stub style imports (
.css
,.less
,.sass/scss
, etc) - Add typeahead preview for filtering in jest's watch mode
Install it via npm or yarn:
npm install --save-dev jest-preset-preact
# or via yarn
yarn add -D jest-preset-preact
...and add the preset to your jest.config.js
file.
// jest.config.js
module.exports = {
preset: 'jest-preset-preact',
};
MIT, see the LICENSE file.