From 6229e9ede5e2e1eb7aa55a0af4dbc6c0774c7489 Mon Sep 17 00:00:00 2001 From: DanielJDufour Date: Tue, 16 Jan 2024 12:49:02 -0500 Subject: [PATCH] fix issue with testing LeafletJS on NodeJS --- test/fix-leaflet.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/fix-leaflet.js b/test/fix-leaflet.js index 87cd156..d9144ac 100644 --- a/test/fix-leaflet.js +++ b/test/fix-leaflet.js @@ -1,3 +1,13 @@ import "global-jsdom/register"; -global.navigator.platform = "MacIntel"; +if (!global.navigator.platform) { + try { + global.navigator.platform = "MacIntel"; + } catch (error) { + Object.defineProperty(global.navigator, "platform", { + get() { + return "MacIntel"; + } + }); + } +}