Learn Vue JS course Learn Javascript and Vue JS Learn VueJS course Learn VueJS Tutorial

Testing Vue.js Components

Installing Vue Test Utils

Before we learn how to test our vue.js components, we need to install a few packages that will be the tools we use.

In this lesson, we'll walk you through the project that we've prepared and show you how to install the required packages before we continue with testing vue.js components.

We have created a boilerplate that contains the components that we will test in this course. Make sure to download or clone it (instructions below) if you want to follow along.

Clone project and Install the dependencies

cd ~
git clone https://github.com/vueschool/testing-vue-components.git
cd testing-vue-components

yarn
# OR
npm install

Install vue-template-compiler and vue-jest

yarn add vue-template-compiler vue-jest
# OR
npm install vue-template-compiler vue-jest

Install vue-test-utils

yarn add @vue/test-utils
# OR
npm install @vue/test-utils

If you're not familiar with Jest, the testing framework, we recommend watching Test with Jest before continuing with this course.