opencode/packages/core/test/util/git-executable.test.ts
opencode-agent[bot] 476432de1e
fix(core): restore Windows Git fast path (#48879)
Co-authored-by: Hona <10430890+Hona@users.noreply.github.com>
2026-09-14 12:03:03 +10:00

17 lines
612 B
TypeScript

import { describe, expect, test } from "bun:test"
import path from "path"
import { resolveGitExecutable } from "@opencode/core/util/git-executable"
describe("Git executable", () => {
test("uses an absolute executable on Windows", () => {
expect(resolveGitExecutable("win32", "bin/git.exe")).toBe(path.resolve("bin/git.exe"))
})
test("leaves lookup to the process outside Windows", () => {
expect(resolveGitExecutable("linux", "/usr/bin/git")).toBe("git")
})
test("falls back to PATH lookup when Git is unresolved", () => {
expect(resolveGitExecutable("win32", null)).toBe("git")
})
})