When the base path set in svelte.config.js is equal to the beginning of the actual project path vitest fails because it resolves the node_modules path incorrectly.
If you are on macOS simply:
/Users)npm run testIf you are on another OS:
svelte.config.js in the line base: "/Users" the "/Users" by the beginning of your project path.npm run test