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
1.8
Ian Oxley 2012-09-11 14:29:30 +01:00 committed by Ariya Hidayat
parent 1dbd371540
commit e85140e80f
1 changed files with 4 additions and 2 deletions

View File

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