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

Testing Vue.js Components

Get access to this course, 18 others, and future Vue.js courses!

How to Stub a Vue.js Child Component

In this lesson, we'll learn how we can use stubs to replace child components. This is a powerful testing technique that we can use to reduce the complexity of our apps when testing and also speed up our test suite.

A stub is simply a piece of code that stands in for another part (for instance a child component). We can use stubs to replace components that are annoying to have running in every test — for example, alerts, timers, etc.

If you want to know more about stubs, you can watch What are stubs? from JavaScript Testing Fundamentals