Skip to content

Commit fd1cfe9

Browse files
committed
chore: add failing test for retaining frontmatter
Signed-off-by: Tim Knight <[email protected]>
1 parent 625d69d commit fd1cfe9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/core.spec.js

+25
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,31 @@ describe('cli', function () {
178178
content.should.not.match(/legacy header format/)
179179
})
180180

181+
it('retains any frontmatter in an existing Changelog with correct header', async function () {
182+
const { header } = require('../defaults')
183+
const frontMatter =
184+
'---\nstatus: new\n---'
185+
186+
const changelog101 =
187+
'### [1.0.1](/compare/v1.0.0...v1.0.1) (YYYY-MM-DD)\n\n\n### Bug Fixes\n\n* patch release ABCDEFXY\n'
188+
189+
const changelog100 =
190+
'### [1.0.0](/compare/v0.0.1...v1.0.0) (YYYY-MM-DD)\n\n\n### Features\n\n* Version one feature set\n'
191+
192+
const initialChangelog = frontMatter + '\n' + header + '\n' + changelog100;
193+
194+
mock({
195+
bump: 'patch',
196+
changelog: changelog101,
197+
fs: { 'CHANGELOG.md': initialChangelog },
198+
tags: ['v1.0.0']
199+
})
200+
await exec()
201+
202+
let content = fs.readFileSync('CHANGELOG.md', 'utf-8')
203+
content.should.equal(frontMatter + '\n' + header + '\n' + changelog101 + changelog100 )
204+
})
205+
181206
it('appends the new release above the last release, removing the old header (new format)', async function () {
182207
const { header } = require('../defaults')
183208
const changelog1 =

0 commit comments

Comments
 (0)