Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow custom note types in changelog #981

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 30 additions & 2 deletions packages/conventional-changelog-conventionalcommits/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ describe('conventionalcommits.org preset', function () {
expect(chunk).to.include('Performance Improvements')
expect(chunk).to.include('Reverts')
expect(chunk).to.include('bad commit')
expect(chunk).to.include('BREAKING CHANGE')
expect(chunk).to.include('BREAKING CHANGES')

expect(chunk).to.not.include('ci')
expect(chunk).to.not.include('feat')
Expand All @@ -135,7 +135,7 @@ describe('conventionalcommits.org preset', function () {

// CHANGELOG should group sections in order of importance:
expect(
chunk.indexOf('BREAKING CHANGE') < chunk.indexOf('Features') &&
chunk.indexOf('BREAKING CHANGES') < chunk.indexOf('Features') &&
chunk.indexOf('Features') < chunk.indexOf('Bug Fixes') &&
chunk.indexOf('Bug Fixes') < chunk.indexOf('Performance Improvements') &&
chunk.indexOf('Performance Improvements') < chunk.indexOf('Reverts')
Expand Down Expand Up @@ -187,6 +187,34 @@ describe('conventionalcommits.org preset', function () {
}))
})

it('shoud allow custom note titles', function (done) {
preparing(1)
conventionalChangelogCore({
config: require('../')({
types: [
{ type: 'chore', scope: 'deps', section: 'Dependencies' }
],
parserOpts: {
noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES", "NOTE"],
issuePrefixes: ["#", "[A-Z]{3}-"],
issuePrefixesCaseSensitive: true,
},
})
})
.on('error', function (err) {
done(err)
})
.pipe(through(function (chunk) {
chunk = chunk.toString()

expect(chunk).to.include('### Dependencies')
expect(chunk).to.include('**deps:** upgrade example from 1 to 2')

expect(chunk).to.not.include('release 0.0.0')
done()
}))
})

it('should allow matching "scope" to configuration', function (done) {
preparing(1)
conventionalChangelogCore({
Expand Down