diff --git a/src/plugins/git/render.js b/src/plugins/git/render.js index 70e38c2..8c66b13 100644 --- a/src/plugins/git/render.js +++ b/src/plugins/git/render.js @@ -17,7 +17,6 @@ export function description( const hash = address.hash; const commit = repository.commits[hash]; if (commit == null) { - console.error(`Unable to find data for commit ${hash}`); return {hash}; } // This `any`-cast courtesy of facebook/flow#6927. diff --git a/src/plugins/git/render.test.js b/src/plugins/git/render.test.js index 77eee40..0997e10 100644 --- a/src/plugins/git/render.test.js +++ b/src/plugins/git/render.test.js @@ -115,14 +115,13 @@ describe("plugins/git/render", () => { expect(el.text()).toContain(commit.summary); } }); - it("logs an error for a commit not in the repository", () => { + it("renders just the hash for a commit not in the repository", () => { + // This can happen if, for instance, the GitHub plugin picks up a + // commit object that was not known to the Git plugin. (Via, say, a + // pull request that was merged but not into master, or a reference + // to a commit in a different repository.) + // const el = renderExample(unregisteredCommit); - expect(console.error).toHaveBeenCalledWith( - `Unable to find data for commit ${unregisteredCommit.hash}` - ); - // $ExpectFlowError - console.error = jest.fn(); - expect(el.find(Link)).toHaveLength(0); // Has the full hash, b.c. short hash couldn't be found expect(el.find("code").text()).toEqual(unregisteredCommit.hash);