-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Failed to load url error when using sveltekit and jsdom environment (0.34.1) #3866
Comments
Previously Vitest was running in SSR mode even if environment was JSDOM. Vite doesn't allow accessing files outside of the root folder by default. Since 0.34.0, Vitest uses export default defineConfig({
plugins: [sveltekit()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}'],
environment: 'jsdom',
setupFiles: './setupTest.ts'
},
server: {
fs: {
allow: ['./setupTest.ts']
}
}
}); For security concerns, it's probably better to check for {
fs: {
allow: process.env.VITEST ? ['./setupTest.ts'] : undefined
}
} |
We should probably add those files on the Vitest side, actually. |
Thank you for explanation! It works fine with |
Describe the bug
I have "Failed to load url" error when using sveltekit and jsdom environment for
setupFiles
file. It works fine with vitest 0.33, this error appear only in vitest 0.34.1Reproduction
npm create svelte@latest my-app
or clone my repo with all dependencies and files: https://github.com/EugeneDraitsev/vitest-setup-files-bugsetupTest.ts
and use followingvite.config.ts
yarn test
and see "Failed to load url" errorIf you comment
environment: 'jsdom',
or downgrade vitest to0.33.0
, then it will work fineSystem Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: