HoldYourWaffle
HoldYourWaffle
DDeno
Created by HoldYourWaffle on 4/22/2025 in #help
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?
6 replies