Permalink
Browse files

Exit 1 if test failed

  • Loading branch information...
1 parent 711dd71 commit a2b7810110a3f17e2bc91c2f183d9d669c61195c @5long committed Aug 23, 2011
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/bin/cli.js
View
11 src/bin/cli.js
@@ -12,8 +12,9 @@ function main() {
loadAndRun(path.join(cwd, file), this)
}, function(err) {
if (err) throw err
- runner.run({}, function(err) {
+ runner.run({}, function(err, results) {
if (err) throw err
+ if (hasFailed(results)) process.exit(1)
})
})
}
@@ -24,4 +25,12 @@ function loadAndRun(filename, cb) {
cb(null)
}
+function hasFailed(results) {
+ return results.some(function(suiteResult) {
+ return suiteResult.some(function(testResult) {
+ return !!testResult.failed.length
+ })
+ })
+}
+
main()

0 comments on commit a2b7810

Please sign in to comment.