0Pricing
Frontend Academy · Lesson

@testing-library/vue: mounting components

Mount Vue components with @testing-library/vue, provide props and global plugins, simulate user events, and assert on the rendered template.

Testing Library for Vue

@testing-library/vue provides the same user-centric testing approach for Vue 3 components. The API mirrors the React version: render(), screen queries, userEvent, and jest-dom matchers.

Installing

Install the testing library packages for Vue.

npm install -D @testing-library/vue @testing-library/user-event @testing-library/jest-dom
# Also install vitest for a Vite project:
npm install -D vitest jsdom

All lessons in this course

  1. Jest Setup and Basic Tests
  2. @testing-library/react: render userEvent
  3. @testing-library/vue: mounting components
  4. Mocking Modules and API Calls
← Back to Frontend Academy