mirror of https://github.com/vitalif/phantomjs
run-jasmine example: Ensure exit code is always returned.
https://github.com/ariya/phantomjs/pull/124862.0
parent
1e7829db97
commit
3be7005a17
|
@ -50,8 +50,8 @@ page.onConsoleMessage = function(msg) {
|
||||||
|
|
||||||
page.open(system.args[1], function(status){
|
page.open(system.args[1], function(status){
|
||||||
if (status !== "success") {
|
if (status !== "success") {
|
||||||
console.log("Unable to access network");
|
console.log("Unable to open " + system.args[1]);
|
||||||
phantom.exit();
|
phantom.exit(1);
|
||||||
} else {
|
} else {
|
||||||
waitFor(function(){
|
waitFor(function(){
|
||||||
return page.evaluate(function(){
|
return page.evaluate(function(){
|
||||||
|
@ -59,6 +59,7 @@ page.open(system.args[1], function(status){
|
||||||
});
|
});
|
||||||
}, function(){
|
}, function(){
|
||||||
var exitCode = page.evaluate(function(){
|
var exitCode = page.evaluate(function(){
|
||||||
|
try {
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log(document.body.querySelector('.description').innerText);
|
console.log(document.body.querySelector('.description').innerText);
|
||||||
var list = document.body.querySelectorAll('.results > #details > .specDetail.failed');
|
var list = document.body.querySelectorAll('.results > #details > .specDetail.failed');
|
||||||
|
@ -79,6 +80,10 @@ page.open(system.args[1], function(status){
|
||||||
console.log(document.body.querySelector('.alert > .passingAlert.bar').innerText);
|
console.log(document.body.querySelector('.alert > .passingAlert.bar').innerText);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
} catch (ex) {
|
||||||
|
console.log(ex);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
phantom.exit(exitCode);
|
phantom.exit(exitCode);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue