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

Unable to pass --js-flags to electron browser #27454

Closed
FDIM opened this issue Aug 3, 2023 · 2 comments · Fixed by #29077
Closed

Unable to pass --js-flags to electron browser #27454

FDIM opened this issue Aug 3, 2023 · 2 comments · Fixed by #29077

Comments

@FDIM
Copy link

FDIM commented Aug 3, 2023

Current behavior

When I set env value ELECTRON_EXTRA_LAUNCH_ARGS to --js-flags="--expose-gc --max-old-space-size=8192" it is not correctly forwarded to the process.

Here is what I can see in process explorer:

"<redacted>AppData\Local\Cypress\Cache\12.7.0\Cypress\Cypress.exe" --type=renderer --user-data-dir="<redacted>AppData\Roaming\Cypress" --app-path="<redacted>AppData\Local\Cypress\Cache\12.7.0\Cypress\resources\app" --enable-sandbox --autoplay-policy=no-user-gesture-required --enable-precise-memory-info --use-fake-ui-for-media-stream --js-flags="\"--expose-gc" --lang=en-US --device-scale-factor=1 --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=6 --time-ticks-at-unix-epoch=-1691047945249108 --launch-time-ticks=17259285088 --mojo-platform-channel-handle=9644 --field-trial-handle=1724,i,7189473835567745350,10601196281146343367,131072 --disable-features=SpareRendererForSitePerProcess,WinRetrieveSuggestionsOnlyOnDemand /prefetch:1

Please note that --js-flags value is not formatted correctly to work.

Desired behavior

I'd expect that all supported formats here: https://www.electronjs.org/docs/latest/api/command-line-switches#--js-flagsflags would work.

Test code to reproduce

N/A

I don't want to sound pushy/bad, but looking at develop branch in environment.js, it is visible from code that multiple switches cannot be passed to the underlying process:

https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/environment.js#L77

Excerpt:

if (process.env.ELECTRON_EXTRA_LAUNCH_ARGS) {
    const electronLaunchArguments = process.env.ELECTRON_EXTRA_LAUNCH_ARGS.split(' ')

It will split the value incorrectly. Maybe there could be a special workaround to pass it with semicolons instead.

Cypress Version

12.7

Node version

v18.15.0

Operating System

Windows

Debug Logs

No response

Other

I'm tinkering with this because one of our tests that involves huge form is crashing due to memory limit and there is no way for me to split it into multiple steps.

I'm not able to use chrome/edge on the workstation in enterprise environment as the cypress extension is blocked and cannot be side loaded to chrome.

If it's OK, I could also work on a PR :) Seems like a somewhat straightforward change.

EDIT: Turns firefox consumed 8gb for the same test :(

@nagash77
Copy link
Contributor

nagash77 commented Aug 4, 2023

Hi @FDIM , thanks for submitting this ticket. We would love to accept a PR for this functionality! Check out our Contributing guide for details on that process.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 11, 2024

Released in 13.7.3.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v13.7.3, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 11, 2024
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.

3 participants