Skip zsh-dependent terminal tests when /bin/zsh is unavailable
CI runners (Ubuntu) don't have zsh installed. Skip the two tests that explicitly spawn /bin/zsh rather than failing the entire suite.
This commit is contained in:
@@ -9,10 +9,20 @@ import {
|
|||||||
resolveZshShellIntegrationDir,
|
resolveZshShellIntegrationDir,
|
||||||
type TerminalSession,
|
type TerminalSession,
|
||||||
} from "./terminal.js";
|
} from "./terminal.js";
|
||||||
import { chmodSync, mkdtempSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
import {
|
||||||
|
chmodSync,
|
||||||
|
existsSync,
|
||||||
|
mkdtempSync,
|
||||||
|
mkdirSync,
|
||||||
|
rmSync,
|
||||||
|
statSync,
|
||||||
|
writeFileSync,
|
||||||
|
} from "node:fs";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
|
|
||||||
|
const hasZsh = existsSync("/bin/zsh");
|
||||||
|
|
||||||
// Extract text from a single row
|
// Extract text from a single row
|
||||||
function getRowText(state: ReturnType<TerminalSession["getState"]>, rowIndex: number): string {
|
function getRowText(state: ReturnType<TerminalSession["getState"]>, rowIndex: number): string {
|
||||||
return state.grid[rowIndex]
|
return state.grid[rowIndex]
|
||||||
@@ -352,7 +362,7 @@ describe("Terminal", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("terminal title", () => {
|
describe("terminal title", () => {
|
||||||
it("restores the user's ZDOTDIR through the zsh wrapper", async () => {
|
it.skipIf(!hasZsh)("restores the user's ZDOTDIR through the zsh wrapper", async () => {
|
||||||
const homeDir = mkdtempSync(join(tmpdir(), "terminal-zsh-home-"));
|
const homeDir = mkdtempSync(join(tmpdir(), "terminal-zsh-home-"));
|
||||||
temporaryDirs.push(homeDir);
|
temporaryDirs.push(homeDir);
|
||||||
const realZdotdir = join(homeDir, ".config", "zsh");
|
const realZdotdir = join(homeDir, ".config", "zsh");
|
||||||
@@ -467,7 +477,7 @@ describe("Terminal", () => {
|
|||||||
unsubscribeTitle();
|
unsubscribeTitle();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("emits zsh shell integration titles for commands and prompts", async () => {
|
it.skipIf(!hasZsh)("emits zsh shell integration titles for commands and prompts", async () => {
|
||||||
const homeDir = mkdtempSync(join(tmpdir(), "terminal-zsh-integration-home-"));
|
const homeDir = mkdtempSync(join(tmpdir(), "terminal-zsh-integration-home-"));
|
||||||
temporaryDirs.push(homeDir);
|
temporaryDirs.push(homeDir);
|
||||||
const realZdotdir = join(homeDir, ".config", "zsh");
|
const realZdotdir = join(homeDir, ".config", "zsh");
|
||||||
|
|||||||
Reference in New Issue
Block a user