Skip to content
This repository has been archived by the owner on Feb 5, 2018. It is now read-only.

Commit

Permalink
fix(context.version): only valid a semver can decide context.isPatch
Browse files Browse the repository at this point in the history
  • Loading branch information
stevemao committed Feb 3, 2016
1 parent 0cc1d01 commit 59ed325
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function generate(options, commits, context, keyCommit) {
context.date = keyCommit.committerDate;
}

if (context.version) {
if (context.version && semver.valid(context.version)) {
context.isPatch = context.isPatch || semver.patch(context.version) !== 0;
}

Expand Down
15 changes: 15 additions & 0 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,21 @@ describe('conventionalChangelogWriter', function() {
}));
});

it('should not error if version is not semver', function(done) {
getStream()
.pipe(conventionalChangelogWriter({
version: 'a.b.c'
}))
.on('error', function(err) {
done(err);
})
.pipe(through(function(chunk) {
expect(chunk.toString()).to.include('a.b.c');

done();
}));
});

it('should callback with error on transform', function(done) {
getStream()
.pipe(conventionalChangelogWriter({}, {
Expand Down

0 comments on commit 59ed325

Please sign in to comment.