Add better diffing for calledWith
and calledWithExactly
failures #124
Open
Description
Currently when a test fails it provides output the following way:
e.g.
const fooObject = {
foo: 'foo'
};
const barObject = {
bar: 'bar'
};
const stub = sinon.stub();
stub(fooObject);
expect(stub).to.be.calledWithExactly(barObject);
prints
AssertionError: expected stub to have been called with exact arguments { bar: "bar" }
{ foo: "foo" } { bar: "bar" }
It would be nice if this was a proper diff similar to what Chai's deep equal assertions provide.
e.g.
const fooObject = {
foo: 'foo'
};
const barObject = {
bar: 'bar'
};
expect(fooObject).to.deep.equal(barObject);
prints
AssertionError: expected { foo: 'foo' } to deeply equal { bar: 'bar' }
+ expected - actual
{
- "foo": "foo"
+ "bar": "bar"
}
Editors such as IntelliJ IDEA have support for the latter style and will provide a nicely formatted diff in their diffing tools if that convention is followed.
Metadata
Assignees
Labels
No labels