fix: Windows test compat — shell quoting, line endings, binary names

- Replace single-quoted git commit messages in worktree tests with
  double quotes (cmd.exe doesn't treat single quotes as delimiters)
- Trim stdout in spawn tests to handle \r\n vs \n
- Use nonexistent binary name in executable test not-found case
This commit is contained in:
Mohamed Boudra
2026-04-13 20:36:59 +07:00
parent 6dfcb4daa9
commit 61201d68a6
3 changed files with 38 additions and 37 deletions
+8 -8
View File
@@ -16,10 +16,10 @@ describe("execCommand", () => {
});
test("returns stdout and stderr for a successful command", async () => {
await expect(execCommand("echo", ["hello"])).resolves.toEqual({
stdout: "hello\n",
stderr: "",
});
const result = await execCommand("echo", ["hello"]);
expect(result.stdout.trim()).toBe("hello");
expect(result.stderr).toBe("");
});
test("rejects when the command times out", async () => {
@@ -46,9 +46,9 @@ describe("execCommand", () => {
}
: { command: "pwd", args: [] };
await expect(execCommand(command.command, command.args, { cwd })).resolves.toEqual({
stdout: `${cwd}\n`,
stderr: "",
});
const result = await execCommand(command.command, command.args, { cwd });
expect(result.stdout.trim()).toBe(cwd);
expect(result.stderr).toBe("");
});
});