From 9b71b5f004c6b1ade7bca64fbe809b93385e0c90 Mon Sep 17 00:00:00 2001 From: Daniel Allen Date: Tue, 13 Oct 2015 13:08:51 -0700 Subject: [PATCH] Fix phantom args references for phantomjs 2.0.0+ Maintain compatibility with phantomjs versions < 2.0.0 --- lib/wrapper/wrapper.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/wrapper/wrapper.js b/lib/wrapper/wrapper.js index 1c33483..041568a 100644 --- a/lib/wrapper/wrapper.js +++ b/lib/wrapper/wrapper.js @@ -13,12 +13,13 @@ Timeout: Specify a timeout (override too) to kill a test var waitTimer, waitCounter = 0, testTimer, - file = phantom.args[0], - timeout = parseInt(phantom.args[1], 10), + phantomArgs = phantom.args || require('system').args.slice(1), + file = phantomArgs[0], + timeout = parseInt(phantomArgs[1], 10), timer, exited = false, debug = false, //Internal debugging of wrapper - logConsole = (phantom.args[2] === 'true' ? true : false), + logConsole = (phantomArgs[2] === 'true' ? true : false), log = function(a, b) { b = (typeof b === 'undefined') ? '' : b; if (debug) { @@ -195,7 +196,7 @@ var executeTest = function(file, cb) { }; -if (!phantom.args.length) { +if (!phantomArgs.length) { console.log('Please provide some test files to execute'); phantom.exit(1); }