fix(test): let the README link check stand down where there is no README

The check I added for `?template=` links read README.md unconditionally, and the
image build is the one place that runs this suite without it: `.dockerignore`
omits the README along with docs/ and AGENTS.md, so that editing a doc does not
invalidate the layer that installs, typechecks, tests and builds. `.github/` is
copied in for the opposite reason, which is why every other check in the file
ran there fine.

So this failed in a way CI could not see — the check job has the whole
repository and stayed green, while the container build went red on a file that
context leaves out on purpose. Skipping it there keeps the gate honest about
what it can actually inspect; the assertion still runs in CI and locally, which
is where a README link is edited in the first place.

Verified by running the suite inside the build stage: 516 pass, 1 skip, 0 fail,
against 517 pass and no skips in the full tree.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Lucas Winther
2026-08-17 23:31:12 +02:00
co-authored by Claude Opus 5
parent d843c7cae7
commit 09716054f4
+16 -1
View File
@@ -21,6 +21,21 @@ import {
const DIR = ".github/ISSUE_TEMPLATE";
/**
* Whether the README is in this context at all.
*
* The image build runs this suite as its gate, and `.dockerignore` excludes the
* README along with `docs/` and `AGENTS.md` — deliberately, so that editing a
* doc does not invalidate the layer that installs, tests and builds. `.github/`
* is copied in for the opposite reason, which is why every other check here runs
* there unchanged.
*
* So the README check stands down where the file was left out on purpose, rather
* than failing the image on the absence of something that context does not ship.
* It still runs in CI and locally, which is where a README link gets edited.
*/
const HAS_README = await Bun.file("README.md").exists();
type Field = {
type: string;
id?: string;
@@ -122,7 +137,7 @@ describe("the app's links into them", () => {
expect(params.get("refreshed")).toBe("15 Aug 2026, 04:12 — 2 days ago");
});
test("every template link in the README names a template that exists", async () => {
test.skipIf(!HAS_README)("every template link in the README names a template that exists", async () => {
// A `?template=` that names nothing lands the reader on the chooser instead,
// which looks close enough to working that nobody reports it.
const readme = await Bun.file("README.md").text();