Skip to content

Commit

Permalink
fix(app): clarify scope-parsing behaviour for issue #50
Browse files Browse the repository at this point in the history
  • Loading branch information
uglow authored and leonardoanalista committed Sep 25, 2017
1 parent 183ae77 commit f3f66be
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
32 changes: 32 additions & 0 deletions spec/parseRawCommit.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

const parseRawCommit = require('../src/lib/parseRawCommit');
const expect = require('chai').expect;

describe('parseRawCommit', () => {
const HASH = '012345HASH';
const SUBJECT = 'subject';
const BODY = 'body';
const FOOTER = 'footer';

it('should parse a "normal" feature commit', () => {
const commit = `${HASH}\nfeat(scope): ${SUBJECT}\n\n${BODY}\n\n${FOOTER}`;

let msg = parseRawCommit(commit);

expect(msg).not.equal(null);
expect(msg.hash).to.equal(HASH);
expect(msg.subject).to.equal(SUBJECT);
expect(msg.body).to.equal(`\n${BODY}\n\n${FOOTER}`);
expect(msg.type).to.equal('feat');
expect(msg.component).to.equal('scope');
});

it('should not parse a feature commit with a scope which contains a "/" to be consistent with other commit message parsing tools', () => {
const commit = `${HASH}\nfeat(scope/foo): ${SUBJECT}\n\n${BODY}\n\n${FOOTER}`;

let msg = parseRawCommit(commit);

expect(msg).to.equal(null);
});
});
5 changes: 0 additions & 5 deletions spec/system.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,6 @@ describe('corp-semantic-release', function() {

// ####### Helpers ######

// function getBranchName() {
// var branch = shell.exec('git branch').stdout;
// return branch;
// }

function semanticRelease(params) {
return shell.exec(`node ${__dirname}/../src/index.js --mock-push 0 ${params || ''}`);
}
Expand Down

0 comments on commit f3f66be

Please sign in to comment.