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

Master Vue.js with Vue School Premium

$25 / month

Testing Vue.js Components

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

Start Learning

Already got an account? Log in

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