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

Commit

Permalink
fix(cli): allow passing the config file before the options
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jnizet authored and juliemr committed Sep 23, 2013
1 parent 6223825 commit 256b21c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var SauceLabs = require('saucelabs');
var glob = require('glob');

var args = process.argv.slice(2);
var configDir;
var configDir, configPath;

var merge = function(into, from) {
for (key in from) {
Expand Down Expand Up @@ -230,14 +230,15 @@ while(args.length) {
commandLineConfig.jasmineNodeOpts.isVerbose = true;
break;
default:
var configPath = path.resolve(process.cwd(), arg);
merge(config, require(configPath).config);
merge (config, commandLineConfig);
configPath = path.resolve(process.cwd(), arg);
configDir = path.dirname(configPath);
break;
}
}

merge(config, require(configPath).config);
merge(config, commandLineConfig);

var sauceAccount;
if (config.sauceUser && config.sauceKey) {
sauceAccount = new SauceLabs({
Expand Down

0 comments on commit 256b21c

Please sign in to comment.