-
-
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
feat(jest-diff, pretty-format): Add compareKeys option for sorting object keys #11992
feat(jest-diff, pretty-format): Add compareKeys option for sorting object keys #11992
Conversation
Codecov Report
@@ Coverage Diff @@
## main #11992 +/- ##
==========================================
+ Coverage 68.74% 68.76% +0.02%
==========================================
Files 323 323
Lines 16649 16657 +8
Branches 4808 4813 +5
==========================================
+ Hits 11445 11454 +9
+ Misses 5171 5170 -1
Partials 33 33
Continue to review full report at Codecov.
|
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.
thanks! just some type nits, the code lgtm 👍
Thanks for the review @SimenB, comments are addressed. |
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.
looks good!
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
When comparing objects with
jest-diff
the keys are printed in alphabetical order by default. If the keys were not sorted alphabetically to begin with the diff is harder to read because the keys are not in their original positions.This PR adds a
compareKeys
option tojest-diff
andpretty-format
which is a function for comparing object keys that's used when sorting.Closes: 11938
Test plan
There are new unit tests in
jest-diff
andpretty-format
.