Using chai 1.5.0 and mocha 1.8.1, the following works for me:
var expect = require('chai').expect; it("shows a diff of arrays", function() { expect([1,2,3]).to.deep.equal([1,2,3, {}]); }); it("shows a diff of objects", function() { expect({foo: "bar"}).to.deep.equal({foo: "bar", baz: "bub"}); });
leads to:
โ 2 of 2 tests failed: 1) shows a diff of arrays: actual expected 1 | [ 2 | 1, 3 | 2, 4 | 3, 5 | {} 6 | ] 2) shows a diff of objects: actual expected { "foo": "bar", "baz": "bub" }
What is not shown here is that the output is highlighted in red / green, where the lines are unexpected / missing.
source share