fix: skip bash-dependent tests on Windows, fix platform-aware assertions
- Skip worktree test suite on Windows (uses bash shell syntax) - Skip ~ home-root directory test on Windows - Make findExecutable mock assertions platform-aware (which vs where.exe) - Use nonexistent binary name for not-found test case
This commit is contained in:
@@ -4,6 +4,8 @@ import path from "node:path";
|
|||||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||||
import { searchHomeDirectories, searchWorkspaceEntries } from "./directory-suggestions.js";
|
import { searchHomeDirectories, searchWorkspaceEntries } from "./directory-suggestions.js";
|
||||||
|
|
||||||
|
const isWindows = process.platform === "win32";
|
||||||
|
|
||||||
describe("searchHomeDirectories", () => {
|
describe("searchHomeDirectories", () => {
|
||||||
let tempRoot: string;
|
let tempRoot: string;
|
||||||
let homeDir: string;
|
let homeDir: string;
|
||||||
@@ -101,7 +103,7 @@ describe("searchHomeDirectories", () => {
|
|||||||
expect(earlierIndex).toBeLessThan(laterIndex);
|
expect(earlierIndex).toBeLessThan(laterIndex);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns home-root suggestions when query is '~'", async () => {
|
it.skipIf(isWindows)("returns home-root suggestions when query is '~'", async () => {
|
||||||
const results = await searchHomeDirectories({
|
const results = await searchHomeDirectories({
|
||||||
homeDir,
|
homeDir,
|
||||||
query: "~",
|
query: "~",
|
||||||
|
|||||||
@@ -142,9 +142,9 @@ describe("findExecutable", () => {
|
|||||||
|
|
||||||
await expect(findExecutable("codex")).resolves.toBe("/usr/local/bin/codex");
|
await expect(findExecutable("codex")).resolves.toBe("/usr/local/bin/codex");
|
||||||
expect(execFileMock).toHaveBeenCalledWith(
|
expect(execFileMock).toHaveBeenCalledWith(
|
||||||
"which",
|
process.platform === "win32" ? "where.exe" : "which",
|
||||||
["codex"],
|
["codex"],
|
||||||
{ encoding: "utf8" },
|
process.platform === "win32" ? { encoding: "utf8", windowsHide: true } : { encoding: "utf8" },
|
||||||
expect.any(Function),
|
expect.any(Function),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -170,7 +170,7 @@ describe("findExecutable", () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
await expect(findExecutable("codex")).resolves.toBeNull();
|
await expect(findExecutable(missingBinaryName)).resolves.toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import { dirname, join } from "path";
|
|||||||
import { tmpdir } from "os";
|
import { tmpdir } from "os";
|
||||||
import net from "node:net";
|
import net from "node:net";
|
||||||
|
|
||||||
describe("createWorktree", () => {
|
describe.skipIf(process.platform === "win32")("createWorktree", () => {
|
||||||
let tempDir: string;
|
let tempDir: string;
|
||||||
let repoDir: string;
|
let repoDir: string;
|
||||||
let paseoHome: string;
|
let paseoHome: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user