Skip to content

Commit

Permalink
Non-zero exit code if any test fails.
Browse files Browse the repository at this point in the history
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 21, 2012
1 parent 1dbd371 commit e85140e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/run-jasmine.js
Expand Up @@ -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');
Expand All @@ -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.