L21 · Build & preview · 5 min

Tests: how your agent proves it works

In one sentence

A test is a small, automated check your coding agent writes and runs inside your project to prove that a piece of your app works as expected—and to catch any future change that accidentally breaks a feature you already built and approved.

Think of it like this

Think of smoke detectors in a house. You don't press the button on every detector each morning by hand; once installed, they watch quietly and sound the alarm the moment something goes wrong.

How it works

Clicking around your app in the browser is essential, but as your project grows you won't remember to re-check every screen after every change. A DefinitiontestA small program that checks your app does what it should, so a fix can't silently break later.Open in the glossary → is code that checks your code: it feeds known inputs into a function or page and verifies that the output matches what your Definitionspec`SPEC.md`: what you're building, who it's for, what's in and out, and how you'll know it works.Open in the glossary → promised.

Before any Definitionpull requestA proposal to merge a branch, shown on GitHub with its changes and checks, so you can review it first.Open in the glossary → is ready to merge, your agent runs three layers of automated checks in the DefinitionterminalA window where you type commands instead of clicking. Your agent mostly uses it for you.Open in the glossary →. Lint (npm run lint) spots common code mistakes and style slips; type checking (npx tsc --noEmit) verifies that data shapes match across files; and unit or integration tests (npm test) check individual rules and flows.

When a DefinitionbugA mistake in the code that makes the app behave wrongly.Open in the glossary → appears and your agent fixes it during DefinitiondebuggingFinding and fixing the root cause of a bug: reproduce, find, fix, prove.Open in the glossary →, the job isn't finished until the agent adds a regression test: a new test that would have failed before the fix and passes now. That way, the same bug can never return silently.

1 · Lint & typesGrammar checkCatches typos, broken imports and mismatched data shapes before the app even runs.
2 · Automated testsBehavior checkRuns key calculations, forms and rules—plus a test for every past bug.
3 · Your reviewHuman checkYou try the Preview link yourself to confirm it feels right before merging.
FIG. 1 · Automated checks prove the code still obeys the rules; your eyes on the Preview prove it's the app you wanted.

What it looks like in your project

At the end of each task—and before opening or merging a pull request—your agent runs lint, type check and tests, and shows you a short summary of what passed. If anything fails, it reads the output, fixes the cause and runs the checks again before asking for your approval.

Copy for your agent

Run lint, type check and tests on my project now. Tell me in plain words what each check verified, and suggest one high-value test we should add for our most important feature.

Quick check · 1 question

Why does your agent write a new test after fixing a bug?

Go deeper

Next lessonLogins and accounts

Last reviewed Nov 8, 2026