cz-customizable
Advanced tools
Comparing version
@@ -31,3 +31,3 @@ | ||
function addScope(scope) { | ||
if (!scope) return ''; | ||
if (!scope) return ': '; //it could be type === WIP. So there is no scope | ||
@@ -38,7 +38,2 @@ return '(' + scope.trim() + '): ' | ||
function addSubject(subject) { | ||
if (!subject) return ''; | ||
if(!answers.scope) | ||
return ': ' + subject.trim(); | ||
return subject.trim(); | ||
@@ -45,0 +40,0 @@ } |
@@ -6,4 +6,7 @@ { | ||
"scripts": { | ||
"test": "node_modules/jasmine-node/bin/jasmine-node spec/", | ||
"test": "node_modules/jasmine-node/bin/jasmine-node spec/ ", | ||
"test:coverage": "istanbul cover -x cz-config-EXAMPLE.js node_modules/jasmine-node/bin/jasmine-node spec/ ", | ||
"test:check-coverage": "istanbul check-coverage --statements 100 --branches 100 --functions 100 --lines 100", | ||
"test:watch": "node_modules/jasmine-node/bin/jasmine-node --color --autotest spec/ --watch .", | ||
"report-coverage": "cat ./coverage/lcov.info | codecov", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post" | ||
@@ -22,6 +25,9 @@ }, | ||
"devDependencies": { | ||
"codecov.io": "^0.1.6", | ||
"cz-conventional-changelog": "1.1.4", | ||
"ghooks": "^1.0.0", | ||
"istanbul": "^0.4.0", | ||
"jasmine-node": "1.14.5", | ||
"rewire": "2.4.0", | ||
"semantic-release": "4.3.5", | ||
"cz-conventional-changelog": "1.1.4" | ||
"semantic-release": "4.3.5" | ||
}, | ||
@@ -31,5 +37,8 @@ "config": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
}, | ||
"ghooks": { | ||
"pre-commit": "npm run test" | ||
} | ||
}, | ||
"version": "2.1.0" | ||
"version": "2.1.1" | ||
} |
@@ -7,2 +7,3 @@ # cz-customizable | ||
[](https://travis-ci.org/leonardoanalista/cz-customizable) | ||
@@ -9,0 +10,0 @@ Steps: |
@@ -29,8 +29,2 @@ | ||
it("should test pass", function() { | ||
expect(1).toEqual(1); | ||
module.prompter(cz, commit); | ||
expect(cz.prompt).toHaveBeenCalled(); | ||
}); | ||
it("should call cz.prompt with questions ", function() { | ||
@@ -75,2 +69,11 @@ module.prompter(cz, commit); | ||
expect(getQuestion(6).type).toEqual('confirm'); | ||
var answers = { | ||
confirmCommit: true, | ||
type: 'feat', | ||
scope: 'myScope', | ||
subject: 'create a new cool feature' | ||
}; | ||
expect(getQuestion(6).message(answers)).toMatch('Are you sure'); | ||
}); | ||
@@ -104,2 +107,32 @@ | ||
it("should call commit() function with commit message with the minimal required fields", function() { | ||
module.prompter(cz, commit); | ||
var commitAnswers = cz.prompt.mostRecentCall.args[1]; | ||
var answers = { | ||
confirmCommit: true, | ||
type: 'feat', | ||
scope: 'myScope', | ||
subject: 'create a new cool feature' | ||
}; | ||
commitAnswers(answers); | ||
expect(commit).toHaveBeenCalledWith('feat(myScope): create a new cool feature'); | ||
}); | ||
it("should suppress scope when commit type is WIP", function() { | ||
module.prompter(cz, commit); | ||
var commitAnswers = cz.prompt.mostRecentCall.args[1]; | ||
var answers = { | ||
confirmCommit: true, | ||
type: 'WIP', | ||
// scope: 'myScope', | ||
subject: 'this is my worl-in-progress' | ||
}; | ||
commitAnswers(answers); | ||
expect(commit).toHaveBeenCalledWith('WIP: this is my worl-in-progress'); | ||
}); | ||
it("should truncate first line if number of characters is higher than 200", function() { | ||
@@ -106,0 +139,0 @@ module.prompter(cz, commit); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
14550
12.08%268
9.39%57
1.79%7
75%