commit c41cd39eb0dee37e4735534d77727a1254f34765
parent df007e395bef2b5dba684a1bf53303d866204186
Author: Henry Unite <unitehenry@gmail.com>
Date: Sun, 15 Nov 2026 19:42:16 +0000
test(opencode): dispose the SDK client with `await using`
Replace the explicit `opencode?.[Symbol.asyncDispose]?.()` call in
afterEach with an `await using` declaration, which runs the async dispose
protocol when the callback scope ends. A comment documents the behaviour,
including the no-op case when opencode was never created.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/opencode.test.ts b/opencode.test.ts
@@ -47,7 +47,10 @@ describe("opencode", () => {
});
afterEach(async () => {
- await opencode?.[Symbol.asyncDispose]?.();
+ // `await using` registers opencode for disposal when this callback's scope
+ // ends, which calls opencode[Symbol.asyncDispose]() for us. It is a no-op
+ // if opencode is undefined (e.g. beforeEach failed before creating it).
+ await using _close = opencode;
});
it("registers openpod plugin with opencode", async () => {