From a53a6b49aeda0cfa9ba1ae84657350980cac614b Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 20:07:49 +0100 Subject: [PATCH 01/67] Upgrade react/react-admin and migrate to vitest --- admin-js/package.json | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/admin-js/package.json b/admin-js/package.json index 6196c5e1..7c25552e 100644 --- a/admin-js/package.json +++ b/admin-js/package.json @@ -3,28 +3,28 @@ "version": "0.1.0", "private": true, "dependencies": { - "react": "18.2.0", - "react-admin": "4.16.7", - "react-dom": "18.2.0", + "react": "19.1.0", + "react-admin": "5.8.3", + "react-dom": "19.1.0", "terser": "5.40.0", "vite": "6.2.7", - "create-react-admin": "4.16.7", - "ra-core": "4.16.7", - "ra-data-fakerest": "4.16.7", - "ra-data-graphql-simple": "4.16.7", - "ra-data-graphql": "4.16.7", - "ra-data-json-server": "4.16.7", - "ra-data-local-forage": "4.16.7", - "ra-data-local-storage": "4.16.7", - "ra-data-simple-rest": "4.16.7", - "ra-i18n-i18next": "4.16.7", - "ra-i18n-polyglot": "4.16.7", - "ra-input-rich-text": "4.16.7", - "ra-language-english": "4.16.7", - "ra-language-french": "4.16.7", - "ra-no-code": "4.16.7", - "ra-ui-materialui": "4.16.7" + "create-react-admin": "5.8.3", + "ra-core": "5.8.3", + "ra-data-fakerest": "5.8.3", + "ra-data-graphql-simple": "5.8.3", + "ra-data-graphql": "5.8.3", + "ra-data-json-server": "5.8.3", + "ra-data-local-forage": "5.8.3", + "ra-data-local-storage": "5.8.3", + "ra-data-simple-rest": "5.8.3", + "ra-i18n-i18next": "5.8.3", + "ra-i18n-polyglot": "5.8.3", + "ra-input-rich-text": "5.8.3", + "ra-language-english": "5.8.3", + "ra-language-french": "5.8.3", + "ra-no-code": "5.8.3", + "ra-ui-materialui": "5.8.3" }, "devDependencies": { "@babel/preset-env": "7.27.2", @@ -37,12 +37,13 @@ "jest": "29.7.0", "jest-environment-jsdom": "29.7.0", "jest-fail-on-console": "3.3.1", + "vitest": "3.2.2", "whatwg-fetch": "3.6.20" }, "scripts": { "dev": "vite", "build": "vite build", - "test": "jest" + "test": "vitest" }, "eslintConfig": { "extends": [ From e8d424e51f7d9e1346b29aed2f6b39f77616f9c8 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 20:17:10 +0100 Subject: [PATCH 02/67] Update package.json --- admin-js/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/package.json b/admin-js/package.json index 7c25552e..1105b9e9 100644 --- a/admin-js/package.json +++ b/admin-js/package.json @@ -34,6 +34,7 @@ "@testing-library/react": "16.3.0", "@testing-library/user-event": "14.6.1", "@ungap/structured-clone": "1.3.0", + "@vitest/coverage-v8": "3.2.2", "jest": "29.7.0", "jest-environment-jsdom": "29.7.0", "jest-fail-on-console": "3.3.1", From c460e94928a8bf5684afc92be8b15708ebdd5f20 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 20:23:48 +0100 Subject: [PATCH 03/67] Update permissions.test.js --- admin-js/tests/permissions.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/tests/permissions.test.js b/admin-js/tests/permissions.test.js index cb2d9a41..4ddd85f4 100644 --- a/admin-js/tests/permissions.test.js +++ b/admin-js/tests/permissions.test.js @@ -1,3 +1,4 @@ +import {beforeAll, describe, expect, test} from "vitest"; import {within} from "@testing-library/dom"; import {screen, waitFor} from "@testing-library/react"; import userEvent from "@testing-library/user-event"; From 5f7790316ddffbd5796fd1a5eb2fb0a4a4efeb17 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 20:24:22 +0100 Subject: [PATCH 04/67] Update relationships.test.js --- admin-js/tests/relationships.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/tests/relationships.test.js b/admin-js/tests/relationships.test.js index 43e0a904..8d316d5d 100644 --- a/admin-js/tests/relationships.test.js +++ b/admin-js/tests/relationships.test.js @@ -1,3 +1,4 @@ +import {expect, test} from "vitest"; import {within} from "@testing-library/dom"; import {screen, waitFor} from "@testing-library/react"; import userEvent from "@testing-library/user-event"; From 76632b7c7646f86e66ac736d44400e1debb91ddc Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 20:24:43 +0100 Subject: [PATCH 05/67] Update simple.test.js --- admin-js/tests/simple.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/tests/simple.test.js b/admin-js/tests/simple.test.js index 96f3aa10..dcad4d40 100644 --- a/admin-js/tests/simple.test.js +++ b/admin-js/tests/simple.test.js @@ -1,3 +1,4 @@ +import {expect, test} from "vitest"; import {within} from "@testing-library/dom"; import {screen, waitFor} from "@testing-library/react"; import userEvent from "@testing-library/user-event"; From ec133382d2df7d7bcce5a1fd50ef1006fa057179 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 20:28:59 +0100 Subject: [PATCH 06/67] Update vite.config.js --- admin-js/vite.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 67f1a929..4b83857a 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -12,4 +12,7 @@ export default defineConfig({ }, sourcemap: true, }, + test: { + environment: "jsdom", + } }) From fdd8862b04497db6e9e753a8f2c9d45cb28d4ccb Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 20:33:10 +0100 Subject: [PATCH 07/67] Update vite.config.js --- admin-js/vite.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 4b83857a..ba0d890f 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -14,5 +14,6 @@ export default defineConfig({ }, test: { environment: "jsdom", + environmentOptions: {"url": "http://localhost:8080", "pretendToBeVisual": true}, } }) From a34dac150d03e28173fb6f4db6e1f4fed39023f5 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 20:36:14 +0100 Subject: [PATCH 08/67] Update vite.config.js --- admin-js/vite.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index ba0d890f..ebab4b04 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -15,5 +15,6 @@ export default defineConfig({ test: { environment: "jsdom", environmentOptions: {"url": "http://localhost:8080", "pretendToBeVisual": true}, + maxWorkers: 1, } }) From ef5c7f745a3fc262ab83d978d48e9e6e68dbfeb5 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 20:38:56 +0100 Subject: [PATCH 09/67] Update vite.config.js --- admin-js/vite.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index ebab4b04..878077b6 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -16,5 +16,6 @@ export default defineConfig({ environment: "jsdom", environmentOptions: {"url": "http://localhost:8080", "pretendToBeVisual": true}, maxWorkers: 1, + setupFiles: ["tests/setupTests.js"], } }) From 50be4a0946b5e1224e4e721b492641f0347d3a7b Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 20:44:05 +0100 Subject: [PATCH 10/67] Update vite.config.js --- admin-js/vite.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 878077b6..3f165fcd 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -15,7 +15,7 @@ export default defineConfig({ test: { environment: "jsdom", environmentOptions: {"url": "http://localhost:8080", "pretendToBeVisual": true}, - maxWorkers: 1, + //maxWorkers: 1, setupFiles: ["tests/setupTests.js"], } }) From fad4afeaaedd7d737f3be662df8dc7f8c1f1c7be Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 21:01:25 +0100 Subject: [PATCH 11/67] Update vite.config.js --- admin-js/vite.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 3f165fcd..a2e20b2b 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -13,6 +13,9 @@ export default defineConfig({ sourcemap: true, }, test: { + coverage: { + exclude: [], + }, environment: "jsdom", environmentOptions: {"url": "http://localhost:8080", "pretendToBeVisual": true}, //maxWorkers: 1, From 0f59db73534afe0c35ec8733efb34f36816252ca Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 21:05:10 +0100 Subject: [PATCH 12/67] Update vite.config.js --- admin-js/vite.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index a2e20b2b..3c216b26 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -13,6 +13,7 @@ export default defineConfig({ sourcemap: true, }, test: { + clearMocks: true, coverage: { exclude: [], }, From 1c081272f8b4f5d7b8ebdf7ebaf9d1f8cb8d36a8 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 21:06:18 +0100 Subject: [PATCH 13/67] Update vite.config.js --- admin-js/vite.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 3c216b26..334e82f4 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -20,6 +20,8 @@ export default defineConfig({ environment: "jsdom", environmentOptions: {"url": "http://localhost:8080", "pretendToBeVisual": true}, //maxWorkers: 1, + mockReset: true, + restoreMocks: true, setupFiles: ["tests/setupTests.js"], } }) From d85a6c3943705dabede310ef73f9fe175b92cc1b Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 21:11:29 +0100 Subject: [PATCH 14/67] Update vite.config.js --- admin-js/vite.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 334e82f4..8a7c7bcf 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -19,6 +19,9 @@ export default defineConfig({ }, environment: "jsdom", environmentOptions: {"url": "http://localhost:8080", "pretendToBeVisual": true}, + expect: { + requireAssertions: true + }, //maxWorkers: 1, mockReset: true, restoreMocks: true, From 62459ead5adc96b367d6f566e00141c7c125a8ef Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 21:12:06 +0100 Subject: [PATCH 15/67] Delete admin-js/jest.config.js --- admin-js/jest.config.js | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 admin-js/jest.config.js diff --git a/admin-js/jest.config.js b/admin-js/jest.config.js deleted file mode 100644 index 742e271f..00000000 --- a/admin-js/jest.config.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - clearMocks: true, - collectCoverageFrom: ["src/**", "tests/**"], - errorOnDeprecated: true, - maxWorkers: 1, - resetMocks: true, - restoreMocks: true, - setupFilesAfterEnv: ["/tests/setupTests.js"], - testEnvironment: "jsdom", - testEnvironmentOptions: {"url": "http://localhost:8080", "pretendToBeVisual": true}, - verbose: true, -}; From eb0e75757d4c58a6fae4aa2dd499027955cfe591 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 22:55:25 +0100 Subject: [PATCH 16/67] Update vite.config.js --- admin-js/vite.config.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 8a7c7bcf..59755eb3 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -1,4 +1,5 @@ -import { defineConfig } from "vite"; +import {defineConfig} from "vite"; +import react from "@vitejs/plugin-react"; export default defineConfig({ build: { @@ -12,6 +13,7 @@ export default defineConfig({ }, sourcemap: true, }, + plugins: [react()], test: { clearMocks: true, coverage: { @@ -25,6 +27,6 @@ export default defineConfig({ //maxWorkers: 1, mockReset: true, restoreMocks: true, - setupFiles: ["tests/setupTests.js"], + setupFiles: "tests/setupTests.js", } }) From 8a1d345b794f4fc37c60b6f37b6b55a2a9e6e4cd Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 22:56:17 +0100 Subject: [PATCH 17/67] Update package.json --- admin-js/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/package.json b/admin-js/package.json index 1105b9e9..d7917997 100644 --- a/admin-js/package.json +++ b/admin-js/package.json @@ -34,6 +34,7 @@ "@testing-library/react": "16.3.0", "@testing-library/user-event": "14.6.1", "@ungap/structured-clone": "1.3.0", + "@vitejs/plugin-react": "4.5.1", "@vitest/coverage-v8": "3.2.2", "jest": "29.7.0", "jest-environment-jsdom": "29.7.0", From c58f2118118807af116ba0e853f3a8134d2bb809 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 22:57:38 +0100 Subject: [PATCH 18/67] Update package.json --- admin-js/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/package.json b/admin-js/package.json index d7917997..adaa1b20 100644 --- a/admin-js/package.json +++ b/admin-js/package.json @@ -39,6 +39,7 @@ "jest": "29.7.0", "jest-environment-jsdom": "29.7.0", "jest-fail-on-console": "3.3.1", + "jsdom": "26.1.0", "vitest": "3.2.2", "whatwg-fetch": "3.6.20" }, From 412c7d418cb84d38afee4e4e78671f6473d999ac Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:01:45 +0100 Subject: [PATCH 19/67] Update package.json --- admin-js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/package.json b/admin-js/package.json index adaa1b20..f6e3c48a 100644 --- a/admin-js/package.json +++ b/admin-js/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "@vitejs/plugin-react": "4.5.1", "react": "19.1.0", "react-admin": "5.8.3", "react-dom": "19.1.0", @@ -34,7 +35,6 @@ "@testing-library/react": "16.3.0", "@testing-library/user-event": "14.6.1", "@ungap/structured-clone": "1.3.0", - "@vitejs/plugin-react": "4.5.1", "@vitest/coverage-v8": "3.2.2", "jest": "29.7.0", "jest-environment-jsdom": "29.7.0", From a03890ab4dc30e93e87864cbf21524c40b3c329c Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:08:53 +0100 Subject: [PATCH 20/67] Rename permissions.test.js to permissions.test.jsx --- admin-js/tests/{permissions.test.js => permissions.test.jsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename admin-js/tests/{permissions.test.js => permissions.test.jsx} (100%) diff --git a/admin-js/tests/permissions.test.js b/admin-js/tests/permissions.test.jsx similarity index 100% rename from admin-js/tests/permissions.test.js rename to admin-js/tests/permissions.test.jsx From 044a8d3a03b906ee55c86d2fb6681f2d9272d89b Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:09:06 +0100 Subject: [PATCH 21/67] Rename relationships.test.js to relationships.test.jsx --- admin-js/tests/{relationships.test.js => relationships.test.jsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename admin-js/tests/{relationships.test.js => relationships.test.jsx} (100%) diff --git a/admin-js/tests/relationships.test.js b/admin-js/tests/relationships.test.jsx similarity index 100% rename from admin-js/tests/relationships.test.js rename to admin-js/tests/relationships.test.jsx From 29af5f0b66f3610ada454b81af8db96dce9639ae Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:09:18 +0100 Subject: [PATCH 22/67] Rename simple.test.js to simple.test.jsx --- admin-js/tests/{simple.test.js => simple.test.jsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename admin-js/tests/{simple.test.js => simple.test.jsx} (100%) diff --git a/admin-js/tests/simple.test.js b/admin-js/tests/simple.test.jsx similarity index 100% rename from admin-js/tests/simple.test.js rename to admin-js/tests/simple.test.jsx From c3416bb8263674900c33df8cc3108f76284bab9c Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:12:05 +0100 Subject: [PATCH 23/67] Update vite.config.js --- admin-js/vite.config.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 59755eb3..687d0c0b 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -1,5 +1,4 @@ import {defineConfig} from "vite"; -import react from "@vitejs/plugin-react"; export default defineConfig({ build: { @@ -13,7 +12,6 @@ export default defineConfig({ }, sourcemap: true, }, - plugins: [react()], test: { clearMocks: true, coverage: { From f52f8ee1f27aec58ebfeac5b000108532cacbc28 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:12:33 +0100 Subject: [PATCH 24/67] Rename setupTests.js to setupTests.jsx --- admin-js/tests/{setupTests.js => setupTests.jsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename admin-js/tests/{setupTests.js => setupTests.jsx} (100%) diff --git a/admin-js/tests/setupTests.js b/admin-js/tests/setupTests.jsx similarity index 100% rename from admin-js/tests/setupTests.js rename to admin-js/tests/setupTests.jsx From d204f22494c2e5387bed8bce451afe5b1682392d Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:15:06 +0100 Subject: [PATCH 25/67] Update vite.config.js --- admin-js/vite.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 687d0c0b..5a477c19 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -25,6 +25,6 @@ export default defineConfig({ //maxWorkers: 1, mockReset: true, restoreMocks: true, - setupFiles: "tests/setupTests.js", + setupFiles: "tests/setupTests.jsx", } }) From 4853b61144df847b7fefb37ecadc506fa0e850a3 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:21:16 +0100 Subject: [PATCH 26/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 97faf961..f9b7bbdf 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -1,8 +1,7 @@ const http = require("http"); const {spawn} = require("child_process"); import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 -import "@testing-library/jest-dom"; -import failOnConsole from "jest-fail-on-console"; +//import failOnConsole from "jest-fail-on-console"; import {memoryStore} from "react-admin"; import {configure, render, screen} from "@testing-library/react"; import * as structuredClone from "@ungap/structured-clone"; @@ -12,7 +11,7 @@ const {App} = require("../src/App"); let pythonProcess; let STATE; -jest.setTimeout(300000); // 5 mins +/*jest.setTimeout(300000); // 5 mins configure({"asyncUtilTimeout": 10000}); jest.mock("react-admin", () => { const originalModule = jest.requireActual("react-admin"); @@ -20,7 +19,7 @@ jest.mock("react-admin", () => { ...originalModule, downloadCSV: jest.fn(), // Mock downloadCSV to test export button. }; -}); +});*/ // https://github.com/jsdom/jsdom/issues/3363#issuecomment-1387439541 global.structuredClone = structuredClone.default; @@ -33,12 +32,12 @@ window.matchMedia = (query) => ({ }); // Ignore not implemented errors -window.scrollTo = jest.fn(); +//window.scrollTo = jest.fn(); global.sleep = (delay_s) => new Promise((resolve) => setTimeout(resolve, delay_s * 1000)); -failOnConsole({ +/*failOnConsole({ silenceMessage: (msg) => { return ( // Suppress act() warnings, because there's too many async changes happening. @@ -49,7 +48,7 @@ failOnConsole({ || msg.includes("The above error occurred in the component") ); } -}); +});*/ beforeAll(async() => { if (!global.pythonProcessPath) From 718bd555a97cd56fdb5de3d113e3bae2b3824932 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:33:54 +0100 Subject: [PATCH 27/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index f9b7bbdf..e266d804 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -6,7 +6,7 @@ import {memoryStore} from "react-admin"; import {configure, render, screen} from "@testing-library/react"; import * as structuredClone from "@ungap/structured-clone"; -const {App} = require("../src/App"); +import {App} from "../src/App"; let pythonProcess; let STATE; From 85ede2512d62041e36bb06f9ce6c1346bff1926c Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:38:00 +0100 Subject: [PATCH 28/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index e266d804..bb72bf10 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -3,6 +3,7 @@ const {spawn} = require("child_process"); import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 //import failOnConsole from "jest-fail-on-console"; import {memoryStore} from "react-admin"; +import {beforeAll, beforeEach, expect} from "vitest"; import {configure, render, screen} from "@testing-library/react"; import * as structuredClone from "@ungap/structured-clone"; From 9e567946defff7227e5ddf6502f2b28439c9fedb Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:40:47 +0100 Subject: [PATCH 29/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index bb72bf10..b8fca516 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -3,7 +3,7 @@ const {spawn} = require("child_process"); import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 //import failOnConsole from "jest-fail-on-console"; import {memoryStore} from "react-admin"; -import {beforeAll, beforeEach, expect} from "vitest"; +import {afterAll, beforeAll, beforeEach, expect} from "vitest"; import {configure, render, screen} from "@testing-library/react"; import * as structuredClone from "@ungap/structured-clone"; From 1ea4d9e86a3870e7964e0fc15628b0383e9f4515 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:51:38 +0100 Subject: [PATCH 30/67] Update vite.config.js --- admin-js/vite.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 5a477c19..427cb261 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -1,3 +1,4 @@ +import react from "@vitejs/plugin-react"; import {defineConfig} from "vite"; export default defineConfig({ @@ -12,6 +13,7 @@ export default defineConfig({ }, sourcemap: true, }, + plugins: [react()], test: { clearMocks: true, coverage: { From d912182bd5164b3797d510439ba526eecda78b20 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:55:10 +0100 Subject: [PATCH 31/67] Update admin-js/vite.config.js --- admin-js/vite.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 427cb261..e36f8a82 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -24,7 +24,7 @@ export default defineConfig({ expect: { requireAssertions: true }, - //maxWorkers: 1, + maxWorkers: 1, mockReset: true, restoreMocks: true, setupFiles: "tests/setupTests.jsx", From e326597bec54f2d49812aa7126dd7257c3100562 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 6 Jun 2025 23:56:09 +0100 Subject: [PATCH 32/67] Update vite.config.js --- admin-js/vite.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index e36f8a82..c929c487 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -24,7 +24,7 @@ export default defineConfig({ expect: { requireAssertions: true }, - maxWorkers: 1, + fileParallelism: false, mockReset: true, restoreMocks: true, setupFiles: "tests/setupTests.jsx", From 0584c75a675de6229a4da543386a9268898139ff Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 00:03:20 +0100 Subject: [PATCH 33/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index b8fca516..70d87c1b 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -28,8 +28,8 @@ global.structuredClone = structuredClone.default; // To render full-width window.matchMedia = (query) => ({ matches: true, - addListener: () => {}, - removeListener: () => {} + addEventListener: () => {}, + removeEventListener: () => {} }); // Ignore not implemented errors From 2cc5f625904f4fa91595db34a3e19e4a6ca52e97 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 00:09:34 +0100 Subject: [PATCH 34/67] Update package.json --- admin-js/package.json | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/admin-js/package.json b/admin-js/package.json index f6e3c48a..36f42aab 100644 --- a/admin-js/package.json +++ b/admin-js/package.json @@ -4,28 +4,28 @@ "private": true, "dependencies": { "@vitejs/plugin-react": "4.5.1", - "react": "19.1.0", - "react-admin": "5.8.3", - "react-dom": "19.1.0", + "react": "18.2.0", + "react-admin": "4.16.7", + "react-dom": "18.2.0", "terser": "5.40.0", "vite": "6.2.7", - "create-react-admin": "5.8.3", - "ra-core": "5.8.3", - "ra-data-fakerest": "5.8.3", - "ra-data-graphql-simple": "5.8.3", - "ra-data-graphql": "5.8.3", - "ra-data-json-server": "5.8.3", - "ra-data-local-forage": "5.8.3", - "ra-data-local-storage": "5.8.3", - "ra-data-simple-rest": "5.8.3", - "ra-i18n-i18next": "5.8.3", - "ra-i18n-polyglot": "5.8.3", - "ra-input-rich-text": "5.8.3", - "ra-language-english": "5.8.3", - "ra-language-french": "5.8.3", - "ra-no-code": "5.8.3", - "ra-ui-materialui": "5.8.3" + "create-react-admin": "4.16.7", + "ra-core": "4.16.7", + "ra-data-fakerest": "4.16.7", + "ra-data-graphql-simple": "4.16.7", + "ra-data-graphql": "4.16.7", + "ra-data-json-server": "4.16.7", + "ra-data-local-forage": "4.16.7", + "ra-data-local-storage": "4.16.7", + "ra-data-simple-rest": "4.16.7", + "ra-i18n-i18next": "4.16.7", + "ra-i18n-polyglot": "4.16.7", + "ra-input-rich-text": "4.16.7", + "ra-language-english": "4.16.7", + "ra-language-french": "4.16.7", + "ra-no-code": "4.16.7", + "ra-ui-materialui": "4.16.7" }, "devDependencies": { "@babel/preset-env": "7.27.2", From 9b1d77bb8c08823e746bae466ca346d1f009f7bb Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 00:14:10 +0100 Subject: [PATCH 35/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 70d87c1b..b8fca516 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -28,8 +28,8 @@ global.structuredClone = structuredClone.default; // To render full-width window.matchMedia = (query) => ({ matches: true, - addEventListener: () => {}, - removeEventListener: () => {} + addListener: () => {}, + removeListener: () => {} }); // Ignore not implemented errors From d9e579767390118406eb269c537ddb3d25536ff3 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 00:47:43 +0100 Subject: [PATCH 36/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index b8fca516..dcd58a13 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -5,7 +5,7 @@ import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 import {memoryStore} from "react-admin"; import {afterAll, beforeAll, beforeEach, expect} from "vitest"; import {configure, render, screen} from "@testing-library/react"; -import * as structuredClone from "@ungap/structured-clone"; +//import * as structuredClone from "@ungap/structured-clone"; import {App} from "../src/App"; @@ -23,7 +23,7 @@ jest.mock("react-admin", () => { });*/ // https://github.com/jsdom/jsdom/issues/3363#issuecomment-1387439541 -global.structuredClone = structuredClone.default; +//global.structuredClone = structuredClone.default; // To render full-width window.matchMedia = (query) => ({ From dc423cbcd6b3abafbb9e1521e5871c298f1e8f40 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 00:51:05 +0100 Subject: [PATCH 37/67] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 031764d3..1867923d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,6 +162,7 @@ jobs: path: | ${{ env.yarn_cache }} admin-js/node_modules + admin-js/yarn.lock - name: Yarn install run: yarn install working-directory: admin-js/ From f6b2d9e44fd8f4957dbfe251abe37c8784543a26 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 00:52:14 +0100 Subject: [PATCH 38/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index dcd58a13..274fb29c 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -1,6 +1,6 @@ const http = require("http"); const {spawn} = require("child_process"); -import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 +//import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 //import failOnConsole from "jest-fail-on-console"; import {memoryStore} from "react-admin"; import {afterAll, beforeAll, beforeEach, expect} from "vitest"; From 3c8f33ecdd5c3fc94b20dbd91ffb161d8af7af0f Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 00:56:04 +0100 Subject: [PATCH 39/67] Update package.json --- admin-js/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/admin-js/package.json b/admin-js/package.json index 36f42aab..5ae27b51 100644 --- a/admin-js/package.json +++ b/admin-js/package.json @@ -40,8 +40,7 @@ "jest-environment-jsdom": "29.7.0", "jest-fail-on-console": "3.3.1", "jsdom": "26.1.0", - "vitest": "3.2.2", - "whatwg-fetch": "3.6.20" + "vitest": "3.2.2" }, "scripts": { "dev": "vite", From 82bf56e4331a9624cf658decfbeb1805aaf4e90a Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 01:08:23 +0100 Subject: [PATCH 40/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 274fb29c..4da89f6a 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -32,6 +32,9 @@ window.matchMedia = (query) => ({ removeListener: () => {} }); +// Fix relative URLs in fetch() +location.href = "http://localhost:8080/"; + // Ignore not implemented errors //window.scrollTo = jest.fn(); From 0632696d900ae8b0d318c81363265017abd2ea51 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 01:23:08 +0100 Subject: [PATCH 41/67] Update vite.config.js --- admin-js/vite.config.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index c929c487..050b369b 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -20,7 +20,10 @@ export default defineConfig({ exclude: [], }, environment: "jsdom", - environmentOptions: {"url": "http://localhost:8080", "pretendToBeVisual": true}, + environmentOptions: { + url: "http://localhost:8080", + pretendToBeVisual: true + }, expect: { requireAssertions: true }, From fa67ee9fa7a6bfa43767aa5209e2119cb53feada Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 01:35:42 +0100 Subject: [PATCH 42/67] Update admin-js/tests/setupTests.jsx --- admin-js/tests/setupTests.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 4da89f6a..0123b756 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -33,7 +33,7 @@ window.matchMedia = (query) => ({ }); // Fix relative URLs in fetch() -location.href = "http://localhost:8080/"; +location.assign("http://localhost:8080/"); // Ignore not implemented errors //window.scrollTo = jest.fn(); From 21adf937d51f8a0fb93b3b136bec96310b12b634 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 01:38:23 +0100 Subject: [PATCH 43/67] Update admin-js/tests/setupTests.jsx --- admin-js/tests/setupTests.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 0123b756..a033520d 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -33,7 +33,7 @@ window.matchMedia = (query) => ({ }); // Fix relative URLs in fetch() -location.assign("http://localhost:8080/"); +location.replace("http://localhost:8080/"); // Ignore not implemented errors //window.scrollTo = jest.fn(); From 19aed8633a8f488e00150aba5ccbfb0375885fd2 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 01:51:51 +0100 Subject: [PATCH 44/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index a033520d..eb750d30 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -33,7 +33,8 @@ window.matchMedia = (query) => ({ }); // Fix relative URLs in fetch() -location.replace("http://localhost:8080/"); +delete window.location; +window.location = "http://localhost:8080/"; // Ignore not implemented errors //window.scrollTo = jest.fn(); From 88667945429a91fc3394a8cce088ba9e092b05ae Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 01:55:43 +0100 Subject: [PATCH 45/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index eb750d30..1395a4af 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -32,10 +32,6 @@ window.matchMedia = (query) => ({ removeListener: () => {} }); -// Fix relative URLs in fetch() -delete window.location; -window.location = "http://localhost:8080/"; - // Ignore not implemented errors //window.scrollTo = jest.fn(); @@ -103,7 +99,7 @@ let login = {"username": "admin", "password": "admin"}; global.setLogin = (username, password) => { login = {username, password}; }; beforeEach(async () => { - location.href = "/"; + location.href = "http://localhost:8080/"; localStorage.clear(); if (STATE) { From 025e0b09d80d78858eb76cd4c7e4178e4aec7cb2 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 01:58:24 +0100 Subject: [PATCH 46/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 1395a4af..7366e917 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -99,6 +99,7 @@ let login = {"username": "admin", "password": "admin"}; global.setLogin = (username, password) => { login = {username, password}; }; beforeEach(async () => { + delete location.href; location.href = "http://localhost:8080/"; localStorage.clear(); From cd1318e6a6d5c4c47dc4941567a6a99da72ab540 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 02:01:02 +0100 Subject: [PATCH 47/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 7366e917..c56a4200 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -99,8 +99,8 @@ let login = {"username": "admin", "password": "admin"}; global.setLogin = (username, password) => { login = {username, password}; }; beforeEach(async () => { - delete location.href; - location.href = "http://localhost:8080/"; + delete window.location; + window.location = {"href": "/"}; localStorage.clear(); if (STATE) { From ea60b924b1638d4be47e7f5eac2fb26c18ea5994 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 02:05:37 +0100 Subject: [PATCH 48/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index c56a4200..4988261e 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -100,7 +100,7 @@ global.setLogin = (username, password) => { login = {username, password}; }; beforeEach(async () => { delete window.location; - window.location = {"href": "/"}; + window.location = new URL("http://localhost:8080/"); localStorage.clear(); if (STATE) { From 79ab8a01734fb47bca4667cf81f231f2afcadbd4 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 02:17:20 +0100 Subject: [PATCH 49/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 4988261e..bb21efce 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -99,8 +99,7 @@ let login = {"username": "admin", "password": "admin"}; global.setLogin = (username, password) => { login = {username, password}; }; beforeEach(async () => { - delete window.location; - window.location = new URL("http://localhost:8080/"); + window.history.replaceState({}, "", "/"); localStorage.clear(); if (STATE) { From 4f82c1d537eade8b16e8b899df1923d64839417e Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 02:22:24 +0100 Subject: [PATCH 50/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index bb21efce..21021a25 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -99,6 +99,7 @@ let login = {"username": "admin", "password": "admin"}; global.setLogin = (username, password) => { login = {username, password}; }; beforeEach(async () => { + location.href = "/"; window.history.replaceState({}, "", "/"); localStorage.clear(); From a73c96ecc17d83365595894d69953730cd9b0442 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 12:47:41 +0100 Subject: [PATCH 51/67] Update package.json --- admin-js/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin-js/package.json b/admin-js/package.json index 5ae27b51..daeb5827 100644 --- a/admin-js/package.json +++ b/admin-js/package.json @@ -40,7 +40,8 @@ "jest-environment-jsdom": "29.7.0", "jest-fail-on-console": "3.3.1", "jsdom": "26.1.0", - "vitest": "3.2.2" + "vitest": "3.2.2", + "vitest-location-mock": "1.0.1" }, "scripts": { "dev": "vite", From 6535c3041ead73a8145da93e6f8022e09498057c Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 12:48:35 +0100 Subject: [PATCH 52/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 21021a25..40c77ffa 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -1,4 +1,5 @@ const http = require("http"); +import "vitest-location-mock"; const {spawn} = require("child_process"); //import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 //import failOnConsole from "jest-fail-on-console"; From 1f65bd68d8fbaee46a65707ab3055edf5d95c9a1 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 7 Jun 2025 12:54:13 +0100 Subject: [PATCH 53/67] Update package.json --- admin-js/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-js/package.json b/admin-js/package.json index daeb5827..ccfbb611 100644 --- a/admin-js/package.json +++ b/admin-js/package.json @@ -36,6 +36,7 @@ "@testing-library/user-event": "14.6.1", "@ungap/structured-clone": "1.3.0", "@vitest/coverage-v8": "3.2.2", + "extend-expect": "3.0.0", "jest": "29.7.0", "jest-environment-jsdom": "29.7.0", "jest-fail-on-console": "3.3.1", From 6d550477fe35cb4dfe9c4f021fff677bee022b66 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 9 Jun 2025 12:54:18 +0100 Subject: [PATCH 54/67] Update admin-js/tests/setupTests.jsx --- admin-js/tests/setupTests.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 40c77ffa..bac3952e 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -1,7 +1,7 @@ const http = require("http"); import "vitest-location-mock"; const {spawn} = require("child_process"); -//import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 +import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 //import failOnConsole from "jest-fail-on-console"; import {memoryStore} from "react-admin"; import {afterAll, beforeAll, beforeEach, expect} from "vitest"; From 7699b65ebb5262cb2913883006b32c2a44abd785 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 9 Jun 2025 12:57:47 +0100 Subject: [PATCH 55/67] Update package.json --- admin-js/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin-js/package.json b/admin-js/package.json index ccfbb611..6296d9f6 100644 --- a/admin-js/package.json +++ b/admin-js/package.json @@ -42,7 +42,8 @@ "jest-fail-on-console": "3.3.1", "jsdom": "26.1.0", "vitest": "3.2.2", - "vitest-location-mock": "1.0.1" + "vitest-location-mock": "1.0.1", + "whatwg-fetch": "3.6.20" }, "scripts": { "dev": "vite", From fcccb6223c9bc9ac1b6e3c1badf20289fbdec58d Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 9 Jun 2025 13:17:04 +0100 Subject: [PATCH 56/67] Update admin-js/tests/setupTests.jsx --- admin-js/tests/setupTests.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index bac3952e..380dfd01 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -1,5 +1,5 @@ const http = require("http"); -import "vitest-location-mock"; +//import "vitest-location-mock"; const {spawn} = require("child_process"); import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 //import failOnConsole from "jest-fail-on-console"; From f812b29727c4fccbc26c46df940a3d772a2b7336 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 10 Jun 2025 01:08:22 +0100 Subject: [PATCH 57/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 380dfd01..fcb081de 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -1,13 +1,15 @@ const http = require("http"); //import "vitest-location-mock"; const {spawn} = require("child_process"); -import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 //import failOnConsole from "jest-fail-on-console"; import {memoryStore} from "react-admin"; import {afterAll, beforeAll, beforeEach, expect} from "vitest"; import {configure, render, screen} from "@testing-library/react"; //import * as structuredClone from "@ungap/structured-clone"; +delete globalThis.fetch; +import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 + import {App} from "../src/App"; let pythonProcess; From 9b5d068bfeab1d42786d62853a2660f1e9f8f60c Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 10 Jun 2025 01:17:32 +0100 Subject: [PATCH 58/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index fcb081de..3c701087 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -8,7 +8,7 @@ import {configure, render, screen} from "@testing-library/react"; //import * as structuredClone from "@ungap/structured-clone"; delete globalThis.fetch; -import "whatwg-fetch"; // https://github.com/jsdom/jsdom/issues/1724 +await import("whatwg-fetch"); import {App} from "../src/App"; From c02706224db193128e865adee1d83c4026d23be8 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 10 Jun 2025 01:30:54 +0100 Subject: [PATCH 59/67] Update admin-js/tests/setupTests.jsx --- admin-js/tests/setupTests.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 3c701087..1d45cf5d 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -103,7 +103,6 @@ global.setLogin = (username, password) => { login = {username, password}; }; beforeEach(async () => { location.href = "/"; - window.history.replaceState({}, "", "/"); localStorage.clear(); if (STATE) { From 21cbfab2ca31213e98c7ce26885cfdcde3706fc3 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 10 Jun 2025 17:29:58 +0100 Subject: [PATCH 60/67] Update package.json --- admin-js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-js/package.json b/admin-js/package.json index 6296d9f6..5940c30e 100644 --- a/admin-js/package.json +++ b/admin-js/package.json @@ -40,7 +40,7 @@ "jest": "29.7.0", "jest-environment-jsdom": "29.7.0", "jest-fail-on-console": "3.3.1", - "jsdom": "26.1.0", + "jsdom": "20.0.3", "vitest": "3.2.2", "vitest-location-mock": "1.0.1", "whatwg-fetch": "3.6.20" From 06acca35225e9a19fa2ad0a9047b7285884d658d Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 10 Jun 2025 17:52:07 +0100 Subject: [PATCH 61/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 1d45cf5d..290007f6 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -102,6 +102,7 @@ let login = {"username": "admin", "password": "admin"}; global.setLogin = (username, password) => { login = {username, password}; }; beforeEach(async () => { + console.log("FOO"); location.href = "/"; localStorage.clear(); @@ -112,4 +113,5 @@ beforeEach(async () => { const profile = await screen.findByText(login["username"], {"exact": false}); expect(profile).toHaveAccessibleName("Profile"); } + console.log("BAR"); }); From db34bb48a097edec7b0725f4936a7a6885762f9c Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 10 Jun 2025 17:54:43 +0100 Subject: [PATCH 62/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 290007f6..18eee849 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -102,16 +102,16 @@ let login = {"username": "admin", "password": "admin"}; global.setLogin = (username, password) => { login = {username, password}; }; beforeEach(async () => { - console.log("FOO"); location.href = "/"; localStorage.clear(); if (STATE) { + console.log("FOO"); const resp = await fetch("http://localhost:8080/admin/token", {"method": "POST", "body": JSON.stringify(login)}); + console.log("BAR"); localStorage.setItem("identity", resp.headers.get("X-Token")); render(); const profile = await screen.findByText(login["username"], {"exact": false}); expect(profile).toHaveAccessibleName("Profile"); } - console.log("BAR"); }); From cad93ab0a682c6a428ca35acadc2d19cc48e337f Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 10 Jun 2025 17:59:51 +0100 Subject: [PATCH 63/67] Update vite.config.js --- admin-js/vite.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 050b369b..91426781 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -22,7 +22,8 @@ export default defineConfig({ environment: "jsdom", environmentOptions: { url: "http://localhost:8080", - pretendToBeVisual: true + pretendToBeVisual: true, + testURL: "http://localhost:8080" }, expect: { requireAssertions: true From 64f72a26505071f3e8b0939497cb37c05508fb94 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Wed, 11 Jun 2025 15:55:30 +0100 Subject: [PATCH 64/67] Update admin-js/vite.config.js --- admin-js/vite.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin-js/vite.config.js b/admin-js/vite.config.js index 91426781..c7d8a14e 100644 --- a/admin-js/vite.config.js +++ b/admin-js/vite.config.js @@ -21,9 +21,9 @@ export default defineConfig({ }, environment: "jsdom", environmentOptions: { - url: "http://localhost:8080", + url: "http://localhost:8081", pretendToBeVisual: true, - testURL: "http://localhost:8080" + testURL: "http://localhost:8081" }, expect: { requireAssertions: true From b69f0827c254162bd813346cfc8d6e6ee90d15dd Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Wed, 11 Jun 2025 15:59:40 +0100 Subject: [PATCH 65/67] Update setupTests.jsx --- admin-js/tests/setupTests.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 18eee849..663ff89d 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -107,9 +107,9 @@ beforeEach(async () => { if (STATE) { console.log("FOO"); - const resp = await fetch("http://localhost:8080/admin/token", {"method": "POST", "body": JSON.stringify(login)}); + //const resp = await fetch("http://localhost:8080/admin/token", {"method": "POST", "body": JSON.stringify(login)}); console.log("BAR"); - localStorage.setItem("identity", resp.headers.get("X-Token")); + //localStorage.setItem("identity", resp.headers.get("X-Token")); render(); const profile = await screen.findByText(login["username"], {"exact": false}); expect(profile).toHaveAccessibleName("Profile"); From 72189011f1b0b06ebd5eabd45f2af07fe69d22b9 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Wed, 11 Jun 2025 16:30:22 +0100 Subject: [PATCH 66/67] Update package.json --- admin-js/package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/admin-js/package.json b/admin-js/package.json index b2083813..415b47cd 100644 --- a/admin-js/package.json +++ b/admin-js/package.json @@ -37,8 +37,6 @@ "@ungap/structured-clone": "1.3.0", "@vitest/coverage-v8": "3.2.2", "extend-expect": "3.0.0", - "jest": "30.0.0", - "jest-environment-jsdom": "30.0.0", "jest-fail-on-console": "3.3.1", "jsdom": "20.0.3", "vitest": "3.2.2", From d50baeacee707b55d04c374b450fce06b9b832f8 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Wed, 11 Jun 2025 16:34:29 +0100 Subject: [PATCH 67/67] Update admin-js/tests/setupTests.jsx --- admin-js/tests/setupTests.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin-js/tests/setupTests.jsx b/admin-js/tests/setupTests.jsx index 663ff89d..ef022d98 100644 --- a/admin-js/tests/setupTests.jsx +++ b/admin-js/tests/setupTests.jsx @@ -107,9 +107,9 @@ beforeEach(async () => { if (STATE) { console.log("FOO"); - //const resp = await fetch("http://localhost:8080/admin/token", {"method": "POST", "body": JSON.stringify(login)}); + const resp = await fetch("/admin/token", {"method": "POST", "body": JSON.stringify(login)}); console.log("BAR"); - //localStorage.setItem("identity", resp.headers.get("X-Token")); + localStorage.setItem("identity", resp.headers.get("X-Token")); render(); const profile = await screen.findByText(login["username"], {"exact": false}); expect(profile).toHaveAccessibleName("Profile");