Skip to content

Commit

Permalink
fix(protractor): extend config with argv
Browse files Browse the repository at this point in the history
This ensures extending the config with passed argv object
  • Loading branch information
Christoffer Åström committed Jan 10, 2018
1 parent 225613c commit c8eb58a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/protractor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ const options = require('./options');
const protractor = {
command: ['protractor', 'ptor'],
desc: 'Run protractor',
getConfig(configPath) {
getConfig(argv) {
const baseConfig = initConfig();
if (!fs.existsSync(configPath)) {
throw new Error(`Config ${configPath} not found`);
if (!fs.existsSync(argv.config)) {
throw new Error(`Config ${argv.config} not found`);
}
let config = {};
const p = path.resolve(process.cwd(), configPath);
const p = path.resolve(process.cwd(), argv.config);
const foundConfig = require(p);
if (typeof foundConfig === 'function') {
config = extend(true, baseConfig, foundConfig(baseConfig));
config = extend(true, argv, baseConfig, foundConfig(baseConfig));
} else {
config = extend(true, baseConfig, foundConfig);
config = extend(true, argv, baseConfig, foundConfig);
}
return config;
},
Expand All @@ -43,7 +43,7 @@ const protractor = {
process.exit(1);
}
}
const config = protractor.getConfig(argv.config);
const config = protractor.getConfig(argv);
argv.require.map(require);
if (argv.glob.length) {
config.specs = argv.glob;
Expand Down

0 comments on commit c8eb58a

Please sign in to comment.