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

Testing Vue.js Components

Get access to the most comprehensive Vue.js video library in the world. Over 300 video lessons including the newest Vue 3 features.

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