chaijs/chai — pull request #91 by piroor (2012-07-26 10:37:22+00:00)
Title: Set "actual" and "expected" for assertion errors from deepEqual and notDeepEqual

Mocha shows difference of expected and actual values for assertion errors. However, because errors from chai's deepEqual/notDeepEqual don't have "actual" value, currently no diff is shown. It is hard to debug if expected and actual values are very large hashes.

For example,

assert.deepEqual({ key1: 'value1',
key2: 'value2',
key3: 'value2', // different from below
key4: 'value4',
key5: 'value5' },
{ key1: 'value1',
key2: 'value2',
key3: 'value3',
key4: 'value4',
key5: 'value5' });

Mocha reports an report for the assertion failure like:

1) test:
expected { key1: 'value1',
key2: 'value2',
key3: 'value2',
key4: 'value4',
key5: 'value5' } to deeply equal { key1: 'value1',
key2: 'value2',
key3: 'value3',
key4: 'value4',
key5: 'value5' }

With these patches, Mocha reports the assertion failure like:

![screenshot of colored diff](https://raw.github.com/gist/1357549/9ce0090637871de5fdde0e8d463332c56f4eabfd/deep-equal-with-diff.png)

It is very helpful for debugging.