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

fix: issue-22732-add-check-CI-browser-value #29188

Closed
2 changes: 1 addition & 1 deletion cli/CHANGELOG.md
Expand Up @@ -6,13 +6,13 @@ _Released 4/2/2024 (PENDING)_
**Bugfixes:**

- Fixed a bug where fields using arrays in `cypress.config` are not correctly processed. Fixes [#27103](https://github.com/cypress-io/cypress/issues/27103). Fixed in [#27312](https://github.com/cypress-io/cypress/pull/27312).
- Fixed launching with a null browser value. Fixes [#22732](https://github.com/cypress-io/cypress/issues/22732).

## 13.7.1

_Released 3/21/2024_

**Bugfixes:**

- Fixed an issue where Cypress was not executing beyond the first spec in `cypress run` for versions of Firefox 124 and up. Fixes [#29172](https://github.com/cypress-io/cypress/issues/29172).
- Fixed an issue blurring shadow dom elements. Fixed in [#29125](https://github.com/cypress-io/cypress/pull/29125).

Expand Down
8 changes: 7 additions & 1 deletion packages/server/lib/util/args.js
Expand Up @@ -412,7 +412,7 @@ module.exports = {
}

let { spec } = options
const { env, config, reporterOptions, outputPath, tag, testingType, autoCancelAfterFailures } = options
const { browser, env, config, reporterOptions, outputPath, tag, testingType, autoCancelAfterFailures } = options
let project = options.project || options.runProject

// only accept project if it is a string
Expand All @@ -426,6 +426,12 @@ module.exports = {
delete options.key
}

if (browser) {
if (typeof browser !== 'string' || browser == null) {
return errors.throwErr('COULD_NOT_PARSE_ARGUMENTS', 'browser', browser, 'browser must be a string or path to executable')
}
}

if (spec) {
try {
const resolvePath = (p) => {
Expand Down
9 changes: 9 additions & 0 deletions packages/server/test/integration/cypress_spec.js
Expand Up @@ -261,6 +261,15 @@ describe('lib/cypress', () => {
})

context('error handling', function () {
it('exits if browser cannot be parsed', function () {
return cypress.start(['--browser', ''])
.then(() => {
const err = this.expectExitWithErr('COULD_NOT_PARSE_ARGUMENTS')

snapshot('could not parse config error', stripAnsi(err.message))
})
})

it('exits if config cannot be parsed', function () {
return cypress.start(['--config', 'xyz'])
.then(() => {
Expand Down