Skip to content

Commit

Permalink
fix: globalThis with CSP compatibility (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
himself65 committed Oct 4, 2023
1 parent 8caf771 commit 8b1baa8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/istanbul-lib-instrument/test/util/verifier.js
Expand Up @@ -26,6 +26,22 @@ function annotatedCode(code) {
}

function getGlobalObject() {
if (typeof globalThis !== 'undefined') {
// eslint-disable-next-line no-undef
return globalThis;
}
if (typeof global !== 'undefined') {
// eslint-disable-next-line no-undef
return global;
}
if (typeof window !== 'undefined') {
// eslint-disable-next-line no-undef
return window;
}
if (typeof self !== 'undefined') {
// eslint-disable-next-line no-undef
return self;
}
return new Function('return this')();
}

Expand Down

0 comments on commit 8b1baa8

Please sign in to comment.