refactor: make formatter config opt-in (#22997)

This commit is contained in:
Dax
2026-04-16 22:33:09 -04:00
committed by GitHub
parent f135c0b5ee
commit 220e3e9a2b
9 changed files with 313 additions and 144 deletions

View File

@@ -142,6 +142,42 @@ test("loads JSON config file", async () => {
})
})
test("loads formatter boolean config", async () => {
await using tmp = await tmpdir({
init: async (dir) => {
await writeConfig(dir, {
$schema: "https://opencode.ai/config.json",
formatter: true,
})
},
})
await Instance.provide({
directory: tmp.path,
fn: async () => {
const config = await load()
expect(config.formatter).toBe(true)
},
})
})
test("loads lsp boolean config", async () => {
await using tmp = await tmpdir({
init: async (dir) => {
await writeConfig(dir, {
$schema: "https://opencode.ai/config.json",
lsp: true,
})
},
})
await Instance.provide({
directory: tmp.path,
fn: async () => {
const config = await load()
expect(config.lsp).toBe(true)
},
})
})
test("loads project config from Git Bash and MSYS2 paths on Windows", async () => {
// Git Bash and MSYS2 both use /<drive>/... paths on Windows.
await check((dir) => {