visionmedia/should.js — Issue #42: asynchronous throw
Author: quangv
Created: 2012-01-26 08:51:52+00:00
State: open

What's the best way to test for throw() (great addition btw) asynchronously? using with mocha.

Example...

```javascript
it('works sync', function() {
(function() {
throw {message: 'error'};
}).should.throw();
});

this works.
```

```javascript
it('should throw async', function(done) {
(function() {
setTimeout(function() {
throw {message: 'error'};
}, 200);
}).should.throw();
});

AssertionError: expected an exception to be thrown
```