From 94b3ec05e7061239538412dc1b6e92d23ff8e74f Mon Sep 17 00:00:00 2001 From: hasundue Date: Fri, 2 Aug 2024 17:18:57 +0900 Subject: [PATCH] refactor(cli): remove try-catch on `comareCommits` --- cli/main_test.ts | 4 ++++ cli/src/changelog.ts | 8 +------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cli/main_test.ts b/cli/main_test.ts index ff048799..b935d225 100644 --- a/cli/main_test.ts +++ b/cli/main_test.ts @@ -49,6 +49,10 @@ describe("CLI", () => { ); }); + it("should not throw with `--changelog`", async () => { + await molt("--changelog"); + }); + it("should update `deno.json` with `--write`", async () => { const { stderr, stdout } = await molt("--write"); assertEquals( diff --git a/cli/src/changelog.ts b/cli/src/changelog.ts index dc72431a..c569b31f 100644 --- a/cli/src/changelog.ts +++ b/cli/src/changelog.ts @@ -48,13 +48,7 @@ export async function printChangelog( // The dependency was newly added in this update return; } - const messages: string[] = []; - try { - // The refs might not exist - messages.push(...await compareCommits(repo, oldest, to)); - } catch { - return; - } + const messages = await compareCommits(repo, oldest, to); const root = await resolvePackageRoot(repo, pkg, to); if (!root) { // The package seems to be generated dynamically on publish