fix(qa): reject duplicate gateway smoke options

This commit is contained in:
Vincent Koc
2026-06-23 14:52:31 +02:00
parent 475252453b
commit 5078ffdeb4
2 changed files with 36 additions and 0 deletions
+9
View File
@@ -49,9 +49,14 @@ function usage(): string {
}
function validateArgs(argv: readonly string[]): void {
const seen = new Set<string>();
for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index] ?? "";
if (BOOLEAN_FLAGS.has(arg)) {
if (seen.has(arg)) {
throw new GatewaySmokeArgError(`${arg} was provided more than once`);
}
seen.add(arg);
continue;
}
if (VALUE_FLAGS.has(arg)) {
@@ -59,6 +64,10 @@ function validateArgs(argv: readonly string[]): void {
if (!value || value.startsWith("-")) {
throw new GatewaySmokeArgError(`${arg} requires a value`);
}
if (seen.has(arg)) {
throw new GatewaySmokeArgError(`${arg} was provided more than once`);
}
seen.add(arg);
index += 1;
continue;
}