-
-
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
$derived
needs a $effect.root
to act reactive
#14997
Comments
This looks an issue with the compilation, if you look at the output generated it's treating it like server output and removing the runes. @dominikg It looks like they have |
here's an example for a vitest setup that allows you to test .svelte.js files with the browser condition but other files with the node condition: https://github.com/dominikg/vitest-example-svelte5 |
The issue indeed is working inside your repro, so I will close this issue. |
@dominikg, If all that setup is needed to test svelte code then both the documentation and the cli add command need to be fixed |
this is pending vitest@3 release which should come soon sveltejs/cli#311 |
Describe the bug
As part of asking about how the testing setup of
vitest
is (#14900). A solution was provided that introduces a$derived
, however that example doesn't work without an explict$effect.root
. Multiple people have claimed that this should just work without the$effect.root
, however this doesn't seem to be the case. At the moment I am not the biggest expert in the Svelte 5 reactivity story, so please correct me if this issue is invalid.Reproduction
An example is provided by @Thiagolino8:
https://stackblitz.com/edit/vitejs-vite-lqzixy57?file=src%2Fmultiplier.svelte.test.ts
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: