Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 256b21c

Browse files
jnizetjuliemr
authored andcommitted
fix(cli): allow passing the config file before the options
The cli usage says: > USAGE: protractor configFile [options] However, the options passed as argument are merged into the default configuration as soon as the configFile is met in the args parsing loop. This fix merges the options in the default configuration only after the loop, allowing to pass the options to the cli before or after, or around the config file.
1 parent 6223825 commit 256b21c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/cli.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var SauceLabs = require('saucelabs');
99
var glob = require('glob');
1010

1111
var args = process.argv.slice(2);
12-
var configDir;
12+
var configDir, configPath;
1313

1414
var merge = function(into, from) {
1515
for (key in from) {
@@ -230,14 +230,15 @@ while(args.length) {
230230
commandLineConfig.jasmineNodeOpts.isVerbose = true;
231231
break;
232232
default:
233-
var configPath = path.resolve(process.cwd(), arg);
234-
merge(config, require(configPath).config);
235-
merge (config, commandLineConfig);
233+
configPath = path.resolve(process.cwd(), arg);
236234
configDir = path.dirname(configPath);
237235
break;
238236
}
239237
}
240238

239+
merge(config, require(configPath).config);
240+
merge(config, commandLineConfig);
241+
241242
var sauceAccount;
242243
if (config.sauceUser && config.sauceKey) {
243244
sauceAccount = new SauceLabs({

0 commit comments

Comments
 (0)