From 6c42f73619326bd7382e64f408be741ca0f89ac8 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 21 Jun 2026 18:37:35 +0200 Subject: [PATCH] fix(test): reject i18n report flag values --- scripts/control-ui-i18n-report.ts | 2 +- src/scripts/control-ui-i18n-report.test.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/control-ui-i18n-report.ts b/scripts/control-ui-i18n-report.ts index 9647f793bd4..85860e24c22 100644 --- a/scripts/control-ui-i18n-report.ts +++ b/scripts/control-ui-i18n-report.ts @@ -128,7 +128,7 @@ export function parseArgs(argv: string[]): ReportArgs { function readOptionValue(argv: string[], index: number, flag: string) { const value = argv[index]; - if (!value || value.startsWith("--")) { + if (!value || value.startsWith("-")) { throw new Error(`${flag} requires a value`); } return value; diff --git a/src/scripts/control-ui-i18n-report.test.ts b/src/scripts/control-ui-i18n-report.test.ts index 1d414be0b09..579b76c5a21 100644 --- a/src/scripts/control-ui-i18n-report.test.ts +++ b/src/scripts/control-ui-i18n-report.test.ts @@ -34,6 +34,13 @@ const entries: RawCopyBaselineEntry[] = [ ]; describe("control-ui-i18n report helpers", () => { + it.each(["--surface", "--locale", "--top"])( + "rejects option-shaped values for %s", + (flag) => { + expect(() => parseArgs([flag, "-h"])).toThrow(`${flag} requires a value`); + }, + ); + it("rejects invalid numeric limits", () => { expect(() => parseArgs(["--top", "3abc"])).toThrow("--top must be a positive integer"); expect(() => parseArgs(["--top", "1.5"])).toThrow("--top must be a positive integer");