logicalparadox/chai — Issue #33: .throw broken?
Author: michaelsbradleyjr
Created: 2012-03-01 16:47:53+00:00
State: open

I just switched to chai from expect.js (because I like the sinon-chai plugin) and was expecting (no pun intended) to be able to match thrown error messages against particular strings.

I've found I have to do something like...

```coffeescript
( expect try
Obj.method()
catch error
error.message
).to.equal ( 'expected string' )
```

I'm using the latest version of chai and NodeJS v0.6.11, and I cannot get that behavior if I do something like:

```coffeescript
( expect -> Obj.method() ).to.throw 'expected string'
```

*-- or --*

```coffeescript
( expect -> Obj.method() ).to.throw Error, 'expected string'
```

Both of those will pass with flying colors even if the string does not match the actual error message. Is something broken, or do I have the wrong idea or...?