nodeunit
nodeunit copied to clipboard
How to fail() a test?
I hate myself when I want to end a test and the only solution coming to my mind is:
foo(err) {
if (err) {
test.ok(false, 'error in foo, test finished');
test.done();
}
}
Would be useful some kind of test.fail(error)
method? do I miss something?
+1 I am using this pattern too and it's not great.
pull request welcome!
This would basically be a hybrid of test.ok()
and test.done()
, right?