fix(release): reject validation flag values

This commit is contained in:
Vincent Koc
2026-06-21 20:05:22 +02:00
parent 7069d95720
commit bda05dbc2f
2 changed files with 4 additions and 1 deletions

View File

@@ -44,7 +44,7 @@ function runStatus(command, args, options = {}) {
function readOptionValue(argv, index, optionName) {
const value = argv[index + 1];
if (value === undefined || value === "" || value.startsWith("--")) {
if (value === undefined || value === "" || value.startsWith("-")) {
throw new Error(`${optionName} requires a value`);
}
return value;

View File

@@ -30,7 +30,10 @@ describe("full-release-validation-at-sha", () => {
it("rejects missing option values", () => {
expect(() => parseArgs(["--sha", "--dry-run"])).toThrow("--sha requires a value");
expect(() => parseArgs(["--sha", "-h"])).toThrow("--sha requires a value");
expect(() => parseArgs(["--branch"])).toThrow("--branch requires a value");
expect(() => parseArgs(["--branch", "-h"])).toThrow("--branch requires a value");
expect(() => parseArgs(["-f", "--dry-run"])).toThrow("-f requires a value");
expect(() => parseArgs(["-f", "-h"])).toThrow("-f requires a value");
});
});