Unit Testing Vue 2

Lessons

1. What to test

4:58

2. Writing a Unit Test with Jest

9:25

3. Testing Props & User Interaction

7:15

4. Testing Emitted Events

6:56

5. Testing API Calls

9:52

6. Stubbing Child Components

6:01

Writing a Unit Test with Jest

In this lesson, we’re going to write our first unit test using Jest and Vue Test Utils. You can get started with the starting code available in this page’s lesson resources, or you can follow along and create the project from scratch using the Vue CLI.


Creating Our Project

We’ll create a new project using the Vue CLI. From the command line run the following command:

vue create unit-testing-vue

We’ll choose “Manually select features” and