Reject flag tokens as values in dev-runner arg parsing

- Treat `--` and `-...` tokens after value flags as missing values
- Add regression test for `--state-dir --continue` to throw the expected error
This commit is contained in:
Julius Marminge committed 2026-02-26 18:21:38 -08:00
1 parent 008fbdd587
commit 16d3376410
2 files changed
+7 -1

No files matched your search

+1 -1
View File
@@ -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;
+6
View File
@@ -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", () => {