-
-
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
Update toStrictEqual failure message #7224
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7224 +/- ##
==========================================
+ Coverage 66.55% 66.59% +0.03%
==========================================
Files 237 237
Lines 9317 9318 +1
Branches 3 4 +1
==========================================
+ Hits 6201 6205 +4
+ Misses 3115 3112 -3
Partials 1 1
Continue to review full report at Codecov.
|
CHANGELOG.md
Outdated
@@ -49,6 +49,7 @@ | |||
- `[jest-runtime]` Fix missing coverage when using negative glob pattern in `testMatch` ([#7170](https://github.com/facebook/jest/pull/7170)) | |||
- `[*]` Ensure `maxWorkers` is at least 1 (was 0 in some cases where there was only 1 CPU) ([#7182](https://github.com/facebook/jest/pull/7182)) | |||
- `[jest-runtime]` Fix transform cache invalidation when requiring a test file from multiple projects ([#7186](https://github.com/facebook/jest/pull/7186)) | |||
- `[expect]` Improves the failing message for `toStrictEqual` matcher. ([#7224]) |
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.
please include the URL as well, so it's clickable outside of github 🙂
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.
Oops. Small hickup. Will do!
Thank you very much. Left one suggestion (first time I used the new feature in GitHub :) To document the goal:
|
@pedrottimark I don't see any suggestions on my end. Could you further explain both points? I don't quite understand the first point. Your second point, what do you mean by align Expected and Received values. Do you mean something like this? Expected:
{ "a": "a" }
Received:
{ "b": "b" } I was just following the style on the right as per our previous discussion. |
packages/expect/src/matchers.js
Outdated
`Received:\n` + | ||
` ${printReceived(received)}` | ||
`Expected: ${printExpected(expected)}\n` + | ||
`Received: ${printReceived(received)}\n` |
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.
Jest trims extra space in message, but let’s omit trailing newline for other dependents of expect
package:
`Received: ${printReceived(received)}\n` | |
`Received: ${printReceived(received)}` |
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.
I've updated this in the code. I just did a commit --amend --no-edit
and forced push to my branch. Hence, you're not gonna see a new commit. Just in case you get confused by the lack of commits. :)
@natealcedo You have my apology if the comment was double confusing :)
|
fabf094
to
1eaf254
Compare
1eaf254
to
e613b6c
Compare
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
This pull request updates the failure message returned by toStrictEqual so that it is more inline with what #7105 envisions.
Test plan
The matcher is tested with a snapshot test.
Here are a few screenshots of the before and after along with the test file.
Before: (I had to minimize the image to fit both tests in one screen)
After: