fix(opencode): terminate help output with newline (#30992)
This commit is contained in:
@@ -55,7 +55,7 @@ function show(out: string) {
|
|||||||
const text = out.trimStart()
|
const text = out.trimStart()
|
||||||
if (!text.startsWith("opencode ")) {
|
if (!text.startsWith("opencode ")) {
|
||||||
process.stderr.write(UI.logo() + EOL + EOL)
|
process.stderr.write(UI.logo() + EOL + EOL)
|
||||||
process.stderr.write(text)
|
process.stderr.write(text + EOL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
process.stderr.write(out)
|
process.stderr.write(out)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
// version (changes per release), so we'd snapshot a moving target.
|
// version (changes per release), so we'd snapshot a moving target.
|
||||||
import { describe, expect } from "bun:test"
|
import { describe, expect } from "bun:test"
|
||||||
import { Effect } from "effect"
|
import { Effect } from "effect"
|
||||||
|
import { EOL } from "os"
|
||||||
import { cliIt } from "../../lib/cli-process"
|
import { cliIt } from "../../lib/cli-process"
|
||||||
import { normalizeForSnapshot, PATH_SEP } from "../../lib/snapshot"
|
import { normalizeForSnapshot, PATH_SEP } from "../../lib/snapshot"
|
||||||
|
|
||||||
@@ -98,6 +99,10 @@ describe("opencode CLI help-text snapshots", () => {
|
|||||||
"every documented command emits stable help text",
|
"every documented command emits stable help text",
|
||||||
({ opencode }) =>
|
({ opencode }) =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
|
const topLevel = yield* opencode.spawn(["--help"], { env: SNAPSHOT_ENV })
|
||||||
|
expect(topLevel.exitCode).toBe(0)
|
||||||
|
expect(topLevel.stderr.endsWith(EOL)).toBe(true)
|
||||||
|
|
||||||
const argvs: Array<readonly string[]> = [...TOP_LEVEL.map((c) => [c] as const), ...SUBCOMMANDS]
|
const argvs: Array<readonly string[]> = [...TOP_LEVEL.map((c) => [c] as const), ...SUBCOMMANDS]
|
||||||
|
|
||||||
// Spawn in parallel, then assert in argv order so snapshot output is
|
// Spawn in parallel, then assert in argv order so snapshot output is
|
||||||
|
|||||||
Reference in New Issue
Block a user