Testing Strategy
Tests that give genuine confidence. Testing philosophy, the testing trophy, unit tests with Vitest, component tests with Testing Library, integration tests with MSW, and E2E with Playwright.
Why the testing pyramid is outdated, how the testing trophy gives you better confidence per dollar, and the mental framework for deciding what to test, how to test it, and when to skip tests entirely.
Why Vitest replaced Jest as the default for modern projects, how to set it up with TypeScript, and every matcher and pattern you need to write fast, reliable unit tests.
Test components the way users interact with them. Master query priority, async patterns, user events, and debugging — the complete guide to writing tests that actually catch bugs.
How to test custom React hooks with renderHook, handle async behavior with waitFor, provide context with wrappers, and know when to test hooks directly vs through components.
Master vi.fn(), vi.spyOn(), vi.mock(), timer mocks, and partial mocking in Vitest — and learn when NOT to mock.
Intercept requests at the network level with Mock Service Worker. No implementation coupling, works in tests and browser, and makes your integration tests actually trustworthy.
How to test multiple units working together. Render pages, interact like a user, assert real outcomes. Patterns for providers, forms, data fetching with MSW, navigation, error boundaries, and loading states.
How to write reliable end-to-end tests with Playwright — auto-waiting, cross-browser testing, locator strategies, page objects, authentication reuse, and CI configuration.
Catch pixel-level UI regressions that unit and integration tests completely miss — using Playwright screenshots, Storybook + Chromatic, and smart CI pipelines.
Catch performance regressions before they reach production. Set up Lighthouse CI, performance budgets, custom Playwright assertions, and automated alerting in your GitHub Actions pipeline.
12 scenario-based questions covering query priority, mocking strategies, test isolation, async patterns, and choosing the right test type. The capstone challenge for the Testing Strategy module.