Closed
Description
Describe the bug
I found that happy-dom
-based tests break if a .svelte
file has >2 components inside it.
It seems in this line, there is no null-check for node
, causing a type error. If I patch it in, the test in the repro passes. I imagine it's either svelte has a bug, or svelte@5
is more strict and happy-dom
is erroneously providing a null node.
Notably, the test passes with svelte@4
+ happy-dom
, so it seems like a svelte bug? However, it also passes if I swap to jsdom
, so... I'm not sure.
Reproduction
- Svelte 5 (fails): https://stackblitz.com/edit/svelte-5-happy-dom-test-uepmhg?file=src%2Flib%2FApp.svelte&view=editor
- Svelte 4 (passes): https://stackblitz.com/edit/svelte-4-happy-dom-test-qdfde2?file=src%2Flib%2FApp.svelte&view=editor
Run pnpm test
to run the bug.test.js
file with vitest. Comment out the 3rd <Child />
in the svelte 5 example and the test will pass. The only difference between the two is the svelte version and using createRoot
instead of new
.
Logs
No response
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 18.18.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.3 - /usr/local/bin/npm
pnpm: 8.14.0 - /usr/local/bin/pnpm
npmPackages:
svelte: 5.0.0-next.44 => 5.0.0-next.44
Severity
blocking an upgrade