Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add config option to merge chromeOptions #42

Merged
merged 3 commits into from
Feb 14, 2019

Conversation

amkirwan
Copy link

  • merge desiredCapabilities.chromeOptions.args by default if specified
    in config
  • allow override of desiredCapabilities.chromeOptions.args with merge:
    false

- merge desiredCapabilities.chromeOptions.args by default if specified
in config
- allow override of desiredCapabilities.chromeOptions.args with merge:
false
@dbushong
Copy link
Member

Thanks for this feature. A few observations:

  1. Since chromeOptions has a lot of different things in it, I'd prefer something like mergeArgs to show what it's operating on
  2. To maintain backward-compatibility, it should default to being false, so the 2nd arg to
    config.get('desiredCapabilities.chromeOptions.mergeArgs') should be false, I believe

lib/processes.js Outdated
args = args.concat(config.get('desiredCapabilities.chromeOptions.args'))
.filter(function filterIt(opt, idx, arr) {
return arr.indexOf(opt) === idx;
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might need to be a bit more sophisticated for cases like --disk-cache-size=2

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that is a good point I forgot about options like --disk-cache-size=2

lib/processes.js Outdated

if (config.has('desiredCapabilities.chromeOptions.args')) {
if (config.has('desiredCapabilities.chromeOptions.mergeArgs')
&& config.get('desiredCapabilities.chromeOptions.mergeArgs') === true) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can probably collapse this to:

if (config.get('desiredCapabilities.chromeOptions.mergeArgs', false) === true) {

lib/processes.js Outdated
return acc;
}, {});

return Object.entries(objOpts).reduce(function mergeOpts(acc, opt) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.entries() requires node 8+; at the moment we want to maintain compatibility with 6+; you can use Object.keys() and a bit more work and maintain compatibility

- use Object.keys for node6
- config.get for 'desiredCapabilities.chromeOptions.mergeArgs' return
false by default
@dbushong
Copy link
Member

LGTM; thanks!

@dbushong dbushong merged commit ec5f863 into testiumjs:master Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants