diff --git a/pr-checks/post-comment.test.ts b/pr-checks/post-comment.test.ts index 8c1ad5d83..d82f5d249 100644 --- a/pr-checks/post-comment.test.ts +++ b/pr-checks/post-comment.test.ts @@ -64,14 +64,14 @@ describe("parseOptions", async () => { await it("rejects an empty --marker", () => { assert.throws( () => parseOptions(withFlag("--marker", "")), - /Missing required flag --marker/, + /The value for --marker cannot be empty/, ); }); await it("rejects a whitespace-only --marker", () => { assert.throws( () => parseOptions(withFlag("--marker", " \t\n")), - /Missing required flag --marker/, + /The value for --marker cannot be empty/, ); }); }); diff --git a/pr-checks/post-comment.ts b/pr-checks/post-comment.ts index 8c9703357..20dad0cf0 100644 --- a/pr-checks/post-comment.ts +++ b/pr-checks/post-comment.ts @@ -46,12 +46,16 @@ export function parseOptions(argv?: string[]): Options { strict: true, }); - assert(values.marker?.trim(), "Missing required flag --marker."); + assert(values.marker !== undefined, "Missing required flag --marker."); + assert( + values.marker.trim() !== "", + "The value for --marker cannot be empty.", + ); const [owner, repo] = values.repository!.split("/"); return { body: values.body!, - marker: values.marker!, + marker: values.marker, issueId: Number(values["issue-id"]), repository: { owner, repo }, };