-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
Do you want to request a feature or report a bug?
Feature / Improvement.
What is the current behavior?
Currently React elements / components in snapshots have closing bracket in the same line as last prop, for example:
exports[`Foo bar 1`] = `
<foo
a={true} />
`;
After adding another prop to foo
, the test will fail and show diff like this:
- Snapshot
+ Received
@@ -1,2 +1,3 @@
<foo
- a={true} />
+ a={true}
+ b={true} />
What is the expected behavior?
In order to improve the clarity of diffs, move the closing bracket to a new line:
exports[`Foo bar 1`] = `
<foo
a={true}
/>
`;
So the diff would be:
- Snapshot
+ Received
@@ -1,3 +1,4 @@
<foo
a={true}
+ b={true}
/>
So it'll only indicate that new line (with b={true}
) has been added, without touching the prior line.
This will definitely break backward compatibility, but it should be easy to fix with --updateSnapshot
option.
I'm looking forward to know your opinion. I'm happy to create a pull request with solution (I already have working PoC).