Using deepEqual with object with .toJSON method produce empty diff
Example with underscore chain object
var test = require('ava'),
_ = require('underscore');
test(function(t) {
t.deepEqual(_([1, 2]).chain(), [1, 2]);
});
$ ava test.js
1 failed
[anonymous]
test.js:5
4: test(function(t) {
5: t.deepEqual(_([1, 2]).chain(), [1, 2]);
6: });
Difference:
Test.fn (test.js:5:4)
$ node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())"
Node.js v4.4.7
linux 4.4.0-59-generic
$ ava --version
0.18.1
$ npm --version
2.15.8
pretty-format has an option callToJSON that true by default, maybe this is a reason?
Hmm, I will look into this, thanks for reporting!
Perhaps if we can't compute a diff then we should not display the "Difference" section at all.
Most helpful comment
Perhaps if we can't compute a diff then we should not display the "Difference" section at all.