N
Nuxtβ€’8mo ago
Luke

'Cannot find module x.vue' in test definition

I've been following https://www.youtube.com/watch?v=yGzwk9xi9gU and https://nuxt.com/docs/getting-started/testing to set up testing with vitest. The tests are working fine, but my IDE is complaining "Cannot find module './Clock.vue' or its corresponding type declarations.". The file is indeed there and it mounts correctly. @manniL / TheAlexLichter you didn't seem to have this issue in your video when you put the test file alongside the component. Do you have any ideas for why this might be?
Alexander Lichter
YouTube
Nuxt Test Utils - A Primer to Testing in Nuxt
πŸƒ Testing is important for any application. And at a certain complexity, manual testing is simply not possible anymore. Luckily, writing Unit Tests and E2E Tests for your Nuxt application isn't as difficult as it may seems. In this video, we will dive into the different testing types and build tests for your demo application in less than 20 minu...
Nuxt
Testing Β· Get Started with Nuxt
How to test your Nuxt application.
No description
13 Replies
oneeach
oneeachβ€’8mo ago
Is Clock.vue in the same directory as your Clock.test.ts? If so, have you tried to remove the './'
Luke
LukeOPβ€’8mo ago
Thanks for your reply πŸ™‚ Yes, it is in the same directory. I get the same issue when I remove the './'. Also, in Alexander's video, he includes the './' and doesn't get the red squiggly of doom.
No description
No description
oneeach
oneeachβ€’8mo ago
I cannot replicate the same error on my end, can you setup a replication of your example? https://nuxt.new
oneeach
oneeachβ€’8mo ago
Also, if you delete your import statement and start to type out... import Clock from './' do you see a context menu popup from VSCode of options within that directory?
manniL
manniLβ€’8mo ago
Would also be happy about a simple repro πŸ™πŸ»
Luke
LukeOPβ€’8mo ago
Hi @oneeach @manniL / TheAlexLichter Thank you both for your replies. I've created a reproduction here: https://github.com/luc122c/test-test As you can see in the screenshot, the file is there and the test passes but I still get the error
GitHub
GitHub - luc122c/test-test: Reproduction of Typescript issue in tes...
Reproduction of Typescript issue in test file. Contribute to luc122c/test-test development by creating an account on GitHub.
No description
Luke
LukeOPβ€’8mo ago
There is no suggestion (apart from copilot).
No description
manniL
manniLβ€’8mo ago
works on my machine πŸ™ˆ
No description
manniL
manniLβ€’8mo ago
No description
manniL
manniLβ€’8mo ago
tests pass too
No description
oneeach
oneeachβ€’8mo ago
you appear to be working on a remote (ssh) connection, I wonder if this may be a permissions issue with your ssh user and the remote directory. Does the same thing happen when your project is run locally on your machine?
Luke
LukeOPβ€’8mo ago
Oooh, interesting. Yes! It is fine locally πŸ™ˆ
No description
Luke
LukeOPβ€’8mo ago
I wouldn't even know where to begin to debug the issues over ssh. At least I know it's an issue with VSCode or my setup and not Nuxt! Thanks for your help both! πŸ’š
Want results from more Discord servers?
Add your server