Skip to content

Commit 91ba9f2

Browse files
authored
fix(tui): repair baseline unit failures (#42198)
1 parent 3125f67 commit 91ba9f2

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎packages/drive/test/cli/integration.test.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ describe("opencode-drive", () => {
120120
expect(initStatus).toBe(0)
121121
const artifacts = initOutput.trim()
122122
expect(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).exists()).toBe(true)
123-
expect(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).json()).toMatchObject({
123+
expect(
124+
Bun.JSONC.parse(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).text()),
125+
).toMatchObject({
124126
model: "simulation/gpt-sim-model",
125127
snapshots: false,
126128
permissions: [{ action: "*", resource: "*", effect: "allow" }],
@@ -765,13 +767,15 @@ describe("opencode-drive", () => {
765767
gitWriteError: expect.stringContaining("must not modify Git metadata"),
766768
matches: true,
767769
})
768-
expect(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).json()).toMatchObject({
770+
expect(
771+
Bun.JSONC.parse(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).text()),
772+
).toMatchObject({
769773
autoupdate: false,
770774
model: "simulation/gpt-sim-model",
771775
providers: { simulation: { models: { "gpt-sim-model": {} } } },
772776
test: { declared: true, setup: true },
773777
})
774-
expect(await Bun.file(join(artifacts, "files", ".opencode", "tui.jsonc")).json()).toEqual({
778+
expect(Bun.JSONC.parse(await Bun.file(join(artifacts, "files", ".opencode", "tui.jsonc")).text())).toEqual({
775779
test: { declared: true, setup: true },
776780
})
777781
const backendEvents = (await Bun.file(join(artifacts, "backend-events.jsonl")).text())

‎packages/drive/test/instance/config.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe("instance configuration", () => {
1515
const root = await initializeInstance()
1616
artifacts.push(root)
1717

18-
expect(await Bun.file(join(root, "files", ".opencode", "opencode.jsonc")).json()).toMatchObject({
18+
expect(Bun.JSONC.parse(await Bun.file(join(root, "files", ".opencode", "opencode.jsonc")).text())).toMatchObject({
1919
model: "simulation/gpt-sim-model",
2020
providers: {
2121
simulation: {

‎packages/tui/src/mini/mono.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ function monoRenderable(renderable: Renderable): void {
9191

9292
function monoCode(renderable: CodeRenderable): void {
9393
const onChunks = renderable.onChunks
94-
const prose = renderable.filetype === "markdown" && onChunks !== undefined
9594
renderable.onChunks = async (chunks, context) => monoChunks((await onChunks?.(chunks, context)) ?? chunks)
9695
renderable.treeSitterClient = monoTreeSitter(renderable.treeSitterClient)
9796

@@ -112,11 +111,11 @@ function monoCode(renderable: CodeRenderable): void {
112111
configurable: true,
113112
get: contentGetter,
114113
set(value: string) {
115-
if (!prose || !isStyledText(Reflect.get(renderable, "_initialStyledText"))) {
114+
if (renderable.filetype !== "markdown" || !isStyledText(Reflect.get(renderable, "_initialStyledText"))) {
116115
renderable.drawUnstyledText = true
117116
renderable.initialStyledText = stringToStyledText(value)
118117
}
119-
contentSetter(value)
118+
contentSetter(renderable.filetype === "markdown" ? value : monoText(value))
120119
},
121120
})
122121

0 commit comments

Comments
 (0)