fix(test): reject i18n report flag values

This commit is contained in:
Vincent Koc
2026-06-21 18:37:35 +02:00
parent d460f00eb9
commit 6c42f73619
2 changed files with 8 additions and 1 deletions

View File

@@ -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;

View File

@@ -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");