Skip to content

Conversation

@AtofStryker
Copy link
Contributor

@AtofStryker AtofStryker commented Oct 23, 2025

  • Closes

Additional details

refactors the environment.js file to handle distinct operations. This file is now:

  • append_electron_switches which now exports a function that takes the electron app as a paramter and appends switches to it by reference
  • configureLongStackTraces in environment.ts which just configures long stack traces on errors and bluebird
  • calculateCypressInternalEnv which calculates the value of CYPRESS_INTERNAL_ENV, which is now set in start-cypress

The reason for the move is the environment.js file was acting as a global drop in that had side effects as opposed to functions or other types of patterns. It makes understanding what is used where and why unclear. For instance, the electron switches silently fail in the parent process, but work in the child electron process. This is why this is now moved to start-cypress when we check if electron is running, and if so, get the electron app and pass it in to append switches by reference. This makes the intent much clearer.

We don't have unit tests for start-cypress (AFAIK?) but it is usually very clear when something is not behaving as it should (i.e., CI system tests start failing in large numbers. start-cypress is responsible for setting the CYPRESS_INTERNAL_ENV env, CYPRESS env, and appending the electron switches correctly. Tests are also added/refactored with this change

Steps to test

How has the user experience changed?

PR Tasks


Note

Extracts Electron switch logic and env/stack-trace configuration from a side-effectful module into explicit functions wired via start-cypress, with updated tests.

  • Server refactor:
    • Split lib/environment.js into:
      • lib/append_electron_switches.ts: appends default Chromium flags, sets --gtk-version=3, disables HW acceleration on Linux, and parses ELECTRON_EXTRA_LAUNCH_ARGS.
      • lib/environment.ts: adds configureLongStackTraces(env) and calculateCypressInternalEnv().
    • Update start-cypress.js to:
      • Set process.env.CYPRESS_INTERNAL_ENV via calculateCypressInternalEnv() and call configureLongStackTraces(); set process.env.CYPRESS = 'true'.
      • When running Electron, call appendElectronSwitches(app) before startup.
    • Remove implicit require('./environment') usage (e.g., from lib/cypress.ts).
  • Tests:
    • Add test/unit/append_electron_switches_spec.ts and test/unit/environment_spec.ts for new modules.
    • Adjust test/spec_helper.js to use configureLongStackTraces(); remove old environment_spec.js.

Written by Cursor Bugbot for commit 1b13a55. This will update automatically on new commits. Configure here.

@cypress
Copy link

cypress bot commented Oct 23, 2025

cypress    Run #66825

Run Properties:  status check passed Passed #66825  •  git commit 1b13a550ee: internal env is test not development
Project cypress
Branch Review chore/rework-electron-switches
Run status status check passed Passed #66825
Run duration 19m 36s
Commit git commit 1b13a550ee: internal env is test not development
Committer Bill Glesias
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 12
Tests that did not run due to a developer annotating a test with .skip  Pending 1102
Tests that did not run due to a failure in a mocha hook  Skipped 4
Tests that passed  Passing 26755
View all changes introduced in this branch ↗︎

Warning

Partial Report: The results for the Application Quality reports may be incomplete.

UI Coverage  45.61%
  Untested elements 187  
  Tested elements 161  
Accessibility  97.98%
  Failed rules  4 critical   8 serious   2 moderate   2 minor
  Failed elements 101  

@AtofStryker AtofStryker force-pushed the chore/rework-electron-switches branch from 0b6c2cf to 36274e3 Compare October 23, 2025 20:20
cursor[bot]

This comment was marked as outdated.

@AtofStryker AtofStryker force-pushed the chore/rework-electron-switches branch from a4b281e to c712e76 Compare October 24, 2025 12:15
@AtofStryker AtofStryker self-assigned this Oct 24, 2025
@jennifer-shehane jennifer-shehane self-requested a review October 24, 2025 14:01
// thus we don't have to worry about casting
// --foo=false for example will be "--foo", "false"
if (value.length) {
let joinedValues = value.join('=')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let joinedValues = value.join('=')
const joinedValues = value.join('=').replace(/^(?:['"](.*)['"]|\u0022(.*)\u0027)$/, '$1$2')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in 56ab152. Thank you for the suggestion!

how bad does this fail?

fix server tests
@AtofStryker AtofStryker force-pushed the chore/rework-electron-switches branch from 56ab152 to ff1543a Compare October 24, 2025 16:55
cursor[bot]

This comment was marked as outdated.

@AtofStryker AtofStryker force-pushed the chore/rework-electron-switches branch from ff1543a to f60cf64 Compare October 24, 2025 17:32
cursor[bot]

This comment was marked as outdated.

@AtofStryker AtofStryker merged commit dee4771 into develop Oct 27, 2025
90 of 92 checks passed
@AtofStryker AtofStryker deleted the chore/rework-electron-switches branch October 27, 2025 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants