-
-
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
expect/jest-matcher-utils: Improve report when assertion fails, part 5 #7557
Conversation
Pictures of improved at right in which assertion line is clear and consistent with stack frame. When received value is incorrect according to matcher criterion: When received value must be a promise: When received promise rejected/resolved instead of resolved/rejected Updated the following picture according to #7557 (comment) When matcher must not have an expected argument: Updated the following picture according to #7557 (comment) |
Codecov Report
@@ Coverage Diff @@
## master #7557 +/- ##
==========================================
+ Coverage 67.99% 68.06% +0.06%
==========================================
Files 248 248
Lines 9490 9522 +32
Branches 6 5 -1
==========================================
+ Hits 6453 6481 +28
- Misses 3035 3039 +4
Partials 2 2
Continue to review full report at Codecov.
|
I know this is behavior that we have currently, but using "expected" there seems out of place, because there's no such in the matcher hint. How about just using the "received" as in improved messages for resolves/rejects matchers? |
Your second pair of eyes is always helpful. Yes, I agree that hint and message don’t add up. Here is a picture with I’m not sure if I understood the alternative htat you meant. Can you say it in other words? I will let it marinate in my mind whether there is another way to communicate the problem. |
I was thinking about:
Does that sound right? It seems on pair with the new promise-related messages.
Pretty sure adding the "expected" as an argument of argument-less fn is pretty confusing as well. |
Sounds good 👍 |
A jest-circus test timing out indicates a slowdown in execution. Worth investigating. I've re-run it 2 times just be sure, still failing. |
Yeah, some of the CI results have been a puzzle to me.
|
@SimenB can you have a final look? I think it's good to merge now |
jestjs#7557) * expect/jest-matcher-utils: Improve report when assertion fails, part 5 * Edit utils and improve one snapshot * Update CHANGELOG.md * Improve message for ensureNoExpected * Rewrite promise instead message * Rewrite half of non-promise value tests with not * Delete empty line and duplicated words * Rebuild and update e2e snapshot * Add section about promise property to ExpectAPI.md * Update example code to use options in ExpectAPI.md * Added promise property to MatcherState
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
Goal: people can quickly see information that is relevant to them
To replace redundant descriptions, and be consistent with stack frame, format as regular black:
Added
promise
property tothis
of matcher methods and tooptions
object argument ofmatcherHint
function.For backward compatibility of community matchers and so we can update snapshots in batches, remove period from matcher name to enable the improvement. For example, replace
'.toBeDefined'
with'toBeDefined'
in first argument ofmatcherHint
function call.Test plan
The change column in the following table refers to one or more of the following:
See also pictures in following comment
Fixes #7105