-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
feat: Add support for optional env key to browser launch options #23624
Changes from 3 commits
7d6e0da
38a63d6
ecbdfe1
62ad6d3
1789849
778b2a1
788154b
25338aa
8300db1
743a7f3
8ce893d
47149dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -465,6 +465,18 @@ export = { | |
throw new Error('Attempting to connect to existing browser for Cypress in Cypress which is not yet implemented for electron') | ||
}, | ||
|
||
validateLaunchOptions (launchOptions: typeof utils.defaultLaunchOptions) { | ||
const options: string[] = [] | ||
|
||
if (Object.keys(launchOptions.env).length > 0) options.push('env') | ||
|
||
if (launchOptions.args.length > 0) options.push('args') | ||
|
||
if (options.length > 0) { | ||
errors.warning('BROWSER_UNSUPPORTED_LAUNCH_OPTION', 'electron', options) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ryanjduffy sorry last comment here before approval... how can I actually pass something to this? I want to verify this error actually shows up, but I couldn't figure out how. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
}, | ||
|
||
async open (browser: Browser, url: string, options: BrowserLaunchOpts, automation: Automation) { | ||
debug('open %o', { browser, url }) | ||
|
||
|
@@ -486,6 +498,8 @@ export = { | |
|
||
const launchOptions = await utils.executeBeforeBrowserLaunch(browser, defaultLaunchOptions, electronOptions) | ||
|
||
this.validateLaunchOptions(launchOptions) | ||
|
||
const { preferences } = launchOptions | ||
|
||
debug('launching browser window to url: %s', url) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is essentially a no-op in Electron, should we add an error or warning if someone sets .env with Electron?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I noticed that
args
seems to be the same so I've added a warning for both of those. Let me know if I've misread andargs
is used or if there's a different way that is preferred for warning.