diff --git a/packages/wct-local/CHANGELOG.md b/packages/wct-local/CHANGELOG.md index 7bf3c4ddb..6db68e075 100644 --- a/packages/wct-local/CHANGELOG.md +++ b/packages/wct-local/CHANGELOG.md @@ -5,7 +5,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). - +## Unreleased +- Added `javaArgs` to plugin options. ## [v2.1.4] - 2019-06-05 diff --git a/packages/wct-local/custom_typings/selenium-standalone.d.ts b/packages/wct-local/custom_typings/selenium-standalone.d.ts index 4b682cbe3..60874a072 100644 --- a/packages/wct-local/custom_typings/selenium-standalone.d.ts +++ b/packages/wct-local/custom_typings/selenium-standalone.d.ts @@ -59,6 +59,9 @@ declare module 'selenium-standalone' { * child_process.spawn. */ seleniumArgs?: string[]; + + /** seleniumJavaArgs */ + javaArgs?: string[]; /** set the javaPath manually, otherwise we use `which` */ javaPath?: string; diff --git a/packages/wct-local/package.json b/packages/wct-local/package.json index 31c26c2ec..6e47231f0 100644 --- a/packages/wct-local/package.json +++ b/packages/wct-local/package.json @@ -35,6 +35,12 @@ "metavar": "ARG", "list": true }, + "javaArgs": { + "help": "Add java args to selenium-java-args", + "full": "selenium-java-args", + "metavar": "ARG", + "list": true + }, "skipSeleniumInstall": { "help": "Skip trying to install selenium.", "full": "skip-selenium-install", diff --git a/packages/wct-local/src/plugin.ts b/packages/wct-local/src/plugin.ts index 91c7515a8..657c41263 100644 --- a/packages/wct-local/src/plugin.ts +++ b/packages/wct-local/src/plugin.ts @@ -17,6 +17,7 @@ import * as selenium from './selenium'; interface PluginOptions { seleniumArgs?: string[]; + javaArgs?: string[]; skipSeleniumInstall?: boolean; browsers: string[]; browserOptions?: {}; @@ -36,6 +37,7 @@ const plugin: wct.PluginInterface = // to kick in if someone has specified browsers via another plugin. const onConfigure = async () => { pluginOptions.seleniumArgs = pluginOptions.seleniumArgs || []; + pluginOptions.javaArgs = pluginOptions.javaArgs || []; pluginOptions.skipSeleniumInstall = pluginOptions.skipSeleniumInstall || false; @@ -90,7 +92,7 @@ const plugin: wct.PluginInterface = if (pluginOptions.skipSeleniumInstall) { start = selenium.startSeleniumServer; } - const port = await start(wct, pluginOptions.seleniumArgs); + const port = await start(wct, pluginOptions.seleniumArgs, pluginOptions.javaArgs); updatePort(eachCapabilities, port); }; wct.hook('prepare', function(done: (err?: unknown) => void) { diff --git a/packages/wct-local/src/selenium.ts b/packages/wct-local/src/selenium.ts index 758f19406..a98963801 100644 --- a/packages/wct-local/src/selenium.ts +++ b/packages/wct-local/src/selenium.ts @@ -45,27 +45,27 @@ export async function checkSeleniumEnvironment(): Promise { } export async function startSeleniumServer( - wct: wct.Context, args: string[]): Promise { + wct: wct.Context, args: string[], javaArgs: string[]): Promise { wct.emit('log:info', 'Starting Selenium server for local browsers'); await checkSeleniumEnvironment(); - const opts = {args: args, install: false}; + const opts = {args: args, javaArgs: javaArgs, install: false}; return seleniumStart(wct, opts); } export async function installAndStartSeleniumServer( - wct: wct.Context, args: string[]): Promise { + wct: wct.Context, args: string[], javaArgs: string[]): Promise { wct.emit( 'log:info', 'Installing and starting Selenium server for local browsers'); await checkSeleniumEnvironment(); - const opts = {args: args, install: true}; + const opts = {args: args, javaArgs: javaArgs, install: true}; return seleniumStart(wct, opts); } async function seleniumStart( wct: wct.Context, - opts: {args: string[], install: boolean}): Promise { + opts: {args: string[], javaArgs: string[], install: boolean}): Promise { const port = await promisify(freeport)(); // See below. @@ -78,6 +78,7 @@ async function seleniumStart( const config: selenium.StartOpts = SELENIUM_OVERRIDES || {}; config.seleniumArgs = ['-port', port.toString()].concat(opts.args); + config.javaArgs = opts.javaArgs || []; // Bookkeeping once the process starts. config.spawnCb = function(server: child_process.ChildProcess) { // Make sure that we interrupt the selenium server ASAP.