badunk/js-fixtures — pull request #20 by jagoda (2013-11-23 01:28:07+00:00)
Title: Script errors in fixtures are not reported in the parent window.

When using karma+mocha+js-fixtures to do UI testing, I noticed that tests that depend on the results of UI events in a fixture do not report the failures -- they just timeout. The problem seems to be that assertions that execute in an event handler belonging to the fixture document are caught by the fixture window's `onerror` handler and not reported to the parent (where mocha is listening for uncaught errors). For example, assuming jQuery is present, the following UI code would cause the following test to report a timeout rather than an assertion failure:

UI code:
```
Toggle

Target

```

Test code:
```
it("displays the div if the button is clicked", function(done){
var $ = fixtures.window().$;
var button = $('#toggle');

button.one('click', function(){
var div = $('#target');
expect(div.is(':visible')).to.be(true);
done();
});

button.click();
});
```

This code builds upon the code for #19.