From fb02699cb00ab8b07f7a80d9d2e4642aed1e7ba8 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Wed, 15 Feb 2023 23:15:55 -0600 Subject: [PATCH] Fix tests not running --- src/game/events.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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"); +}