So QUnit provides the "raise" assertion to test if an exception is thrown. Is there any way to test the actual message thrown by the exception, though? For instance, say I have this function:
throwError = function(arg) {
var err = new Error();
if (typeof arg === 'undefined') {
err.message = 'missing parameter';
throw err;
}
}
I'd like to be able to write something along these lines:
raises(
function(){throwError();},
Error.message,
'missing arg'
);
Ideally, this test would fail because the exception message is "missing parameter" and I expect it to be "missing arg," but it passes because qunit only checks that an error was raised. Any way to check the actual contents of the thrown exception?