Commit f086cb4a f086cb4accc4b014137e42abb939873c787202cb by Nicolas Perriault

fixed casperjs test command argument parsing

1 parent 608108ee
...@@ -108,7 +108,8 @@ CasperError.prototype = Object.getPrototypeOf(new Error()); ...@@ -108,7 +108,8 @@ CasperError.prototype = Object.getPrototypeOf(new Error());
108 } 108 }
109 if (!fs.hasOwnProperty('dirname')) { 109 if (!fs.hasOwnProperty('dirname')) {
110 fs.dirname = function dirname(path) { 110 fs.dirname = function dirname(path) {
111 return path.replace(/\\/g, '/').replace(/\/[^\/]*$/, ''); 111 if (!path) return undefined;
112 return path.toString().replace(/\\/g, '/').replace(/\/[^\/]*$/, '');
112 }; 113 };
113 } 114 }
114 if (!fs.hasOwnProperty('isWindows')) { 115 if (!fs.hasOwnProperty('isWindows')) {
...@@ -215,7 +216,7 @@ CasperError.prototype = Object.getPrototypeOf(new Error()); ...@@ -215,7 +216,7 @@ CasperError.prototype = Object.getPrototypeOf(new Error());
215 phantom.casperScript = fs.absolute(fs.pathJoin(baseTestsPath, 'run.js')); 216 phantom.casperScript = fs.absolute(fs.pathJoin(baseTestsPath, 'run.js'));
216 phantom.casperTest = true; 217 phantom.casperTest = true;
217 phantom.casperArgs.drop("test"); 218 phantom.casperArgs.drop("test");
218 phantom.casperScriptBaseDir = fs.dirname(phantom.casperArgs.get(1)); 219 phantom.casperScriptBaseDir = fs.dirname(phantom.casperArgs.get(0));
219 } else if (phantom.casperArgs.get(0) === "selftest") { 220 } else if (phantom.casperArgs.get(0) === "selftest") {
220 phantom.casperScript = fs.absolute(fs.pathJoin(baseTestsPath, 'run.js')); 221 phantom.casperScript = fs.absolute(fs.pathJoin(baseTestsPath, 'run.js'));
221 phantom.casperSelfTest = phantom.casperTest = true; 222 phantom.casperSelfTest = phantom.casperTest = true;
......