Permalink
Browse files

Non-zero exit code if any test fails.

In the callback function passed to `waitFor`, the call to `page.evaluate`
returns a 1 or 0, and this is then passed to `phantom.exit` (with a 1
indicating at least one test failed, 0 indicating all tests passed).

http://code.google.com/p/phantomjs/issues/detail?id=792
  • Loading branch information...
ianoxley authored and ariya committed Sep 11, 2012
1 parent 1dbd371 commit e85140e80f3393d96a6c206cbf2ea5696415b285
Showing with 4 additions and 2 deletions.
  1. +4 −2 examples/run-jasmine.js
View
@@ -58,7 +58,7 @@ page.open(system.args[1], function(status){
return document.body.querySelector('.symbolSummary .pending') === null
});
}, function(){
- page.evaluate(function(){
+ var exitCode = page.evaluate(function(){
console.log('');
console.log(document.body.querySelector('.description').innerText);
var list = document.body.querySelectorAll('.results > #details > .specDetail.failed');
@@ -74,11 +74,13 @@ page.open(system.args[1], function(status){
console.log(msg.innerText);
console.log('');
}
+ return 1;
} else {
console.log(document.body.querySelector('.alert > .passingAlert.bar').innerText);
+ return 0;
}
});
- phantom.exit();
+ phantom.exit(exitCode);
});
}
});

0 comments on commit e85140e

Please sign in to comment.