Fix casperjs tests in Travis CI.

For reasons I don't understand, it appears that in Travis CI we're now
seeing errors using Casper that seem to correspond to a compatibility
issue introduced in PhantomJS 2, even though we're still using 1.9.8.

The solution for that compatability issue of patching casper's
bootstrap.js to get arguments from system.args at a slightly different
time than before seems to work in our setting as well, and that's what
this implements.

Probably the right long-term solution involves upgrading both
phantomjs and Casper to the latest versions.
This commit is contained in:
Tim Abbott 2015-10-14 19:24:02 -04:00
parent eac6ea75dd
commit e8e38e911b
1 changed files with 3 additions and 3 deletions

View File

@ -175,7 +175,7 @@ function patchRequire(require, requireDirs) {
function bootstrap(global) {
"use strict";
var phantomArgs = require('system').args;
var system = require('system');
/**
* Hooks in default phantomjs error handler to print a hint when a possible
@ -223,7 +223,7 @@ function bootstrap(global) {
// casper root path
if (!phantom.casperPath) {
try {
phantom.casperPath = phantom.args.map(function _map(i) {
phantom.casperPath = system.args.map(function _map(i) {
var match = i.match(/^--casper-path=(.*)/);
if (match) {
return fs.absolute(match[1]);
@ -289,7 +289,7 @@ function bootstrap(global) {
global.require = patchRequire(global.require, [phantom.casperPath, fs.workingDirectory]);
// casper cli args
phantom.casperArgs = global.require('cli').parse(phantom.args);
phantom.casperArgs = global.require('cli').parse(system.args);
// loaded status
phantom.casperLoaded = true;