fix(test): use Bun.spawnSync in command discovery test to avoid execFileSync mock leakage

The opencode-project-command-discovery test used execFileSync for git init,
which collided with image-converter.test.ts's global execFileSync mock when
running in parallel on Linux CI. Switching to Bun.spawnSync avoids the mock
entirely since spyOn(childProcess, 'execFileSync') doesn't affect Bun APIs.

Fixes CI flake that only reproduced on Linux.
This commit is contained in:
YeonGyu-Kim
2026-03-26 19:47:25 +09:00
parent 1c54fdad26
commit f419a3a925
@@ -1,4 +1,3 @@
import { execFileSync } from "node:child_process"
import { afterEach, beforeEach, describe, expect, it } from "bun:test"
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs"
import { tmpdir } from "node:os"
@@ -27,9 +26,12 @@ describe("opencode project command discovery", () => {
const nestedDirectory = join(repositoryDir, "packages", "app", "src")
mkdirSync(nestedDirectory, { recursive: true })
execFileSync("git", ["init"], {
// Use Bun.spawnSync instead of execFileSync to avoid mock leakage
// from parallel test files (e.g. image-converter.test.ts mocks execFileSync globally)
Bun.spawnSync(["git", "init"], {
cwd: repositoryDir,
stdio: ["ignore", "ignore", "ignore"],
stdout: "ignore",
stderr: "ignore",
})
writeCommand(