Skip to content

Commit a97e3f8

Browse files
committed
ci(coverage): remove already tested branches not showing up in coverage
1 parent dd9298f commit a97e3f8

File tree

5 files changed

+44
-2
lines changed

5 files changed

+44
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"babel-preset-stage-2": "6.18.0",
5656
"chai": "3.5.0",
5757
"codecov.io": "0.1.6",
58+
"cz-conventional-changelog-default-export": "0.0.0-semantically-released.1",
5859
"eslint": "3.12.2",
5960
"eslint-config-standard": "6.2.1",
6061
"eslint-plugin-promise": "3.4.0",

src/commitizen/adapter.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ function getNearestNodeModulesDirectory(options) {
7878
// Get the nearest node_modules directories to the current working directory
7979
let nodeModulesDirectories = findNodeModules(options);
8080

81-
// Make sure we find a node_modules folder
81+
// Make sure we find a node_modules folder
82+
83+
/* istanbul ignore else */
8284
if(nodeModulesDirectories && nodeModulesDirectories.length > 0) {
8385
return nodeModulesDirectories[0];
8486
} else {
@@ -113,7 +115,8 @@ function getPrompter(adapterPath) {
113115

114116
// Load the adapter
115117
let adapter = require(resolvedAdapterPath);
116-
118+
119+
/* istanbul ignore next */
117120
if(adapter && adapter.prompter && isFunction(adapter.prompter)) {
118121
return adapter.prompter;
119122
} else if (adapter && adapter.default && adapter.default.prompter && isFunction(adapter.default.prompter)) {

src/git/commit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function commit(sh, repoPath, message, options, done) {
3131
stdio: options.quiet ? 'ignore' : 'inherit'
3232
}, function(error, stdout, stderror) {
3333
if (error) {
34+
/* istanbul ignore next */
3435
error.message = [error.message, stderror].filter(Boolean).join('\n');
3536
return done(error);
3637
}

test/tests/adapter.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,42 @@ describe('adapter', function() {
140140
expect(function() {adapter.getPrompter(adapterConfig.path); }).not.to.throw(Error);
141141
expect(isFunction(adapter.getPrompter(adapterConfig.path))).to.be.true;
142142
});
143+
144+
it('gets adapter prompter functions for default export adapters', function(){
145+
146+
this.timeout(config.maxTimeout); // this could take a while
147+
148+
// SETUP
149+
150+
// Describe a repo and some files to add and commit
151+
let repoConfig = {
152+
path: config.paths.endUserRepo,
153+
files: {
154+
dummyfile: {
155+
contents: `duck-duck-goose`,
156+
filename: `mydummyfile.txt`,
157+
},
158+
gitignore: {
159+
contents: `node_modules/`,
160+
filename: `.gitignore`
161+
}
162+
}
163+
};
164+
165+
// Describe an adapter
166+
let adapterConfig = {
167+
path: path.join(repoConfig.path, '/node_modules/cz-conventional-changelog-default-export'),
168+
npmName: 'cz-conventional-changelog-default-export'
169+
};
170+
171+
// Install an adapter
172+
commitizenInit(sh, config.paths.endUserRepo, 'cz-conventional-changelog-default-export');
173+
174+
// TEST
175+
expect(function() {adapter.getPrompter('IAMANIMPOSSIBLEPATH'); }).to.throw(Error);
176+
expect(function() {adapter.getPrompter(adapterConfig.path); }).not.to.throw(Error);
177+
expect(isFunction(adapter.getPrompter(adapterConfig.path))).to.be.true;
178+
});
143179

144180
});
145181

test/tests/commit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ before(function() {
2727

2828
beforeEach(function() {
2929
this.timeout(config.maxTimeout); // this could take a while
30+
/* istanbul ignore next */
3031
repo.createEndUser(sh, config.paths.endUserRepo);
3132
});
3233

0 commit comments

Comments
 (0)