less verbose bootstrap.js
Showing
1 changed file
with
15 additions
and
15 deletions
... | @@ -207,31 +207,31 @@ CasperError.prototype = Object.getPrototypeOf(new Error()); | ... | @@ -207,31 +207,31 @@ CasperError.prototype = Object.getPrototypeOf(new Error()); |
207 | /** | 207 | /** |
208 | * Initializes the CasperJS Command Line Interface. | 208 | * Initializes the CasperJS Command Line Interface. |
209 | */ | 209 | */ |
210 | function initCasperCli() { | 210 | function initCasperCli(casperArgs) { |
211 | var baseTestsPath = fs.pathJoin(phantom.casperPath, 'tests'); | 211 | var baseTestsPath = fs.pathJoin(phantom.casperPath, 'tests'); |
212 | 212 | ||
213 | if (!!phantom.casperArgs.options.version) { | 213 | if (!!casperArgs.options.version) { |
214 | return __terminate(phantom.casperVersion.toString()) | 214 | return __terminate(phantom.casperVersion.toString()) |
215 | } else if (phantom.casperArgs.get(0) === "test") { | 215 | } else if (casperArgs.get(0) === "test") { |
216 | phantom.casperScript = fs.absolute(fs.pathJoin(baseTestsPath, 'run.js')); | 216 | phantom.casperScript = fs.absolute(fs.pathJoin(baseTestsPath, 'run.js')); |
217 | phantom.casperTest = true; | 217 | phantom.casperTest = true; |
218 | phantom.casperArgs.drop("test"); | 218 | casperArgs.drop("test"); |
219 | phantom.casperScriptBaseDir = fs.dirname(phantom.casperArgs.get(0)); | 219 | phantom.casperScriptBaseDir = fs.dirname(casperArgs.get(0)); |
220 | } else if (phantom.casperArgs.get(0) === "selftest") { | 220 | } else if (casperArgs.get(0) === "selftest") { |
221 | phantom.casperScript = fs.absolute(fs.pathJoin(baseTestsPath, 'run.js')); | 221 | phantom.casperScript = fs.absolute(fs.pathJoin(baseTestsPath, 'run.js')); |
222 | phantom.casperSelfTest = phantom.casperTest = true; | 222 | phantom.casperSelfTest = phantom.casperTest = true; |
223 | phantom.casperArgs.options.includes = fs.pathJoin(baseTestsPath, 'selftest.js'); | 223 | casperArgs.options.includes = fs.pathJoin(baseTestsPath, 'selftest.js'); |
224 | if (phantom.casperArgs.args.length <= 1) { | 224 | if (casperArgs.args.length <= 1) { |
225 | phantom.casperArgs.args.push(fs.pathJoin(baseTestsPath, 'suites')); | 225 | casperArgs.args.push(fs.pathJoin(baseTestsPath, 'suites')); |
226 | } | 226 | } |
227 | phantom.casperArgs.drop("selftest"); | 227 | casperArgs.drop("selftest"); |
228 | phantom.casperScriptBaseDir = fs.dirname(phantom.casperArgs.get(1) || fs.dirname(phantom.casperScript)); | 228 | phantom.casperScriptBaseDir = fs.dirname(casperArgs.get(1) || fs.dirname(phantom.casperScript)); |
229 | } else if (phantom.casperArgs.args.length === 0 || !!phantom.casperArgs.options.help) { | 229 | } else if (casperArgs.args.length === 0 || !!casperArgs.options.help) { |
230 | return printHelp(); | 230 | return printHelp(); |
231 | } | 231 | } |
232 | 232 | ||
233 | if (!phantom.casperScript) { | 233 | if (!phantom.casperScript) { |
234 | phantom.casperScript = phantom.casperArgs.get(0); | 234 | phantom.casperScript = casperArgs.get(0); |
235 | } | 235 | } |
236 | 236 | ||
237 | if (!fs.isFile(phantom.casperScript)) { | 237 | if (!fs.isFile(phantom.casperScript)) { |
... | @@ -247,7 +247,7 @@ CasperError.prototype = Object.getPrototypeOf(new Error()); | ... | @@ -247,7 +247,7 @@ CasperError.prototype = Object.getPrototypeOf(new Error()); |
247 | } | 247 | } |
248 | 248 | ||
249 | // filter out the called script name from casper args | 249 | // filter out the called script name from casper args |
250 | phantom.casperArgs.drop(phantom.casperScript); | 250 | casperArgs.drop(phantom.casperScript); |
251 | } | 251 | } |
252 | 252 | ||
253 | // CasperJS version, extracted from package.json - see http://semver.org/ | 253 | // CasperJS version, extracted from package.json - see http://semver.org/ |
... | @@ -291,7 +291,7 @@ CasperError.prototype = Object.getPrototypeOf(new Error()); | ... | @@ -291,7 +291,7 @@ CasperError.prototype = Object.getPrototypeOf(new Error()); |
291 | phantom.casperArgs = require('cli').parse(phantomArgs); | 291 | phantom.casperArgs = require('cli').parse(phantomArgs); |
292 | 292 | ||
293 | if (true === phantom.casperArgs.get('cli')) { | 293 | if (true === phantom.casperArgs.get('cli')) { |
294 | initCasperCli(); | 294 | initCasperCli(phantom.casperArgs); |
295 | } | 295 | } |
296 | 296 | ||
297 | // casper loading status flag | 297 | // casper loading status flag | ... | ... |
-
Please register or sign in to post a comment