joyent/node — pull request #2097 by seebees (2011-11-14 02:58:22+00:00)
Title: a cleaner default output for deepEqual

I find myself pasting in this code every time I have to fix a bunch of unit tests that use deepEqual.

Maybe the world will find it useful? It is clearly inefficient to walk to object twice, once to find that it is not equal and once to format output. But I like to thing that we can spend a few cycles to scratch our own back...

deepEqual/notDeepEqual by default return
truncate(JSON.stringify(a, replacer), 128) for both the actual and expected values.

This makes it hard to debug what is actually different.

Now, if a user makes a deepEqual call without passing a message I will attempt to format the message into something readable.

e.g.

```
deepEqual : {
'key': "actual" == "expected"
}
```