Currently we do an == to compare the expected exception. It would be good if we could pass a constructor and do an instanceof check instead, Currently: shouldThrow('localStorage.key()', '"TypeError: Not enough arguments"') It would be useful to allow this too shouldThrow('localStorage.key()', 'TypeError') which would do an instanceof check instead. We could even go one step further and also allow checking the message of the exception: shouldThrow('localStorage.key()', 'TypeError', '"Not enough arguments"') The benefit is that this would work better on different browsers where the toString of the exception does not match what we do in WebKit.
Great idea!