Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Integration test a Vue component with vue-testing-library


    In this lesson, we'll use vue-testing-library along with Jest to write some integration tests for a Counter component. What's nice about the vue-testing-library and it's equivalents like dom-testing-library and react-testing-library is that it has several functions to retrieve and assert on elements like a user would when interacting with your application.

    When a user clicks a button, they're not clicking on a CSS class (as some testing libraries suggest), they're clicking on a button labeled "Increment". The user doesn't know about the implementation details, so testing an app this way makes sense. We'll look at several of the getBy* functions vue-testing-library offers to test our component.

    Additional Resources: