fix(scripts): reject short flag performance summary paths

This commit is contained in:
Vincent Koc 2026-06-21 22:02:05 +02:00
parent 6399eb8191
commit 8102d5ebc3
No known key found for this signature in database
2 changed files with 2 additions and 1 deletions

View file

@ -8,7 +8,7 @@ import { pathToFileURL } from "node:url";
function readOptionValue(argv, index, optionName) {
const value = argv[index + 1];
if (!value || value.startsWith("--")) {
if (!value || value.startsWith("-")) {
throw new Error(`${optionName} requires a value`);
}
return value;

View file

@ -134,6 +134,7 @@ describe("parseArgs", () => {
for (const flag of ["--source-dir", "--baseline-source-dir", "--output"]) {
expect(() => parseArgs([flag])).toThrow(`${flag} requires a value`);
expect(() => parseArgs([flag, ""])).toThrow(`${flag} requires a value`);
expect(() => parseArgs([flag, "-h"])).toThrow(`${flag} requires a value`);
expect(() => parseArgs([flag, "--source-dir", "reports/current"])).toThrow(
`${flag} requires a value`,
);