Closed lbsn closed 2 years ago
I just run into the same problem, but you can install from the v5 version, i.e. "@testing-library/vue": "^5.8.0"
.
As per the release tags in this repo it seems the latest v6 track is for Vue 3 while the v5 track is for Vue 2.
I just run into the same problem, but you can install from the v5 version, i.e.
"@testing-library/vue": "^5.8.0"
.As per the release tags in this repo it seems the latest v6 track is for Vue 3 while the v5 track is for Vue 2.
Sure, I was rather pointing out that the docs are inaccurate on this point. And it seems to me that the information is nowhere to find, one has to look at the package.json
in order to know that v5 is for Vue 2.
I was having the same problem here. Thank you for clarifying. v5.8.2 worked for me.
Docs updated. thanks everyone.
Describe the bug
I'm using vue-testing-library with Nuxt and Vue2. Based on the docs installation should be done using the command:
npm install --save-dev @testing-library/vue
That will install the latest version of
@testing-library/vue
(currently 6.5.1) which under the hood is using version 2.0.0-rc.18 of@vue/test-utils
. This version oftest-utils
is not compatible with Vue2 (v1 should be used instead) and results in error when running the test suite:Cannot find module '@vue/compiler-dom' from 'node_modules/@testing-library/vue/node_modules/@vue/test-utils/dist/vue-test-utils.cjs.js'
Apparently the latest version of
@testing-library/vue
compatible with Nuxt / Vue2 is 5.8.2 and that should probably be clarified in the docs.To Reproduce
npx create-nuxt-app foo-project
)@testing-library/vue
withnpm install --save-dev @testing-library/vue
@testing-library/vue
npm run test
Related information:
@testing-library/vue
version: 6.5.1Vue
version: 2.6.14Nuxt
version: 2.15.8