Testing Vue.js Components
Plans from $25/month

This lesson is for members. Join us?

Subscribe now and get immediate access to this course, 30 more and all future Vue.js courses!

🚧 NOTICE: You are watching a Vue.js 2 lesson

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