diff --git a/support.js b/support.js index 384adafc..d6f427b6 100644 --- a/support.js +++ b/support.js @@ -71,8 +71,15 @@ const registerHooks = () => { // because we don't control the cross-origin code, we can safely return let applicationSourceCoverage try { - applicationSourceCoverage = win?.__coverage__ + // 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__ + } } catch {} + if (!applicationSourceCoverage) { return }