Skip to content

Commit 30c7eaf

Browse files
committed
Use globalThis
1 parent 161bfb4 commit 30c7eaf

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Diff for: test/helpers/location.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ class MockLocation {
8484
}
8585
}
8686

87-
8887
export default function locationFactory(url) {
89-
if (!('document' in global)) {
90-
global["document"] = {} as Document;
88+
if (!('document' in globalThis)) {
89+
globalThis["document"] = {} as Document;
9190
}
92-
global.document.location = new MockLocation(url) as unknown as Location;
91+
globalThis.document.location = new MockLocation(url) as unknown as Location;
9392
}

Diff for: test/unit/authorize.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class MockRemote extends RemoteBase implements Remote {
4040
}
4141

4242
locationFactory('https://foo/bar');
43-
global.localStorageAvailable = localStorageAvailable;
44-
global["sessionStorage"] = sessionStorage;
43+
globalThis.localStorageAvailable = localStorageAvailable;
44+
globalThis["sessionStorage"] = sessionStorage;
4545

4646
describe("authorization", () => {
4747
const sandbox = sinon.createSandbox();
@@ -54,7 +54,7 @@ describe("authorization", () => {
5454
sessionStorage.removeItem('remotestorage:codeVerifier');
5555
sessionStorage.removeItem('remotestorage:state');
5656

57-
global.document.location.href = 'https://foo/bar';
57+
globalThis.document.location.href = 'https://foo/bar';
5858
});
5959

6060
afterEach(() => {

0 commit comments

Comments
 (0)