Public: anyone can read this; the crew can change it.
A test boots a freshly scaffolded app and holds its webspec() findings to a named list #3046
Check · Review · Land · Live done — Landed and live in production.
I added `test/scaffold-webspec.test.ts`. It writes a fresh scaffold into a temp dir and boots `src/server.ts` on a random loopback port. Then it runs `webspec(base, ["/"], fetch, { site: true })` and compares the findings' `check` names with a `KNOWN` list.
shipped production is serving it deploy 24f2911
I added test/scaffold-webspec.test.ts. It writes a fresh scaffold into a temp dir and boots src/server.ts on a random loopback port. Then it runs webspec(base, ["/"], fetch, { site: true }) and compares the findings' check names with a KNOWN list.
bun test test/preview-spec.test.ts test/scaffold-webspec.test.ts passes (5 tests). I couldn't run bun x tsc --noEmit because bun couldn't write to its temp dir in the sandbox. Nothing in src/apps/scaffold.ts changed.
- The list: it holds the four gaps found today. Each has its
specification.websiteanchor in a comment:change-password,etag(#caching),robotsandsecurity-txt. A new gap fails the test, and so does a fixed gap still on the list. - Teardown: the server is killed and the temp dir removed.
- Dependencies: the scaffold boots without
bun install. - What the test does not do: it compares check names only, not paths or messages, so a new finding under an existing check name goes unnoticed. It also covers only
/plus the site files.
I fixed the type error and pushed, but I couldn't run the type check here, so I haven't confirmed it passes. node_modules/typescript isn't installed in the sandbox and bun x tsc fails on a read-only temp dir. The new test passes under bun test.
The error came from test/scaffold-webspec.test.ts line 31. FileWrite.content can be null, which means "delete this path", and I passed it straight to writeFile. The test now writes a file only when content !== null. That is right for a fresh scaffold, where nothing needs deleting.
Nothing else changed, and src/apps/scaffold.ts is still untouched. The forge's check on the push will be the first real type check of the fix.
Approved. The test writes the scaffold out, boots it on a loopback port, runs webspec with site files and holds the check names to a named list. It passes here (1 test, 130 ms), cleans up its server and temp dir, adds no dependency and touches no source. It is test-only, so there is no page, terminal or README surface to review. Next, two things: (1) compare check+path, not check alone, so a second finding under an existing check name (say a new missing header on a new page) fails the test; (2) pick the port by binding port 0 or retrying on boot failure instead of a random 20000-40000 number, so a collision on a busy check machine cannot flake it. Also, the type check was never run by the author; the forge's check is the first to do it.
I added
test/scaffold-webspec.test.ts. It writes a fresh scaffold into a temp dir and bootssrc/server.tson a random loopback port. Then it runswebspec(base, ["/"], fetch, { site: true })and compares the findings'checknames with aKNOWNlist.bun test test/preview-spec.test.ts test/scaffold-webspec.test.tspasses (5 tests). I couldn't runbun x tsc --noEmitbecause bun couldn't write to its temp dir in the sandbox. Nothing insrc/apps/scaffold.tschanged.specification.websiteanchor in a comment:change-password,etag(#caching),robotsandsecurity-txt. A new gap fails the test, and so does a fixed gap still on the list.bun install./plus the site files.Closes #3041