Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing Electron launch CLI flags #5807

Closed
bahmutov opened this issue Nov 27, 2019 · 2 comments · Fixed by #5891
Closed

Allow passing Electron launch CLI flags #5807

bahmutov opened this issue Nov 27, 2019 · 2 comments · Fixed by #5891
Assignees

Comments

@bahmutov
Copy link
Contributor

@bahmutov bahmutov commented Nov 27, 2019

Currently we allow passing Chrome browser CLI switches via https://on.cypress.io/browser-launch-api The user specifies these flags in the plugins file.

We should allow passing Electron CLI flags, but because we launch Electron FIRST way before the plugins file gets processed, then we need to somehow pipe it through CLI to the https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/environment.coffee

Probable an environment variable would be ok to achieve this

ELECTRON_EXTRA_LAUNCH_ARGS=disable-dev-shm-usage 

that would be equivalent to running chrome --disable-dev-shm-usage

Note: only some Chrome CLI switches are supported though, see Electron Documentation Supported Chrome Command Line Switches

The parsed args will be fed to https://electronjs.org/docs/api/command-line#commandlineappendswitchswitch-value so we need to support both presence and value flags like

ELECTRON_EXTRA_LAUNCH_ARGS=foo bar=baz disable-renderer-backgrounding=true

that would be like (note that boolean flag "true" has been converted)

const { app } = require('electron')
app.commandLine.appendSwitch('foo')
app.commandLine.appendSwitch('bar', 'baz')
app.commandLine.appendSwitch('disable-renderer-backgrounding', true)

Related issues

  • #1519 (probably can mark as duplicate and close by same PR)

Related links

@cypress-bot

This comment has been minimized.

Copy link

@cypress-bot cypress-bot bot commented Dec 12, 2019

The code for this is done in cypress-io/cypress#5891, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot

This comment has been minimized.

Copy link

@cypress-bot cypress-bot bot commented Dec 12, 2019

Released in 3.8.0.

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Dec 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.