metaskills/mocha-phantomjs — pull request #30 by jfirebaugh (2012-12-15 00:05:06+00:00)
Title: Fails with Chai 1.4.0 in mocha's string diff code

This pull request reveals a problem with the interaction of
Chai 1.4.0, mocha's browser package, and mocha-phantomjs. Because
of the complexity, I'm not sure how, or even where, to fix it.

The problem presents itself when you have a failing equality
assertion on strings, e.g. `expect('false').to.equal('true')`.
The failure mode is that the following message is printed, and
then the mocha-phantomjs process hangs:

```
TypeError: 'undefined' is not a function (evaluating 'diff['diff' + type](err.actual, err.expected)')

file:///Users/john/Development/mocha-phantomjs/node_modules/mocha/mocha.js:1697 in errorDiff
file:///Users/john/Development/mocha-phantomjs/node_modules/mocha/mocha.js:1517
```

This error points to an [`errorDiff`](https://github.com/visionmedia/mocha/blob/2a8efb22f118d4e714546ee9cd90a2ccf08f2b8a/mocha.js#L1697)
function in mocha.js. The `diff` object there is from [requiring](https://github.com/visionmedia/mocha/blob/2a8efb22f118d4e714546ee9cd90a2ccf08f2b8a/mocha.js#L1349)
`browser/diff`, which is an [empty stub](https://github.com/visionmedia/mocha/blob/2a8efb22f118d4e714546ee9cd90a2ccf08f2b8a/mocha.js#L60)
in the browser package.

I believe this has never worked, but didn't manifest until Chai 1.4.0 because
before that the errors Chai produced had no [`actual`](https://github.com/visionmedia/mocha/blob/2a8efb22f118d4e714546ee9cd90a2ccf08f2b8a/mocha.js#L1502)
property.

/cc @visionmedia