Skip to content

Using enzyme-to-json to get better diff snapshots#2

Open
patw0929 wants to merge 3 commits into
developfrom
feature/enzyme-to-json
Open

Using enzyme-to-json to get better diff snapshots#2
patw0929 wants to merge 3 commits into
developfrom
feature/enzyme-to-json

Conversation

@patw0929
Copy link
Copy Markdown
Collaborator

We can use enzyme-to-json to generate better diff snapshots like following case:

-exports[`<A /> snapshots should match latest mount snapshot 1`] = `"<div><h1 style=\\"display: none;\\">title</h1><button class=\\"btn-foo\\">click me</button><button class=\\"btn-bar\\">click me</button><nav><a href=\\"#\\"><!-- react-text: 7 -->I am link <!-- /react-text --><!-- react-text: 8 -->0<!-- /react-text --><!-- react-text: 9 -->.<!-- /react-text --></a><a href=\\"#\\"><!-- react-text: 11 -->I am link <!-- /react-text --><!-- react-text: 12 -->1<!-- /react-text --><!-- react-text: 13 -->.<!-- /react-text --></a><a href=\\"#\\"><!-- react-text: 15 -->I am link <!-- /react-text --><!-- react-text: 16 -->2<!-- /react-text --><!-- react-text: 17 -->.<!-- /react-text --></a></nav></div>"`;
+exports[`<A /> snapshots should match latest mount snapshot 1`] = `
+<A
+  bar={[Function]}
+>
+  <div>
+    <h1
+      style={
+        Object {
+          "display": "none",
+        }
+      }
+    >
+      title
+    </h1>
+    <button
+      className="btn-foo"
+      onClick={[Function]}
+    >
+      click me
+    </button>
+    <button
+      className="btn-bar"
+      onClick={[Function]}
+    >
+      click me
+    </button>
...

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant