-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
jest-snapshot: Omit irrelevant received properties when property matchers fail #9198
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9198 +/- ##
=======================================
Coverage 64.83% 64.83%
=======================================
Files 279 279
Lines 11742 11742
Branches 2887 2886 -1
=======================================
Hits 7613 7613
Misses 3511 3511
Partials 618 618
Continue to review full report at Codecov.
|
@@ -6,6 +6,7 @@ | |||
*/ | |||
|
|||
import chalk = require('chalk'); | |||
import {getObjectSubset} from 'expect/build/utils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is correct, yeah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful, thank you!
* master: chore: upgrade to fsevents 2 (jestjs#9215) docs: remove expect.assertions(1) in rejects example of Tutoria… (jestjs#9149) chore: bump to istanbul alphas (jestjs#9192) Fix typo in JestPlatform.md (jestjs#9212) jest-snapshot: Ignore indentation for most serialized objects (jestjs#9203) fix(jest-types): tighten Config types and set more defaults (jestjs#9200) jest-snapshot: Improve colors when snapshots are updatable (jestjs#9132) jest-snapshot: Omit irrelevant received properties when property matchers fail (jestjs#9198) chore: make changedFiles option optional in `shouldInstrument` (jestjs#9197) fix(pretty-format): correctly detect memo (jestjs#9196) chore: regenerate lockfiles in e2e tests (jestjs#9193) chore: bump handlebars
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Call
getObjectSubset
to be consistent withtoMatchObject
Expected properties
versusReceived value
can also hide the problem in a mess of irrelevant detailsBecause the long-term solution is data-driven diff, please forgive a temporary hack to import
getObjectSubset
which is a private helper function of theexpect
packageSimen, when I wrote
'expect/src/utils'
the package tests ran okay, but the example test outside Jest threw an error, so is this correct instead:Test plan
In
printSnapshot.test.ts
Example picture baseline at left and improved at right