-
-
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: Improve report when matcher fails, part 13 #8077
Conversation
8 example pictures baseline at left and improved at right EDIT: updated 3 pictures according to #8077 (comment) and 3 according to #8077 (comment) Sentence instead of empty string for Sentence instead of confusing constructor name for other primitive values Sentence instead of
Display Display
|
"Received value does not have a prototype chain" is a rather cumbersome message, can we cut it down to "Received value has no prototype"? I don't think "chain" is needed (anything that has a prototype also has a prototype chain of length >= 1), unless you wanted to express something specific with it? |
Thank you for constructive critique! |
In the "Omit expected if constructor has empty string as its name" case maybe we should still indicate that Expected was an unnamed constructor? "Expected unnamed constructor" or something? Or maybe it's fine because the user can identify the constructor in the code frame anyway, what do you think? |
Yes, I agree with short phrases instead of omitted lines. Bonus points to start same as the labels:
|
Here are two phrases so length of report is consistent positive 3 lines and negative 2 lines:
Omit expected if class has static name method:
Omit expected if constructor has empty string as its name:
P.S. Because |
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.
LGTM!
For what it’s worth, I have see this warning in local
|
Yeah, it's from |
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
For
toBeInstanceOf
matcher:not
following expected labelFor more information, see discussion with @jeysal in #7795
The report is less helpful than it might be because
min
option ofpretty-format
omits class name :(Residue: Improve report for
toThrow
with expected error class especially if receivederror.name
is not the same aserror.constructor.name
Test plan
See also pictures in following comment.