Coverage
ELI5 — The Vibe Check
Coverage tells you what percentage of your code is actually tested. 80% coverage means 80% of your lines are touched by at least one test. It sounds great until you realize the untested 20% is where all the bugs live.
Real Talk
Code coverage measures how much of your source code is executed by your test suite. Types include line coverage, branch coverage, function coverage, and statement coverage. High coverage doesn't guarantee correctness — it just means code was executed.
Show Me The Code
# Run tests with coverage report
vitest run --coverage
# Output:
# File | % Stmts | % Branch | % Funcs | % Lines
# auth.ts | 92.31 | 87.50 | 100.00 | 92.31
When You'll Hear This
"We require 80% coverage before merging." / "High coverage doesn't mean your tests are actually good."
Related Terms
CI Testing
CI Testing is running all your tests automatically every time someone pushes code.
Code Coverage
Code coverage is the report card for your tests. It shows you a map of your code and highlights which lines got tested (green) and which didn't (red).
Jest
Jest is the most popular JavaScript testing framework.
Test Suite
A test suite is just a collection of related tests grouped together.
Vitest
Vitest is a blazing-fast test runner built on Vite. If Jest is the reliable sedan, Vitest is the electric sports car — same driving experience, 10x faster.