fix(qa): reject short flag gateway smoke values

This commit is contained in:
Vincent Koc
2026-06-21 22:40:32 +02:00
parent 75a997dd7c
commit 3bae0d6b82
2 changed files with 21 additions and 1 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ function validateArgs(argv: readonly string[]): void {
}
if (VALUE_FLAGS.has(arg)) {
const value = argv[index + 1];
if (!value || value.startsWith("--")) {
if (!value || value.startsWith("-")) {
throw new GatewaySmokeArgError(`${arg} requires a value`);
}
index += 1;
@@ -203,6 +203,26 @@ describe("gateway-smoke", () => {
expect(result.stderr.trim()).toBe("Unknown argument: --wat");
});
it("rejects option-looking CLI values before connecting", () => {
for (const [flag, args] of [
["--url", ["--url", "-h", "--token", "token"]],
["--token", ["--url", "ws://127.0.0.1:9", "--token", "-h"]],
] as const) {
const result = spawnSync(
process.execPath,
["--import", "tsx", "scripts/dev/gateway-smoke.ts", ...args],
{
cwd: process.cwd(),
encoding: "utf8",
},
);
expect(result.status).toBe(1);
expect(result.stdout).toBe("");
expect(result.stderr.trim()).toBe(`${flag} requires a value`);
}
});
it("passes against a loopback gateway websocket using the real client", async () => {
const stdout: string[] = [];
const stderr: string[] = [];