Render JSX and Preact components to JSON
JavaScript
Pull request Compare This branch is 12 commits ahead, 8 commits behind developit:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.babelrc
.eslintrc
.gitignore
.npmignore
LICENSE
README.md
circle.yml
package.json
rollup.config.js

README.md

preact-render-to-json

npm CircleCI

Render JSX and Preact components to JSON. Useful for Jest Snapshot testing.

Usage with Jest

import preact from 'preact'
import render from 'preact-render-to-json'

/** @jsx preact.h */

let component = <div class="foo">content</div>;

test('component', () => {
    const tree = render(component)
    expect(tree).toMatchSnapshot()
})

License

MIT