You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the latest nuxt test-utils I was trying to mock a server side import. Before even able to mock the server side import, I have realized that the plain vanilla minimal nuxt module seems to be ignored/not executed when running e2e test.
Basic setup is to have a server side import coming from a module. an API is using that import to return a value. Running pnpm dev works, and the API returns the value as expected.
Running an E2E test in the nuxt environment however fails, showing error messages which are hinting that the module import has not been executed:
(node-resolve plugin) Could not resolve import "#auth" in /home/projects/nuxt-vitest-x6ycht/server/api/test.get.ts using imports defined in /home/projects/nuxt-vitest-x6ycht/package.json.
Maybe my test config needs to be improved? Or is it a bug?
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered:
You can definitely test the server side with e2e, but that starts a server with setup and performs fetch requests to it. You don't directly import the server code into your test.
Environment
Reproduction
With the latest nuxt test-utils I was trying to mock a server side import. Before even able to mock the server side import, I have realized that the plain vanilla minimal nuxt module seems to be ignored/not executed when running e2e test.
See repro here:
https://stackblitz.com/edit/nuxt-vitest-x6ycht
Describe the bug
Basic setup is to have a server side import coming from a module. an API is using that import to return a value. Running
pnpm dev
works, and the API returns the value as expected.Running an E2E test in the nuxt environment however fails, showing error messages which are hinting that the module import has not been executed:
(node-resolve plugin) Could not resolve import "#auth" in /home/projects/nuxt-vitest-x6ycht/server/api/test.get.ts using imports defined in /home/projects/nuxt-vitest-x6ycht/package.json.
Maybe my test config needs to be improved? Or is it a bug?
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: