Skip to content

Commit

Permalink
fix: ensure that projects without optional chainer support can use @c…
Browse files Browse the repository at this point in the history
…ypress/code-coverage (#881)
  • Loading branch information
ryanthemanuel authored Sep 16, 2024
1 parent 207b027 commit a4ac9de
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion support.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit a4ac9de

Please sign in to comment.