diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index a524f14a8483..b14417c7a6c3 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -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). diff --git a/packages/server/lib/util/args.js b/packages/server/lib/util/args.js index f948f709c82e..65c2e5a887c5 100644 --- a/packages/server/lib/util/args.js +++ b/packages/server/lib/util/args.js @@ -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 @@ -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) => { diff --git a/packages/server/test/integration/cypress_spec.js b/packages/server/test/integration/cypress_spec.js index f7957c35a0cf..ba6a68c122f5 100644 --- a/packages/server/test/integration/cypress_spec.js +++ b/packages/server/test/integration/cypress_spec.js @@ -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(() => {