exit on error
exit on error to be able to rerun the process
This commit is contained in:
parent
41c7a61960
commit
991483bfc5
1 changed files with 10 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue