chore: narrow the top-heading match with a guard, not a non-null assertion

biome (error-on-warnings in CI) rejects the ! assertion; an explicit
throw narrows properly and says what broke if the file ever has no
heading at all.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
dan-claude-bot 2026-07-19 13:52:10 +00:00
parent f9187272ec
commit d7d715ac55

View file

@ -157,8 +157,8 @@ describe("release-notes.sh", () => {
it("the real CHANGELOG.md's top section extracts", async () => { it("the real CHANGELOG.md's top section extracts", async () => {
const changelog = readFileSync(join(ROOT, "CHANGELOG.md"), "utf8"); const changelog = readFileSync(join(ROOT, "CHANGELOG.md"), "utf8");
const top = changelog.match(/^## (\S+)/m); const top = changelog.match(/^## (\S+)/m);
expect(top).not.toBeNull(); if (!top) throw new Error("CHANGELOG.md has no ## section at all");
const r = await notes(top![1], join(ROOT, "CHANGELOG.md")); const r = await notes(top[1], join(ROOT, "CHANGELOG.md"));
expect(r.code).toBe(0); expect(r.code).toBe(0);
expect(r.output.trim()).not.toBe(""); expect(r.output.trim()).not.toBe("");
}); });