-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Describe the bug
It seems that code inside an $effect.root()
in unit tests doesn't run. I'm following the instructions on the docs to set up vitest and a simple test case, but no matter what I tried, the code inside $effect.root()
doesn't run at all in the test.
Depending on how the test is set up (e.g. all the assertions are made in code inside $effect.root()
, which is also what the example in the docs does), vitest reports the test as successful, but that's because no code ran at all. This is misleading.
This issue was also observed by someone else on the discord server, but no resolution was found yet over there.
Reproduction
https://www.sveltelab.dev/dnfqrcdar7xg6qw?files=.%2Fsrc%2Flib%2Feffect_test.svelte.test.ts
Please stop the dev server on sveltelab's console and run the test:unit
npm script instead.
Logs
No response
System Info
System:
OS: Linux 6.10 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Container: Yes
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.8.0 - /nix/store/xsrv93rg8vi05k9ig6v9mcvcyn01n6n2-nodejs-22.8.0/bin/node
npm: 10.8.2 - /nix/store/xsrv93rg8vi05k9ig6v9mcvcyn01n6n2-nodejs-22.8.0/bin/npm
Browsers:
Chromium: 130.0.6723.69
npmPackages:
svelte: ^5.1.9 => 5.1.9
Severity
blocking all usage of svelte