Skip to content

Commit be393c5

Browse files
authored
Merge pull request #699 from intuit/window-test-guard
Guard against `window` not existing in test setup
2 parents 53e1a0e + a124f97 commit be393c5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

plugins/test/src/jest/setupTests.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
/* eslint-disable @typescript-eslint/ban-ts-comment */
22

3-
window.matchMedia =
4-
window.matchMedia ||
5-
function() {
6-
return {
7-
matches: false
3+
if (typeof window !== 'undefined') {
4+
window.matchMedia =
5+
window.matchMedia ||
6+
function() {
7+
return {
8+
matches: false
9+
};
810
};
9-
};
11+
}
12+
1013

1114
// @ts-ignore
1215
if (global.document) {

0 commit comments

Comments
 (0)