From b83dce7b3347358b7bbcd8be55ebafa68d951b22 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 21 Jun 2026 18:28:28 +0200 Subject: [PATCH] fix(test): reject rpc rtt flag values --- scripts/measure-rpc-rtt.mjs | 2 +- test/scripts/measure-rpc-rtt.test.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/measure-rpc-rtt.mjs b/scripts/measure-rpc-rtt.mjs index 612b4d604ba..ef709496f44 100644 --- a/scripts/measure-rpc-rtt.mjs +++ b/scripts/measure-rpc-rtt.mjs @@ -38,7 +38,7 @@ function usage() { function readFlagValue(argv, index, flag) { const value = argv[index + 1]; - if (!value || value.startsWith("--")) { + if (!value || value.startsWith("-")) { throw new Error(`${flag} requires a value.`); } return value; diff --git a/test/scripts/measure-rpc-rtt.test.ts b/test/scripts/measure-rpc-rtt.test.ts index e2f461cb105..4b785a59954 100644 --- a/test/scripts/measure-rpc-rtt.test.ts +++ b/test/scripts/measure-rpc-rtt.test.ts @@ -178,8 +178,10 @@ describe("scripts/measure-rpc-rtt.mjs", () => { expect(() => parseArgs(["--output-dir", "/tmp/rpc-rtt", "--methods"])).toThrow( "--methods requires a value.", ); - for (const flag of ["--output-dir", "--repo-root", "--iterations", "--methods"]) { - expect(() => parseArgs([flag, "--methods", "health"])).toThrow(`${flag} requires a value.`); + for (const value of ["--methods", "-h"]) { + for (const flag of ["--output-dir", "--repo-root", "--iterations", "--methods"]) { + expect(() => parseArgs([flag, value, "health"])).toThrow(`${flag} requires a value.`); + } } });