Takes function and throws exception if passed function doesn't throw an exception
It kind of boils down to coding style, but this is how I'd refactor your code.


I like my assertions to clearly state they are; rename throws() to assertThrows().
I like guard clauses rather than "unneccessary" else statements.
If a function ever throws an exception with an undefined message, your assertion would fail.
I like a specific format of assert failures: expected xxx but got yyy.


Code:

function assertThrows(testFunction, expectedMessage) {

    var actual = catchExceptionFrom(testFunction); 

    if (actual === undefined)
        throw new Error("Function did not throw an exception.");

    if (actual.message !== expectedMessage)
        throw new Error("Expected exception '" + expectedMessage + "' but got '" + actual.message + "'");
}; 

function catchExceptionFrom(fn) { 
    try { 
        fn(); 
    } 
    catch (exception) { 
        return exception; 
    } 
};