From 7072f3c16844716be3d0c0129d1314e548e76cf5 Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Wed, 30 Aug 2023 14:47:11 -0500 Subject: [PATCH] fix: make CDP errors non fatal (#27709) --- cli/CHANGELOG.md | 4 ++++ packages/server/lib/cloud/protocol.ts | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index cd438f94ac65..52d50b91628e 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -11,6 +11,10 @@ _Released 09/12/2023 (PENDING)_ - Fixed a regression introduced in Cypress [13.0.0](#13-0-0) where the [Module API](https://docs.cypress.io/guides/guides/module-api), [`after:run`](https://docs.cypress.io/api/plugins/after-run-api), and [`after:spec`](https://docs.cypress.io/api/plugins/after-spec-api) results did not include the `stats.skipped` field for each run result. Fixes [#27694](https://github.com/cypress-io/cypress/issues/27694). Addressed in [#27695](https://github.com/cypress-io/cypress/pull/27695). +**Bugfixes:** + +- Individual CDP errors that occur while capturing data for test replay will no longer prevent the entire run from being available. Addressed in [#27709](https://github.com/cypress-io/cypress/pull/27709). + ## 13.0.0 _Released 08/29/2023_ diff --git a/packages/server/lib/cloud/protocol.ts b/packages/server/lib/cloud/protocol.ts index adec482ede01..98163018db0d 100644 --- a/packages/server/lib/cloud/protocol.ts +++ b/packages/server/lib/cloud/protocol.ts @@ -112,7 +112,7 @@ export class ProtocolManager implements ProtocolManagerShape { await listener(message) } catch (error) { if (CAPTURE_ERRORS) { - this._errors.push({ captureMethod: 'cdpClient.on', fatal: true, error, args: [event, message] }) + this._errors.push({ captureMethod: 'cdpClient.on', fatal: false, error, args: [event, message] }) } else { debug('error in cdpClient.on %O', { error, event, message }) throw error @@ -137,8 +137,11 @@ export class ProtocolManager implements ProtocolManagerShape { try { this._beforeSpec(spec) } catch (error) { + // Clear out protocol since we will not have a valid state when spec has failed + this._protocol = undefined + if (CAPTURE_ERRORS) { - this._errors.push({ captureMethod: 'beforeSpec', error, args: [spec], runnableId: this._runnableId }) + this._errors.push({ captureMethod: 'beforeSpec', fatal: true, error, args: [spec], runnableId: this._runnableId }) } else { throw error }