diff options
Diffstat (limited to 'packages/opencode/test/util/process.test.ts')
| -rw-r--r-- | packages/opencode/test/util/process.test.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/opencode/test/util/process.test.ts b/packages/opencode/test/util/process.test.ts index b9bc50f9b..1d08cba6b 100644 --- a/packages/opencode/test/util/process.test.ts +++ b/packages/opencode/test/util/process.test.ts @@ -109,4 +109,20 @@ describe("util.process", () => { expect(await proc.exited).toBe(0) }) + + test("rejects missing commands without leaking unhandled errors", async () => { + await using tmp = await tmpdir() + const cmd = path.join(tmp.path, "missing" + (process.platform === "win32" ? ".cmd" : "")) + const err = await Process.spawn([cmd], { + stdin: "pipe", + stdout: "pipe", + stderr: "pipe", + }).exited.catch((err) => err) + + expect(err).toBeInstanceOf(Error) + if (!(err instanceof Error)) throw err + expect(err).toMatchObject({ + code: "ENOENT", + }) + }) }) |
