what

Testing

Assert what your pages render — status, content, redirects — with plain-text .what files. No test framework to install, no JavaScript. Run them with run-what test.

Quick start

Create a tests/ directory in your project and add one .what file per case:

# tests/home.what
page: /
status: 200
contains: "<h1>"
contains: "Welcome"

Then run:

run-what test

Each file is a GET request against your app (loaded with your real what.toml), checked against its assertions. Exit code is 0 when everything passes, 1 on any failure — so it drops straight into CI or an agent's build loop.

Assertions

DirectiveMeaning
page:The path to request (required), e.g. /blog/hello
status:Expected HTTP status, e.g. 200, 303, 404
contains:Body must contain this string (repeatable)
not_contains:Body must NOT contain this string (repeatable)
redirect:Expected redirect target (for 3xx responses)

Lines starting with # are comments. Values may be quoted; contains and not_contains can appear multiple times to assert several fragments.

Recipes

A public page renders

# tests/about.what
page: /about
status: 200
contains: "About us"

A protected page redirects when logged out

# tests/dashboard-guarded.what
page: /dashboard
status: 303
redirect: "/login"

A missing route 404s

# tests/not-found.what
page: /no-such-page
status: 404

Content is present and stale content is gone

# tests/pricing.what
page: /pricing
status: 200
contains: "Pro plan"
not_contains: "Coming soon"
For AI agents: tests are the feedback loop. Have the agent write a .what assertion for each page it builds, then run run-what test to confirm the generated app actually renders what was intended — and to catch regressions when it edits.

Custom test directory

Point at a different folder with --test-dir:

run-what test --test-dir e2e

A project with no tests directory isn't an error — run-what test simply prints an example to get you started.