fix(tui): repair baseline unit failures (#42198)

This commit is contained in:
Kit Langton 2026-08-12 21:04:50 -04:00 committed by GitHub
parent 3125f67708
commit 91ba9f2412
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 7 deletions

View file

@ -120,7 +120,9 @@ describe("opencode-drive", () => {
expect(initStatus).toBe(0)
const artifacts = initOutput.trim()
expect(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).exists()).toBe(true)
expect(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).json()).toMatchObject({
expect(
Bun.JSONC.parse(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).text()),
).toMatchObject({
model: "simulation/gpt-sim-model",
snapshots: false,
permissions: [{ action: "*", resource: "*", effect: "allow" }],
@ -765,13 +767,15 @@ describe("opencode-drive", () => {
gitWriteError: expect.stringContaining("must not modify Git metadata"),
matches: true,
})
expect(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).json()).toMatchObject({
expect(
Bun.JSONC.parse(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).text()),
).toMatchObject({
autoupdate: false,
model: "simulation/gpt-sim-model",
providers: { simulation: { models: { "gpt-sim-model": {} } } },
test: { declared: true, setup: true },
})
expect(await Bun.file(join(artifacts, "files", ".opencode", "tui.jsonc")).json()).toEqual({
expect(Bun.JSONC.parse(await Bun.file(join(artifacts, "files", ".opencode", "tui.jsonc")).text())).toEqual({
test: { declared: true, setup: true },
})
const backendEvents = (await Bun.file(join(artifacts, "backend-events.jsonl")).text())

View file

@ -15,7 +15,7 @@ describe("instance configuration", () => {
const root = await initializeInstance()
artifacts.push(root)
expect(await Bun.file(join(root, "files", ".opencode", "opencode.jsonc")).json()).toMatchObject({
expect(Bun.JSONC.parse(await Bun.file(join(root, "files", ".opencode", "opencode.jsonc")).text())).toMatchObject({
model: "simulation/gpt-sim-model",
providers: {
simulation: {

View file

@ -91,7 +91,6 @@ function monoRenderable(renderable: Renderable): void {
function monoCode(renderable: CodeRenderable): void {
const onChunks = renderable.onChunks
const prose = renderable.filetype === "markdown" && onChunks !== undefined
renderable.onChunks = async (chunks, context) => monoChunks((await onChunks?.(chunks, context)) ?? chunks)
renderable.treeSitterClient = monoTreeSitter(renderable.treeSitterClient)
@ -112,11 +111,11 @@ function monoCode(renderable: CodeRenderable): void {
configurable: true,
get: contentGetter,
set(value: string) {
if (!prose || !isStyledText(Reflect.get(renderable, "_initialStyledText"))) {
if (renderable.filetype !== "markdown" || !isStyledText(Reflect.get(renderable, "_initialStyledText"))) {
renderable.drawUnstyledText = true
renderable.initialStyledText = stringToStyledText(value)
}
contentSetter(value)
contentSetter(renderable.filetype === "markdown" ? value : monoText(value))
},
})