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

Commit

Permalink
fix(cli): Correctly parse list chromeOptions
Browse files Browse the repository at this point in the history
Chromedriver requires that certain options always be passed as an array.
Optimist passes --single-option as a string instead of an array which is
invalid. This ensures that we always pass an array, even if a single
option is passed via the cli.

Fixes #4050
  • Loading branch information
NickTomlin authored and heathkit committed May 3, 2017
1 parent a655d45 commit 1250278
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,17 @@ if (argv.exclude) {
argv.exclude = processFilePatterns_(<string>argv.exclude);
}

if (argv.capabilities && argv.capabilities.chromeOptions) {
// ensure that single options (which optimist parses as a string)
// are passed in an array in chromeOptions when required:
// https://sites.google.com/a/chromium.org/chromedriver/capabilities#TOC-chromeOptions-object
['args', 'extensions', 'excludeSwitches', 'windowTypes'].forEach((key) => {
if (typeof argv.capabilities.chromeOptions[key] === 'string') {
argv.capabilities.chromeOptions[key] = [argv.capabilities.chromeOptions[key]];
}
});
}

// Use default configuration, if it exists.
let configFile: string = argv._[0];
if (!configFile) {
Expand Down

0 comments on commit 1250278

Please sign in to comment.