Skip to content

Commit 59fab27

Browse files
committed
ignore cross-origin coverage
1 parent c840433 commit 59fab27

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

support.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ const registerHooks = () => {
6666
windowCoverageObjects = []
6767

6868
const saveCoverageObject = (win) => {
69+
// accessing win.__coverage__ will error when testing cross-origin code
70+
// because we don't control cross-origin code anyway, we can safely return
71+
try {
72+
win.__coverage__
73+
} catch {
74+
return
75+
}
76+
6977
// if application code has been instrumented, the app iframe "window" has an object
7078
const applicationSourceCoverage = win.__coverage__
7179
if (!applicationSourceCoverage) {

0 commit comments

Comments
 (0)