-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svelte 5: happy-dom
test fails with >2 components in a file
#10358
Comments
Ran into a similar problem using |
Tested this - the problem is that happy-dom doesn't seem to support the shorthand for comments, |
Happy-dom 14.3.6 claims to have it fixed, haven't validatet it yet |
FWIW I still get runtime errors when I use a single line in a component, rather than multiple with happy-dom (but JSDom still works fine). So, something's going on. I just upgraded, so I'm still debugging.
|
Hello from testing-library/svelte-testing-library#319! I found some time to debug this, and it looks to me like the primary problem is that Svelte v5 relies on accessing a few methods through It seems like the best path forward would be to fix this in happy-dom, but it looks like a fairly large change on their end based on how they've got all their classes set up |
The just released |
Thank you for pushing this forward! |
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, orsvelte@5
is more strict andhappy-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 tojsdom
, so... I'm not sure.Reproduction
Run
pnpm test
to run thebug.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 usingcreateRoot
instead ofnew
.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
The text was updated successfully, but these errors were encountered: