mirror of
https://github.com/anomalyco/opencode.git
synced 2026-09-28 05:23:19 +08:00
fix(opencode): compare config snapshots as JSON (#45784)
Co-authored-by: jlongster <17031+jlongster@users.noreply.github.com>
This commit is contained in:
co-authored by
jlongster
parent
790fb5b86f
commit
15537a41d2
@@ -1,6 +1,8 @@
|
||||
import { expect } from "bun:test"
|
||||
import { ConfigParse } from "../../src/config/parse"
|
||||
|
||||
export async function snapshot(file: string, actual: string) {
|
||||
const value = ConfigParse.jsonc(actual, file)
|
||||
if (process.env.UPDATE_CONFIG_FIXTURES === "1") await Bun.write(file, actual)
|
||||
expect(actual).toBe(await Bun.file(file).text())
|
||||
expect(value).toEqual(ConfigParse.jsonc(await Bun.file(file).text(), file))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user