assertive icon indicating copy to clipboard operation
assertive copied to clipboard

Reporting for undefined diffs in deepEqual is unhelpful

Open dbushong opened this issue 11 years ago • 3 comments

assert.deepEqual { x: 42 }, { x: 42, y: undefined }
Error: deepEqual {"x":42} failed on something that
serializes to the same result (likely some function)

In this case it's a tiny structure and easy to hunt down, but for large structures figuring out which thing has an undefined can be odious.

dbushong avatar Feb 06 '14 19:02 dbushong

This would require some smarter deepEqual logic.

@johan thoughts?

EndangeredMassa avatar Feb 06 '14 19:02 EndangeredMassa

I couldn't agree more; patches to improve this situation are warmly welcome and encouraged.

The current output is one step up from stating your two objects did not match, and showing two huge identical JSON serializations, which I think was the behaviour of assertive's predecessor.

The not-yet-exposed stringify (with potential additional needed tweaks) might be one approach, but I assume non-serialization-based logic in deepEqual is the more solid workable approach.

johan avatar Feb 06 '14 19:02 johan

Something like deep-diff might be useful for displaying the differences in a concise way.

EndangeredMassa avatar Feb 06 '14 19:02 EndangeredMassa