diff --git a/scripts/dev-runner.mjs b/scripts/dev-runner.mjs index 67ffbc2b6937f2e14238bda30a7bf57195592e1a..1c6efcc63d6068221babce6b0509274c7f715a82 100644 --- a/scripts/dev-runner.mjs +++ b/scripts/dev-runner.mjs @@ -131,7 +131,7 @@ export function parseDevRunnerArgs(rawArgs) { let value = parsedFlag.value; if (value === undefined) { const next = args[index + 1]; - if (next === undefined) { + if (next === undefined || next === "--" || next.startsWith("-")) { throw new Error(`Missing value for --${parsedFlag.name}`); } value = next; diff --git a/scripts/dev-runner.test.ts b/scripts/dev-runner.test.ts index 98dd5bd53be814263870692c7a241bf2378757f0..4501bf7922705fdcc736004848020c1922fb4801 100644 --- a/scripts/dev-runner.test.ts +++ b/scripts/dev-runner.test.ts @@ -30,6 +30,12 @@ describe("parseDevRunnerArgs", () => { it("throws when a value flag is missing its value", () => { expect(() => parseDevRunnerArgs(["--state-dir"])).toThrow("Missing value for --state-dir"); }); + + it("throws when a value flag is followed by another flag token", () => { + expect(() => parseDevRunnerArgs(["--state-dir", "--continue"])).toThrow( + "Missing value for --state-dir", + ); + }); }); describe("createDevRunnerEnv", () => {