Unit Testing Vue 3

Lessons

1. What to test

4:38

2. Writing a Unit Test with Jest

10:05

3. Testing Props & User Interaction

6:51

4. Testing Emitted Events

6:35

5. Testing API Calls

9:38

6. Stubbing Child Components

5:49

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 click enter so that we can specify whic