/** * Tests for release-note derivation. * * TRACES: | DR-219 | UT-210 * * The bug these were written against: `bun run release:notes v0.9.1..HEAD` * listed *every user requirement in the project* as a feature of the release. * The range contained a repo-wide `prettier --write` sweep, so `git diff * --name-only` reported 199 files, their TRACES comments resolved to nearly the * whole matrix, and the result claimed one release had added the entire * application. * * That mattered more than it looked: build-release.yml now generates the * published release body from this script, so the noise would have shipped. */ import { describe, it, expect } from "vitest"; import { isCosmeticCommit } from "./release-notes"; describe("isCosmeticCommit", () => { it("treats a formatting sweep as cosmetic", () => { // The actual commit that triggered this. expect(isCosmeticCommit("chore(format): run prettier over src/ and scripts/")).toBe(true); expect(isCosmeticCommit("style: reindent the player module")).toBe(true); expect(isCosmeticCommit("style(player): reindent")).toBe(true); }); it("treats a lockfile-only dependency bump as cosmetic", () => { // Touches package.json/bun.lock, which carry no TRACES, but a `chore(deps)` // that also edits source would still be caught by that source file. expect(isCosmeticCommit("chore(deps): bump vitest to 4.1.11")).toBe(true); }); it("does NOT treat ordinary work as cosmetic", () => { expect(isCosmeticCommit("fix(player): restart the hero banner timer")).toBe(false); expect(isCosmeticCommit("feat(updater): in-app update on desktop")).toBe(false); expect(isCosmeticCommit("ci: make the frontend gates real")).toBe(false); expect(isCosmeticCommit("docs: add SECURITY.md")).toBe(false); }); it("does not mistake a chore that is not formatting for a formatting one", () => { // `chore(release)` bumps versions and must still be attributable; a bare // `chore:` could be anything, so it is NOT skipped by default. expect(isCosmeticCommit("chore(release): v0.9.2")).toBe(false); expect(isCosmeticCommit("chore: tidy up the queue helper")).toBe(false); }); it("is not fooled by the word format appearing later in a subject", () => { // A real fix to formatting *code* is not a cosmetic commit. expect(isCosmeticCommit("fix(duration): format times over 24 hours correctly")).toBe(false); expect(isCosmeticCommit("feat: add a format picker to settings")).toBe(false); }); it("handles an empty or malformed subject without throwing", () => { expect(isCosmeticCommit("")).toBe(false); expect(isCosmeticCommit(" ")).toBe(false); }); });