From d9b5e778a905a55395191762f947077421746d34 Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Fri, 13 Nov 2026 05:55:21 -0600 Subject: [PATCH] test(claimant): isolate bun install state in install suite (#9529) The installer suite spawns bun with a fixture HOME and asserts the HOME tree is unchanged. On CI a bun child wrote a .bun directory into that HOME, failing expectNoWrites in 3 tests. Point BUN_INSTALL at a suite-owned temp dir removed in afterAll, so bun's state never lands in the fixture HOME. The strict expectNoWrites listing is unchanged, so a real stray write from the installer is still caught. Refs #9529 --- pm-stack/opencode-claimant/test/install.test.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pm-stack/opencode-claimant/test/install.test.mjs b/pm-stack/opencode-claimant/test/install.test.mjs index 20cefb2eda..2eb742bf6b 100644 --- a/pm-stack/opencode-claimant/test/install.test.mjs +++ b/pm-stack/opencode-claimant/test/install.test.mjs @@ -1,4 +1,4 @@ -import { describe, expect, test } from "bun:test"; +import { afterAll, describe, expect, test } from "bun:test"; import { spawnSync } from "node:child_process"; import { mkdir, mkdtemp, readFile, readdir, rm, writeFile, @@ -17,6 +17,11 @@ const recoveryMigration = await readFile( join(here, "..", "migration-0022.sql"), "utf8", ); const installer = join(here, "..", "install.mjs"); +const bunInstallState = await mkdtemp(join(tmpdir(), "opencode-claimant-bun-")); + +afterAll(async () => { + await rm(bunInstallState, { recursive: true, force: true }); +}); async function makeStores() { const home = await mkdtemp(join(tmpdir(), "opencode-claimant-install-")); @@ -43,7 +48,7 @@ async function makeStores() { function runInstaller(home, args) { return spawnSync(process.execPath, [installer, ...args], { encoding: "utf8", - env: { ...process.env, HOME: home }, + env: { ...process.env, HOME: home, BUN_INSTALL: bunInstallState }, }); }