diff --git a/scripts/lib/report-cli-helpers.mjs b/scripts/lib/report-cli-helpers.mjs index 46e4950af96..ac71227e4fd 100644 --- a/scripts/lib/report-cli-helpers.mjs +++ b/scripts/lib/report-cli-helpers.mjs @@ -7,7 +7,7 @@ import path from "node:path"; */ function readReportOptionValue(argv, index, optionName) { const value = argv[index + 1]; - if (value === undefined || value === "" || value.startsWith("--")) { + if (value === undefined || value === "" || value.startsWith("-")) { throw new Error(`Expected ${optionName} .`); } return value; diff --git a/test/scripts/report-cli-helpers.test.ts b/test/scripts/report-cli-helpers.test.ts index b8949be796c..ab72ad51f55 100644 --- a/test/scripts/report-cli-helpers.test.ts +++ b/test/scripts/report-cli-helpers.test.ts @@ -23,10 +23,15 @@ describe("report-cli-helpers", () => { expect(() => parseReportCliArgs(["--root", "--json", "report.json"])).toThrow( "Expected --root .", ); + expect(() => parseReportCliArgs(["--root", "-h"])).toThrow("Expected --root ."); expect(() => parseReportCliArgs(["--json"])).toThrow("Expected --json ."); expect(() => parseReportCliArgs(["--json", "--markdown", "report.md"])).toThrow( "Expected --json .", ); + expect(() => parseReportCliArgs(["--json", "-h"])).toThrow("Expected --json ."); expect(() => parseReportCliArgs(["--markdown", ""])).toThrow("Expected --markdown ."); + expect(() => parseReportCliArgs(["--markdown", "-h"])).toThrow( + "Expected --markdown .", + ); }); });