The robot tester

Play this lesson

Test everything, every time?

After every change, someone should check the whole game. Does the ship still move? Does the score count? Does the shop sell seeds? Does Sprig still lose health?

Doing that by hand takes ages, and after the tenth time, people start skipping it. That's exactly when bugs sneak in.

We have tests. Who runs them?

An automated test is a small program that runs a piece of the game's code and checks the answer. The tests lessons showed you how to write them: unit and integration tests in Vitest, and end-to-end tests in Playwright, which plays the real game in a real browser.

Hyper Shards now has hundreds of them. But tests only help if someone runs them after every change, and people forget. So we hand that job to a robot that runs them on every push.

Quick check

Hyper Shards has 400 tests. Why let a robot run them instead of a teammate?

  1. The robot runs every test on every push, the same way each time, and never skips one
  2. Robots write better tests than people do
  3. A robot can tell whether the game is fun
Show the answer

The robot runs every test on every push, the same way each time, and never skips one

Running tests is boring, exact work, which is perfect for a robot. Writing good tests and judging whether the game is fun stay with the team.

The commands the robot types

The robot types the same commands you would. npm test runs the "test" script in package.json, which for us is vitest run: every unit and integration test, once.

End-to-end tests need browsers first, so a second job runs npx playwright install --with-deps, then npx playwright test. It saves the Playwright report, with screenshots and traces of any failure, so you can download it and see what went wrong.

Bolt says: A failing test is good news. It found a bug for you, early.

CI: the robot runs the tests

CI stands for continuous integration: a robot runs all the tests every time someone pushes code (uploads commits to GitHub) or opens a pull request.

GitHub's robot is called GitHub Actions. Its instructions live in a workflow file inside the repo, in the folder .github/workflows/.

Workflows are written in YAML, a simple text format where the spaces at the start of each line matter. One space out of place and the robot can't read it.

Read the workflow

.github/workflows/test.yml
name: Testson: [push, pull_request]jobs:  test:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v7      - uses: actions/setup-node@v7        with:          node-version: 24      - run: npm ci      - run: npm test

This is our real workflow file. Which line tells GitHub Actions when to run?

  1. Line 2
  2. Line 5
  3. Line 12
Show the answer

Line 2

on: lists the events that start the workflow: every push and every pull request. Line 5 picks the computer it runs on, and line 12 runs the tests.

Inside the workflow

Bolt says: The robot starts from an empty computer every time. "It works on my laptop" isn't enough: it has to work from scratch.

Red cross, green tick, deploy

If any step fails, the job stops with a red cross. On a pull request, the team sees it right away, so a broken change can't sneak into main.

CD stands for continuous deployment. Deploying means putting the new version where players can get it. When all tests pass on main, another job can publish our website to Cloudflare. Minutes after Kai merges a fix, Hyper Shards players on the web have it. If a test fails, nothing is published.

Test result

GitHub Actions
 FAIL  score.test.js > combo bonus doubles pointsAssertionError: expected 10 to be 20  Test Files  1 failed | 2 passed (3)      Tests  1 failed | 18 passed (19)

GitHub Actions shows this on Kai's pull request. What does it tell the team?

  1. The ship controls are broken
  2. The combo bonus in score.js is broken, so nothing gets published
  3. Every test passed, so the new version is live
Show the answer

The combo bonus in score.js is broken, so nothing gets published

score.test.js failed: a combo should double 10 points to 20, but the score stayed at 10. Because a test failed, the robot stops and players keep the last working version.

Workshop ready

Look at our workshop now: an IDE with AI agents, Claude as a teammate, prompts that work, LEGO-style code and the command line. Then the whole Git toolkit: commits, push and pull, branches, merge conflicts, pull requests, tests at every size and a robot tester that runs them.

That's how real studios work. Now we can change our games quickly and safely.

Bolt says: Beat the boss quiz to finish Stage 2. Then in Stage 3 we make the games feel great to play.

Fact-checked 9 October 2026