You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when _DeepMatcher encounters a Matcher nested within a collection and the match fails, it uses the describe method to describe the mismatch rather than the describeMismatch method.
This is best demonstrated with an example. Consider the following expectation.
expect('foo', hasLength(4));
It fails with the following message which we can all agree is quite helpful.
Expected: an object with length of <4>
Actual: 'foo'
Which: has length of <3>
Meanwhile, observe what happens when we nest the value and matcher in a collection.
expect(['foo'], [hasLength(4)]);
Current output
Expected: [<an object with length of <4>>]
Actual: ['foo']
Which: does not match an object with length of <4> at location [0]
While the message here is alright, it's not quite as good as before, and it's not useful if the actual value's toString() doesn't make it clear why it didn't match.
Desired output
Expected: [<an object with length of <4>>]
Actual: ['foo']
Which: has length of <3> at location [0]
The ideal output would be akin to that of the non-nested expectation, making use of the expected matcher's describeMismatch method.
The text was updated successfully, but these errors were encountered:
Currently when
_DeepMatcher
encounters aMatcher
nested within a collection and the match fails, it uses thedescribe
method to describe the mismatch rather than thedescribeMismatch
method.This is best demonstrated with an example. Consider the following expectation.
It fails with the following message which we can all agree is quite helpful.
Meanwhile, observe what happens when we nest the value and matcher in a collection.
Current output
While the message here is alright, it's not quite as good as before, and it's not useful if the actual value's
toString()
doesn't make it clear why it didn't match.Desired output
The ideal output would be akin to that of the non-nested expectation, making use of the expected matcher's
describeMismatch
method.The text was updated successfully, but these errors were encountered: