From 9908950e5260c47f2a540ec4eb09e6e1f7d11ebd Mon Sep 17 00:00:00 2001 From: cpendery Date: Fri, 20 Nov 2026 18:05:23 -0800 Subject: [PATCH 1/3] ci: install Linux shells from Ubuntu repositories --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d495ac..d5a8fb3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,9 +34,8 @@ jobs: if: matrix.os == 'ubuntu-latest' shell: bash run: | - sudo apt-add-repository ppa:fish-shell/release-3 sudo apt-get update - sudo apt install fish zsh + sudo apt-get install -y fish zsh sudo chmod -R 755 /usr/share/zsh/vendor-completions sudo chown -R root:root /usr/share/zsh/vendor-completions From 63f3d785523015917f138f594fea4e38f77cc438 Mon Sep 17 00:00:00 2001 From: cpendery Date: Fri, 20 Nov 2026 18:22:16 -0800 Subject: [PATCH 2/3] test: stub installed .NET tool discovery in completion test --- src/tests/runtime/runtime.test.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/tests/runtime/runtime.test.ts b/src/tests/runtime/runtime.test.ts index 8cdaee9..3fe4196 100644 --- a/src/tests/runtime/runtime.test.ts +++ b/src/tests/runtime/runtime.test.ts @@ -27,8 +27,15 @@ jest.unstable_mockModule("../../runtime/utils.js", () => ({ ...utils, buildExecuteShellCommand: (timeout: number, signal?: AbortSignal): Fig.ExecuteCommandFunction => { const execute = utils.buildExecuteShellCommand(timeout, signal); - return (input) => - input.command === "curl" && input.args.at(-1)?.startsWith("https://azuresearch-usnc.nuget.org/query?") ? executeNugetSearch(input) : execute(input); + return async (input) => { + if (input.command === "dotnet" && input.args.join(" ") === "tool list --global") { + return { status: 0, stderr: "", stdout: "" }; + } + if (input.command === "curl" && input.args.at(-1)?.startsWith("https://azuresearch-usnc.nuget.org/query?")) { + return executeNugetSearch(input); + } + return execute(input); + }; }, })); From e622f2e76a1eaf7e0e6d6d091728115f9fed5b83 Mon Sep 17 00:00:00 2001 From: cpendery Date: Fri, 20 Nov 2026 18:40:25 -0800 Subject: [PATCH 3/3] test: exit Windows shells before closing their PTY --- src/tests/ui/autocomplete.test.ts | 6 +++--- src/tests/ui/helpers.ts | 20 +++++++++++++++----- src/tests/ui/status.test.ts | 4 ++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/tests/ui/autocomplete.test.ts b/src/tests/ui/autocomplete.test.ts index 9cfef56..a274a10 100644 --- a/src/tests/ui/autocomplete.test.ts +++ b/src/tests/ui/autocomplete.test.ts @@ -33,7 +33,7 @@ describe("configured description layout", () => { }); afterEach(async () => { - await closeSession(terminal); + await closeSession(terminal, "bash"); terminal = undefined; }); @@ -156,7 +156,7 @@ describe("resize recovery", () => { terminal = await startSession({ label: "bash-resize", shell: "bash", env: { BASH_SILENCE_DEPRECATION_WARNING: "1" } }, ["-T", "-s", "bash"]); }); afterEach(async () => { - await closeSession(terminal); + await closeSession(terminal, "bash"); }); test("restores input and suggestions after becoming too narrow", async () => { @@ -242,7 +242,7 @@ configs.map((config) => { terminal = await startSession(config, args); }); afterEach(async () => { - await closeSession(terminal); + await closeSession(terminal, config.shell); }); test("basic git suggestions", async () => { diff --git a/src/tests/ui/helpers.ts b/src/tests/ui/helpers.ts index 65d08a5..0f8226b 100644 --- a/src/tests/ui/helpers.ts +++ b/src/tests/ui/helpers.ts @@ -64,11 +64,21 @@ export const expectPrompt = async (terminal: TuiTest, timeout = promptTimeout): await terminal.waitIdle(); }; -export const closeSession = async (terminal: TuiTest | undefined): Promise => { - if (terminal) { - await terminal.closeQuiet(); - untrackTerminal(terminal); +export const closeSession = async (terminal: TuiTest | undefined, shell: string): Promise => { + if (!terminal) return; + if (os.platform() === "win32") { + try { + // Let the nested shell exit before closing the Windows pseudoconsole. + await terminal.press("Ctrl+C"); + await terminal.waitIdle({ timeout: 5_000 }); + await terminal.write(`exit${returnChar(shell)}`); + await terminal.waitExit({ timeout: 5_000 }); + } catch { + // Fall back to closing directly if the shell has already exited or is unresponsive. + } } + await terminal.closeQuiet(); + untrackTerminal(terminal); }; const baseEnv = { ISTERM: "0", ISTERM_TESTING: "0" }; @@ -86,7 +96,7 @@ export const startSession = async (config: ShellConfig, args: string[], cols = 8 await expectPrompt(terminal); return terminal; } catch (error) { - await closeSession(terminal); + await closeSession(terminal, config.shell); throw error; } }; diff --git a/src/tests/ui/status.test.ts b/src/tests/ui/status.test.ts index e51e1fd..6902cef 100644 --- a/src/tests/ui/status.test.ts +++ b/src/tests/ui/status.test.ts @@ -18,7 +18,7 @@ describe("status checks", () => { terminal = await startSession({ label: "status", shell }, ["-T", "-s", shell]); }); afterEach(async () => { - await closeSession(terminal); + await closeSession(terminal, shell); }); test("current status", async () => { @@ -33,7 +33,7 @@ describe("status checks", () => { terminal = await startShell(shell); }); afterEach(async () => { - await closeSession(terminal); + await closeSession(terminal, shell); }); test("current status", async () => {