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 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

Related links

@bahmutov bahmutov self-assigned this Nov 27, 2019
@cypress-bot cypress-bot bot added the stage: proposal 💡 No work has been done of this issue label Dec 3, 2019
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: proposal 💡 No work has been done of this issue stage: work in progress labels Dec 5, 2019
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Dec 12, 2019
@cypress-bot
Copy link
Contributor

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
Copy link
Contributor

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
Development

Successfully merging a pull request may close this issue.

2 participants