fix(qa): reject duplicate gateway startup controls

This commit is contained in:
Vincent Koc 2026-06-23 17:08:08 +02:00
parent 524e19726f
commit c308295cd3
No known key found for this signature in database
2 changed files with 10 additions and 0 deletions

View file

@ -206,12 +206,19 @@ function readRequiredFlagValue(argv: string[], index: number, flag: string): str
}
function validateCliArgs(argv: string[]): void {
const seenSingleValueFlags = new Set<string>();
for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index] ?? "";
if (BOOLEAN_FLAGS.has(arg)) {
continue;
}
if (VALUE_FLAGS.has(arg)) {
if (arg !== "--case") {
if (seenSingleValueFlags.has(arg)) {
throw new CliArgumentError(`${arg} was provided more than once`);
}
seenSingleValueFlags.add(arg);
}
readRequiredFlagValue(argv, index, arg);
index += 1;
continue;

View file

@ -84,6 +84,9 @@ describe("gateway startup benchmark script", () => {
expect(() => testing.parseOptions(["--case", "default", "--case", "default"])).toThrow(
'Duplicate --case "default"',
);
expect(() =>
testing.parseOptions(["--output", "first.json", "--output", "second.json"]),
).toThrow("--output was provided more than once");
expect(() => testing.resolveEntry("--inspect")).toThrow(/must be a file path/u);
});