-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Objects prematurely coerced into string primitives #2496
Comments
How assertion libraries generate error messages is outside of the scope of Mocha. I suggest taking this up with chai or the relevant chai plugin you might be using |
@Munter Apparently the behavior is related to https://github.com/mochajs/mocha/blob/master/lib/utils.js#L435 Also, @boneskull suggested to post this here |
Quite reproducible: it('should foo', function () {
var err = new Error('oh no');
err.actual = new String('foo');
err.expected = 'foo';
throw err;
}); Output:
|
@Munter Yeah, the problem seems to be in our diffing code; Chai actually outputs the difference correctly. See original issue. |
- rename some exported functions/vars as to use locally - update JSDoc comments
- rename some exported functions/vars as to use locally - update JSDoc comments - includes IE7/8 support
Does the fix also apply to |
- rename some exported functions/vars as to use locally - update JSDoc comments - includes IE7/8 support
This is regarding an issue I reported on the WebStorm tracker: https://youtrack.jetbrains.com/issue/WEB-23383
Differences between symbols that are not strictly equal, appear as being equal and are thus hard to read and confusing.
Here is a simplified version of a test where I noticed this behavior:
Because
new String( "foo" )
is not equal to the primitive"foo"
, the test will correctly fail. However, in the resulting output, the difference is not immediately apparent.In this simple test, the
AssertionError
will pretty clearly identify the issue. However, in larger objects, this can be much harder to identify, especially if the truncation threshold is not raised.The text was updated successfully, but these errors were encountered: