fix keymap fallback priority and TUI config diagnostics (#27384)
This commit is contained in:
@@ -439,6 +439,25 @@ it.instance("merges keybind overrides across precedence layers", () =>
|
||||
),
|
||||
)
|
||||
|
||||
it.instance("ignores unknown keybind names without dropping valid overrides from the same file", () =>
|
||||
withCleanState(
|
||||
Effect.gen(function* () {
|
||||
const fs = yield* AppFileSystem.Service
|
||||
const test = yield* TestInstance
|
||||
yield* fs.writeJson(path.join(Global.Path.config, "tui.json"), {
|
||||
keybinds: {
|
||||
session_delete: "ctrl+d",
|
||||
not_a_real_keybind: "ctrl+q",
|
||||
},
|
||||
})
|
||||
|
||||
const config = yield* getTuiConfig(test.directory)
|
||||
expect(config.keybinds.get("session.delete")?.[0]?.key).toBe("ctrl+d")
|
||||
expect(config.keybinds.get("not_a_real_keybind")).toEqual([])
|
||||
}),
|
||||
),
|
||||
)
|
||||
|
||||
it.instance("resolves keybind lookup from canonical keybinds", () =>
|
||||
withCleanState(
|
||||
Effect.gen(function* () {
|
||||
|
||||
@@ -47,3 +47,31 @@ it.live("init cleanup keeps the newest timestamped logs", () =>
|
||||
expect(next).toContain(list.at(-1)!)
|
||||
}),
|
||||
)
|
||||
|
||||
it.live("local dev log is not truncated twice for the same run", () =>
|
||||
Effect.gen(function* () {
|
||||
const log = Global.Path.log
|
||||
const runID = process.env.OPENCODE_RUN_ID
|
||||
const initialized = process.env.OPENCODE_LOG_INITIALIZED_RUN_ID
|
||||
yield* Effect.addFinalizer(() =>
|
||||
Effect.sync(() => {
|
||||
Global.Path.log = log
|
||||
if (runID === undefined) delete process.env.OPENCODE_RUN_ID
|
||||
else process.env.OPENCODE_RUN_ID = runID
|
||||
if (initialized === undefined) delete process.env.OPENCODE_LOG_INITIALIZED_RUN_ID
|
||||
else process.env.OPENCODE_LOG_INITIALIZED_RUN_ID = initialized
|
||||
}),
|
||||
)
|
||||
|
||||
const dir = yield* tmpdirScoped()
|
||||
Global.Path.log = dir
|
||||
process.env.OPENCODE_RUN_ID = "run-1"
|
||||
delete process.env.OPENCODE_LOG_INITIALIZED_RUN_ID
|
||||
|
||||
yield* Effect.promise(() => Log.init({ print: false, dev: true }))
|
||||
yield* Effect.promise(() => fs.writeFile(path.join(dir, "dev.log"), "main startup\n"))
|
||||
yield* Effect.promise(() => Log.init({ print: false, dev: true }))
|
||||
|
||||
expect(yield* Effect.promise(() => fs.readFile(path.join(dir, "dev.log"), "utf8"))).toContain("main startup")
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user