Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions src/tests/runtime/runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
},
}));

Expand Down
6 changes: 3 additions & 3 deletions src/tests/ui/autocomplete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("configured description layout", () => {
});

afterEach(async () => {
await closeSession(terminal);
await closeSession(terminal, "bash");
terminal = undefined;
});

Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
Expand Down
20 changes: 15 additions & 5 deletions src/tests/ui/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,21 @@ export const expectPrompt = async (terminal: TuiTest, timeout = promptTimeout):
await terminal.waitIdle();
};

export const closeSession = async (terminal: TuiTest | undefined): Promise<void> => {
if (terminal) {
await terminal.closeQuiet();
untrackTerminal(terminal);
export const closeSession = async (terminal: TuiTest | undefined, shell: string): Promise<void> => {
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" };
Expand All @@ -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;
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/tests/ui/status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -33,7 +33,7 @@ describe("status checks", () => {
terminal = await startShell(shell);
});
afterEach(async () => {
await closeSession(terminal);
await closeSession(terminal, shell);
});

test("current status", async () => {
Expand Down
Loading