diff --git a/scripts/dev-runner.mjs b/scripts/dev-runner.mjs index 67ffbc2b69..1c6efcc63d 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 98dd5bd53b..4501bf7922 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", () => {