test: release.test.ts allocates through tmp(), like everything else under test/

The rebase onto main was textually clean and behaviourally broken, and this
PR's own guard is what caught it.

This branch removed test/release.test.ts's `mkdtempSync`/`tmpdir` imports when
it converted that file's call sites to `tmp()`. While it was open, #133's
changelog-monotonic work landed on main and added THREE new
`mkdtempSync(join(tmpdir(), ...))` sites to the same file. The two changes
never touch the same line, so git merged them without a word — leaving call
sites whose imports this branch had deleted. 20 tests died on
`ReferenceError: mkdtempSync is not defined`.

Converted all three to `tmp()`, which is what the file already imports and
what every other test file under test/ uses.

Worth noting which test failed and why it matters: test/tmp-guard.test.ts,
this PR's own class check, reported `offenders: ["release.test.ts"]`. It was
written to stop exactly this — a new raw allocation drifting in — and it did
so on a real regression rather than a synthetic one, before the fix existed.
That is the guard earning its place on its first genuine encounter.
This commit is contained in:
dan-claude-bot 2026-07-21 12:35:11 +00:00
parent 7f0e886851
commit 5075310336

View file

@ -410,7 +410,7 @@ describe("changelog-monotonic.sh — release headings are append-only (#133)", (
* whose CHANGELOG.md is `head` (unchanged when omitted). * whose CHANGELOG.md is `head` (unchanged when omitted).
*/ */
function repoWith(head?: string): string { function repoWith(head?: string): string {
const repo = mkdtempSync(join(tmpdir(), "cast-monotonic-")); const repo = tmp("cast-monotonic-");
git(repo, "init", "-q"); git(repo, "init", "-q");
git(repo, "config", "user.email", "test@example.com"); git(repo, "config", "user.email", "test@example.com");
git(repo, "config", "user.name", "test"); git(repo, "config", "user.name", "test");
@ -563,7 +563,7 @@ describe("changelog-monotonic.sh — release headings are append-only (#133)", (
* `exit 0` before uniqueness had run (#133, box#143). * `exit 0` before uniqueness had run (#133, box#143).
*/ */
function repoIntroducing(head: string): string { function repoIntroducing(head: string): string {
const repo = mkdtempSync(join(tmpdir(), "cast-monotonic-new-")); const repo = tmp("cast-monotonic-new-");
git(repo, "init", "-q"); git(repo, "init", "-q");
git(repo, "config", "user.email", "test@example.com"); git(repo, "config", "user.email", "test@example.com");
git(repo, "config", "user.name", "test"); git(repo, "config", "user.name", "test");
@ -627,7 +627,7 @@ describe("changelog-monotonic.sh — release headings are append-only (#133)", (
it("a duplicate OUTSIDE a git work tree is caught (#133)", async () => { it("a duplicate OUTSIDE a git work tree is caught (#133)", async () => {
// No git at all — a tarball, an unpacked release. Uniqueness still has // No git at all — a tarball, an unpacked release. Uniqueness still has
// everything it needs; only containment does not. // everything it needs; only containment does not.
const dir = mkdtempSync(join(tmpdir(), "cast-monotonic-nogit-")); const dir = tmp("cast-monotonic-nogit-");
writeFileSync( writeFileSync(
join(dir, "CHANGELOG.md"), join(dir, "CHANGELOG.md"),
`# Changelog\n\n${dated("0.1.1")}${body}\n${dated("0.1.1")}${body}`, `# Changelog\n\n${dated("0.1.1")}${body}\n${dated("0.1.1")}${body}`,