refactor: switch from jsdom to happy-dom

This commit is contained in:
2025-02-16 23:59:00 +08:00
parent ba13828093
commit 41f2b04c45
8 changed files with 124 additions and 89 deletions

124
pnpm-lock.yaml generated
View File

@@ -36,9 +36,6 @@ importers:
'@tanstack/react-router':
specifier: ^1.99.6
version: 1.99.6(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
'@types/jsdom':
specifier: ^21.1.7
version: 21.1.7
'@types/lodash-es':
specifier: ^4.17.12
version: 4.17.12
@@ -54,9 +51,9 @@ importers:
commander:
specifier: ^13.1.0
version: 13.1.0
jsdom:
specifier: ^26.0.0
version: 26.0.0
happy-dom:
specifier: ^17.1.0
version: 17.1.0
lodash-es:
specifier: ^4.17.21
version: 4.17.21
@@ -98,7 +95,7 @@ importers:
version: 5.1.4(typescript@5.7.3)(vite@6.0.7(@types/node@22.12.0)(jiti@2.4.2)(lightningcss@1.29.1)(tsx@4.19.2)(yaml@2.7.0))
vitest:
specifier: ^3.0.4
version: 3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)
version: 3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(happy-dom@17.1.0)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)
examples/react-tanstack-router:
dependencies:
@@ -1244,9 +1241,6 @@ packages:
'@types/estree@1.0.6':
resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
'@types/jsdom@21.1.7':
resolution: {integrity: sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==}
'@types/lodash-es@4.17.12':
resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==}
@@ -1991,6 +1985,10 @@ packages:
resolution: {integrity: sha512-AjqGKbDGUFRKIRCP9tCKiIGHyriz2oHEbPIbEtcSLSs4YjReZOIPQQWek4+6hjw62H9QShXHyaGivGiYVLeYFQ==}
engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0}
happy-dom@17.1.0:
resolution: {integrity: sha512-9tUhXyePCjzUMycaHS/IzrIpF69xiq/laAT7golk4MtZ6t8ft5+Rv7U3lfrs2b4NMH0JTL3EhZzjfahrPmOnaQ==}
engines: {node: '>=18.0.0'}
has-flag@4.0.0:
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
engines: {node: '>=8'}
@@ -3190,6 +3188,10 @@ packages:
resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==}
engines: {node: '>=18'}
whatwg-mimetype@3.0.0:
resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==}
engines: {node: '>=12'}
whatwg-mimetype@4.0.0:
resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==}
engines: {node: '>=18'}
@@ -3302,6 +3304,7 @@ snapshots:
'@csstools/css-parser-algorithms': 3.0.4(@csstools/css-tokenizer@3.0.3)
'@csstools/css-tokenizer': 3.0.3
lru-cache: 10.4.3
optional: true
'@babel/code-frame@7.26.2':
dependencies:
@@ -3486,12 +3489,14 @@ snapshots:
tough-cookie: 4.1.4
optional: true
'@csstools/color-helpers@5.0.1': {}
'@csstools/color-helpers@5.0.1':
optional: true
'@csstools/css-calc@2.1.1(@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3))(@csstools/css-tokenizer@3.0.3)':
dependencies:
'@csstools/css-parser-algorithms': 3.0.4(@csstools/css-tokenizer@3.0.3)
'@csstools/css-tokenizer': 3.0.3
optional: true
'@csstools/css-color-parser@3.0.7(@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3))(@csstools/css-tokenizer@3.0.3)':
dependencies:
@@ -3499,12 +3504,15 @@ snapshots:
'@csstools/css-calc': 2.1.1(@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3))(@csstools/css-tokenizer@3.0.3)
'@csstools/css-parser-algorithms': 3.0.4(@csstools/css-tokenizer@3.0.3)
'@csstools/css-tokenizer': 3.0.3
optional: true
'@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3)':
dependencies:
'@csstools/css-tokenizer': 3.0.3
optional: true
'@csstools/css-tokenizer@3.0.3': {}
'@csstools/css-tokenizer@3.0.3':
optional: true
'@esbuild/aix-ppc64@0.23.1':
optional: true
@@ -4249,12 +4257,6 @@ snapshots:
'@types/estree@1.0.6': {}
'@types/jsdom@21.1.7':
dependencies:
'@types/node': 22.12.0
'@types/tough-cookie': 4.0.5
parse5: 7.2.1
'@types/lodash-es@4.17.12':
dependencies:
'@types/lodash': 4.17.15
@@ -4284,7 +4286,8 @@ snapshots:
'@types/statuses@2.0.5':
optional: true
'@types/tough-cookie@4.0.5': {}
'@types/tough-cookie@4.0.5':
optional: true
'@types/which@2.0.2':
optional: true
@@ -4309,7 +4312,7 @@ snapshots:
msw: 2.7.0(@types/node@22.12.0)(typescript@5.7.3)
sirv: 3.0.0
tinyrainbow: 2.0.0
vitest: 3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)
vitest: 3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(happy-dom@17.1.0)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)
ws: 8.18.0
optionalDependencies:
playwright: 1.50.0
@@ -4336,7 +4339,7 @@ snapshots:
std-env: 3.8.0
test-exclude: 7.0.1
tinyrainbow: 2.0.0
vitest: 3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)
vitest: 3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(happy-dom@17.1.0)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)
optionalDependencies:
'@vitest/browser': 3.0.4(@types/node@22.12.0)(playwright@1.50.0)(typescript@5.7.3)(vite@6.0.7(@types/node@22.12.0)(jiti@2.4.2)(lightningcss@1.29.1)(tsx@4.19.2)(yaml@2.7.0))(vitest@3.0.4)(webdriverio@9.7.2)
transitivePeerDependencies:
@@ -4447,7 +4450,8 @@ snapshots:
acorn@8.14.0: {}
agent-base@7.1.3: {}
agent-base@7.1.3:
optional: true
ajv-draft-04@1.0.0(ajv@8.13.0):
optionalDependencies:
@@ -4546,7 +4550,8 @@ snapshots:
async@3.2.6:
optional: true
asynckit@0.4.0: {}
asynckit@0.4.0:
optional: true
autoprefixer@10.4.20(postcss@8.5.1):
dependencies:
@@ -4732,6 +4737,7 @@ snapshots:
combined-stream@1.0.8:
dependencies:
delayed-stream: 1.0.0
optional: true
commander@12.1.0: {}
@@ -4805,6 +4811,7 @@ snapshots:
dependencies:
'@asamuzakjp/css-color': 2.8.3
rrweb-cssom: 0.8.0
optional: true
csstype@3.1.3: {}
@@ -4818,6 +4825,7 @@ snapshots:
dependencies:
whatwg-mimetype: 4.0.0
whatwg-url: 14.1.0
optional: true
debug@4.4.0:
dependencies:
@@ -4826,7 +4834,8 @@ snapshots:
decamelize@6.0.0:
optional: true
decimal.js@10.5.0: {}
decimal.js@10.5.0:
optional: true
deep-eql@5.0.2: {}
@@ -4840,7 +4849,8 @@ snapshots:
esprima: 4.0.1
optional: true
delayed-stream@1.0.0: {}
delayed-stream@1.0.0:
optional: true
dequal@2.0.3:
optional: true
@@ -4919,7 +4929,8 @@ snapshots:
once: 1.4.0
optional: true
entities@4.5.0: {}
entities@4.5.0:
optional: true
error-stack-parser@2.1.4:
dependencies:
@@ -5082,6 +5093,7 @@ snapshots:
asynckit: 0.4.0
combined-stream: 1.0.8
mime-types: 2.1.35
optional: true
formdata-polyfill@4.0.10:
dependencies:
@@ -5180,6 +5192,11 @@ snapshots:
graphql@16.10.0:
optional: true
happy-dom@17.1.0:
dependencies:
webidl-conversions: 7.0.0
whatwg-mimetype: 3.0.0
has-flag@4.0.0: {}
hasown@2.0.2:
@@ -5192,6 +5209,7 @@ snapshots:
html-encoding-sniffer@4.0.0:
dependencies:
whatwg-encoding: 3.1.1
optional: true
html-entities@2.5.2: {}
@@ -5214,6 +5232,7 @@ snapshots:
debug: 4.4.0
transitivePeerDependencies:
- supports-color
optional: true
https-proxy-agent@7.0.6:
dependencies:
@@ -5221,10 +5240,12 @@ snapshots:
debug: 4.4.0
transitivePeerDependencies:
- supports-color
optional: true
iconv-lite@0.6.3:
dependencies:
safer-buffer: 2.1.2
optional: true
ieee754@1.2.1:
optional: true
@@ -5271,7 +5292,8 @@ snapshots:
is-plain-obj@4.1.0:
optional: true
is-potential-custom-element-name@1.0.1: {}
is-potential-custom-element-name@1.0.1:
optional: true
is-stream@2.0.1:
optional: true
@@ -5353,6 +5375,7 @@ snapshots:
- bufferutil
- supports-color
- utf-8-validate
optional: true
jsesc@3.1.0: {}
@@ -5512,11 +5535,13 @@ snapshots:
braces: 3.0.3
picomatch: 2.3.1
mime-db@1.52.0: {}
mime-db@1.52.0:
optional: true
mime-types@2.1.35:
dependencies:
mime-db: 1.52.0
optional: true
minimatch@3.0.8:
dependencies:
@@ -5607,7 +5632,8 @@ snapshots:
boolbase: 1.0.0
optional: true
nwsapi@2.2.16: {}
nwsapi@2.2.16:
optional: true
object-assign@4.1.1: {}
@@ -5685,6 +5711,7 @@ snapshots:
parse5@7.2.1:
dependencies:
entities: 4.5.0
optional: true
path-key@3.1.1: {}
@@ -5822,7 +5849,8 @@ snapshots:
once: 1.4.0
optional: true
punycode@2.3.1: {}
punycode@2.3.1:
optional: true
query-selector-shadow-dom@1.0.1:
optional: true
@@ -5938,7 +5966,8 @@ snapshots:
'@rollup/rollup-win32-x64-msvc': 4.30.1
fsevents: 2.3.3
rrweb-cssom@0.8.0: {}
rrweb-cssom@0.8.0:
optional: true
rsbuild-plugin-dts@0.4.0(@microsoft/api-extractor@7.49.2(@types/node@22.12.0))(@rsbuild/core@1.2.4)(typescript@5.7.3):
dependencies:
@@ -5967,11 +5996,13 @@ snapshots:
safe-buffer@5.2.1:
optional: true
safer-buffer@2.1.2: {}
safer-buffer@2.1.2:
optional: true
saxes@6.0.0:
dependencies:
xmlchars: 2.2.0
optional: true
scheduler@0.25.0: {}
@@ -6124,7 +6155,8 @@ snapshots:
supports-preserve-symlinks-flag@1.0.0: {}
symbol-tree@3.2.4: {}
symbol-tree@3.2.4:
optional: true
tailwindcss@3.4.17:
dependencies:
@@ -6212,11 +6244,13 @@ snapshots:
tinyspy@3.0.2: {}
tldts-core@6.1.75: {}
tldts-core@6.1.75:
optional: true
tldts@6.1.75:
dependencies:
tldts-core: 6.1.75
optional: true
to-regex-range@5.0.1:
dependencies:
@@ -6236,10 +6270,12 @@ snapshots:
tough-cookie@5.1.0:
dependencies:
tldts: 6.1.75
optional: true
tr46@5.0.0:
dependencies:
punycode: 2.3.1
optional: true
ts-interface-checker@0.1.13: {}
@@ -6394,7 +6430,7 @@ snapshots:
tsx: 4.19.2
yaml: 2.7.0
vitest@3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0):
vitest@3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(happy-dom@17.1.0)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0):
dependencies:
'@vitest/expect': 3.0.4
'@vitest/mocker': 3.0.4(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(vite@6.0.7(@types/node@22.12.0)(jiti@2.4.2)(lightningcss@1.29.1)(tsx@4.19.2)(yaml@2.7.0))
@@ -6419,6 +6455,7 @@ snapshots:
optionalDependencies:
'@types/node': 22.12.0
'@vitest/browser': 3.0.4(@types/node@22.12.0)(playwright@1.50.0)(typescript@5.7.3)(vite@6.0.7(@types/node@22.12.0)(jiti@2.4.2)(lightningcss@1.29.1)(tsx@4.19.2)(yaml@2.7.0))(vitest@3.0.4)(webdriverio@9.7.2)
happy-dom: 17.1.0
jsdom: 26.0.0
transitivePeerDependencies:
- jiti
@@ -6437,6 +6474,7 @@ snapshots:
w3c-xmlserializer@5.0.0:
dependencies:
xml-name-validator: 5.0.0
optional: true
wait-port@1.1.0:
dependencies:
@@ -6512,13 +6550,18 @@ snapshots:
whatwg-encoding@3.1.1:
dependencies:
iconv-lite: 0.6.3
optional: true
whatwg-mimetype@4.0.0: {}
whatwg-mimetype@3.0.0: {}
whatwg-mimetype@4.0.0:
optional: true
whatwg-url@14.1.0:
dependencies:
tr46: 5.0.0
webidl-conversions: 7.0.0
optional: true
which@2.0.2:
dependencies:
@@ -6556,11 +6599,14 @@ snapshots:
wrappy@1.0.2:
optional: true
ws@8.18.0: {}
ws@8.18.0:
optional: true
xml-name-validator@5.0.0: {}
xml-name-validator@5.0.0:
optional: true
xmlchars@2.2.0: {}
xmlchars@2.2.0:
optional: true
y18n@5.0.8:
optional: true