Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

perf: run the client test suite on happy-dom instead of jsdom (#6144)

Adam Eivy3f14aa1062f6
diff --git a/AGENTS.md b/AGENTS.md
index 7ceb6a2541..13b63f1909 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -14,7 +14,7 @@ npm run install:all # includes git submodule update --init --recursive
# Root `npm test` runs both workspaces in sequence (server, then client). Run them
# per workspace to scope to one — both are Vitest, with different environments:
cd server && npm test # Vitest (node) — ALSO globs ../scripts, ../lib, ../autofixer
-cd client && npm test # Vitest (jsdom) — component/unit tests
+cd client && npm test # Vitest (happy-dom) — component/unit tests
# No NODE_ENV prefix needed: server/vitest.config.js FORCES NODE_ENV=test (#4554).
# Vitest only defaults it when unset, and PortOS runs under PM2 with
# NODE_ENV=development — a suite run that inherits that aims at the real Postgres.
diff --git a/client/package-lock.json b/client/package-lock.json
index aa9973447b..98520a0126 100644
--- a/client/package-lock.json
+++ b/client/package-lock.json
@@ -32,7 +32,7 @@
"@testing-library/react": "16.3.3",
"@testing-library/user-event": "14.6.7",
"@vitejs/plugin-react": "6.1.1",
- "jsdom": "30.0.1",
+ "happy-dom": "20.14.0",
"rollup-plugin-visualizer": "7.1.1",
"tailwindcss": "4.3.3",
"vite": "8.2.2",
@@ -126,59 +126,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/@asamuzakjp/css-color": {
- "version": "6.0.5",
- "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-6.0.5.tgz",
- "integrity": "sha512-mbhpPMmnw/kwW19aRNmSUl1QzLbdGo1SCuE49BT98MNwqF6zaHb3o2owssFc/PEO/4t2UjqtCNwocuDtJornzA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@csstools/css-calc": "^3.2.1",
- "@csstools/css-color-parser": "^4.1.9",
- "@csstools/css-parser-algorithms": "^4.0.0",
- "@csstools/css-tokenizer": "^4.0.0",
- "lru-cache": "^11.5.2"
- },
- "engines": {
- "node": "^22.13.0 || >=24.0.0"
- }
- },
- "node_modules/@asamuzakjp/css-color/node_modules/lru-cache": {
- "version": "11.5.2",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz",
- "integrity": "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==",
- "dev": true,
- "license": "BlueOak-1.0.0",
- "engines": {
- "node": "20 || >=22"
- }
- },
- "node_modules/@asamuzakjp/dom-selector": {
- "version": "8.3.2",
- "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-8.3.2.tgz",
- "integrity": "sha512-93Z1N+BQNXysodoicpOIyNh2drHfz/CTf9nnT0FEx72GJcIiwgydD7tGAr78j41LsYn3hlRn+LdGPuBLn1Bl8Q==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "bidi-js": "^1.0.3",
- "css-tree": "^3.2.1",
- "is-potential-custom-element-name": "^1.0.1",
- "lru-cache": "^11.5.2"
- },
- "engines": {
- "node": "^22.13.0 || >=24.0.0"
- }
- },
- "node_modules/@asamuzakjp/dom-selector/node_modules/lru-cache": {
- "version": "11.5.2",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz",
- "integrity": "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==",
- "dev": true,
- "license": "BlueOak-1.0.0",
- "engines": {
- "node": "20 || >=22"
- }
- },
"node_modules/@babel/code-frame": {
"version": "7.29.7",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",
@@ -424,19 +371,6 @@
"node": ">=14.21.3"
}
},
- "node_modules/@bramus/specificity": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.2.tgz",
- "integrity": "sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "css-tree": "^3.0.0"
- },
- "bin": {
- "specificity": "bin/cli.js"
- }
- },
"node_modules/@codemirror/autocomplete": {
"version": "6.20.3",
"resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.20.3.tgz",
@@ -591,146 +525,6 @@
"w3c-keyname": "^2.2.4"
}
},
- "node_modules/@csstools/color-helpers": {
- "version": "6.1.0",
- "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.0.tgz",
- "integrity": "sha512-064IFJdjTfUqnjpCVpMOdbr8FLQBhinbZj6yRv2An2E41O/pLEXqfFRWqGq/SxlE5PEUYTlvWsG2r8MswAVvkg==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/csstools"
- },
- {
- "type": "opencollective",
- "url": "https://opencollective.com/csstools"
- }
- ],
- "license": "MIT-0",
- "engines": {
- "node": ">=20.19.0"
- }
- },
- "node_modules/@csstools/css-calc": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.3.0.tgz",
- "integrity": "sha512-c5ihYsPkdG6JCkU2zTMm4+k6r7RXuGxtWYhu5DHMIiF1FHzrfmHL5so11AoFpUv/tu61xfcmT4AmKoFfMPoqdQ==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/csstools"
- },
- {
- "type": "opencollective",
- "url": "https://opencollective.com/csstools"
- }
- ],
- "license": "MIT",
- "engines": {
- "node": ">=20.19.0"
- },
- "peerDependencies": {
- "@csstools/css-parser-algorithms": "^4.0.0",
- "@csstools/css-tokenizer": "^4.0.0"
- }
- },
- "node_modules/@csstools/css-color-parser": {
- "version": "4.1.10",
- "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.1.10.tgz",
- "integrity": "sha512-UZhQLIUyJaaMepqehrCODwCg2KW25vFvLWBmqYFaPclYvvxzj/sG8LBOhBFCp11i9uE7t1EyS+RAoV9tztPFyw==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/csstools"
- },
- {
- "type": "opencollective",
- "url": "https://opencollective.com/csstools"
- }
- ],
- "license": "MIT",
- "dependencies": {
- "@csstools/color-helpers": "^6.1.0",
- "@csstools/css-calc": "^3.3.0"
- },
- "engines": {
- "node": ">=20.19.0"
- },
- "peerDependencies": {
- "@csstools/css-parser-algorithms": "^4.0.0",
- "@csstools/css-tokenizer": "^4.0.0"
- }
- },
- "node_modules/@csstools/css-parser-algorithms": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.0.tgz",
- "integrity": "sha512-+B87qS7fIG3L5h3qwJ/IFbjoVoOe/bpOdh9hAjXbvx0o8ImEmUsGXN0inFOnk2ChCFgqkkGFQ+TpM5rbhkKe4w==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/csstools"
- },
- {
- "type": "opencollective",
- "url": "https://opencollective.com/csstools"
- }
- ],
- "license": "MIT",
- "engines": {
- "node": ">=20.19.0"
- },
- "peerDependencies": {
- "@csstools/css-tokenizer": "^4.0.0"
- }
- },
- "node_modules/@csstools/css-syntax-patches-for-csstree": {
- "version": "1.1.7",
- "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.7.tgz",
- "integrity": "sha512-fQ+05118eQS1cofO3aJpB5efgpBZMvIzwr/sbC8kDLVA5XLG8q1kJV5yzrUAI1f7lvhPnm8fgIjzFB8/O/5Dig==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/csstools"
- },
- {
- "type": "opencollective",
- "url": "https://opencollective.com/csstools"
- }
- ],
- "license": "MIT-0",
- "peerDependencies": {
- "css-tree": "^3.2.1"
- },
- "peerDependenciesMeta": {
- "css-tree": {
- "optional": true
- }
- }
- },
- "node_modules/@csstools/css-tokenizer": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.0.tgz",
- "integrity": "sha512-QxULHAm7cNu72w97JUNCBFODFaXpbDg+dP8b/oWFAZ2MTRppA3U00Y2L1HqaS4J6yBqxwa/Y3nMBaxVKbB/NsA==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/csstools"
- },
- {
- "type": "opencollective",
- "url": "https://opencollective.com/csstools"
- }
- ],
- "license": "MIT",
- "engines": {
- "node": ">=20.19.0"
- }
- },
"node_modules/@dimforge/rapier3d-compat": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/@dimforge/rapier3d-compat/-/rapier3d-compat-0.12.0.tgz",
@@ -790,24 +584,6 @@
"react": ">=16.8.0"
}
},
- "node_modules/@exodus/bytes": {
- "version": "1.15.1",
- "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.15.1.tgz",
- "integrity": "sha512-S6mL0yNB/Abt9Ei4tq8gDhcczc4S3+vQ4ra7vxnAf+YHC02srtqxKKZghx2Dq6p0e66THKwR6r8N6P95wEty7Q==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
- },
- "peerDependencies": {
- "@noble/hashes": "^1.8.0 || ^2.0.0"
- },
- "peerDependenciesMeta": {
- "@noble/hashes": {
- "optional": true
- }
- }
- },
"node_modules/@floating-ui/core": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.8.0.tgz",
@@ -2696,6 +2472,23 @@
"integrity": "sha512-h8fgEd/DpoS9CBrjEQXR+dIDraopAEfu4wYVNY2tEPwk60stPWhvZMf4Foo5FakuQ7HFZoa8WceaWFervK2Ovg==",
"license": "MIT"
},
+ "node_modules/@types/whatwg-mimetype": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/@types/whatwg-mimetype/-/whatwg-mimetype-3.0.2.tgz",
+ "integrity": "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/ws": {
+ "version": "8.18.1",
+ "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz",
+ "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
"node_modules/@ungap/structured-clone": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.4.0.tgz",
@@ -3271,6 +3064,19 @@
"ieee754": "^1.2.1"
}
},
+ "node_modules/buffer-image-size": {
+ "version": "0.6.4",
+ "resolved": "https://registry.npmjs.org/buffer-image-size/-/buffer-image-size-0.6.4.tgz",
+ "integrity": "sha512-nEh+kZOPY1w+gcCMobZ6ETUp9WfibndnosbpwB1iJk/8Gt5ZF2bhS6+B6bPYz424KtwsR6Rflc3tCz1/ghX2dQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ },
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
"node_modules/bundle-name": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz",
@@ -3477,20 +3283,6 @@
"node": ">= 8"
}
},
- "node_modules/css-tree": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz",
- "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "mdn-data": "2.27.1",
- "source-map-js": "^1.2.1"
- },
- "engines": {
- "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0"
- }
- },
"node_modules/css.escape": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz",
@@ -3645,20 +3437,6 @@
"node": ">=12"
}
},
- "node_modules/data-urls": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-7.0.0.tgz",
- "integrity": "sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "whatwg-mimetype": "^5.0.0",
- "whatwg-url": "^16.0.0"
- },
- "engines": {
- "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
- }
- },
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
@@ -3676,13 +3454,6 @@
}
}
},
- "node_modules/decimal.js": {
- "version": "10.6.0",
- "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz",
- "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==",
- "dev": true,
- "license": "MIT"
- },
"node_modules/decimal.js-light": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz",
@@ -3848,19 +3619,6 @@
"node": ">=10.13.0"
}
},
- "node_modules/entities": {
- "version": "8.0.0",
- "resolved": "https://registry.npmjs.org/entities/-/entities-8.0.0.tgz",
- "integrity": "sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA==",
- "dev": true,
- "license": "BSD-2-Clause",
- "engines": {
- "node": ">=20.19.0"
- },
- "funding": {
- "url": "https://github.com/fb55/entities?sponsor=1"
- }
- },
"node_modules/es-module-lexer": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz",
@@ -4083,6 +3841,48 @@
"node": ">=18.18.0"
}
},
+ "node_modules/happy-dom": {
+ "version": "20.14.0",
+ "resolved": "https://registry.npmjs.org/happy-dom/-/happy-dom-20.14.0.tgz",
+ "integrity": "sha512-4bRh1KzRvKDnFNTlLhzT1RZTpkKhQbQDl9j+7GXszWsvuspYdo29k6OHRf4PwiM6oLb8r/pMWeYiJjkfod5AvQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": ">=20.0.0",
+ "@types/whatwg-mimetype": "^3.0.2",
+ "@types/ws": "^8.18.1",
+ "buffer-image-size": "^0.6.4",
+ "entities": "^7.0.1",
+ "whatwg-mimetype": "^3.0.0",
+ "ws": "^8.21.0"
+ },
+ "engines": {
+ "node": ">=20.0.0"
+ }
+ },
+ "node_modules/happy-dom/node_modules/entities": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz",
+ "integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.12"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/entities?sponsor=1"
+ }
+ },
+ "node_modules/happy-dom/node_modules/whatwg-mimetype": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz",
+ "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/hast-util-embedded": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/hast-util-embedded/-/hast-util-embedded-3.0.0.tgz",
@@ -4437,19 +4237,6 @@
"integrity": "sha512-U9LYDy1CwhMCnprUfeAZWZGByVbhd54hwepegYTK7Pi5NvqEj63ifz5z+xukznehT7i6NIZRu89Ay1AZmRsLEQ==",
"license": "MIT"
},
- "node_modules/html-encoding-sniffer": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz",
- "integrity": "sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@exodus/bytes": "^1.6.0"
- },
- "engines": {
- "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
- }
- },
"node_modules/html-void-elements": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz",
@@ -4640,13 +4427,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/is-potential-custom-element-name": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
- "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==",
- "dev": true,
- "license": "MIT"
- },
"node_modules/is-promise": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz",
@@ -4722,72 +4502,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/jsdom": {
- "version": "30.0.1",
- "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-30.0.1.tgz",
- "integrity": "sha512-52v7mUVUfNQVYYqE1lcdaymWL0njO7lTLUog6ZvW2U5KsbiLk/GnZlVJ+qx0xfNJZ6Gn+KSpPNE52vurbxZwrA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@asamuzakjp/css-color": "^6.0.5",
- "@asamuzakjp/dom-selector": "^8.3.0",
- "@bramus/specificity": "^2.4.2",
- "@csstools/css-syntax-patches-for-csstree": "^1.1.7",
- "@exodus/bytes": "^1.15.1",
- "css-tree": "^3.2.1",
- "data-urls": "^7.0.0",
- "decimal.js": "^10.6.0",
- "html-encoding-sniffer": "^6.0.0",
- "is-potential-custom-element-name": "^1.0.1",
- "lru-cache": "^11.5.2",
- "parse5": "^8.0.1",
- "saxes": "^6.0.0",
- "symbol-tree": "^3.2.4",
- "tough-cookie": "^6.0.2",
- "undici": "^8.9.0",
- "w3c-xmlserializer": "^5.0.0",
- "webidl-conversions": "^8.0.1",
- "whatwg-mimetype": "^5.0.0",
- "whatwg-url": "^17.1.0",
- "xml-name-validator": "^5.0.0"
- },
- "engines": {
- "node": "^22.22.2 || ^24.15.0 || >=26.0.0"
- },
- "peerDependencies": {
- "canvas": "^3.2.3"
- },
- "peerDependenciesMeta": {
- "canvas": {
- "optional": true
- }
- }
- },
- "node_modules/jsdom/node_modules/lru-cache": {
- "version": "11.5.2",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz",
- "integrity": "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==",
- "dev": true,
- "license": "BlueOak-1.0.0",
- "engines": {
- "node": "20 || >=22"
- }
- },
- "node_modules/jsdom/node_modules/whatwg-url": {
- "version": "17.1.0",
- "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.1.0.tgz",
- "integrity": "sha512-3GeworPmc2ZfEEHP7lEbUfBX/L75wdEsi0rLNhXcXxnoN5jyq0SL5gCy06SGW2cyTIZdTvWIDQNQoza++vKeaw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@exodus/bytes": "^1.15.1",
- "tr46": "^6.0.0",
- "webidl-conversions": "^8.0.1"
- },
- "engines": {
- "node": "^22.14.0 || >=24.0.0"
- }
- },
"node_modules/json-schema": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
@@ -5403,13 +5117,6 @@
"url": "https://opencollective.com/unified"
}
},
- "node_modules/mdn-data": {
- "version": "2.27.1",
- "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz",
- "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==",
- "dev": true,
- "license": "CC0-1.0"
- },
"node_modules/meshline": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/meshline/-/meshline-3.3.1.tgz",
@@ -6105,19 +5812,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/parse5": {
- "version": "8.0.1",
- "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz",
- "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "entities": "^8.0.0"
- },
- "funding": {
- "url": "https://github.com/inikulin/parse5?sponsor=1"
- }
- },
"node_modules/path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
@@ -6269,16 +5963,6 @@
"url": "https://github.com/sponsors/wooorm"
}
},
- "node_modules/punycode": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
- "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/radix-vue": {
"version": "1.9.17",
"resolved": "https://registry.npmjs.org/radix-vue/-/radix-vue-1.9.17.tgz",
@@ -6803,19 +6487,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/saxes": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz",
- "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==",
- "dev": true,
- "license": "ISC",
- "dependencies": {
- "xmlchars": "^2.2.0"
- },
- "engines": {
- "node": ">=v12.22.7"
- }
- },
"node_modules/scheduler": {
"version": "0.27.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz",
@@ -7097,13 +6768,6 @@
"vue": ">=3.2.26 < 4"
}
},
- "node_modules/symbol-tree": {
- "version": "3.2.4",
- "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
- "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
- "dev": true,
- "license": "MIT"
- },
"node_modules/tabbable": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.5.0.tgz",
@@ -7255,52 +6919,6 @@
"node": ">=14.0.0"
}
},
- "node_modules/tldts": {
- "version": "7.4.10",
- "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.10.tgz",
- "integrity": "sha512-GgouD1B+sWwvkaEq8vXC15DjQitxbvs12oIXELpconwm+Tg3zfcEv4jgzq3vtKverDXsg3VI8aRgNL2Nra0Iog==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "tldts-core": "^7.4.10"
- },
- "bin": {
- "tldts": "bin/cli.js"
- }
- },
- "node_modules/tldts-core": {
- "version": "7.4.10",
- "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.10.tgz",
- "integrity": "sha512-KnQjp53ZekKgm/r3l+u8kJGGzYgrWdP8+Mql7a4vijh2WE0IrZWspQj/TpTxDho/YxO+AnOZnIjQcCD+q6iJsw==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/tough-cookie": {
- "version": "6.0.2",
- "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz",
- "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==",
- "dev": true,
- "license": "BSD-3-Clause",
- "dependencies": {
- "tldts": "^7.0.5"
- },
- "engines": {
- "node": ">=16"
- }
- },
- "node_modules/tr46": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz",
- "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "punycode": "^2.3.1"
- },
- "engines": {
- "node": ">=20"
- }
- },
"node_modules/trim-lines": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",
@@ -7423,16 +7041,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/undici": {
- "version": "8.9.0",
- "resolved": "https://registry.npmjs.org/undici/-/undici-8.9.0.tgz",
- "integrity": "sha512-aWZpUj7XoGonMClx4gdDRfgBjqeA+F473aDmROQQbM9n6PRfK/u1q/a0X4wMTgcHfT8H6fpbt98PFuDUwFg2YA==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=22.19.0"
- }
- },
"node_modules/undici-types": {
"version": "7.18.2",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
@@ -8114,19 +7722,6 @@
"integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==",
"license": "MIT"
},
- "node_modules/w3c-xmlserializer": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz",
- "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "xml-name-validator": "^5.0.0"
- },
- "engines": {
- "node": ">=18"
- }
- },
"node_modules/web-namespaces": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz",
@@ -8154,41 +7749,6 @@
"integrity": "sha512-9Z0JcMTFxeE+b2x1LJTdnaT8rT8aEp7MVxkNwoycNmJWwPdzoXzMh0BjJSh/AEFP+KPYZUli814h8bJZFIZ2jA==",
"license": "MIT"
},
- "node_modules/webidl-conversions": {
- "version": "8.0.1",
- "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz",
- "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==",
- "dev": true,
- "license": "BSD-2-Clause",
- "engines": {
- "node": ">=20"
- }
- },
- "node_modules/whatwg-mimetype": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz",
- "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=20"
- }
- },
- "node_modules/whatwg-url": {
- "version": "16.0.1",
- "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-16.0.1.tgz",
- "integrity": "sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@exodus/bytes": "^1.11.0",
- "tr46": "^6.0.0",
- "webidl-conversions": "^8.0.1"
- },
- "engines": {
- "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
- }
- },
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -8295,23 +7855,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/xml-name-validator": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz",
- "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==",
- "dev": true,
- "license": "Apache-2.0",
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/xmlchars": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
- "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==",
- "dev": true,
- "license": "MIT"
- },
"node_modules/xmlhttprequest-ssl": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz",
diff --git a/client/package.json b/client/package.json
index 21cef5a4b6..d2c0e19918 100644
--- a/client/package.json
+++ b/client/package.json
@@ -43,7 +43,7 @@
"@testing-library/react": "16.3.3",
"@testing-library/user-event": "14.6.7",
"@vitejs/plugin-react": "6.1.1",
- "jsdom": "30.0.1",
+ "happy-dom": "20.14.0",
"rollup-plugin-visualizer": "7.1.1",
"tailwindcss": "4.3.3",
"vite": "8.2.2",
diff --git a/client/src/components/media/VideoTimelineLanes.test.jsx b/client/src/components/media/VideoTimelineLanes.test.jsx
index 3d17ab4da4..31bd5cb67f 100644
--- a/client/src/components/media/VideoTimelineLanes.test.jsx
+++ b/client/src/components/media/VideoTimelineLanes.test.jsx
@@ -55,7 +55,9 @@ describe('TimelineBlock — remove control', () => {
expect(remove.className).toContain('lg:opacity-0');
expect(remove.className).not.toContain('sm:opacity-0');
expect(remove).toHaveAttribute('title', 'Remove from timeline');
- expect(remove.querySelector('svg').className.baseVal).toContain('w-3 h-3');
+ // `getAttribute` rather than `.className.baseVal`: an SVG element's className
+ // is an SVGAnimatedString only where the environment implements one (#6144).
+ expect(remove.querySelector('svg').getAttribute('class')).toContain('w-3 h-3');
});
it('removes without starting a drag or selecting the parent timeline block', () => {
diff --git a/client/src/components/settings/AiAssignmentsTab.test.jsx b/client/src/components/settings/AiAssignmentsTab.test.jsx
index c30790a67f..bc2d6b19e6 100644
--- a/client/src/components/settings/AiAssignmentsTab.test.jsx
+++ b/client/src/components/settings/AiAssignmentsTab.test.jsx
@@ -155,10 +155,17 @@ describe('AiAssignmentsTab tool-use warning', () => {
});
describe('AiAssignmentsTab provider chips', () => {
- // TabPills renders the count in its own span right after the label, so the
- // accessible name of a chip is 'Ollama1' — and a zero count renders no span
- // at all, leaving a bare 'Ollama'.
- const chip = (label, count = '') => screen.getByRole('button', { name: `${label}${count}` });
+ // TabPills renders the count in its own span right after the label, and a zero
+ // count renders no span at all (leaving a bare 'Ollama'). Whether the two join
+ // with a space depends on what the test DOM reports for the span's `display`:
+ // dom-accessibility-api inserts one for anything it does not see as inline, so
+ // happy-dom — which serves no UA defaults and reports `''` — gives 'Ollama 1'
+ // where jsdom's `'inline'` gave 'Ollama1' (#6144). A real browser blockifies the
+ // flex item and also spaces it, so match on the name with whitespace collapsed
+ // rather than pinning one engine's join.
+ const squash = (text) => text.replace(/\s+/g, '');
+ const chipName = (label, count = '') => (name) => squash(name) === squash(`${label}${count}`);
+ const chip = (label, count = '') => screen.getByRole('button', { name: chipName(label, count) });
// Rendered per test rather than in a beforeEach: the mount's async load has to
// settle inside the test body, or the suite's act(...) guard fails it.
@@ -173,7 +180,7 @@ describe('AiAssignmentsTab provider chips', () => {
it('filters the table to one provider when its chip is clicked, and clears on a second click', async () => {
renderRows();
- const ollama = await screen.findByRole('button', { name: 'Ollama1' });
+ const ollama = await screen.findByRole('button', { name: chipName('Ollama', 1) });
await userEvent.click(ollama);
expect(ollama).toHaveAttribute('aria-pressed', 'true');
@@ -188,14 +195,14 @@ describe('AiAssignmentsTab provider chips', () => {
it('gives rows with no provider their own chip', async () => {
renderRows();
- await userEvent.click(await screen.findByRole('button', { name: 'Default / unset1' }));
+ await userEvent.click(await screen.findByRole('button', { name: chipName('Default / unset', 1) }));
expect(screen.getByText('Charlie row')).toBeInTheDocument();
expect(screen.queryByText('Alpha row')).not.toBeInTheDocument();
});
it('clears the filter from the All chip', async () => {
renderRows();
- await userEvent.click(await screen.findByRole('button', { name: 'Ollama1' }));
+ await userEvent.click(await screen.findByRole('button', { name: chipName('Ollama', 1) }));
await userEvent.click(chip('All', 3));
expect(screen.getByText('Bravo row')).toBeInTheDocument();
expect(screen.getByText('Charlie row')).toBeInTheDocument();
@@ -206,7 +213,7 @@ describe('AiAssignmentsTab provider chips', () => {
// numbers stop matching the table; and a selection the search zeroes out
// must stay on screen or there is no way to undo it.
renderRows();
- await userEvent.click(await screen.findByRole('button', { name: 'Ollama1' }));
+ await userEvent.click(await screen.findByRole('button', { name: chipName('Ollama', 1) }));
await userEvent.type(screen.getByLabelText('Search assignments'), 'Bravo');
expect(chip('OpenAI', 1)).toBeInTheDocument();
diff --git a/client/src/lib/terminalScroll.test.js b/client/src/lib/terminalScroll.test.js
index 5def6df4fc..a29ca1a9eb 100644
--- a/client/src/lib/terminalScroll.test.js
+++ b/client/src/lib/terminalScroll.test.js
@@ -208,7 +208,11 @@ describe('attachTerminalWheelScroll', () => {
const xtermListener = vi.fn();
term.element.addEventListener('wheel', xtermListener);
const detach = attachTerminalWheelScroll(term);
- const event = new WheelEvent('wheel', { deltaY: -120, shiftKey: true, bubbles: true, cancelable: true });
+ const event = new WheelEvent('wheel', { deltaY: -120, bubbles: true, cancelable: true });
+ // WheelEvent inherits its modifier state from MouseEvent, and not every DOM
+ // implementation carries `shiftKey` through the WheelEvent constructor — pin it
+ // on the instance so the shift branch is actually the one exercised (#6144).
+ Object.defineProperty(event, 'shiftKey', { value: true });
term.element.dispatchEvent(event);
expect(term.input).not.toHaveBeenCalled();
expect(xtermListener).toHaveBeenCalledTimes(1);
diff --git a/client/src/pages/RapidReader.jsx b/client/src/pages/RapidReader.jsx
index 4131bc1732..c45bb46a97 100644
--- a/client/src/pages/RapidReader.jsx
+++ b/client/src/pages/RapidReader.jsx
@@ -325,7 +325,14 @@ export default function RapidReaderPage() {
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2 pt-1">
<label className="text-xs text-gray-400"><span className="sr-only">Shelf title</span><input value={saveTitle} onChange={(event) => setSaveTitle(event.target.value)} placeholder="Title to save" className="w-full min-h-10 bg-port-bg border border-port-border rounded-md px-3" /></label>
<button type="button" disabled={savingShelf || !documentText || !saveTitle.trim()} onClick={saveToShelf} className="inline-flex justify-center items-center gap-1 min-h-10 border border-port-accent/50 text-port-accent rounded-md disabled:opacity-40"><Save size={14} /> Save to shelf</button>
- <label className="sm:col-span-2 text-xs text-gray-400 flex flex-col sm:flex-row gap-2"><span className="sr-only">URL to add to shelf</span><input value={url} onChange={(event) => setUrl(event.target.value)} placeholder="https://example.com/article" className="flex-1 min-h-10 bg-port-bg border border-port-border rounded-md px-3" /><button type="button" disabled={fetchingShelf || !url.trim()} onClick={fetchToShelf} className="min-h-10 px-3 border border-port-accent/50 text-port-accent rounded-md disabled:opacity-40">Fetch URL to shelf</button></label>
+ {/* The Fetch button is a sibling of the field, not a child of its
+ <label>: a <button> is a labelable element, so nesting it made the
+ label a candidate name source for the button as well as the input. */}
+ <div className="sm:col-span-2 text-xs text-gray-400 flex flex-col sm:flex-row gap-2">
+ <label htmlFor="rapid-reader-shelf-url" className="sr-only">URL to add to shelf</label>
+ <input id="rapid-reader-shelf-url" value={url} onChange={(event) => setUrl(event.target.value)} placeholder="https://example.com/article" className="flex-1 min-h-10 bg-port-bg border border-port-border rounded-md px-3" />
+ <button type="button" disabled={fetchingShelf || !url.trim()} onClick={fetchToShelf} className="min-h-10 px-3 border border-port-accent/50 text-port-accent rounded-md disabled:opacity-40">Fetch URL to shelf</button>
+ </div>
</div>
</div>
diff --git a/client/src/pages/SongBookViewer.test.jsx b/client/src/pages/SongBookViewer.test.jsx
index 622e2748da..0a6f0ad789 100644
--- a/client/src/pages/SongBookViewer.test.jsx
+++ b/client/src/pages/SongBookViewer.test.jsx
@@ -782,11 +782,13 @@ K: o - - - - - o -`;
});
describe('fit-to-duration autoscroll preset (#4100)', () => {
- // jsdom lays nothing out, so the scroll container reports 0/0 — stub the two
+ // The test DOM lays nothing out, so the scroll container reports 0/0 — stub the two
// metrics the preset measures. 2000 tall in a 500 viewport = 1500px of travel.
const stubScrollMetrics = (scrollHeight, clientHeight) => {
- const sh = vi.spyOn(Element.prototype, 'scrollHeight', 'get').mockReturnValue(scrollHeight);
- const ch = vi.spyOn(Element.prototype, 'clientHeight', 'get').mockReturnValue(clientHeight);
+ // HTMLElement, not Element: `clientHeight` is declared on HTMLElement in some
+ // DOM implementations, and vi.spyOn only walks *up* the prototype chain (#6144).
+ const sh = vi.spyOn(HTMLElement.prototype, 'scrollHeight', 'get').mockReturnValue(scrollHeight);
+ const ch = vi.spyOn(HTMLElement.prototype, 'clientHeight', 'get').mockReturnValue(clientHeight);
return () => { sh.mockRestore(); ch.mockRestore(); };
};
diff --git a/client/src/pages/VoiceCallHost.test.jsx b/client/src/pages/VoiceCallHost.test.jsx
index 29e685f822..37693434f3 100644
--- a/client/src/pages/VoiceCallHost.test.jsx
+++ b/client/src/pages/VoiceCallHost.test.jsx
@@ -22,8 +22,14 @@ const grantCapabilities = () => {
window.HTMLMediaElement.prototype.setSinkId = () => Promise.resolve();
navigator.mediaDevices = { enumerateDevices: vi.fn(), getUserMedia: vi.fn() };
// Mirrors the real API: the returned promise settles with the CALLBACK's
- // result, so a held lock never resolves it.
- navigator.locks = { request: vi.fn((_name, _options, fn) => Promise.resolve(fn(true))) };
+ // result, so a held lock never resolves it. `defineProperty` rather than a plain
+ // assignment — `navigator.locks` is a getter-only accessor in some DOM
+ // implementations, where assigning to it throws (#6144).
+ Object.defineProperty(navigator, 'locks', {
+ value: { request: vi.fn((_name, _options, fn) => Promise.resolve(fn(true))) },
+ configurable: true,
+ writable: true,
+ });
};
const devices = [
diff --git a/client/src/test/formValidityPolyfill.js b/client/src/test/formValidityPolyfill.js
new file mode 100644
index 0000000000..8a636dcddd
--- /dev/null
+++ b/client/src/test/formValidityPolyfill.js
@@ -0,0 +1,47 @@
+// Constraint-validation fix for the test environment (#6144).
+//
+// happy-dom decides `stepMismatch` with a raw float modulo of the value against
+// the `step` attribute — it ignores the step base and IEEE-754 rounding — so
+// `<input type="range" min="0" max="1" step="0.05" value="0.35">` reports
+// invalid, because `0.35 % 0.05` is 0.049999999999999975 rather than 0. A single
+// invalid control makes the whole form's `checkValidity()` false, and happy-dom's
+// implicit submission then drops the submit event *silently*: clicking a
+// `type="submit"` button runs no handler and raises nothing, so the test just
+// sees zero calls (this is what hid MediaJobsQueue's video retry form).
+//
+// No browser behaves that way. Per HTML, a range input is snapped by its value
+// sanitization algorithm and can never suffer a step mismatch, and every other
+// numeric input measures the step from the step base (`min`), not from zero.
+// Restoring both keeps a form in a test submitting exactly where it would in a
+// browser, and leaves a genuinely out-of-step value still reported as such.
+
+// Floating-point steps (0.05, 0.1) never divide cleanly, so compare the multiple
+// against the nearest integer rather than demanding an exact zero remainder.
+const STEP_EPSILON = 1e-9;
+
+export const installFormValidityFix = () => {
+ const probe = globalThis.document?.createElement?.('input');
+ const prototype = probe?.validity ? Object.getPrototypeOf(probe.validity) : null;
+ const original = prototype && Object.getOwnPropertyDescriptor(prototype, 'stepMismatch');
+ if (!original?.get) return;
+
+ Object.defineProperty(prototype, 'stepMismatch', {
+ ...original,
+ get() {
+ const element = this.element;
+ // `element` is happy-dom's own back-reference; without it (any other
+ // environment) leave the host implementation alone.
+ if (!element) return original.get.call(this);
+ if (element.type === 'range') return false;
+ if (element.value === '') return false;
+ const step = Number(element.getAttribute?.('step'));
+ const value = Number(element.value);
+ if (!Number.isFinite(step) || step <= 0 || !Number.isFinite(value)) {
+ return original.get.call(this);
+ }
+ const base = Number(element.getAttribute?.('min'));
+ const multiple = (value - (Number.isFinite(base) ? base : 0)) / step;
+ return Math.abs(multiple - Math.round(multiple)) > STEP_EPSILON;
+ },
+ });
+};
diff --git a/client/src/test/formValidityPolyfill.test.js b/client/src/test/formValidityPolyfill.test.js
new file mode 100644
index 0000000000..15585bdd16
--- /dev/null
+++ b/client/src/test/formValidityPolyfill.test.js
@@ -0,0 +1,38 @@
+import { describe, it, expect } from 'vitest';
+
+// setup.js has already run installFormValidityFix() against this environment, so
+// these assert the resulting DOM behaviour rather than the installer. The
+// regression they catch is silent: an input the environment wrongly calls
+// step-mismatched makes its form's checkValidity() false, and implicit submission
+// then drops the submit event with no error at all (#6144).
+const input = (attrs) => {
+ const el = document.createElement('input');
+ for (const [key, value] of Object.entries(attrs)) el.setAttribute(key, String(value));
+ return el;
+};
+
+describe('form validity — step mismatch', () => {
+ it('never step-mismatches a range, whose value the UA snaps for it', () => {
+ // 0.35 % 0.05 is 0.049999999999999975 in IEEE-754, which a naive check reads
+ // as out of step. This is the exact slider that blocked a retry form's submit.
+ expect(input({ type: 'range', min: 0, max: 1, step: 0.05, value: '0.35' }).validity.stepMismatch)
+ .toBe(false);
+ });
+
+ it('measures a number input from its step base, not from zero', () => {
+ expect(input({ type: 'number', min: 1, step: 2, value: '7' }).validity.stepMismatch).toBe(false);
+ expect(input({ type: 'number', step: 0.1, value: '0.3' }).validity.stepMismatch).toBe(false);
+ });
+
+ it('still reports a genuinely out-of-step value', () => {
+ expect(input({ type: 'number', min: 1, step: 2, value: '8' }).validity.stepMismatch).toBe(true);
+ });
+
+ it('lets a form with a fractional-step slider submit', () => {
+ const form = document.createElement('form');
+ form.appendChild(input({ type: 'range', min: 0, max: 1, step: 0.05, value: '0.35' }));
+ document.body.appendChild(form);
+ expect(form.checkValidity()).toBe(true);
+ form.remove();
+ });
+});
diff --git a/client/src/test/setup.js b/client/src/test/setup.js
index c24de4dc0d..5b301e82d3 100644
--- a/client/src/test/setup.js
+++ b/client/src/test/setup.js
@@ -2,6 +2,7 @@ import '@testing-library/jest-dom/vitest';
import { afterEach } from 'vitest';
import { cleanup, configure } from '@testing-library/react';
import { installTestStorage } from './storagePolyfill.js';
+import { installFormValidityFix } from './formValidityPolyfill.js';
// testing-library defaults asyncUtilTimeout to 1000ms. Several views debounce at
// 500ms and a couple wait on a debounce plus a retry, so under parallel-worker CPU
@@ -12,10 +13,14 @@ import { installTestStorage } from './storagePolyfill.js';
configure({ asyncUtilTimeout: 3000 });
// Guarantee a working localStorage/sessionStorage before any test runs, regardless
-// of how jsdom exposes Storage in this environment. See storagePolyfill.js / #1438.
+// of how the environment exposes Storage. See storagePolyfill.js / #1438.
installTestStorage();
-// jsdom doesn't implement Element.prototype.scrollIntoView; components call it
+// Make constraint validation match a browser so implicit form submission isn't
+// swallowed by a float-modulo step check. See formValidityPolyfill.js / #6144.
+installFormValidityFix();
+
+// The test DOM doesn't implement Element.prototype.scrollIntoView; components call it
// (often from a requestAnimationFrame callback that can fire AFTER a test unmounts),
// and the resulting unhandled error fails the whole run despite passing assertions
// (#2958). Stub it once, guarded so it never clobbers a real implementation — on real
@@ -24,7 +29,7 @@ if (typeof Element !== 'undefined' && !Element.prototype.scrollIntoView) {
Element.prototype.scrollIntoView = () => {};
}
-// Stub jsdom missing media/canvas methods to eliminate stderr noise in test runs
+// Stub the media/canvas methods the test DOM omits, to eliminate stderr noise in test runs
if (typeof HTMLMediaElement !== 'undefined') {
HTMLMediaElement.prototype.play = () => Promise.resolve();
HTMLMediaElement.prototype.pause = () => {};
diff --git a/client/src/test/storagePolyfill.js b/client/src/test/storagePolyfill.js
index 885dac27c1..2e8636e1a6 100644
--- a/client/src/test/storagePolyfill.js
+++ b/client/src/test/storagePolyfill.js
@@ -7,6 +7,15 @@
// absent, any test whose `beforeEach` calls `localStorage.clear()` dies with
// "Cannot read properties of undefined (reading 'clear')". Installing a guaranteed
// in-memory Storage removes that environmental dependency. See issue #1438.
+//
+// setup.js installs the shim unconditionally (`force`), because a *present* Storage
+// is not automatically a usable one either: happy-dom backs `localStorage` with a
+// Proxy that turns any property definition into a stored item, so `vi.spyOn(
+// window.localStorage, 'setItem')` cannot be undone and `vi.restoreAllMocks()`
+// leaks the throwing stub into every later test in the file (#6144). The shim is a
+// plain object, so a spy on it restores like any other. Storage identity is not
+// otherwise observable — nothing in the app reads `instanceof Storage`, and the
+// 'storage' event listeners take a synthetic event from the test.
export const createMemoryStorage = () => {
let store = new Map();
@@ -50,11 +59,12 @@ export const storageWorks = (candidate) => {
return ok;
};
-// Ensure `globalThis[name]` (and `window[name]`, which jsdom aliases) is a working
-// Storage. Returns true when it installed a shim, false when the environment's own
-// Storage already worked. Idempotent.
-export const ensureStorage = (name, root = globalThis) => {
- if (storageWorks(root[name])) return false;
+// Ensure `globalThis[name]` (and `window[name]`, which the environment may alias) is
+// a working Storage. Returns true when it installed a shim, false when the
+// environment's own Storage already worked and was left alone. Idempotent.
+// `force` skips the probe and installs the shim regardless — see the header.
+export const ensureStorage = (name, root = globalThis, { force = false } = {}) => {
+ if (!force && storageWorks(root[name])) return false;
const shim = createMemoryStorage();
Object.defineProperty(root, name, { value: shim, configurable: true, writable: true });
// jsdom may expose `window` and `globalThis` as distinct objects; alias the shim
@@ -68,6 +78,6 @@ export const ensureStorage = (name, root = globalThis) => {
};
export const installTestStorage = () => {
- ensureStorage('localStorage');
- ensureStorage('sessionStorage');
+ ensureStorage('localStorage', globalThis, { force: true });
+ ensureStorage('sessionStorage', globalThis, { force: true });
};
diff --git a/client/src/test/storagePolyfill.test.js b/client/src/test/storagePolyfill.test.js
index 95f810c0bd..35e61317bd 100644
--- a/client/src/test/storagePolyfill.test.js
+++ b/client/src/test/storagePolyfill.test.js
@@ -87,6 +87,17 @@ describe('storagePolyfill', () => {
expect(root.localStorage).not.toBe(before);
});
+ it('installs over a working Storage when forced (the setup.js path)', () => {
+ // happy-dom's Proxy-backed Storage survives the probe but cannot be un-spied,
+ // so setup.js replaces it outright rather than trusting it (#6144).
+ const existing = createMemoryStorage();
+ existing.setItem('keep', 'me');
+ const root = { localStorage: existing };
+ expect(ensureStorage('localStorage', root, { force: true })).toBe(true);
+ expect(root.localStorage).not.toBe(existing);
+ expect(storageWorks(root.localStorage)).toBe(true);
+ });
+
it('leaves a working Storage untouched (idempotent, no clobber)', () => {
const existing = createMemoryStorage();
existing.setItem('keep', 'me');
@@ -109,8 +120,8 @@ describe('storagePolyfill', () => {
it('guarantees both local AND session storage are working (idempotent)', () => {
// The actual entry point setup.js calls. Asserting it directly catches a
// refactor that dropped the sessionStorage line — the ensureStorage cases above
- // would still pass. It targets the live globals (already installed by setup.js),
- // so this re-invocation must be a no-op that leaves both keys working.
+ // would still pass. It targets the live globals, and re-installs a fresh shim
+ // over each (the forced path), so both keys must still be working after.
expect(() => installTestStorage()).not.toThrow();
expect(storageWorks(globalThis.localStorage)).toBe(true);
expect(storageWorks(globalThis.sessionStorage)).toBe(true);
diff --git a/client/vitest.config.js b/client/vitest.config.js
index 202c7ae283..d0cc6e3ea0 100644
--- a/client/vitest.config.js
+++ b/client/vitest.config.js
@@ -6,11 +6,15 @@ import { vitestCiPool } from '../scripts/vitestCiPool.js';
export default defineConfig({
plugins: [react()],
test: {
- // Four jsdom workers exhausted Testing Library's existing 3s async budget
+ // Four DOM workers exhausted Testing Library's existing 3s async budget
// on the public runner before ChiefOfStaff's config panel settled. Keep the
// proven two-worker client cap; the Node/server runner uses all four CPUs.
...vitestCiPool({ maxWorkers: 2 }),
- environment: 'jsdom',
+ // happy-dom, not jsdom (#6144): building the DOM was the client suite's
+ // largest CI phase, and happy-dom cuts it by roughly two thirds for the same
+ // 10k assertions. Files that need no DOM at all still opt out entirely with a
+ // `// @vitest-environment node` pragma — see docs/GITHUB_ACTIONS.md.
+ environment: 'happy-dom',
globals: true,
setupFiles: ['./src/test/setup.js'],
css: false,
diff --git a/docs/DEPS.md b/docs/DEPS.md
index 66f96b35e0..9cdb7ade4d 100644
--- a/docs/DEPS.md
+++ b/docs/DEPS.md
@@ -74,8 +74,8 @@ Before removing a Tier 3 candidate, run a transitive-dep check (`npm ls <pkg>`).
| `tailwindcss` | 1 | KEEP | styling | |
| `@vitejs/plugin-react` | 1 | KEEP | build | |
| `vite` | 1 | KEEP | build | |
-| `vitest` | 1 | KEEP | client test runner | jsdom environment |
-| `jsdom` | 1 | KEEP | test DOM | Paired with vitest |
+| `vitest` | 1 | KEEP | client test runner | happy-dom environment |
+| `happy-dom` | 1 | KEEP | test DOM | Paired with vitest. Replaced `jsdom` in #6144 — same suite, ~65% less time in `environment` |
| `@testing-library/jest-dom` | 1 | KEEP | test matchers | |
| `@testing-library/dom` | 1 | KEEP | DOM test utilities | Foundation for the client Testing Library stack |
| `@testing-library/react` | 1 | KEEP | component tests | |
diff --git a/docs/GITHUB_ACTIONS.md b/docs/GITHUB_ACTIONS.md
index 87848ea935..ac8622359a 100644
--- a/docs/GITHUB_ACTIONS.md
+++ b/docs/GITHUB_ACTIONS.md
@@ -66,7 +66,7 @@ On GitHub Actions, `CI=true` caps the server Vitest runner at `maxWorkers: 4`
`client/vitest.config.js`). Standard Linux runners for public repositories are
[4 vCPU / 16GB](https://docs.github.com/en/actions/reference/runners/github-hosted-runners);
uncapped forks oversubscribe those cores during transform. Local `npm test`
-is unbounded. The jsdom-heavy client retains its proven two-worker override:
+is unbounded. The DOM-heavy client retains its proven two-worker override:
four workers made its async rendering assertions timing-dependent under CI
contention. File-level parallelism stays on; the DB suite already serializes
files because those tests share one Postgres.
@@ -79,18 +79,18 @@ writes Vitest wall time to the job summary so later runs can be compared
against the pre-change full-suite job wall on `main` (2026-08-16, run
`31951919659`): server ~300s, client+build ~467s, Windows ~463s.
-### Test environment cost (jsdom vs happy-dom)
+### Test environment cost (happy-dom, and skipping the DOM entirely)
-`environment` — the per-file cost of constructing the DOM the test runs in — is
+`environment` — the per-file cost of constructing the DOM the test runs in — was
the single largest phase of the client suite. On the 2026-08-16 full run it was
`environment 489s` against `tests 384s`: building jsdom cost more than running
-the assertions. Two levers exist.
+the assertions. Two levers cut it, and both are now applied.
-**Lever 1 — don't build a DOM you don't need (applied).** A test file that never
-touches the DOM opts out with a `// @vitest-environment node` pragma on line 1,
-and pays ~0ms instead of ~0.35s (local) / ~0.7s (CI runner) for its environment.
-Every file under `client/src/{lib,utils,services}` that passes in `node` now
-carries the pragma. Measured on the 36 files converted in that sweep:
+**Lever 1 — don't build a DOM you don't need.** A test file that never touches
+the DOM opts out with a `// @vitest-environment node` pragma on line 1, and pays
+~0ms instead of ~0.35s (local) / ~0.7s (CI runner) for its environment. Every
+file under `client/src/{lib,utils,services}` that passes in `node` carries the
+pragma. Measured on the 36 files converted in that sweep (#6008):
| environment | wall |
| --- | --- |
@@ -99,48 +99,64 @@ carries the pragma. Measured on the 36 files converted in that sweep:
When adding a test under `client/src/{lib,utils,services}`, default to the
pragma and only drop it if the file (or the module it imports) genuinely needs
-`document`/`window`. The 13 files in that tree that legitimately keep jsdom do
+`document`/`window`. The 13 files in that tree that legitimately keep a DOM do
so because the *module under test* reaches for a browser global — e.g.
`apiApps.js` navigates via `window.location`, `webglSupport.js` calls
`document.createElement('canvas')`.
-**Lever 2 — a cheaper DOM (measured, not adopted).** happy-dom 20.14 was
-prototyped against the whole `client/src/components/` tree (440 files) on
-Node 24, versus the jsdom 30 baseline:
-
-| environment | wall | failures |
-| --- | --- | --- |
-| jsdom 30.0.1: 146.19s | 33.86s | baseline |
-| happy-dom 20.14.0: 55.05s | 21.02s | 3 files / 7 assertions |
-
-A 62% cut to the environment phase, which would put the full-run figure under
-the 300s target on its own. `client/src/test/setup.js` needs no change: its
-`scrollIntoView`, `HTMLMediaElement`, and `HTMLCanvasElement` stubs are all
-either guarded or unconditional assignments that happy-dom accepts, and
-`installTestStorage()` covers the storage difference already.
-
-The gap is in the *tests*, not the setup, and it is small but real:
-
-1. **`getComputedStyle` returns no UA defaults.** happy-dom reports
- `display: ""` for an unstyled `<span>` where jsdom reports `"inline"`.
- `dom-accessibility-api` reads that as block-level and joins the text with a
- space, so `getByRole('button', { name: 'Ollama1' })` has to become
- `'Ollama 1'`. Hits every query whose expected accessible name concatenates a
- label with an adjacent inline element (`AiAssignmentsTab.test.jsx`, 4
- assertions — the `TabPills` count badge).
-2. **No `SVGAnimatedString`.** `svgEl.className` is a plain string, so
- `.baseVal` is `undefined` (`VideoTimelineLanes.test.jsx`, 1 assertion).
- Assert on `getAttribute('class')` instead, which works in both.
-3. **Unresolved async-settling divergence** in `MediaJobsQueue.test.jsx`
- (2 assertions): a `type="submit"` click whose `onSubmit` produces no call
- under happy-dom while the same click in sibling tests in the same file does.
- Implicit form submission itself is fine in both — a minimal
- `<form onSubmit><button type="submit">` probe fires once in each — so this
- one needs a root cause before the switch, not a mechanical edit.
-
-Conclusion: **viable, deferred to #6144.** The switch is a new devDependency
-plus a default-environment flip affecting all 868 client test files, so it ships
-as its own change rather than riding along with the pragma sweep.
+**Lever 2 — a cheaper DOM.** `client/vitest.config.js` runs on happy-dom
+(#6144). Full-suite figures for the 834 files, Node 24, same machine, same
+assertions:
+
+| environment | wall |
+| --- | --- |
+| jsdom 30.0.1: 236.86s | 55.68s |
+| happy-dom 20.14.0: 83.65s | 34.83s |
+
+A 65% cut to the environment phase and a 37% cut to wall. jsdom is no longer a
+dependency, so `// @vitest-environment jsdom` is not available as a per-file
+escape hatch — a divergence gets fixed in the test, the way the six below were.
+
+**What differs, when a test breaks after touching the DOM.** happy-dom is not
+bug-compatible with jsdom, and the gaps all showed up as tests rather than as
+product failures. Two are patched centrally in `client/src/test/`, so they never
+need handling again; the rest are per-site idioms worth copying.
+
+Patched in setup:
+
+- **Constraint validation.** happy-dom computes `stepMismatch` as a raw float
+ modulo against `step`, ignoring the step base — so
+ `<input type="range" min="0" max="1" step="0.05" value="0.35">` reports
+ invalid. One invalid control makes the form's `checkValidity()` false, and
+ implicit submission is then dropped *silently*: clicking a `type="submit"`
+ button runs no handler and raises nothing.
+ `client/src/test/formValidityPolyfill.js` restores the browser behaviour.
+- **Storage identity.** happy-dom backs `localStorage` with a Proxy that turns a
+ property definition into a stored item, so `vi.spyOn(window.localStorage,
+ 'setItem')` cannot be undone and leaks a throwing stub into every later test in
+ the file. `installTestStorage()` now replaces Storage with the plain in-memory
+ shim unconditionally.
+
+Per-site idioms:
+
+- **`getComputedStyle` returns no UA defaults.** An unstyled `<span>` reports
+ `display: ""`, and `dom-accessibility-api` joins non-inline text with a space —
+ so a `TabPills` chip's accessible name is `'Ollama 1'`, not jsdom's
+ `'Ollama1'`. A real browser blockifies the flex item and also spaces it. Match
+ a whitespace-tolerant regex rather than pinning one engine.
+- **No `SVGAnimatedString`.** `svgEl.className` is a plain string, so `.baseVal`
+ is `undefined`. Assert on `getAttribute('class')`, which works everywhere.
+- **`clientHeight` is declared on `HTMLElement`, not `Element`**, and
+ `vi.spyOn` only walks *up* the prototype chain. Spy on `HTMLElement.prototype`.
+- **`WheelEvent` does not extend `MouseEvent`**, so modifier keys passed to the
+ constructor are dropped. `Object.defineProperty(event, 'shiftKey', …)` after
+ construction works in both.
+- **Some `navigator` members are getter-only** (`navigator.locks`), where a plain
+ assignment throws. Use `Object.defineProperty`.
+- **A `<label>` reports itself as the label of *any* labelable descendant**, not
+ just its control — so a `<button>` nested inside a field's `<label>` takes the
+ label's text as its accessible name. Pair `htmlFor`/`id` and keep the button a
+ sibling, which is the convention anyway.
### Reusing the server install
@@ -303,7 +319,7 @@ The selected work is split across parallel jobs:
### Full-suite sharding
A full plan is the slow case: on the 4-vCPU public runners the client suite
-alone took ~10 minutes (jsdom setup per file dominates — the 868-file run
+alone took ~10 minutes (DOM setup per file dominated — the 868-file run
spent 489 s in `environment` against 384 s in `tests` — and its worker cap is
two, see `scripts/vitestCiPool.js`), the Windows server suite ~10 minutes
(module import is several times slower there), and the Linux server suite ~6