From 0b3cd9b2e13fd58c102c17b40e390d9dfce7748a Mon Sep 17 00:00:00 2001 From: Costas Ford Date: Mon, 4 Aug 2025 13:48:31 -0700 Subject: [PATCH 1/2] Fix: Ensure data.json is generated before tests run - Fix Windows path issue in metadata_fetch.mjs - Add pretest script to package.json for automatic data generation - Simplify Makefile by removing manual metadata fetch call - Resolves issue #2711 --- Makefile | 1 - metadata_fetch.mjs | 4 +++- package.json | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2639b6777..abd1b7226 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,6 @@ debug: REACT_APP_DEBUG=true npm start test: - node metadata_fetch.mjs npm run test deploy-setup: diff --git a/metadata_fetch.mjs b/metadata_fetch.mjs index 56fcff570..512150429 100644 --- a/metadata_fetch.mjs +++ b/metadata_fetch.mjs @@ -6,8 +6,10 @@ let metadataUS = null; let metadataUK = null; let metadataCA = null; const __dirname = path.dirname(new URL(import.meta.url).pathname); +// Fix for Windows path issues +const normalizedDirname = __dirname.startsWith('/') ? __dirname.slice(1) : __dirname; const filePath = path.join( - __dirname, + normalizedDirname, "src", "__tests__", "__setup__", diff --git a/package.json b/package.json index babfe2ff4..c938192ee 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "scripts": { "start": "react-scripts start", "build": "react-scripts build", + "pretest": "node metadata_fetch.mjs", "test": "jest", "eject": "react-scripts eject", "fix": "eslint --fix --ext js,jsx . && prettier -w .", From e20a6949e10656e547ec1daee2973ce0a3344577 Mon Sep 17 00:00:00 2001 From: Costas Ford Date: Tue, 5 Aug 2025 10:28:41 -0700 Subject: [PATCH 2/2] Update dependencies and configuration files --- metadata_fetch.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/metadata_fetch.mjs b/metadata_fetch.mjs index 512150429..7dd18ee7e 100644 --- a/metadata_fetch.mjs +++ b/metadata_fetch.mjs @@ -7,7 +7,9 @@ let metadataUK = null; let metadataCA = null; const __dirname = path.dirname(new URL(import.meta.url).pathname); // Fix for Windows path issues -const normalizedDirname = __dirname.startsWith('/') ? __dirname.slice(1) : __dirname; +const normalizedDirname = __dirname.startsWith("/") + ? __dirname.slice(1) + : __dirname; const filePath = path.join( normalizedDirname, "src",