diff --git a/scripts/bench-gateway-startup.ts b/scripts/bench-gateway-startup.ts index 79e61f3ac52..56fbea9fefe 100644 --- a/scripts/bench-gateway-startup.ts +++ b/scripts/bench-gateway-startup.ts @@ -206,12 +206,19 @@ function readRequiredFlagValue(argv: string[], index: number, flag: string): str } function validateCliArgs(argv: string[]): void { + const seenSingleValueFlags = new Set(); 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; diff --git a/test/scripts/bench-gateway-startup.test.ts b/test/scripts/bench-gateway-startup.test.ts index f248a518888..d451d14443e 100644 --- a/test/scripts/bench-gateway-startup.test.ts +++ b/test/scripts/bench-gateway-startup.test.ts @@ -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); });