test(react-auth): switch vitest env to happy-dom

This commit is contained in:
Saravana Achu Mac 2026-02-14 13:15:12 -08:00
parent b2986744fa
commit c84185da24
3 changed files with 104 additions and 34 deletions

View File

@ -27,7 +27,7 @@
"@testing-library/react": "^16.3.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"jsdom": "^28.0.0",
"happy-dom": "^18.0.1",
"react": "^19.2.4",
"react-dom": "^19.2.4"
}

View File

@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
environment: 'jsdom',
// Use happy-dom to avoid jsdom's heavy dependency chain and ESM/CJS edge cases.
// This package only needs a minimal DOM + localStorage for unit tests.
environment: 'happy-dom',
},
});

132
pnpm-lock.yaml generated
View File

@ -43,7 +43,7 @@ importers:
version: 8.55.0(eslint@9.39.2)(typescript@5.9.3)
'@vitest/coverage-v8':
specifier: ^3.0.0
version: 3.2.4(vitest@3.2.4(@types/node@20.19.33)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2))
version: 3.2.4(vitest@3.2.4(@types/node@20.19.33)(happy-dom@18.0.1)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2))
eslint:
specifier: ^9.0.0
version: 9.39.2
@ -61,7 +61,7 @@ importers:
version: 5.9.3
vitest:
specifier: ^3.0.0
version: 3.2.4(@types/node@20.19.33)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
version: 3.2.4(@types/node@20.19.33)(happy-dom@18.0.1)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
packages/api-client: {}
@ -133,9 +133,9 @@ importers:
'@types/react-dom':
specifier: ^19.2.3
version: 19.2.3(@types/react@19.2.14)
jsdom:
specifier: ^28.0.0
version: 28.0.0
happy-dom:
specifier: ^18.0.1
version: 18.0.1
react:
specifier: ^19.2.4
version: 19.2.4
@ -147,7 +147,7 @@ importers:
dependencies:
vitest:
specifier: '>=3.0.0'
version: 3.2.4(@types/node@22.19.11)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
version: 3.2.4(@types/node@22.19.11)(happy-dom@18.0.1)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
devDependencies:
'@bytelyst/fastify-core':
specifier: workspace:*
@ -203,7 +203,7 @@ importers:
version: 5.9.3
vitest:
specifier: ^3.0.5
version: 3.2.4(@types/node@22.19.11)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
version: 3.2.4(@types/node@22.19.11)(happy-dom@18.0.1)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
services/growth-service:
dependencies:
@ -252,7 +252,7 @@ importers:
version: 5.9.3
vitest:
specifier: ^3.0.5
version: 3.2.4(@types/node@22.19.11)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
version: 3.2.4(@types/node@22.19.11)(happy-dom@18.0.1)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
services/monitoring:
devDependencies:
@ -322,7 +322,7 @@ importers:
version: 5.9.3
vitest:
specifier: ^3.0.5
version: 3.2.4(@types/node@22.19.11)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
version: 3.2.4(@types/node@22.19.11)(happy-dom@18.0.1)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
services/tracker-service:
dependencies:
@ -377,7 +377,7 @@ importers:
version: 5.9.3
vitest:
specifier: ^3.0.5
version: 3.2.4(@types/node@22.19.11)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
version: 3.2.4(@types/node@22.19.11)(happy-dom@18.0.1)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
packages:
'@acemir/cssom@0.9.31':
@ -1396,6 +1396,12 @@ packages:
integrity: sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==,
}
'@types/whatwg-mimetype@3.0.2':
resolution:
{
integrity: sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA==,
}
'@typescript-eslint/eslint-plugin@8.55.0':
resolution:
{
@ -2330,6 +2336,13 @@ packages:
}
engines: { node: '>= 0.4' }
happy-dom@18.0.1:
resolution:
{
integrity: sha512-qn+rKOW7KWpVTtgIUi6RVmTBZJSe2k0Db0vh1f7CWrWclkkc7/Q+FrOfkZIb2eiErLyqu5AXEzE7XthO9JVxRA==,
}
engines: { node: '>=20.0.0' }
has-flag@4.0.0:
resolution:
{
@ -3623,6 +3636,13 @@ packages:
}
engines: { node: '>=20' }
whatwg-mimetype@3.0.0:
resolution:
{
integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==,
}
engines: { node: '>=12' }
whatwg-mimetype@5.0.0:
resolution:
{
@ -3722,7 +3742,8 @@ packages:
}
snapshots:
'@acemir/cssom@0.9.31': {}
'@acemir/cssom@0.9.31':
optional: true
'@ampproject/remapping@2.3.0':
dependencies:
@ -3736,6 +3757,7 @@ snapshots:
'@csstools/css-parser-algorithms': 4.0.0(@csstools/css-tokenizer@4.0.0)
'@csstools/css-tokenizer': 4.0.0
lru-cache: 11.2.6
optional: true
'@asamuzakjp/dom-selector@6.7.8':
dependencies:
@ -3744,8 +3766,10 @@ snapshots:
css-tree: 3.1.0
is-potential-custom-element-name: 1.0.1
lru-cache: 11.2.6
optional: true
'@asamuzakjp/nwsapi@2.3.9': {}
'@asamuzakjp/nwsapi@2.3.9':
optional: true
'@azure-rest/core-client@2.5.1':
dependencies:
@ -3942,12 +3966,14 @@ snapshots:
'@bcoe/v8-coverage@1.0.2': {}
'@csstools/color-helpers@6.0.1': {}
'@csstools/color-helpers@6.0.1':
optional: true
'@csstools/css-calc@3.1.0(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)':
dependencies:
'@csstools/css-parser-algorithms': 4.0.0(@csstools/css-tokenizer@4.0.0)
'@csstools/css-tokenizer': 4.0.0
optional: true
'@csstools/css-color-parser@4.0.1(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)':
dependencies:
@ -3955,14 +3981,18 @@ snapshots:
'@csstools/css-calc': 3.1.0(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)
'@csstools/css-parser-algorithms': 4.0.0(@csstools/css-tokenizer@4.0.0)
'@csstools/css-tokenizer': 4.0.0
optional: true
'@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0)':
dependencies:
'@csstools/css-tokenizer': 4.0.0
optional: true
'@csstools/css-syntax-patches-for-csstree@1.0.27': {}
'@csstools/css-syntax-patches-for-csstree@1.0.27':
optional: true
'@csstools/css-tokenizer@4.0.0': {}
'@csstools/css-tokenizer@4.0.0':
optional: true
'@esbuild/aix-ppc64@0.27.3':
optional: true
@ -4092,7 +4122,8 @@ snapshots:
'@eslint/core': 0.17.0
levn: 0.4.1
'@exodus/bytes@1.14.1': {}
'@exodus/bytes@1.14.1':
optional: true
'@fastify/ajv-compiler@4.0.5':
dependencies:
@ -4308,6 +4339,8 @@ snapshots:
dependencies:
csstype: 3.2.3
'@types/whatwg-mimetype@3.0.2': {}
'@typescript-eslint/eslint-plugin@8.55.0(@typescript-eslint/parser@8.55.0(eslint@9.39.2)(typescript@5.9.3))(eslint@9.39.2)(typescript@5.9.3)':
dependencies:
'@eslint-community/regexpp': 4.12.2
@ -4407,7 +4440,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@vitest/coverage-v8@3.2.4(vitest@3.2.4(@types/node@20.19.33)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2))':
'@vitest/coverage-v8@3.2.4(vitest@3.2.4(@types/node@20.19.33)(happy-dom@18.0.1)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2))':
dependencies:
'@ampproject/remapping': 2.3.0
'@bcoe/v8-coverage': 1.0.2
@ -4422,7 +4455,7 @@ snapshots:
std-env: 3.10.0
test-exclude: 7.0.1
tinyrainbow: 2.0.0
vitest: 3.2.4(@types/node@20.19.33)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
vitest: 3.2.4(@types/node@20.19.33)(happy-dom@18.0.1)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2)
transitivePeerDependencies:
- supports-color
@ -4542,6 +4575,7 @@ snapshots:
bidi-js@1.0.3:
dependencies:
require-from-string: 2.0.2
optional: true
bintrees@1.0.2: {}
@ -4622,6 +4656,7 @@ snapshots:
dependencies:
mdn-data: 2.12.2
source-map-js: 1.2.1
optional: true
cssstyle@5.3.7:
dependencies:
@ -4629,6 +4664,7 @@ snapshots:
'@csstools/css-syntax-patches-for-csstree': 1.0.27
css-tree: 3.1.0
lru-cache: 11.2.6
optional: true
csstype@3.2.3: {}
@ -4638,12 +4674,14 @@ snapshots:
whatwg-url: 16.0.0
transitivePeerDependencies:
- '@noble/hashes'
optional: true
debug@4.4.3:
dependencies:
ms: 2.1.3
decimal.js@10.6.0: {}
decimal.js@10.6.0:
optional: true
deep-eql@5.0.2: {}
@ -4667,7 +4705,8 @@ snapshots:
emoji-regex@9.2.2: {}
entities@6.0.1: {}
entities@6.0.1:
optional: true
environment@1.1.0: {}
@ -4942,6 +4981,12 @@ snapshots:
gopd@1.2.0: {}
happy-dom@18.0.1:
dependencies:
'@types/node': 20.19.33
'@types/whatwg-mimetype': 3.0.2
whatwg-mimetype: 3.0.0
has-flag@4.0.0: {}
has-symbols@1.1.0: {}
@ -4955,6 +5000,7 @@ snapshots:
'@exodus/bytes': 1.14.1
transitivePeerDependencies:
- '@noble/hashes'
optional: true
html-escaper@2.0.2: {}
@ -5005,7 +5051,8 @@ snapshots:
is-number@7.0.0: {}
is-potential-custom-element-name@1.0.1: {}
is-potential-custom-element-name@1.0.1:
optional: true
is-stream@3.0.0: {}
@ -5075,6 +5122,7 @@ snapshots:
transitivePeerDependencies:
- '@noble/hashes'
- supports-color
optional: true
json-buffer@3.0.1: {}
@ -5155,7 +5203,8 @@ snapshots:
lru-cache@10.4.3: {}
lru-cache@11.2.6: {}
lru-cache@11.2.6:
optional: true
lz-string@1.5.0: {}
@ -5175,7 +5224,8 @@ snapshots:
math-intrinsics@1.1.0: {}
mdn-data@2.12.2: {}
mdn-data@2.12.2:
optional: true
merge-stream@2.0.0: {}
@ -5254,6 +5304,7 @@ snapshots:
parse5@8.0.0:
dependencies:
entities: 6.0.1
optional: true
path-exists@4.0.0: {}
@ -5400,6 +5451,7 @@ snapshots:
saxes@6.0.0:
dependencies:
xmlchars: 2.2.0
optional: true
scheduler@0.27.0: {}
@ -5518,7 +5570,8 @@ snapshots:
dependencies:
has-flag: 4.0.0
symbol-tree@3.2.4: {}
symbol-tree@3.2.4:
optional: true
tdigest@0.1.2:
dependencies:
@ -5549,11 +5602,13 @@ snapshots:
tinyspy@4.0.4: {}
tldts-core@7.0.23: {}
tldts-core@7.0.23:
optional: true
tldts@7.0.23:
dependencies:
tldts-core: 7.0.23
optional: true
to-regex-range@5.0.1:
dependencies:
@ -5564,10 +5619,12 @@ snapshots:
tough-cookie@6.0.0:
dependencies:
tldts: 7.0.23
optional: true
tr46@6.0.0:
dependencies:
punycode: 2.3.1
optional: true
ts-api-utils@2.4.0(typescript@5.9.3):
dependencies:
@ -5590,7 +5647,8 @@ snapshots:
undici-types@6.21.0: {}
undici@7.21.0: {}
undici@7.21.0:
optional: true
uri-js@4.4.1:
dependencies:
@ -5666,7 +5724,7 @@ snapshots:
tsx: 4.21.0
yaml: 2.8.2
vitest@3.2.4(@types/node@20.19.33)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2):
vitest@3.2.4(@types/node@20.19.33)(happy-dom@18.0.1)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2):
dependencies:
'@types/chai': 5.2.3
'@vitest/expect': 3.2.4
@ -5693,6 +5751,7 @@ snapshots:
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 20.19.33
happy-dom: 18.0.1
jsdom: 28.0.0
transitivePeerDependencies:
- jiti
@ -5708,7 +5767,7 @@ snapshots:
- tsx
- yaml
vitest@3.2.4(@types/node@22.19.11)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2):
vitest@3.2.4(@types/node@22.19.11)(happy-dom@18.0.1)(jsdom@28.0.0)(tsx@4.21.0)(yaml@2.8.2):
dependencies:
'@types/chai': 5.2.3
'@vitest/expect': 3.2.4
@ -5735,6 +5794,7 @@ snapshots:
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 22.19.11
happy-dom: 18.0.1
jsdom: 28.0.0
transitivePeerDependencies:
- jiti
@ -5753,10 +5813,15 @@ snapshots:
w3c-xmlserializer@5.0.0:
dependencies:
xml-name-validator: 5.0.0
optional: true
webidl-conversions@8.0.1: {}
webidl-conversions@8.0.1:
optional: true
whatwg-mimetype@5.0.0: {}
whatwg-mimetype@3.0.0: {}
whatwg-mimetype@5.0.0:
optional: true
whatwg-url@16.0.0:
dependencies:
@ -5765,6 +5830,7 @@ snapshots:
webidl-conversions: 8.0.1
transitivePeerDependencies:
- '@noble/hashes'
optional: true
which@2.0.2:
dependencies:
@ -5795,9 +5861,11 @@ snapshots:
string-width: 7.2.0
strip-ansi: 7.1.2
xml-name-validator@5.0.0: {}
xml-name-validator@5.0.0:
optional: true
xmlchars@2.2.0: {}
xmlchars@2.2.0:
optional: true
yaml@2.8.2: {}