test-utils icon indicating copy to clipboard operation
test-utils copied to clipboard

Error: This module cannot be imported in the Vue part of your app

Open AlbertBrand opened this issue 1 year ago • 1 comments

Environment

  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: 3.9.3
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools, modules
  • Runtime Modules: @nuxt/test-utils/[email protected]
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-3etpwp?file=package.json

Describe the bug

If you have test files in your pages folder importing @nuxt/test-utils/runtime, the following error pops up when starting the project

ERROR  This module cannot be imported in the Vue part of your app. [importing @nuxt/test-utils/runtime from pages/<testname>.ts]

The error does not seem to have effect on the app startup itself (it's probably more a warning).

The error goes away when moving the test out of the pages folder.

Additional context

No response

Logs

No response

AlbertBrand avatar Jan 30 '24 09:01 AlbertBrand