mirror of https://github.com/zulip/zulip.git
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:
parent
eac6ea75dd
commit
e8e38e911b
|
@ -175,7 +175,7 @@ function patchRequire(require, requireDirs) {
|
||||||
|
|
||||||
function bootstrap(global) {
|
function bootstrap(global) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var phantomArgs = require('system').args;
|
var system = require('system');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hooks in default phantomjs error handler to print a hint when a possible
|
* Hooks in default phantomjs error handler to print a hint when a possible
|
||||||
|
@ -223,7 +223,7 @@ function bootstrap(global) {
|
||||||
// casper root path
|
// casper root path
|
||||||
if (!phantom.casperPath) {
|
if (!phantom.casperPath) {
|
||||||
try {
|
try {
|
||||||
phantom.casperPath = phantom.args.map(function _map(i) {
|
phantom.casperPath = system.args.map(function _map(i) {
|
||||||
var match = i.match(/^--casper-path=(.*)/);
|
var match = i.match(/^--casper-path=(.*)/);
|
||||||
if (match) {
|
if (match) {
|
||||||
return fs.absolute(match[1]);
|
return fs.absolute(match[1]);
|
||||||
|
@ -289,7 +289,7 @@ function bootstrap(global) {
|
||||||
global.require = patchRequire(global.require, [phantom.casperPath, fs.workingDirectory]);
|
global.require = patchRequire(global.require, [phantom.casperPath, fs.workingDirectory]);
|
||||||
|
|
||||||
// casper cli args
|
// casper cli args
|
||||||
phantom.casperArgs = global.require('cli').parse(phantom.args);
|
phantom.casperArgs = global.require('cli').parse(system.args);
|
||||||
|
|
||||||
// loaded status
|
// loaded status
|
||||||
phantom.casperLoaded = true;
|
phantom.casperLoaded = true;
|
||||||
|
|
Loading…
Reference in New Issue