From 38ed261063073959fff0ee56f2a71748b90ba60c Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Sat, 25 Apr 2026 00:31:27 +0000 Subject: [PATCH] fix(test): widen capturedHandler cast to resolve TS2349 never narrowing (FAR-40) TypeScript CFA does not trace the assignment inside the vi.spyOn mockImplementation callback, so it narrows capturedHandler to null at the if-check, making the body unreachable (never). Cast at the call site breaks the false narrowing without changing runtime behaviour. Co-Authored-By: Paperclip --- src/server/execute.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/execute.test.ts b/src/server/execute.test.ts index 25e68d7..485c514 100644 --- a/src/server/execute.test.ts +++ b/src/server/execute.test.ts @@ -357,7 +357,7 @@ describe("execute — SIGTERM handler", () => { if (capturedHandler) { const batchApi = vi.mocked(getBatchApi)(); // Fire the handler and verify it deletes the job that was just created. - try { capturedHandler(); } catch { /* swallow process.exit throw */ } + try { (capturedHandler as () => void)(); } catch { /* swallow process.exit throw */ } await new Promise((r) => setTimeout(r, 50)); // let async handler tick expect(batchApi.deleteNamespacedJob).toHaveBeenCalled(); }