Checking an Astro build before it ships

What bun run verify runs, what the output checks and the deadhead HTML audit catch, and why a plain astro build is not enough.

astro build turns your pages into HTML, but it does not run the type checker, does not run tests and does not look at the result. A page with a missing description, or with social tags that disagree with its canonical URL, builds without complaint. The starter adds checks around the build so those mistakes stop a deployment instead of reaching search engines.

One command: bun run verify

Run bun run verify before you commit, with your productionsite configured. It runs six steps in order and stops at the first failure:

  1. bun run check runs astro check: Astro diagnostics and TypeScript in its strictest preset, across pages, components and scripts.
  2. bun run test runs the unit tests with Bun's test runner: metadata resolution, URL rules, the build receipt, the output checks and title-card drawing.
  3. bun run test:build builds small fixture projects with the real Astro CLI and checks the rendered metadata, the sitemap selection and title cards across output formats and subpaths, with Node's test runner — the documented fallback for these Astro fixture builds.
  4. bun run build builds your site into dist/.
  5. bun run verify:output checks that output.
  6. bun run lint:html audits the HTML with deadhead.

One build test removes the title-card feature and its package the way the README describes, so it may need registry access even after a frozen install.

Checks inside the build

Some rules run during bun run build itself, so they protect every build, including one started by a host. The build fails whensite is missing or includes a path, credentials, a query or a fragment; when two routes would write the same file; when a title card cannot be drawn, for example because the font lacks a glyph; or when the sitemap the official integration wrote does not match the pages selected for it. A failed build also deletes the previous build record, so the later checks cannot pass against stale output.

What verify:output checks

A successful build records its origin, base, output directory and the pages it emitted in .astro/starter-build.json. The output check reads that record, so a build with --site,--base or --outDir is checked where it actually went. For every page that uses the layout it confirms:

It then compares robots.txt and every sitemap file with the recorded selection. Your own CSS, scripts and fonts are allowed; pages that bypass the layout keep their own metadata rules.

The deadhead HTML audit

deadhead lints HTML for deprecated, unnecessary and harmful markup. The pinned version, 0.4.0, has 205 rules, covering problems such as a missing viewport tag, rel="shortcut icon" or a keywords meta tag that no major search engine reads. Every finding links to an explanation with sources. bun run lint:html runs the published CLI over the whole recorded output directory, including HTML copied from public/, with its default rules and threshold: any finding fails the step. It changes no files, applies no fixes and keeps no baseline, so what you see is what ships.

In CI and on the host

The GitHub Actions workflow runs the same steps on Node 24.8.0 and the latest LTS release, with a frozen Bun install and Actions pinned to commits. It builds with https://example.test as the origin, so your own site stays yours to set. On the host, chain the checks after the build:

bun run build --site https://example.com && bun run verify:output && bun run lint:html

If either check fails, the host gets a failing command and keeps the previous deployment. The Cloudflare Pages guide shows where that command goes.