From e0d2e719a25cf8472e1ee408bba3275c8c55cac6 Mon Sep 17 00:00:00 2001 From: "devsy-app[bot]" <277138668+devsy-app[bot]@users.noreply.github.com> Date: Sat, 15 Aug 2026 10:07:05 +0000 Subject: [PATCH] style: replace banned Function type in cli test Replace the banned `Function` type with a typed execFile callback alias (`ExecCb`) in desktop/src/main/__tests__/cli.test.ts. Fixes 5 biome `lint/complexity/noBannedTypes` findings (lines 67, 99, 130, 156, 211) where mock execFile implementations used `callback: Function`. The new alias types the callback as `(error: Error | null, result: { stdout: string; stderr: string }) => void`, matching the mock's actual usage. No behavioral changes; tests and tsc still pass. This PR was created by an AI agent as part of an automated daily lint fix job. --- desktop/src/main/__tests__/cli.test.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/desktop/src/main/__tests__/cli.test.ts b/desktop/src/main/__tests__/cli.test.ts index d9391770f..82dfaecc8 100644 --- a/desktop/src/main/__tests__/cli.test.ts +++ b/desktop/src/main/__tests__/cli.test.ts @@ -5,6 +5,11 @@ import { Readable } from "node:stream" import { beforeEach, describe, expect, it, vi } from "vitest" import { CliRunner } from "../cli.js" +type ExecCb = ( + error: Error | null, + result: { stdout: string; stderr: string }, +) => void + function fakeChild() { const child = new EventEmitter() as EventEmitter & { stdout: EventEmitter @@ -59,7 +64,7 @@ describe("CliRunner", () => { typeof vi.fn > mockExecFile.mockImplementation( - (_cmd: string, _args: string[], _opts: unknown, callback: Function) => { + (_cmd: string, _args: string[], _opts: unknown, callback: ExecCb) => { callback(null, { stdout: '[{"id":"ws-1"}]', stderr: "" }) }, ) @@ -91,7 +96,7 @@ describe("CliRunner", () => { typeof vi.fn > mockExecFile.mockImplementation( - (_cmd: string, _args: string[], _opts: unknown, callback: Function) => { + (_cmd: string, _args: string[], _opts: unknown, callback: ExecCb) => { const error = new Error("Command failed") as Error & { code: number stderr: string @@ -122,7 +127,7 @@ describe("CliRunner", () => { cliError: cliErrorPayload, }) mockExecFile.mockImplementation( - (_cmd: string, _args: string[], _opts: unknown, callback: Function) => { + (_cmd: string, _args: string[], _opts: unknown, callback: ExecCb) => { const error = new Error("Command failed") as Error & { code: number stderr: string @@ -148,7 +153,7 @@ describe("CliRunner", () => { typeof vi.fn > mockExecFile.mockImplementation( - (_cmd: string, _args: string[], _opts: unknown, callback: Function) => { + (_cmd: string, _args: string[], _opts: unknown, callback: ExecCb) => { callback(null, { stdout: "v0.6.0-dev\n", stderr: "" }) }, ) @@ -203,7 +208,7 @@ describe("CliRunner", () => { typeof vi.fn > mockExecFile.mockImplementation( - (_cmd: string, _args: string[], _opts: unknown, callback: Function) => { + (_cmd: string, _args: string[], _opts: unknown, callback: ExecCb) => { callback(null, { stdout: "[]", stderr: "" }) }, )