react-test-renderer-tree-to-json
Convert React Test Renderer tree to a format compatible with Jest snapshot testing.
This is similar to enzyme-to-json.
Install
$ npm i -D react-test-renderer-tree-to-json
Usage
Only for full rendering without key props.
import React from "react"; import TestRenderer from "react-test-renderer";import treeToJSON from "react-test-renderer-tree-to-json"; import mount from "enzyme";import toJson from "enzyme-to-json"; const Hoge = <div />; ;/*-----------------------exports[`snapshot 1`] = `<Hoge> <div /></Hoge>`; -----------------------*/