EN
Lesson 5.1Pro - Part of Agentic School Pro

Tests, Tests, Tests: TSC, Linting, Vitest, Playwright and CI/CD

Protect your project with type checks, linting, unit and end-to-end tests, wired into CI/CD

28 min•Quality, Security and the Agent-First Business•Available

What you learn

  • Why agents make tests more important, not less, and the four-layer quality gate
  • Writing Vitest unit tests and Playwright end-to-end tests that survive refactors
  • Running the whole suite automatically with a pre-push hook and GitHub Actions

Summary

There is a myth that AI writes the code so you no longer need tests. The opposite is true. An agent will happily rewrite a working function at 2am because you asked for an unrelated change, and it has no memory of why the old behaviour mattered. Tests are how you tell future agents what must not break. This lesson builds the four-layer quality gate - types, lint, unit, end-to-end - and wires it into a pre-push hook and a CI pipeline so quality is enforced by the machine, not by your discipline.

What you will learn

You will learn what each layer of the quality stack catches, how to write a Vitest unit test and a Playwright end-to-end test that keep working after a refactor, how to block a bad push with a Git hook, and how to run the whole suite automatically on every push with GitHub Actions. By the end you can hand an agent free rein on a repo and trust the gate to catch its mistakes.

Prerequisites

A working TypeScript project from earlier courses and the hooks lesson from Course 2, since CI/CD is just the team-wide version of a pre-push gate. You do not need to be a test expert. The point of this lesson is to make testing a habit your agent does for you, not a discipline you have to remember.

The problem

When you drive an agent hard, it touches a lot of code fast. A change to one file silently breaks another. The agent reports success because the file it edited looks right, and you only discover the regression when a page is blank in production. Manual testing does not scale to agent speed - you cannot click through every flow after every change. Without an automated gate, every agent session is a small gamble with your live product. The fix is to make "is it still working?" a question the machine answers in seconds.

Unlocking your Pro lesson

Comments

Loading comments.

Post a comment
CommentsNext
Next step

Ready to put AI to work as a real workflow?

Start with the foundations course, keep your progress locally and sync everything to your free account whenever you like.