Skip to content

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 angular#4050
  • Loading branch information
NickTomlin committed Feb 26, 2017
1 parent 237593a commit 903c301
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 @@ -200,6 +200,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 903c301

Please sign in to comment.