Simple and complete Vue.js testing utilities that encourage good testing practices.
This product is a testing library for Vue components, known as Vue Testing Library. It is specifically designed to facilitate writing tests that closely resemble how Vue components are used in actual applications. The library is built with guiding principles focused on simplicity, flexibility, and encouraging testing practices that align with Vue component usage. Vue Testing Library supports Vue 2 and Vue 3, along with dependencies like jest-dom.
To install Vue Testing Library as a devDependency in your project, use npm:
npm install @testing-library/vue
To install dependencies for Vue 3 and @vue/compiler-sfc, include peerDependencies:
npm install vue@3 @vue/compiler-sfc
For Vue 2 users, install version 5 of the library:
npm install @testing-library/vue@5
To add jest-dom for custom matchers, consider installing:
npm install @testing-library/jest-dom
Vue Testing Library is a versatile tool for testing Vue components, encouraging practices that mirror real-world usage scenarios. With support for Vue 2 and Vue 3, along with peer dependencies, eslint support, and TypeScript compatibility, it aims to simplify and enhance the testing experience for Vue developers. The library’s guiding principles, detailed documentation, and active community of contributors make it a valuable asset for testing Vue applications efficiently and effectively.