From a07e236634acc618347b060cf425024fa8878f7b Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Mon, 16 Sep 2024 15:32:36 -0500 Subject: [PATCH 1/3] fix: ensure that projects without optional chainer support can use @cypress/code-coverage --- support.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/support.js b/support.js index 81697ca3..aee87d80 100644 --- a/support.js +++ b/support.js @@ -71,8 +71,11 @@ const registerHooks = () => { // because we don't control the cross-origin code, we can safely return let applicationSourceCoverage try { - applicationSourceCoverage = win?.__coverage__ + if (win) { + applicationSourceCoverage = win.__coverage__ + } } catch {} + if (!applicationSourceCoverage) { return } From 7131786e682159b98fcbdc85f8adaa858ed3ef9d Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Mon, 16 Sep 2024 15:50:35 -0500 Subject: [PATCH 2/3] Update support.js --- support.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/support.js b/support.js index aee87d80..40a80afc 100644 --- a/support.js +++ b/support.js @@ -71,6 +71,10 @@ const registerHooks = () => { // because we don't control the cross-origin code, we can safely return let applicationSourceCoverage try { + // Note that we are purposefully not supporting the optional chaining syntax here to + // support a wide range of projects (some of which are not set up to support the optional + // chaining syntax due to current Cypress limitations). See: + // /~https://github.com/cypress-io/cypress/issues/20753 if (win) { applicationSourceCoverage = win.__coverage__ } From 92485cc6ea71f0d1363f6845960720aba46c04d6 Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Mon, 16 Sep 2024 16:00:20 -0500 Subject: [PATCH 3/3] fix linter --- support.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support.js b/support.js index 40a80afc..1d8e04cc 100644 --- a/support.js +++ b/support.js @@ -74,7 +74,7 @@ const registerHooks = () => { // Note that we are purposefully not supporting the optional chaining syntax here to // support a wide range of projects (some of which are not set up to support the optional // chaining syntax due to current Cypress limitations). See: - // /~https://github.com/cypress-io/cypress/issues/20753 + // /~https://github.com/cypress-io/cypress/issues/20753 if (win) { applicationSourceCoverage = win.__coverage__ }