exit on error

exit on error to be able to rerun the process
This commit is contained in:
Richard Ivan 2016-06-05 17:58:28 +02:00
parent 41c7a61960
commit 991483bfc5

View file

@ -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
}
}