-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Testing of rune effects is broken #16092
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
Comments
Likely related: I'm encountering To reproduce:
Test fails since |
This is related to #14239 so maybe should have added to existing issue. My bad. Hovewer solution to use |
Same issue,
|
This appears to have been an issue in Vitest -- 3.2.3 fixes the issue for me. If you're still experiencing it after upgrading, feel free to reopen! |
I have no permission to reopen this issue. But vitest 3.2.3 only changes problem back to state it was with vitest <= 3.1.4, as described at the end of my reproduction logs. I.e.
Updated my reproduction repo to latest Svelte and Vitest. |
Will look into it! |
@vits You cannot used
This is a problem because the reading phase will add the I think there are only 2 things that you can do safely in the However it's important you don't write and read on the same variable, you can look at One possible workaround for user specific case is to wrap The complete solution of your specific reactive module is $effect(() => {
const v = getValue();
untrack(() => {
log.push(v);
});
}); This will ensure that your |
@raythurnvoid Thanks, your example with So this is documentation issue, as the code example with |
Ah @vits good catch, the docs should not be doing that. It sounds like there's not actually a bug here after all (after the Vite issue was fixed, at least). |
Describe the bug
Testing rune effects as described in Svelte documentation is broken in Svelte > 5.1.11 and is double broken with vitest 3.2.x
Repo has
logger.svelte.test.js
from documentation with latest svelte and vitest versions. Its expectation fails asflushSync()
seems to be ignored and code in $effect rune is not run.Downgrading vitest version to 3.1.4 changes test behavior - it fails with
effect_update_depth_exceeded
.Downgrading Svelte as well to 5.1.11 or older makes test to pass.
Reproduction
Repo: https://github.com/vits/vitest-svelte-effects
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: