Skip to content

Commit

Permalink
Add EOL at end of file (resolves #76)
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Nov 12, 2023
1 parent bd11366 commit 545b753
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion index.js
Expand Up @@ -137,7 +137,8 @@ class ConventionalChangelog extends Plugin {
infile,
header +
(changelog ? EOL + EOL + changelog.trim() : '') +
(previousChangelog ? EOL + EOL + previousChangelog.trim() : '')
(previousChangelog ? EOL + EOL + previousChangelog.trim() : '') +
EOL
);

if (!hasInfile) {
Expand Down
11 changes: 4 additions & 7 deletions test.js
Expand Up @@ -269,7 +269,8 @@ test(`should write and update infile`, async () => {
const title = header('1.0.0', '1.1.0');
const fix1 = commit('fix', 'foo');
const feat1 = commit('feat', 'bar');
assert.match(nl(changelog), new RegExp('^' + h + EOL + EOL + title + fixes + fix1 + features + feat1 + '$'));
const first = title + fixes + fix1 + features + feat1;
assert.match(nl(changelog), new RegExp('^' + h + EOL + EOL + first + EOL + '$'));
{
add('fix', 'bar');
add('fix', 'baz');
Expand All @@ -280,12 +281,8 @@ test(`should write and update infile`, async () => {
const title2 = header('1.1.0', '1.1.1');
const fix2 = commit('fix', 'bar');
const fix3 = commit('fix', 'baz');
assert.match(
nl(changelog),
new RegExp(
'^' + h + EOL + EOL + title2 + fixes + fix2 + fix3 + EOL + EOL + title + fixes + fix1 + features + feat1 + '$'
)
);
const second = title2 + fixes + fix2 + fix3;
assert.match(nl(changelog), new RegExp('^' + h + EOL + EOL + second + EOL + EOL + first + EOL + '$'));
}
});

Expand Down

0 comments on commit 545b753

Please sign in to comment.