busterjs/buster

"brief" reporter fails when exception happens outside of test context in browsers

dominykas opened this issue · 1 comments

If an exception is thrown during parsing/init (e.g. due to https://github.com/busterjs/buster-test/blob/master/lib/test-case.js#L19 and invalid testCase or whatever other reason), brief reporter will report an incorrect exception like so:

dominykas@patti ~/devel/libs/buster/tmp $ buster-test
Uncaught exception: undefined
Running tests ...
TypeError: uncaughtException listener threw error: Cannot read property 'description' of undefined
    at Object.module.exports.uncaughtException (/Users/dominykas/devel/libs/buster/busterDevEnv/buster-test/lib/reporters/brief.js:334:42)

https://github.com/busterjs/buster-test/blob/master/lib/reporters/brief.js#L334 needs a check that getEnv(this.runtimes, e) is actually valid.

I'll probably PR later, if no one gets around to do this.