Skip to content
Render JSX and Preact components to JSON
JavaScript
Branch: master
Clone or download
Pull request Compare This branch is 15 commits ahead, 76 commits behind preactjs:master.
nathancahill Merge pull request #2 from 9renpoto/fix/circleci
feat(.circleci) use CircleCI v2
Latest commit df058ca Apr 19, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
src
test
.babelrc
.eslintrc
.gitignore
.npmignore
LICENSE
README.md
package.json
rollup.config.js
yarn.lock

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

You can’t perform that action at this time.