-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Made operator
property on errors optional.
#41
Conversation
Codecov Report
@@ Coverage Diff @@
## master #41 +/- ##
=======================================
Coverage 90.06% 90.06%
=======================================
Files 3 3
Lines 302 302
=======================================
Hits 272 272
Misses 30 30
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.
Hey~! How do you feel about (unknown)
instead?
@lukeed I still feel is "adding stuff" to my error message, but is better than |
Ok. Can you please "allow edits from maintainers" so that I can push a commit? |
For some reason I can find the option to allow edits from maintainer (and I think is because of this). I'll try adding you as maintainer to the fork I did. |
No problem. Can you please insert this for the entire function format(name, err, suite = '') {
let { details, operator='' } = err;
let idx = err.stack && err.stack.indexOf('\n');
if (err.name.startsWith('AssertionError') && !operator.includes('not')) details = compare(err.actual, err.expected); // TODO?
let str = ' ' + FAILURE + (suite ? kleur.red(SUITE(` ${suite} `)) : '') + ' ' + QUOTE + kleur.red().bold(name) + QUOTE;
str += '\n ' + err.message + (operator ? kleur.italic().dim(` (${operator})`) : '') + '\n';
if (details) str += GUTTER + details.split('\n').join(GUTTER);
if (!!~idx) str += stack(err.stack, idx);
return str + '\n';
} |
Sure thing! |
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!
If I just do inside a test:
I get this:
Followed by the stack trace, instead of just getting
Message
. This is because the format function is expecting the error to have a string propertyoperator
to put after the message of the error.This MR makes it so if that property is missing, we just skip it.