-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Snapshot feature shows empty diff when changing order of keys on object #1220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@vadimdemedes I assume magic assert doesn't care about key order? I suppose the snapshot comparison does, which seems fair. |
Please see #1275 for context. |
Nope, it doesn't. |
The issue is that we're actually comparing JSON strings inside |
* Make the Runner manage the snapshot state. Thread an accessor to the `t.snapshot()` assertion. * Save snapshots when runner has finished. Fixes #1218. * Use jest-snapshot directly, without serializing values. Use jest-diff to generate the diff if the snapshot doesn't match. This does mean the output is not colored and has other subtle differences with how other assertions format values, but that's OK for now. Fixes #1220, #1254. * Pin jest-snapshot and jest-diff versions. This isn't ideal but we're using private APIs and making other assumptions, so I'm not comfortable with using a loose SemVer range.
* Make the Runner manage the snapshot state. Thread an accessor to the `t.snapshot()` assertion. * Save snapshots when runner has finished. Fixes #1218. * Use jest-snapshot directly, without serializing values. Use jest-diff to generate the diff if the snapshot doesn't match. This does mean the output is not colored and has other subtle differences with how other assertions format values, but that's OK for now. Fixes #1220, #1254. * Pin jest-snapshot and jest-diff versions. This isn't ideal but we're using private APIs and making other assumptions, so I'm not comfortable with using a loose SemVer range.
* Make the Runner manage the snapshot state. Thread an accessor to the `t.snapshot()` assertion. * Save snapshots when runner has finished. Fixes #1218. * Use jest-snapshot directly, without serializing values. Use jest-diff to generate the diff if the snapshot doesn't match. This does mean the output is not colored and has other subtle differences with how other assertions format values, but that's OK for now. Fixes #1220, #1254. * Pin jest-snapshot and jest-diff versions. This isn't ideal but we're using private APIs and making other assumptions, so I'm not comfortable with using a loose SemVer range.
* Make the Runner manage the snapshot state. Thread an accessor to the `t.snapshot()` assertion. * Save snapshots when runner has finished. Fixes #1218. * Use jest-snapshot directly, without serializing values. Use jest-diff to generate the diff if the snapshot doesn't match. This does mean the output is not colored and has other subtle differences with how other assertions format values, but that's OK for now. Fixes #1220, #1254. * Pin jest-snapshot and jest-diff versions. This isn't ideal but we're using private APIs and making other assumptions, so I'm not comfortable with using a loose SemVer range.
* Make the Runner manage the snapshot state. Thread an accessor to the `t.snapshot()` assertion. * Save snapshots when runner has finished. Fixes #1218. * Use jest-snapshot directly, without serializing values. Use jest-diff to generate the diff if the snapshot doesn't match. This does mean the output is not colored and has other subtle differences with how other assertions format values, but that's OK for now. Fixes #1220, #1254. * Pin jest-snapshot and jest-diff versions. This isn't ideal but we're using private APIs and making other assumptions, so I'm not comfortable with using a loose SemVer range.
* Make the Runner manage the snapshot state. Thread an accessor to the `t.snapshot()` assertion. * Save snapshots when runner has finished. Fixes #1218. * Use jest-snapshot directly, without serializing values. Use jest-diff to generate the diff if the snapshot doesn't match. This does mean the output is not colored and has other subtle differences with how other assertions format values, but that's OK for now. Fixes #1220, #1254. * Pin jest-snapshot and jest-diff versions. This isn't ideal but we're using private APIs and making other assumptions, so I'm not comfortable with using a loose SemVer range.
Description
When using the snapshot feature, if the new value is an object that is identical to the snapshot but with a different key order, the diff shown is empty.
Test Source
Before:
After altering the test so that the keys are in reversed order:
Error Message & Stack Trace
Config
package.json:
.babelrc:
Command-Line Arguments
Environment
The text was updated successfully, but these errors were encountered: