Testing JavaScript Apps
Write tests that catch real bugs, run fast and never cry wolf.
- 4.8 (642 ratings)
- 5,200 learners
- Intermediate
- 5h 30m total
- Updated September 2026
What you’ll learn
- Choose the right mix of unit, integration and end-to-end tests
- Write clear Vitest tests with edge cases and table-driven cases
- Test errors, async code and collaborators without over-mocking
- Test UI the way users use it, with Testing Library queries
- Write Playwright tests that wait correctly and don't flake
- Judge a suite with coverage, mutation testing and CI signals
Who it’s for
Most teams don't lack tests; they lack tests they trust. This course teaches you to write the kind that earn their place: unit tests that pin down behaviour, UI tests that act like a user, and end-to-end tests that don't flake. You use Vitest, Testing Library and Playwright, the tools most JavaScript teams run in 2026.
Everything is built around Splitwise-lite, a bill-splitting module with real money bugs waiting to happen: rounding, leftover cents, async saves and a settle-up algorithm. In the playground you write tests against working code, then prove them by catching deliberately broken versions, the same idea behind mutation testing, which you meet properly at the end.
- Who it’s for
- JavaScript developers who can build a small app and want tests that give them real confidence to change it.
- Before you start
- Comfortable with modern JavaScript (functions, arrays, promises, async/await) and basic DOM or React.
Hands-on practice
- Write JavaScript and run it in a sandbox with automatic checks.
- Write tests that must catch real bugs (mutation testing).
- Guided exercises: spot the bug, fill the command, order the steps.
Course content
5 sections · 18 lessons · 5h 30m total
- What Tests Buy You10 min
- Setting Up Vitest16 min
- Anatomy of a Test and Reading Failures18 min
- Section checkpoint5 questions
- Test Behaviour, Not Implementation18 min
- Edge Cases and Table-Driven Tests20 min
- Testing Errors and Async Code18 min
- Test Doubles and When Mocking Hurts20 min
- Section checkpoint5 questions
- Querying the DOM Like a User18 min
- Simulating User Interaction18 min
- Testing Async UI18 min
- Testing React Components and the Network20 min
- Section checkpoint5 questions
- Locators, Web-First Assertions and Auto-Waiting20 min
- Fixtures and Test Isolation20 min
- Debugging and Fixing Flaky Tests20 min
- Section checkpoint5 questions
- Test-Driven Development as a Tool20 min
- Coverage and Its Limits18 min
- Mutation Testing20 min
- Testing in CI and Choosing What Not to Test18 min
- Section checkpoint5 questions
Your instructor

Kenji Watanabe
Staff Engineer, Developer Experience · Trellis
- 4.7 instructor rating
- 19,500 learners
- 2 courses
Kenji's job at Trellis is to make other engineers faster: the Git workflow, the CI pipeline, and the test suite that has to finish before lunch. He has untangled more broken rebases than he can count, and once cut a 40-minute test run to six.
What learners say
4.8
642 ratings
Farah Siddiqui
6 months ago
The mutant exercises are brilliant: your tests must pass on the real code and fail on a planted bug. They showed me how many of my old tests checked nothing at all.
Pedro Almeida
4 months ago
Testing Library's query-by-role approach finally clicked, and our component tests stopped breaking every time someone renamed a CSS class.
Aisha Bello
last week
Clear on unit and component tests with Vitest. The Playwright end-to-end part is good but short; I'd happily take two more lessons on it.