test-utils
test-utils copied to clipboard
Cannot install latest version in standard Nuxt 2 project
Hello! :)
Since the release candidate of Nuxt 3 came out last month, many dependencies to do with Nuxt and its modules/libraries are broken.
I can't install @nuxt/test-utils on a fresh Nuxt 2 stable project due to it having a hard dependency for Vue 3.x when Nuxt 2 uses Vue 2. I can install version 0.2.2 but it is year+ old compared to your current version. Is this the last version that will support Nuxt 2, or is this now deprecated in favour of @vue/test-utils which is what Nuxt 2 currently ships its NuxtLogo.spec.js example with?
To reproduce you just need to create a nuxt 2 project and try to execute:
npm --save-dev install @nuxt/vue-utils
The output is:
❯ npm --save-dev install @nuxt/test-utils
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: *********@1.0.0
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR! vue@"^2.6.12" from @nuxt/[email protected]
npm ERR! node_modules/@nuxt/vue-app
npm ERR! @nuxt/vue-app@"2.15.8" from @nuxt/[email protected]
npm ERR! node_modules/@nuxt/builder
npm ERR! @nuxt/builder@"2.15.8" from [email protected]
npm ERR! node_modules/nuxt
npm ERR! nuxt@"^2.15.7" from the root project
npm ERR! @nuxt/vue-app@"2.15.8" from [email protected]
npm ERR! node_modules/nuxt
npm ERR! nuxt@"^2.15.7" from the root project
npm ERR! vue@"^2.6.12" from @nuxt/[email protected]
npm ERR! node_modules/@nuxt/vue-renderer
npm ERR! @nuxt/vue-renderer@"2.15.8" from @nuxt/[email protected]
npm ERR! node_modules/@nuxt/server
npm ERR! @nuxt/server@"2.15.8" from @nuxt/[email protected]
npm ERR! node_modules/@nuxt/core
npm ERR! @nuxt/core@"2.15.8" from [email protected]
npm ERR! node_modules/nuxt
npm ERR! 1 more (nuxt)
npm ERR! @nuxt/vue-renderer@"2.15.8" from [email protected]
npm ERR! node_modules/nuxt
npm ERR! nuxt@"^2.15.7" from the root project
npm ERR! 4 more (@vue/test-utils, vue-jest, vue-tailwind, vuex)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @nuxt/test-utils@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/vue
npm ERR! peer vue@"3.2.33" from @nuxt/[email protected]
npm ERR! node_modules/@nuxt/test-utils
npm ERR! dev @nuxt/test-utils@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Any advice or help would be greatly appreciated as currently this is blocking my team from starting our project with full Nuxt SSR testing support.
@Jedv-TransReport I'm fairly new to using nuxt's test-utils package myself. It looks like a dependency tree issue. Have you tried installing the packages with the --legacy-peer-deps flag?
npm --save-dev install @nuxt/vue-utils --legacy-peer-deps
Hi @dmaisano,
Unfortunately trying --legacy-peer-deps just creates more issues as Jest then expects @nuxt/test-utils to have a jest-config.json or similar file in its node_modules root as they are far apart in development versions and time.
For now we are having to use standard Jest with vue-test-utils for Vue support and unable to use any Nuxt helpers, stubs or ssr: true testing.
Thanks, Jed.