Skip to content

Commit 15113e5

Browse files
committed
Use globalThis instead of global in tests.
1 parent 2195822 commit 15113e5

7 files changed

Lines changed: 12 additions & 10 deletions

File tree

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- Removed the now redundant `not IE > 0` from the Browserslist query.
2222
- Updated `react-dom/server` imports in tests to suit React v18.
2323
- Fixed the `fetchGraphQL` test with the global `fetch` API unavailable for new versions of Node.js that have the `fetch` global.
24+
- Use `globalThis` instead of `global` in tests.
2425
- Fixed some JSDoc links.
2526
- Removed some unnecessary JSDoc comments in tests.
2627
- Revamped the readme:

test/polyfills/AbortController.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44

55
import { AbortController } from "abort-controller";
66

7-
if (!("AbortController" in global)) global.AbortController = AbortController;
7+
if (!("AbortController" in globalThis))
8+
globalThis.AbortController = AbortController;

test/polyfills/AbortSignal.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
import { AbortSignal } from "abort-controller";
66

7-
if (!("AbortSignal" in global)) global.AbortSignal = AbortSignal;
7+
if (!("AbortSignal" in globalThis)) globalThis.AbortSignal = AbortSignal;

test/polyfills/CustomEvent.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// @ts-check
22

3-
if (!("CustomEvent" in global))
4-
global.CustomEvent =
3+
if (!("CustomEvent" in globalThis))
4+
globalThis.CustomEvent =
55
/**
66
* `CustomEvent` polyfill.
7-
* @type {typeof global.CustomEvent}
7+
* @type {typeof globalThis.CustomEvent}
88
*/
9-
class CustomEvent extends global.Event {
9+
class CustomEvent extends globalThis.Event {
1010
/**
1111
* @param {string} type Event type.
1212
* @param {CustomEventInit} [eventInitDict] Custom event options.

test/polyfills/Event.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
import { Event } from "event-target-shim";
44

5-
if (!("Event" in global)) global.Event = Event;
5+
if (!("Event" in globalThis)) globalThis.Event = Event;

test/polyfills/EventTarget.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
import { EventTarget } from "event-target-shim";
44

5-
if (!("EventTarget" in global)) global.EventTarget = EventTarget;
5+
if (!("EventTarget" in globalThis)) globalThis.EventTarget = EventTarget;

test/polyfills/performance.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import { performance } from "perf_hooks";
44

5-
if (!("performance" in global))
5+
if (!("performance" in globalThis))
66
// @ts-ignore Node.js has a partial implementation.
7-
global.performance = performance;
7+
globalThis.performance = performance;

0 commit comments

Comments
 (0)