chaijs/chai — pull request #173 by domenic (2013-06-14 03:13:49+00:00)
Title: Fix `utils.inspect` with custom object-returning inspect()s.

This code is lifted from the latest node utils.js: https://github.com/joyent/node/blob/896b2aa7074fc886efd7dd0a397d694763cac7ce/lib/util.js#L205-L209

Without it, if an object contains another object whose custom `inspect()` method returns a non-string, `utils.inspect` gets confused and tries to do `nonString.indexOf`.

This fixes domenic/chai-as-promised#32, where Chai as Promised was trying to call `utils.inspect` on an `AssertionError` which contained as its "actual" property a Q promise. Since Q promises have custom `inspect` methods that return objects, not strings, this was triggered.

---

Would love a patch release with this soon :)