Support PowerShell and resolve workspaces by directory path

This commit is contained in:
Mohamed Boudra
2026-04-03 14:05:05 +07:00
parent 5d5a79a2a8
commit 449a4b48d2
10 changed files with 323 additions and 17 deletions

View File

@@ -0,0 +1,36 @@
import { describe, expect, it } from "vitest";
import { buildStringCommandShellInvocation } from "./string-command-shell.js";
describe("buildStringCommandShellInvocation", () => {
it("uses bash login-command semantics on unix platforms", () => {
expect(
buildStringCommandShellInvocation({
command: 'echo "hello"',
platform: "darwin",
}),
).toEqual({
shell: "/bin/bash",
args: ["-lc", 'echo "hello"'],
});
});
it("uses powershell command semantics on windows", () => {
expect(
buildStringCommandShellInvocation({
command: "Write-Output 'hello'",
platform: "win32",
}),
).toEqual({
shell: "powershell",
args: [
"-NoProfile",
"-NonInteractive",
"-ExecutionPolicy",
"Bypass",
"-Command",
"Write-Output 'hello'",
],
});
});
});