Skip to content

Commit

Permalink
fix(analyzer): Fix commit behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotttf committed Feb 17, 2017
1 parent 78025ae commit a2a01ec
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = (config, { commits }, cb) => {
mergePattern,
mergeCorrespondence,
};
commits.map(commit => parser(commit, parserOptions))
commits.map(commit => parser(`${commit.hash}\n${commit.message}`, parserOptions))
.filter(commit => commit)
.every((commit) => {
// TODO - handle squash merge commits with lots of sub-commits.
Expand Down
41 changes: 38 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ module.exports = {
test.expect(1);
analyzer(
{},
{ commits: ['feat(thing): Added the thing\nBREAKING CHANGE: api change'] },
{
commits: [{
hash: '',
message: 'feat(thing): Added the thing\nBREAKING CHANGE: api change',
}],
},
(err, type) => {
test.equal(type, 'major', 'Unexpected type.');
test.done();
Expand All @@ -18,7 +23,7 @@ module.exports = {
test.expect(1);
analyzer(
{},
{ commits: ['feat(thing): Added the thing'] },
{ commits: [{ hash: '', message: 'feat(thing): Added the thing' }] },
(err, type) => {
test.equal(type, 'minor', 'Unexpected type.');
test.done();
Expand All @@ -28,12 +33,42 @@ module.exports = {
test.expect(1);
analyzer(
{},
{ commits: ['fix(thing): Added the thing'] },
{ commits: [{ hash: '', message: 'fix(thing): Added the thing' }] },
(err, type) => {
test.equal(type, 'patch', 'Unexpected type.');
test.done();
});
},
},
majorConfig(test) {
test.expect(1);
analyzer(
{ majorTypes: ['break'] },
{ commits: [{ hash: '', message: 'break(thing): Added the thing' }] },
(err, type) => {
test.equal(type, 'major', 'Unexpected type.');
test.done();
});
},
minorConfig(test) {
test.expect(1);
analyzer(
{ minorTypes: ['minor'] },
{ commits: [{ hash: '', message: 'minor(thing): Added the thing' }] },
(err, type) => {
test.equal(type, 'minor', 'Unexpected type.');
test.done();
});
},
patchConfig(test) {
test.expect(1);
analyzer(
{ patchTypes: ['patch'] },
{ commits: [{ hash: '', message: 'patch(thing): Added the thing' }] },
(err, type) => {
test.equal(type, 'patch', 'Unexpected type.');
test.done();
});
},
};

0 comments on commit a2a01ec

Please sign in to comment.