From c74b5ba3a29026c7a61f1265d9aeaa0ebf58e63f Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 13 Oct 2013 11:26:22 -0700 Subject: [PATCH] Update vendor/qunit-clib to throw errors for failed tests in ringo, rhino, & narwhal. --- vendor/qunit-clib/qunit-clib.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/vendor/qunit-clib/qunit-clib.js b/vendor/qunit-clib/qunit-clib.js index f43ff6c04..296ac4abe 100644 --- a/vendor/qunit-clib/qunit-clib.js +++ b/vendor/qunit-clib/qunit-clib.js @@ -173,20 +173,26 @@ console.log(' Finished in ' + details.runtime + ' milliseconds.'); console.log(hr); - // exit out of Narhwal, Rhino, or RingoJS - try { - quit(); - } catch(e) { } + var fails = details.failed, + error = fails + ' of ' + details.total + ' tests failed.'; // exit out of Node.js or PhantomJS try { var process = context.process || context.phantom; - if (details.failed) { - console.error('Error: ' + details.failed + ' of ' + details.total + ' tests failed.'); + if (fails) { + console.error('Error: ' + error); process.exit(1); } else { process.exit(0); } + } catch(e) { + if (fails) { + throw new Error(error); + } + } + // exit out of Narhwal, Rhino, or RingoJS + try { + quit(); } catch(e) { } }; }());