nodeunit icon indicating copy to clipboard operation
nodeunit copied to clipboard

How to fail() a test?

Open ibc opened this issue 10 years ago • 3 comments

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?

ibc avatar Feb 18 '15 20:02 ibc

+1 I am using this pattern too and it's not great.

StuartHa avatar Mar 04 '15 18:03 StuartHa

pull request welcome!

mreinstein avatar Mar 04 '15 19:03 mreinstein

This would basically be a hybrid of test.ok() and test.done(), right?

shakeelmohamed avatar May 06 '15 19:05 shakeelmohamed