documentcloud/underscore-contrib — pull request #157 by bahmutov (2014-07-05 17:58:10+00:00)
Title: added qunit-helpful to remove need for duplicate messages in assertions

Looking through the unit tests, found them very verbose to repeating the condition
```js
test("add", function() {
equal(_.add(1, 1), 2, '1 + 1 == 2');
equal(_.add(3, 5), 8, '3 + 5 == 8');
equal(_.add(1, 2, 3, 4), 10, 'adds multiple operands');
});
```
This is due to QUnit not showing the actual condition expression that failed, only the help message.
I wrote [qunit-helpful](https://github.com/bahmutov/qunit-helpful) that automatically rewrites QUnit unit tests and adds the condition expression to the message argument. So you can now write (failing on purpose)
```js
test("add", function() {
equal(_.add(1, 1), 3);
});
```
and still get the exact expression on failure
```
underscore.util.operators - add
>> Message: QUnit.equal(_.add(1, 1), 3)
>> Actual: 2
>> Expected: 3
```
The only real requirement in this case was to add *qunit-helpful-browser.js* after qunit.js. For tests that would not work after rewriting (due to using closure variables), for example iterators or tree walkers, I added names
to functions ending with `noHelp` to disable rewriting. There is better way to get closure variables by using [qunit-inject](https://github.com/bahmutov/qunit-inject), but one thing at a time.

On local Mac the dynamic rewriting added less than 100 ms (from 420ms to 500ms).