Skip to main content

Running Tests in CI, and What Comes Next

Why This Matters

Tests on your own laptop protect only you, and only when you remember to run them. Continuous integration (CI) runs them automatically on every change, for everyone, before code is merged. It turns your tests into a safety net for the whole team.

How CI works

  1. Someone pushes a change or opens a pull request.
  2. A CI service (GitHub Actions, GitLab CI, Azure Pipelines, Jenkins) starts a clean machine.
  3. It installs the project and runs the checks.
  4. The result appears on the pull request: a green check or a red cross. Red means: do not merge yet.

Read TestRun Board’s pipeline

The pipeline is a file in the repository, .github/workflows/checks.yml. Here is the first job:

on:
  pull_request:
  push:
    branches: [main]

jobs:
  check:
    name: Lint, typecheck, unit and component tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 22, cache: npm }
      - run: npm ci
      - run: npm run lint
      - run: npm run typecheck
      - run: npm test

You can read it with what you know now:

  • on: when it runs: on every pull request and every push to main.
  • runs-on: a fresh Linux machine.
  • steps: get the code, install Node 22, install packages, then run the same commands you ran locally.

The file has two more jobs: mutation (are the tests strong enough to catch changes? see lesson 8, A Unit Test: Generate, Then Judge) and e2e (the Playwright UI test). The order follows the pyramid: fast checks first, slow checks after.

You can see the results of every run under the Actions tab of the TestRun Board repository.

Making CI trustworthy

  • Red must mean broken. Fix or remove flaky tests quickly; a team that is used to ignoring red will miss the real failure.
  • Fast first. Developers wait for CI. Keep the fast checks fast and run slow ones in parallel or later.
  • The same commands everywhere. CI should run exactly what you run locally (npm run check), so “works on my machine” disappears.

Exercise

  1. Fork the TestRun Board repository on GitHub and enable Actions on your fork.
  2. On a branch, break formatDuration as in lesson 8, A Unit Test: Generate, Then Judge, push, and open a pull request in your fork. Watch CI turn red, and read the failure in the job log.
  3. Fix it, push again, and watch it turn green.

What comes next

You can now decide what to test, read code and tests, get tests written with AI, and judge whether they protect you. That is the foundation. The next step is working with an AI agent on a whole codebase: giving it context, rules and guardrails, and reviewing its changes the way you reviewed tests here.

That is the follow-up course: Agentic Engineering with Claude Code, which uses the same TestRun Board project.

Key Takeaways

  • CI runs your tests automatically on every change, before merging.
  • A pipeline file is readable: triggers, machine, and the same commands you run locally.
  • Order checks like the pyramid: fast first, slow later.
  • Red must mean broken: fix flaky tests fast.