node-async-testing icon indicating copy to clipboard operation
node-async-testing copied to clipboard

throw null

Open dominictarr opened this issue 15 years ago • 2 comments

if null is thrown, it's it ends the test, but does not count as an error!

you get a passing test!

in javascript you can throw ANYTHING

dominictarr avatar Nov 27 '10 08:11 dominictarr

We absolutely don't check instanceof Error anywhere, nor do we say if(err) in the errorHandling code. So something else is going on.

bentomas avatar Nov 27 '10 18:11 bentomas

it's mainly in the reporting end of things: lib/console-runner 236 var r = tests[i]; if (r.failure) { var s = r.failure.stack ? r.failure.stack.split("\n"): ['no stack trace']

also, lib/testing 206

  if (test.failure) {
    test.failureType = test.failure instanceof assert.AssertionError ? 'assertion' : 'error';

a lot of that code breaks if a non Error is thrown, usually a property of null error when you try to say failure.stack.length, and failure is a string, and has no stack property.

dominictarr avatar Nov 28 '10 03:11 dominictarr