Validation & Testing
Three checks run as part of npm run build, so problems surface at build time
rather than in front of a reader.
Config validation
npm run validate:payloadπ Validating payload configuration...
β
Payload validation passed!
payload/config.ts is checked against a JSON Schema. It catches:
- missing required fields (
global.title,global.description) - malformed colours β theme values must be
#rrggbb - an invalid
urlStrategyβ onlypathandhashare accepted - navigation entries missing a
name, or nested wrongly
A failure stops the build immediately, before anything is rendered.
Example failure
β Payload validation failed:
- /global/title must NOT have fewer than 1 characters
Link checking
npm run check:linksπ Links OK β 61 links across 21 pages
Every wiki link and internal Markdown link is resolved against the content tree. Anything pointing at no page is reported with the file it was written in:
π 2 unresolved links:
content/guides/setup.md
[[instalation]] matches no page
content/guides/api.md
[[overview]] is ambiguous β matches api/overview, guides/overview
Use the full path to disambiguate.
By default this reports without failing. A dangling link in one page is not a reason to block a deploy of the other twenty, and content is often written before the page it references exists.
To make it fatal β in CI, for instance:
npm run check:links -- --strictThe same list appears at the bottom of the Graph page.
Tests
npm test # once
npm run test:watch # on changeThe suite covers the engine: content discovery, navigation assembly, URL resolution under both strategies, the Markdown pipeline, wiki-link parsing, search indexing and ranking, and the graph layout.
It also asserts against this site's own content β that every section in the search index points at a real anchor, and that no page contains a dangling link β so the tests fail if the documentation drifts from the code.
Types
npm run type-checkpayload/config.ts is typed, so most configuration mistakes are caught in your
editor before any script runs. If a field is not in the Payload type, it is
not a real option.
Formatting and lint
npm run lint # ESLint, with --fix
npm run format # PrettierIn CI
A workflow that runs everything:
- run: npm ci
- run: npm run type-check
- run: npm run lint
- run: npm test
- run: npm run check:links -- --strict
- run: npm run buildNext
- Payload Configuration β what the config can contain
- Graph & Backlinks β see unresolved links in context
- Static Export β deploying the result