You can use the assert-diff library to show only the difference when the test fails.
var assert = require('assert-diff'); describe("objects", function () { it("should equal", function () { var a = { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2, x: 3 } } }; var b = { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2, x: 4 } } }; assert.deepEqual(a, b); }); });
this will give you an error with a difference
1) objects should equal: AssertionError: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2, x: 3 } } } deepEqual { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2, x: 4 } } } { c: { c: { - x: 4 + x: 3 } } }
pihvi source share