Expand end-of-options positional parsing coverage

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-10 01:28:02 +00:00
1 parent e060cf4fd4
commit 5f17ee8a33
1 file changed
+11
+11
View File
@@ -166,6 +166,11 @@ describe("parseCliOptions", () => {
expect(options.launchCwd).toBe(path.resolve("/workspace", "-project"));
});
it("treats known flag tokens as positional values after end-of-options marker", () => {
const options = parseCliOptions(["--", "--help"], {}, "/workspace");
expect(options.launchCwd).toBe(path.resolve("/workspace", "--help"));
});
it("throws when end-of-options marker has no positional value", () => {
expect(() => parseCliOptions(["--"], {}, "/workspace")).toThrow("Missing value for [path]");
});
@@ -176,6 +181,12 @@ describe("parseCliOptions", () => {
);
});
it("throws when end-of-options marker has extra values after flag-like path", () => {
expect(() => parseCliOptions(["--", "--help", "apps/t3"], {}, "/workspace")).toThrow(
"Unexpected positional argument: apps/t3",
);
});
it("keeps ports unlocked when using defaults", () => {
const options = parseCliOptions([], {}, "/workspace");
expect(options.backendPortLocked).toBe(false);