fixed casperjs test command argument parsing
Showing
1 changed file
with
3 additions
and
2 deletions
... | @@ -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; | ... | ... |
-
Please register or sign in to post a comment