From 47a1390fd475cbc4be056e3e0ade5354a5f5da8f Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Mon, 9 Nov 2026 17:44:28 +0100 Subject: [PATCH] test: replace jsdom with happy-dom --- package.json | 2 +- pnpm-lock.yaml | 146 +++++++++++++++++++++++++++++----------------- vitest.config.mjs | 2 +- 3 files changed, 94 insertions(+), 56 deletions(-) diff --git a/package.json b/package.json index 187f5ee328..5cfdbca586 100644 --- a/package.json +++ b/package.json @@ -70,10 +70,10 @@ "eslint-plugin-jsx-a11y": "6.10.2", "eslint-plugin-prettier": "5.5.7", "eslint-plugin-react": "7.37.5", + "happy-dom": "21.0.4", "hoist-non-react-statics": "3.3.2", "html-loader": "5.1.0", "html-webpack-plugin": "5.6.8", - "jsdom": "30.1.3", "less": "4.9.1", "less-loader": "13.1.0", "mini-css-extract-plugin": "2.10.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b2a5d85eed..24d7c4e3ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -239,6 +239,9 @@ importers: eslint-plugin-react: specifier: 7.37.5 version: 7.37.5(eslint@9.39.5(supports-color@8.1.1)) + happy-dom: + specifier: 21.0.4 + version: 21.0.4 hoist-non-react-statics: specifier: 3.3.2 version: 3.3.2 @@ -248,9 +251,6 @@ importers: html-webpack-plugin: specifier: 5.6.8 version: 5.6.8(webpack@5.112.2) - jsdom: - specifier: 30.1.3 - version: 30.1.3(@noble/hashes@1.8.0) less: specifier: 4.9.1 version: 4.9.1(supports-color@8.1.1) @@ -280,7 +280,7 @@ importers: version: 3.16.3(react-dom@19.3.1(react@19.3.1))(react@19.3.1) vitest: specifier: 5.1.0 - version: 5.1.0(@types/node@26.6.6)(@vitest/coverage-v8@5.1.0)(jsdom@30.1.3(@noble/hashes@1.8.0))(vite@8.3.6(@types/node@26.6.6)(less@4.9.1(supports-color@8.1.1))(terser@5.51.2)) + version: 5.1.0(@types/node@26.6.6)(@vitest/coverage-v8@5.1.0)(happy-dom@21.0.4)(vite@8.3.6(@types/node@26.6.6)(less@4.9.1(supports-color@8.1.1))(terser@5.51.2)) webpack: specifier: 5.112.2 version: 5.112.2(clean-css@5.3.3)(cssnano@7.1.9(postcss@8.5.32))(csso@5.0.5)(html-minifier-terser@7.2.0)(lightningcss@1.33.0)(postcss@8.5.32)(svgo@4.1.0)(webpack-cli@7.3.1) @@ -1412,6 +1412,9 @@ packages: '@types/serve-static@2.2.0': resolution: {integrity: sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ==} + '@types/whatwg-mimetype@3.0.2': + resolution: {integrity: sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA==} + '@types/ws@8.18.2': resolution: {integrity: sha512-67MQl+fpWKVTT1NYdnmo3U4sc/xPo/zQBncVnI74qmQa0z/b+1g6iYqNmGCPbxO+zz2aklb08a0oHfegiVd0/w==} @@ -1708,6 +1711,10 @@ packages: buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + buffer-image-size@0.6.4: + resolution: {integrity: sha512-nEh+kZOPY1w+gcCMobZ6ETUp9WfibndnosbpwB1iJk/8Gt5ZF2bhS6+B6bPYz424KtwsR6Rflc3tCz1/ghX2dQ==} + engines: {node: '>=4.0'} + bundle-name@4.1.1: resolution: {integrity: sha512-DdH81/zPLVS11EUgWq3tEu/xn+EzljlMYooDNdzWEnFha3R3NBMpMV1UqYIpjYHV/SgpFKMIX1Oh7o06SjM/oA==} engines: {node: '>=18'} @@ -2126,6 +2133,10 @@ packages: resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==} engines: {node: '>=0.12'} + entities@7.0.1: + resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==} + engines: {node: '>=0.12'} + entities@9.0.0: resolution: {integrity: sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==} engines: {node: '>=20.19.0'} @@ -2469,6 +2480,10 @@ packages: graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + happy-dom@21.0.4: + resolution: {integrity: sha512-tFm+GaLBgo6o0awHnvHaNoraVo27qJ+2tZEtZ+cIa08hXbeitrxAJajLI05hsUy/2/YTKcUjQYzHe5mCcraLBw==} + engines: {node: '>=20.0.0'} + has-bigints@1.1.0: resolution: {integrity: sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==} engines: {node: '>= 0.4'} @@ -2802,15 +2817,6 @@ packages: resolution: {integrity: sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==} hasBin: true - jsdom@30.1.3: - resolution: {integrity: sha512-hQMUPvRgN7KxsfIytDQji7bimuJeRQa6Qo5+iuiZQk5CafeRxLIA10/cG5YCBFNpD9RO3oqIiN4CO1Y44kxqXg==} - engines: {node: ^22.22.2 || ^24.15.0 || >=26.0.0} - peerDependencies: - canvas: ^3.2.3 - peerDependenciesMeta: - canvas: - optional: true - jsesc@3.1.0: resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==} engines: {node: '>=6'} @@ -4259,6 +4265,10 @@ packages: webpack-cli: optional: true + whatwg-mimetype@3.0.0: + resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} + engines: {node: '>=12'} + whatwg-mimetype@5.0.0: resolution: {integrity: sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==} engines: {node: '>=20'} @@ -4344,6 +4354,7 @@ snapshots: '@csstools/css-parser-algorithms': 4.0.2(@csstools/css-tokenizer@4.0.2) '@csstools/css-tokenizer': 4.0.2 lru-cache: 11.5.3 + optional: true '@asamuzakjp/dom-selector@10.0.5': dependencies: @@ -4351,6 +4362,7 @@ snapshots: css-tree: 3.2.1 is-potential-custom-element-name: 1.0.1 lru-cache: 11.5.3 + optional: true '@babel/cli@7.29.7(@babel/core@7.29.13(supports-color@8.1.1))': dependencies: @@ -5088,15 +5100,18 @@ snapshots: '@bramus/specificity@2.4.3': dependencies: css-tree: 3.2.1 + optional: true '@colordx/core@5.8.0': {} - '@csstools/color-helpers@6.1.2': {} + '@csstools/color-helpers@6.1.2': + optional: true '@csstools/css-calc@3.4.3(@csstools/css-parser-algorithms@4.0.2(@csstools/css-tokenizer@4.0.2))(@csstools/css-tokenizer@4.0.2)': dependencies: '@csstools/css-parser-algorithms': 4.0.2(@csstools/css-tokenizer@4.0.2) '@csstools/css-tokenizer': 4.0.2 + optional: true '@csstools/css-color-parser@4.2.7(@csstools/css-parser-algorithms@4.0.2(@csstools/css-tokenizer@4.0.2))(@csstools/css-tokenizer@4.0.2)': dependencies: @@ -5104,16 +5119,20 @@ snapshots: '@csstools/css-calc': 3.4.3(@csstools/css-parser-algorithms@4.0.2(@csstools/css-tokenizer@4.0.2))(@csstools/css-tokenizer@4.0.2) '@csstools/css-parser-algorithms': 4.0.2(@csstools/css-tokenizer@4.0.2) '@csstools/css-tokenizer': 4.0.2 + optional: true '@csstools/css-parser-algorithms@4.0.2(@csstools/css-tokenizer@4.0.2)': dependencies: '@csstools/css-tokenizer': 4.0.2 + optional: true '@csstools/css-syntax-patches-for-csstree@1.1.16(css-tree@3.2.1)': optionalDependencies: css-tree: 3.2.1 + optional: true - '@csstools/css-tokenizer@4.0.2': {} + '@csstools/css-tokenizer@4.0.2': + optional: true '@discoveryjs/json-ext@1.1.0': {} @@ -5170,6 +5189,7 @@ snapshots: '@exodus/bytes@1.16.0(@noble/hashes@1.8.0)': optionalDependencies: '@noble/hashes': 1.8.0 + optional: true '@humanfs/core@0.19.2': dependencies: @@ -5539,7 +5559,7 @@ snapshots: picocolors: 1.1.1 redent: 3.0.0 optionalDependencies: - vitest: 5.1.0(@types/node@26.6.6)(@vitest/coverage-v8@5.1.0)(jsdom@30.1.3(@noble/hashes@1.8.0))(vite@8.3.6(@types/node@26.6.6)(less@4.9.1(supports-color@8.1.1))(terser@5.51.2)) + vitest: 5.1.0(@types/node@26.6.6)(@vitest/coverage-v8@5.1.0)(happy-dom@21.0.4)(vite@8.3.6(@types/node@26.6.6)(less@4.9.1(supports-color@8.1.1))(terser@5.51.2)) '@testing-library/react@16.3.3(@testing-library/dom@10.4.2)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)': dependencies: @@ -5637,6 +5657,8 @@ snapshots: '@types/http-errors': 2.0.5 '@types/node': 26.6.6 + '@types/whatwg-mimetype@3.0.2': {} + '@types/ws@8.18.2': dependencies: '@types/node': 26.6.6 @@ -5659,7 +5681,7 @@ snapshots: obug: 3.0.0 std-env: 4.3.0 tinyrainbow: 3.2.0 - vitest: 5.1.0(@types/node@26.6.6)(@vitest/coverage-v8@5.1.0)(jsdom@30.1.3(@noble/hashes@1.8.0))(vite@8.3.6(@types/node@26.6.6)(less@4.9.1(supports-color@8.1.1))(terser@5.51.2)) + vitest: 5.1.0(@types/node@26.6.6)(@vitest/coverage-v8@5.1.0)(happy-dom@21.0.4)(vite@8.3.6(@types/node@26.6.6)(less@4.9.1(supports-color@8.1.1))(terser@5.51.2)) '@vitest/istanbul-lib-coverage@2.1.0': {} @@ -5956,6 +5978,7 @@ snapshots: bidi-js@1.1.0: dependencies: require-from-string: 2.0.2 + optional: true binary-extensions@2.3.0: optional: true @@ -6000,6 +6023,10 @@ snapshots: buffer-from@1.1.2: {} + buffer-image-size@0.6.4: + dependencies: + '@types/node': 26.6.6 + bundle-name@4.1.1: dependencies: run-applescript: 7.1.0 @@ -6272,6 +6299,7 @@ snapshots: whatwg-url: 17.3.0(@noble/hashes@1.8.0) transitivePeerDependencies: - '@noble/hashes' + optional: true data-view-buffer@1.0.2: dependencies: @@ -6309,7 +6337,8 @@ snapshots: optionalDependencies: supports-color: 8.1.1 - decimal.js@10.6.0: {} + decimal.js@10.6.0: + optional: true deep-is@0.1.4: {} @@ -6424,7 +6453,10 @@ snapshots: entities@6.0.1: {} - entities@9.0.0: {} + entities@7.0.1: {} + + entities@9.0.0: + optional: true envinfo@7.21.0: {} @@ -6909,6 +6941,19 @@ snapshots: graceful-fs@4.2.11: {} + happy-dom@21.0.4: + dependencies: + '@types/node': 26.6.6 + '@types/whatwg-mimetype': 3.0.2 + '@types/ws': 8.18.2 + buffer-image-size: 0.6.4 + entities: 7.0.1 + whatwg-mimetype: 3.0.0 + ws: 8.22.1 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + has-bigints@1.1.0: {} has-flag@4.0.0: {} @@ -6942,6 +6987,7 @@ snapshots: '@exodus/bytes': 1.16.0(@noble/hashes@1.8.0) transitivePeerDependencies: - '@noble/hashes' + optional: true html-loader@5.1.0(webpack@5.112.2): dependencies: @@ -7158,7 +7204,8 @@ snapshots: dependencies: isobject: 3.0.1 - is-potential-custom-element-name@1.0.1: {} + is-potential-custom-element-name@1.0.1: + optional: true is-promise@4.0.0: {} @@ -7255,31 +7302,6 @@ snapshots: dependencies: argparse: 2.0.1 - jsdom@30.1.3(@noble/hashes@1.8.0): - dependencies: - '@asamuzakjp/css-color': 7.1.9 - '@asamuzakjp/dom-selector': 10.0.5 - '@bramus/specificity': 2.4.3 - '@csstools/css-syntax-patches-for-csstree': 1.1.16(css-tree@3.2.1) - '@exodus/bytes': 1.16.0(@noble/hashes@1.8.0) - css-tree: 3.2.1 - data-urls: 8.0.0(@noble/hashes@1.8.0) - decimal.js: 10.6.0 - html-encoding-sniffer: 7.0.0(@noble/hashes@1.8.0) - is-potential-custom-element-name: 1.0.1 - lru-cache: 11.5.3 - parse5: 8.1.0 - saxes: 6.0.0 - tough-cookie: 6.0.2 - undici: 8.12.4 - w3c-xmlserializer: 6.0.0 - webidl-conversions: 8.0.1 - whatwg-mimetype: 5.0.0 - whatwg-url: 17.3.0(@noble/hashes@1.8.0) - xml-name-validator: 5.0.0 - transitivePeerDependencies: - - '@noble/hashes' - jsesc@3.1.0: {} json-buffer@3.0.1: {} @@ -7422,7 +7444,8 @@ snapshots: dependencies: tslib: 2.9.1 - lru-cache@11.5.3: {} + lru-cache@11.5.3: + optional: true lru-cache@5.1.1: dependencies: @@ -7698,6 +7721,7 @@ snapshots: parse5@8.1.0: dependencies: entities: 9.0.0 + optional: true parseurl@1.3.3: {} @@ -8171,6 +8195,7 @@ snapshots: saxes@6.0.0: dependencies: xmlchars: 2.2.0 + optional: true scheduler@0.28.0: {} @@ -8457,11 +8482,13 @@ snapshots: tinyrainbow@3.2.0: {} - tldts-core@7.4.20: {} + tldts-core@7.4.20: + optional: true tldts@7.4.19: dependencies: tldts-core: 7.4.20 + optional: true to-regex-range@5.0.1: dependencies: @@ -8472,10 +8499,12 @@ snapshots: tough-cookie@6.0.2: dependencies: tldts: 7.4.19 + optional: true tr46@7.0.0: dependencies: punycode: 2.3.1 + optional: true tree-dump@1.1.0(tslib@2.9.1): dependencies: @@ -8549,7 +8578,8 @@ snapshots: undici-types@8.9.0: {} - undici@8.12.4: {} + undici@8.12.4: + optional: true unicode-canonical-property-names-ecmascript@2.0.1: {} @@ -8597,7 +8627,7 @@ snapshots: less: 4.9.1(supports-color@8.1.1) terser: 5.51.2 - vitest@5.1.0(@types/node@26.6.6)(@vitest/coverage-v8@5.1.0)(jsdom@30.1.3(@noble/hashes@1.8.0))(vite@8.3.6(@types/node@26.6.6)(less@4.9.1(supports-color@8.1.1))(terser@5.51.2)): + vitest@5.1.0(@types/node@26.6.6)(@vitest/coverage-v8@5.1.0)(happy-dom@21.0.4)(vite@8.3.6(@types/node@26.6.6)(less@4.9.1(supports-color@8.1.1))(terser@5.51.2)): dependencies: '@types/chai': 5.2.3 '@vitest/mocker': 5.1.0(vite@8.3.6(@types/node@26.6.6)(less@4.9.1(supports-color@8.1.1))(terser@5.51.2)) @@ -8616,13 +8646,14 @@ snapshots: optionalDependencies: '@types/node': 26.6.6 '@vitest/coverage-v8': 5.1.0(vitest@5.1.0) - jsdom: 30.1.3(@noble/hashes@1.8.0) + happy-dom: 21.0.4 transitivePeerDependencies: - msw w3c-xmlserializer@6.0.0: dependencies: xml-name-validator: 5.0.0 + optional: true warning@4.0.3: dependencies: @@ -8632,7 +8663,8 @@ snapshots: dependencies: graceful-fs: 4.2.11 - webidl-conversions@8.0.1: {} + webidl-conversions@8.0.1: + optional: true webpack-cli@7.3.1(js-yaml@4.3.2)(json5@2.2.3)(webpack-dev-server@6.1.0)(webpack@5.112.2): dependencies: @@ -8742,7 +8774,10 @@ snapshots: - svgo - uglify-js - whatwg-mimetype@5.0.0: {} + whatwg-mimetype@3.0.0: {} + + whatwg-mimetype@5.0.0: + optional: true whatwg-url@17.3.0(@noble/hashes@1.8.0): dependencies: @@ -8751,6 +8786,7 @@ snapshots: webidl-conversions: 8.0.1 transitivePeerDependencies: - '@noble/hashes' + optional: true which-boxed-primitive@1.1.1: dependencies: @@ -8812,9 +8848,11 @@ snapshots: is-wsl: 3.1.1 powershell-utils: 0.2.1 - xml-name-validator@5.0.0: {} + xml-name-validator@5.0.0: + optional: true - xmlchars@2.2.0: {} + xmlchars@2.2.0: + optional: true yallist@3.1.1: {} diff --git a/vitest.config.mjs b/vitest.config.mjs index a18685bf5c..b563d658f8 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -3,7 +3,7 @@ import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { include: ['**/__tests__/**/*-test.js(x)?'], - environment: 'jsdom', + environment: 'happy-dom', coverage: { all: true, include: ['src/**'],