Vitest borked when inside Deno workspace

Not sure if this is just a misconfiguration or a bug somewhere, so I figure I might as well shoot my shot here. I installed SvelteKit with Vitest, Playwright and Deno as package manager. I had to change some generated npm commands to deno, but otherwise this configuration seems to work great. I then tried to integrate this setup into a Deno workspace, but that didn't work out so great... deno task -r test:unit gives me this odd error:
FAIL client src/routes/page.svelte.test.ts [ src/routes/page.svelte.test.ts ]
Error: Cannot find module '<snip>/node_modules/.deno/@testing-library+svelte@5.2.7/node_modules/@testing-library/svelte/src/vitest.js'
Object.runMicrotasks ext:core/01_core.js:692:26
processTicksAndRejections ext:deno_node/_next_tick.ts:59:10
runNextTicks ext:deno_node/_next_tick.ts:76:3
eventLoopTick ext:core/01_core.js:185:21

Caused by: Error: Failed to load url <snip>/node_modules/.deno/@testing-library+svelte@5.2.7/node_modules/@testing-library/svelte/src/vitest.js (resolved id: <snip>/node_modules/.deno/@testing-library+svelte@5.2.7/node_modules/@testing-library/svelte/src/vitest.js). Does the file exist?
loadAndTransform ../node_modules/.deno/vite@6.3.2/node_modules/vite/dist/node/chunks/dep-DG3BLbPj.js:35668:17
Object.runMicrotasks ext:core/01_core.js:692:26
processTicksAndRejections ext:deno_node/_next_tick.ts:59:10
runNextTicks ext:deno_node/_next_tick.ts:76:3
eventLoopTick ext:core/01_core.js:185:21
FAIL client src/routes/page.svelte.test.ts [ src/routes/page.svelte.test.ts ]
Error: Cannot find module '<snip>/node_modules/.deno/@testing-library+svelte@5.2.7/node_modules/@testing-library/svelte/src/vitest.js'
Object.runMicrotasks ext:core/01_core.js:692:26
processTicksAndRejections ext:deno_node/_next_tick.ts:59:10
runNextTicks ext:deno_node/_next_tick.ts:76:3
eventLoopTick ext:core/01_core.js:185:21

Caused by: Error: Failed to load url <snip>/node_modules/.deno/@testing-library+svelte@5.2.7/node_modules/@testing-library/svelte/src/vitest.js (resolved id: <snip>/node_modules/.deno/@testing-library+svelte@5.2.7/node_modules/@testing-library/svelte/src/vitest.js). Does the file exist?
loadAndTransform ../node_modules/.deno/vite@6.3.2/node_modules/vite/dist/node/chunks/dep-DG3BLbPj.js:35668:17
Object.runMicrotasks ext:core/01_core.js:692:26
processTicksAndRejections ext:deno_node/_next_tick.ts:59:10
runNextTicks ext:deno_node/_next_tick.ts:76:3
eventLoopTick ext:core/01_core.js:185:21
The file it's referring to definitely exists and seems to contain the expected content. It seems to be caused by the @testing-library/svelte/vite import in vite.config.ts, if I comment out that line (and its dependants) things seem to work smoothly again. Any ideas on how to solve this?
4 Replies
marvinh.
marvinh.3d ago
This sounds like something that cannot be solved by sharing opinions or exchanging arguments. Therefore, I'd treat it as an issue. Can you open an issue at https://github.com/denoland/deno/issues ? The CLI team rarely looks here at discord as it's more a "users helping users" kind of thing. So they'll likely won't be aware of this, unless a GitHub issue is created for this
HoldYourWaffle
HoldYourWaffleOP3d ago
Not the easy "you overlooked this" fix I was hoping for, but helpful nonetheless, thanks :)
HoldYourWaffle
HoldYourWaffleOP3d ago
GitHub
@testing-library/svelte/vite borked when inside Deno workspace ·...
Version: Deno 2.2.11 (stable, release, x86_64-unknown-linux-gnu) V8 13.5.212.10-rusty Typescript 5.7.3 I installed SvelteKit with Vitest and Deno as package manager. This configuration seemed to wo...

Did you find this page helpful?