diff --git a/test/commits.ts b/test/commits.ts index e28e4f7b5..6d3e3fb0a 100644 --- a/test/commits.ts +++ b/test/commits.ts @@ -82,6 +82,18 @@ describe('parseConventionalCommits', () => { expect(conventionalCommits[0].references[0].action).to.eql('Fixes'); }); + it('parse commits with code examples', async () => { + const commits = [buildCommitFromFixture('bug-with-code')]; + const conventionalCommits = parseConventionalCommits(commits); + expect(conventionalCommits).lengthOf(1); + expect(conventionalCommits[0].type).to.eql('fix'); + expect(conventionalCommits[0].breaking).to.be.false; + expect(conventionalCommits[0].references).lengthOf(1); + expect(conventionalCommits[0].references[0].prefix).to.eql('#'); + expect(conventionalCommits[0].references[0].issue).to.eql('123'); + expect(conventionalCommits[0].references[0].action).to.eql('Fixes'); + }); + it('captures git trailers', async () => { const commits = [buildCommitFromFixture('git-trailers-with-breaking')]; const conventionalCommits = parseConventionalCommits(commits); diff --git a/test/fixtures/commit-messages/bug-with-code.txt b/test/fixtures/commit-messages/bug-with-code.txt new file mode 100644 index 000000000..4b962cb0e --- /dev/null +++ b/test/fixtures/commit-messages/bug-with-code.txt @@ -0,0 +1,9 @@ +fix: some fix + +Example: + +``` +page.on('request', (request) => {}) +``` + +Fixes #123 \ No newline at end of file