From 991483bfc52907f240e4ec0c53ef5c615681c31e Mon Sep 17 00:00:00 2001 From: Richard Ivan Date: Sun, 5 Jun 2016 17:58:28 +0200 Subject: [PATCH] exit on error exit on error to be able to rerun the process --- ospec/ospec.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ospec/ospec.js b/ospec/ospec.js index a0016aa9..2eab8727 100644 --- a/ospec/ospec.js +++ b/ospec/ospec.js @@ -184,16 +184,24 @@ module.exports = new function init() { function highlight(message) { return hasProcess ? "\x1b[31m" + message + "\x1b[0m" : "%c" + message + "%c " } + + function printInfo() { + var total = results.length + var completed = total - subjects.length + console.log(completed + " out of " + total + " assertions completed in " + Math.round(new Date - start) + "ms") + } function report() { for (var i = 0, r; r = results[i]; i++) { if (!r.pass) { var stackTrace = r.error.match(/^(?:(?!Error|[\/\\]ospec[\/\\]ospec\.js).)*$/m) console.error(r.context + ": " + highlight(r.message) + (stackTrace ? "\n\n" + stackTrace + "\n\n" : ""), hasProcess ? "" : "color:red", hasProcess ? "" : "color:black") + printInfo() + process.exit(1) } } - console.log(results.length + " assertions completed in " + Math.round(new Date - start) + "ms") + printInfo() } return o -} \ No newline at end of file +}