Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

- Split prompt + image-only turns match `userMessage` on Anthropic, Gemini, Bedrock, Cohere (#643)
- Split prompt + image-only turns match `userMessage` on Gemini Live too (#648)
- `llmock` now errors on blank `--port`/`--host`/`--latency`/... values instead of starting (#644)

## [1.48.1] - 2026-11-20

Expand Down
10 changes: 10 additions & 0 deletions src/__tests__/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@ describe.skipIf(!CLI_AVAILABLE)("CLI: argument validation", () => {
expect(code).toBe(1);
});

for (const name of ["port", "host", "latency", "journal-max", "fixture-counts-max"]) {
for (const blank of ["", " "]) {
it(`rejects --${name} with a blank value (${JSON.stringify(blank)})`, async () => {
const { stderr, code } = await runCli([`--${name}`, blank]);
expect(stderr).toContain(`--${name} requires a non-empty value`);
expect(code).toBe(1);
});
}
}

it("rejects --journal-max=-5 (negative)", async () => {
const { stderr, code } = await runCli(["--journal-max=-5"]);
expect(stderr).toContain("Invalid journal-max");
Expand Down
12 changes: 12 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ if (values.help) {
process.exit(0);
}

// An option GIVEN with a blank value is a usage error, not "not given": Number("") is 0,
// so a blank --port bound a random port, a blank --journal-max / --fixture-counts-max
// meant "unbounded", and a blank --host reached listen() as "", which binds every
// interface instead of the documented 127.0.0.1. (aimock-cli.ts refuses the same.)
for (const name of ["port", "host", "latency", "journal-max", "fixture-counts-max"] as const) {
const value = values[name];
if (value !== undefined && value.trim() === "") {
console.error(`Error: --${name} requires a non-empty value.\n\n${HELP}`);
process.exit(1);
}
}

const port = Number(values.port);
const host = values.host!;
const latency = Number(values.latency);
Expand Down
Loading