Enforce non-empty positional cwd arguments in CLI parser
Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
1 parent
b2d7c19868
commit
223f4063ec
2 files changed
+5
-1
No files matched your search
@@ -118,6 +118,10 @@ describe("parseCliOptions", () => {
|
||||
expect(options.launchCwd).toBe(path.resolve("apps/renderer"));
|
||||
});
|
||||
|
||||
it("rejects whitespace-only positional cwd arguments", () => {
|
||||
expect(() => parseCliOptions([" "], {}, "/workspace")).toThrow("Invalid value for [path]");
|
||||
});
|
||||
|
||||
it("rejects multiple positional cwd arguments", () => {
|
||||
expect(() => parseCliOptions(["apps/renderer", "apps/t3"], {}, "/workspace")).toThrow(
|
||||
"Unexpected positional argument: apps/t3",
|
||||
|
||||
+1
-1
@@ -184,7 +184,7 @@ export function parseCliOptions(
|
||||
if (usedPositionalCwd) {
|
||||
throw new Error(`Unexpected positional argument: ${arg}`);
|
||||
}
|
||||
launchCwd = path.resolve(arg);
|
||||
launchCwd = parseExplicitPath(arg, "[path]");
|
||||
usedPositionalCwd = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user