Install `@testing-library/vue` by default instead of `@vue/test-utils`
See original GitHub issueWhat problem does this feature solve?
In the official documentation on testing, the following is mentioned when suggesting the 2 libraries that can be used for testing:
Vue Test Utils is the official low-level component testing library that was written to provide users access to Vue specific APIs. If you are new to testing Vue applications, we would recommend using Vue Testing Library, which is an abstraction over Vue Test Utils.
The recommendation for new users is to use @testing-library/vue.
However, @vue/cli-plugin-unit-jest
doesn’t actually install @testing-library/vue
, but @vue/test-utils
I find it to be unintuitive that despite the recommendation, the more low-level (and “harder to use”) alternative is installed by default.
It’s probably not a good idea to install both by default, but if we have to pick one, @testing-library/vue
seems like the obvious choice to me.
The users who would be more likely to go with @vue/test-utils
instead, are more likely to be more experienced, and will have a better understanding of the alternatives.
What does the proposed API look like?
Change https://github.com/vuejs/vue-cli/blob/82aef123d9e4bbeec397023edc0c820672f79c8f/packages/%40vue/cli-plugin-unit-jest/generator/index.js#L15 to add @testing-library/vue
instead
Happy to open a PR on this myself
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top GitHub Comments
Hi! Vue Testing Library maintainer here. 👋
We’re still ironing out our integration with Vue 3, but we’re almost there. I’ll keep an eye on this issue and ping you back when VTL for Vue 3 is marked as stable.
Actually Vue Testing Library relies on Vue Test Utils, so you might end up with both libraries installed under the hood (even though you might only want to use VTL 😄)
Thanks!
Yeah, it would be great to use an easier-to-use testing library by default. But I have zero experience with it. So any PR is very welcome!