From 52002ab2bcfee29d538ccdc32d238295ae7be743 Mon Sep 17 00:00:00 2001 From: "Schero D." Date: Wed, 18 Nov 2026 23:23:00 +0100 Subject: [PATCH] test(admin): use jsdom's Web Storage on Node 25 and later Node 25+ defines its own localStorage and sessionStorage globals (undefined without --localstorage-file), so the StrictMode harness kept them and the Strapi admin providers failed on Node 26 (seen in the Magic Link CI). Keeps the shared harness files identical across the plugins. Co-Authored-By: Claude Opus 5.5 --- tests/admin/harness/setup.mjs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/admin/harness/setup.mjs b/tests/admin/harness/setup.mjs index f2f1bde..5736476 100644 --- a/tests/admin/harness/setup.mjs +++ b/tests/admin/harness/setup.mjs @@ -49,6 +49,15 @@ for (const key of Object.getOwnPropertyNames(window)) { globalThis.window = window; globalThis.document = window.document; Object.defineProperty(globalThis, 'navigator', { value: window.navigator, configurable: true }); +// Node 25+ has its own Web Storage globals (`localStorage` is undefined without +// --localstorage-file), so the loop above would keep them: use jsdom's storage like a browser. +for (const key of ['localStorage', 'sessionStorage']) { + Object.defineProperty(globalThis, key, { + value: window[key], + configurable: true, + writable: true, + }); +} // React DOM expects the jsdom event classes on `window` and on the global object to match. // Abort signals must be jsdom's: components pass them to DOM `addEventListener({ signal })`. for (const key of [