Payload Logo

Testing a Static Site Means Testing the Build, Not Just the Code

Date Published

Over-the-shoulder view of a MacBook Pro screen showing a code editor with colorful syntax-highlighted source code

A component can be perfectly correct in isolation and still produce a broken page once it's run through static generation — a data fetch that works in development but times out at build time, a route that resolves locally but 404s once exported, a page that depends on a runtime API the static output doesn't have. None of that shows up in a component-level test.

The gap gets closed by testing the actual build artifact — running the static export and checking the real output, not the source that produced it. It catches an entire category of failure that unit tests structurally can't see, because the bug isn't in any single function, it's in how the pieces come together during generation.

This is the least glamorous testing to set up and the easiest to skip, which is exactly why it's usually the layer missing when a deploy that passed CI turns out to have shipped a blank page.