feat(launcher): ignoreDefaultArgs to accept array of options (#3049)

If `ignoreDefaultArgs` is given an array of options, than
these options will be excluded from the default command-line
flags.
This commit is contained in:
Andrey Lushnikov
2018-08-08 19:10:10 -07:00
committed by GitHub
parent 1be7545b70
commit 40466cb3a4
3 changed files with 36 additions and 9 deletions

View File

@@ -75,7 +75,14 @@ class Launcher {
timeout = 30000
} = options;
const chromeArguments = !ignoreDefaultArgs ? this.defaultArgs(options) : args;
const chromeArguments = [];
if (!ignoreDefaultArgs)
chromeArguments.push(...this.defaultArgs(options));
else if (Array.isArray(ignoreDefaultArgs))
chromeArguments.push(...this.defaultArgs(options).filter(arg => ignoreDefaultArgs.indexOf(arg) === -1));
else
chromeArguments.push(...args);
let temporaryUserDataDir = null;
if (!chromeArguments.some(argument => argument.startsWith('--remote-debugging-')))