Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure that projects without optional chainer support can use @cypress/code-coverage #881

Merged
merged 4 commits into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
ryanthemanuel marked this conversation as resolved.
Show resolved Hide resolved
applicationSourceCoverage = win.__coverage__
}
} catch {}

if (!applicationSourceCoverage) {
return
}
Expand Down
Loading