Closed liquorvicar closed 7 years ago
this should be addressed to core chai module, that we are using to generate diff: https://github.com/debitoor/chai-subset/blob/master/lib/chai-subset.js#L13
var Assertion = chai.Assertion;
I think the issue is that chai-subset
still uses the core chai module to generate the diff. Chai's core diff is designed to highlight the differences between two objects for an exact match, not for a subset. A subset diff is only supposed to highlight differences that are missing, not extra differences.
I would expected this to fail with a message along the lines of
However it failed with the message
(Adding the extra line highlighting the
bar
property into the diff).Is this intended? Personally I found it very confusing (this was my first time with this chai plugin) as I thought initially the plugin wasn't working.
Given that my test has specified I'm not interested in the
bar
property, should a failure highlight that property? In my real example, the object I was comparing to the subset had a lot more properties so it was a confusing assertion error.From what I can see it's the reporter that's generating the diff so not sure if the issue lies with that rather than this plugin?
Would be interested in your thoughts.