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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user