Skip to content

Commit

Permalink
fix: Fix clobbering of arguments in custom configurations (#50)
Browse files Browse the repository at this point in the history
Properly merge arrays when custom configuration is used, so i.e.
ChromeHeadless now can be extended with additional args:

```js
customLaunchers: {
  'ChromeHeadlessNoSandbox': {
    base: 'ChromeHeadless',
    config: {
      'goog:chromeOptions': {
        args: [
          '--no-sandbox',
          // before we had to pass other args because merge wasn't working properly
          // '--headless',
          // '--disable-gpu',
          // '--disable-dev-shm-usage',
        ],
      },
    },
  },
},
```
  • Loading branch information
tykus160 authored Jul 19, 2023
1 parent 165177d commit 43ce270
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,14 @@ const LocalWebDriverBase = function(baseBrowserDecorator, args, logger) {

log.debug('config:', JSON.stringify(config));

const extraSpecs =
_.merge(this.constructor.EXTRA_WEBDRIVER_SPECS, args.config);
const extraSpecs = _.mergeWith(
this.constructor.EXTRA_WEBDRIVER_SPECS,
args.config,
(objValue, srcValue) => {
if (Array.isArray(objValue)) {
return objValue.concat(srcValue);
}
});
log.debug('extraSpecs:', extraSpecs);

// These names ("browser" and "spec") are needed for compatibility with
Expand Down

0 comments on commit 43ce270

Please sign in to comment.