diff --git a/src/game/events.ts b/src/game/events.ts index cf7ae65..a167042 100644 --- a/src/game/events.ts +++ b/src/game/events.ts @@ -54,4 +54,8 @@ export interface GlobalEvents { /** A global event bus for hooking into {@link GlobalEvents}. */ export const globalBus = createNanoEvents(); -document.fonts.onloadingdone = () => globalBus.emit("fontsLoaded"); +if ("fonts" in document) { + // This line breaks tests + // JSDom doesn't add document.fonts, and Object.defineProperty doesn't seem to work on document + document.fonts.onloadingdone = () => globalBus.emit("fontsLoaded"); +}