azer / prova

Test runner based on Tape and Browserify
Other
333 stars 30 forks source link

runner hangs in the browser when exception is thrown from test #38

Open aghassemi opened 9 years ago

aghassemi commented 9 years ago

When a test throws an exception, running Prova with --browser tag just hangs.

Likely related to updated to Tape 3.0.0 and this commit https://github.com/substack/tape/commit/b74737415c98be5e68fcd28213d86c3e32433a05

Similar behaviour happens when tests run in Node ( it crashes the runner ) but at least the error stack is visible whereas in browser it just hangs.

I don't think crashing the runner when a test throws is ideal. Tests throwing exceptions should not break the runner and should just be reported as failures. Otherwise other unaffected tests won't run so we won't know how many other tests a particular bad commit breaks. It's important to consider that a test throwing exception does not mean the test itself has fatal errors in it and could very well be result of another change in another part of the system. For instance

test('foo.bar() = baz', function(t)) {
  var foo = require('fooModule');
  t.equal(foo.bar(),'baz');
}

would throw exception when someone else changes fooModule in a bad way, but that hardly justifies all of the runner crashing and other possibly unaffected tests not to run, it should just fail that test.

I don't know the justification behind https://github.com/substack/tape/commit/b74737415c98be5e68fcd28213d86c3e32433a05 but maybe Prova can take over the try catch now that Tape doesn't.