From 26cadbc9881a258fe645c675f9666caea7aca711 Mon Sep 17 00:00:00 2001 From: Dan Hitchcock Date: Fri, 22 Mar 2024 16:17:06 +0000 Subject: [PATCH 1/8] fix: add check for browser value and test --- packages/server/lib/util/args.js | 6 +++++- packages/server/test/integration/cypress_spec.js | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/server/lib/util/args.js b/packages/server/lib/util/args.js index f948f709c82e..5a93c159b3b3 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,10 @@ module.exports = { delete options.key } + 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(() => { From bb54c79147c345232d746303da1701921f50d7a5 Mon Sep 17 00:00:00 2001 From: Dan Hitchcock Date: Fri, 22 Mar 2024 16:28:48 +0000 Subject: [PATCH 2/8] fix: add changelog entry --- cli/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index b2055cbbecb1..59b581769dbd 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -4,7 +4,7 @@ _Released 3/21/2024_ **Bugfixes:** - +- Fixed launching with a null browser value. Fixes [#22732](https://github.com/cypress-io/cypress/issues/22732). - 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). From 1c8db294132530c7110e903740c43072677a3664 Mon Sep 17 00:00:00 2001 From: Dan Hitchcock Date: Fri, 22 Mar 2024 16:43:44 +0000 Subject: [PATCH 3/8] fix: changelog update --- cli/CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 59b581769dbd..2e0e276996bd 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -1,10 +1,16 @@ +## + +_Released (PENDING)_ + +**Bugfixes:** +- 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 launching with a null browser value. Fixes [#22732](https://github.com/cypress-io/cypress/issues/22732). - 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). From b3ed7a141e449820e6d79a4e63c47f27adcd3691 Mon Sep 17 00:00:00 2001 From: Dan Hitchcock Date: Fri, 22 Mar 2024 16:45:57 +0000 Subject: [PATCH 4/8] fix: changelog update --- cli/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 2e0e276996bd..283d704ba67c 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -1,5 +1,5 @@ -## +## 13.7.2 _Released (PENDING)_ From 480350ddb5549ecfaf525fd87f30b652c096fbba Mon Sep 17 00:00:00 2001 From: Dan Hitchcock Date: Fri, 22 Mar 2024 16:49:35 +0000 Subject: [PATCH 5/8] fix: changelog updates --- cli/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 283d704ba67c..9ab7a242429d 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -1,7 +1,7 @@ ## 13.7.2 -_Released (PENDING)_ +_Released xx/xx/xxxx (PENDING)_ **Bugfixes:** - Fixed launching with a null browser value. Fixes [#22732](https://github.com/cypress-io/cypress/issues/22732). From 51c3fadb8881a26945a2050ff3ffb2317da0d6ac Mon Sep 17 00:00:00 2001 From: Dan Hitchcock Date: Fri, 22 Mar 2024 17:13:17 +0000 Subject: [PATCH 6/8] chore: changelog update --- cli/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 9ab7a242429d..0b173f0f7268 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -1,7 +1,7 @@ ## 13.7.2 -_Released xx/xx/xxxx (PENDING)_ +_Released 04/04/2024 (PENDING)_ **Bugfixes:** - Fixed launching with a null browser value. Fixes [#22732](https://github.com/cypress-io/cypress/issues/22732). From 8bafb605350a41d22214faabc1d4b7370e1181a0 Mon Sep 17 00:00:00 2001 From: Dan Hitchcock Date: Fri, 22 Mar 2024 17:14:11 +0000 Subject: [PATCH 7/8] chore: changelog updates --- cli/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 0b173f0f7268..d7848cc4831e 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -4,6 +4,7 @@ _Released 04/04/2024 (PENDING)_ **Bugfixes:** + - Fixed launching with a null browser value. Fixes [#22732](https://github.com/cypress-io/cypress/issues/22732). ## 13.7.1 From 5cb26532e71d488f8913a155b7b2d38c031c69dd Mon Sep 17 00:00:00 2001 From: Dan Hitchcock Date: Tue, 26 Mar 2024 17:00:55 +0000 Subject: [PATCH 8/8] fix: resolve browser check issue --- packages/server/lib/util/args.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/lib/util/args.js b/packages/server/lib/util/args.js index 5a93c159b3b3..65c2e5a887c5 100644 --- a/packages/server/lib/util/args.js +++ b/packages/server/lib/util/args.js @@ -426,8 +426,10 @@ module.exports = { delete options.key } - 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 (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) {