Parse negative port args as invalid values
Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
1 parent
ea69ec16fe
commit
8f9096c626
2 files changed
+17
-2
No files matched your search
@@ -237,12 +237,24 @@ describe("parseCliOptions", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects negative backend port values provided as separate args", () => {
|
||||
expect(() => parseCliOptions(["--backend-port", "-1"], {}, "/workspace")).toThrow(
|
||||
"Invalid value for --backend-port",
|
||||
);
|
||||
});
|
||||
|
||||
it("throws when web port value is missing", () => {
|
||||
expect(() => parseCliOptions(["--web-port"], {}, "/workspace")).toThrow(
|
||||
"Missing value for --web-port",
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects negative web port values provided as separate args", () => {
|
||||
expect(() => parseCliOptions(["--web-port", "-1"], {}, "/workspace")).toThrow(
|
||||
"Invalid value for --web-port",
|
||||
);
|
||||
});
|
||||
|
||||
it("throws for invalid environment port values", () => {
|
||||
expect(() => parseCliOptions([], { T3_WEB_PORT: "nope" }, "/workspace")).toThrow(
|
||||
"Invalid value for T3_WEB_PORT",
|
||||
|
||||
+5
-2
@@ -198,7 +198,7 @@ export function parseCliOptions(
|
||||
|
||||
if (arg === "--backend-port") {
|
||||
backendPort = parseExplicitPort(
|
||||
readArgValue(argv, index, "--backend-port"),
|
||||
readArgValue(argv, index, "--backend-port", { allowDashPrefixed: true }),
|
||||
"--backend-port",
|
||||
);
|
||||
backendPortLocked = true;
|
||||
@@ -213,7 +213,10 @@ export function parseCliOptions(
|
||||
}
|
||||
|
||||
if (arg === "--web-port") {
|
||||
webPort = parseExplicitPort(readArgValue(argv, index, "--web-port"), "--web-port");
|
||||
webPort = parseExplicitPort(
|
||||
readArgValue(argv, index, "--web-port", { allowDashPrefixed: true }),
|
||||
"--web-port",
|
||||
);
|
||||
webPortLocked = true;
|
||||
index += 1;
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user