Node assert.throws not catching exception
The examples take a function, while your sample code calls a function and passes the result. The exception happens before the assert even gets to look at it.
Change your code to this:
var assert = require('assert');
function boom(){
throw new Error('BOOM');
}
assert.throws( boom, Error ); // note no parentheses
EDIT: To pass parameters, just make another function. After all, this is javascript!
var assert = require('assert');
function boom(blowup){
if(blowup)
throw new Error('BOOM');
}
assert.throws( function() { boom(true); }, Error );
You can use bind():
assert.throws( boom.bind(null), Error );
With arguments it is:
assert.throws( boom.bind(null, "This is a blowup"), Error );