mathFromtheGroundUp mathFromtheGroundUp - 1 year ago 18
Javascript Question

Qunit report JS errors?

I'm testing with qunit. When there's a JS error (this last one was an incredibly obscure syntax error in a complex mock object in my test) in either the unit test itself or in the code under test qunit will just die without reporting any errors to the console, leaving me to go treasure hunting trying to find the error, while qunit just shows the unhelpful:

Testing /path/to/code/under/test ...

So either I'd like to see JS errors propagated to the console or some method of running my unit tests through node to have it check for syntax errors so I don't have to sift through manually.



Specifically node qunit. It doesn't appear to be documented anywhere obvious, but from their getting started notes on their npm:{
    code: "/path/to/your/code.js",
    tests: "/path/to/your/tests.js"
}, function(err, report) {

The err bit there, seems to pass errors through to the testing environment. It's not as robust as node (doesn't give you a line number, source file, etc), but it's something.