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.
|
SimenB
left a comment
There was a problem hiding this comment.
thanks! just some type nits, the code lgtm 👍
|
Thanks for the review @SimenB, comments are addressed. |
|
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-diffthe 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
compareKeysoption tojest-diffandpretty-formatwhich is a function for comparing object keys that's used when sorting.Closes: 11938
Test plan
There are new unit tests in
jest-diffandpretty-format.