-
-
Notifications
You must be signed in to change notification settings - Fork 700
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
Provide friendly error message when deep equality check fails because of types #246
Comments
+1 looks like it requires incompatible interface change of deepEqual in deep-eql:
|
+1, but actually it needs some better diff even if the types are the same: expect({k: undefined}).to.deep.equal({}) will output the same diff:
It's ok for short objects because then you'll see the full list of properties, but for long object it'll list the first properties and then |
@huafu You can disable the chai.config.truncateThreshold = 0; // disable truncating This should give you a bit more information for where to look for mysterious mismatched deep equal objects. As for the visual diff of |
@logicalparadox thanks but what I actually would like is to have then a diff showing me that in one side I have a But anyway, using |
Something could be done about this to make it a little less painful. @huafu since you commented on the issue, do you have any suggestions that could be done to help highlight these errors more? |
well, I guess it could be shown like this: +someProperty: undefined
-someProperty: --missing-- |
This is not related to the type, in this case actually they are bare objects. But on any object you could have a property NOT defined on the prototype while you want to expect that this property would be set to UPDATE: ok, I re-read the thread and your message makes more sense @OliverJAsh, my apologizes ;-) |
|
It's easy to miss Of course, if |
Ideally truncatethreshold should be deprecated in favour of doing the sensible thing instead. I'd like to not bring it more to the forefront, and instead fix underlying issues |
Thank you for your time in reporting this. We're going to put a lot of work into error messaging for chai 5, so I'm going to close this, because there is nothing for us to do right now, but rest assured this has been noted, and we'll be making sure to keep this in mind in the future. |
This fails because the objects are not the same type, but the error message doesn’t tell me this:
The text was updated successfully, but these errors were encountered: