Skip to content

Svelte 5: happy-dom test fails with >2 components in a file #10358

Closed
@andrewthebold

Description

@andrewthebold

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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions