Open Ked57 opened 6 months ago
@vue/test-utils
expects Vue to be defined on a global object (UMD) in its browser build for some reason. Try deduping Vue in the config instead:
export default {
resolve: {
dedupe: ['vue'],
}
}
it solves the Vue import issue and now it's another module. I updated the stackblitz
TypeError: Failed to fetch dynamically imported module: https://vitestdevvitesturjsz7-5l23--5179--7dbe22a9.local-credentialless.webcontainer.io/home/projects/vitest-dev-vitest-urjsz7/test/Hello.spec.ts?browserv=0
EDIT: Hmm there's actually an error above,
3:29:21 PM [vite] Pre-transform error: Failed to parse source for import analysis because the content contains invalid JS syntax. Install @vitejs/plugin-vue to handle .vue files.
@vitejs/plugin-vue is installed tough
I'm also facing this issue but with importing http://localhost:5173/@id/@vitest/coverage-v8/browser?import
and only in GitHub actions: https://github.com/sapphiredev/shapeshift/actions/runs/10980659362/job/30486718676?pr=396. This is clearly not something I can influence, because it's a vitest library. I also get the same issue with coverage Istanbul as seen here: https://github.com/sapphiredev/shapeshift/actions/runs/10979357381/job/30483626781?pr=396.
Notably, downgrading from 2.1.1 to 2.0.5 (and switching back to Istanbul) does solve the issue.
Describe the bug
I'm in the process of comparing all of the test runners on a very basic vue 3 composition API + TS app. So i setup testing lib and a basic test, it worked. Then I tried to add
@vitest/browser
and I updatedvitest.config.ts
to use playwright and chromium but vitest started errors likeReproduction
I haven't seen this error anywhere else but I reproduced it in StackBlitz, the setup is fairly similar to the one on my machine and gives the same result
https://stackblitz.com/edit/vitest-dev-vitest-urjsz7
Could it be a setup error on my part ? Or is it a bug ?
System Info
Used Package Manager
npm
Validations