0PricingLogin
React Academy · Lesson

React Testing Library + Vitest/Jest Setup

Install and configure Vitest/Jest with React Testing Library; use jsdom, render components, and query the DOM like a user.

Why this stack

Goal: Test components like a user interacts.

  • Vitest/Jest runner
  • jsdom environment
  • React Testing Library (RTL)

Install + env

Install:

  • npm i -D vitest @testing-library/react @testing-library/user-event jsdom
  • Set test env to jsdom
  • Add scripts: test, test:watch

All lessons in this course

  1. React Testing Library + Vitest/Jest Setup
  2. Queries, Events, Assertions — Forms & Async UI
  3. Mocking Fetch & Timers
← Back to React Academy