Skip to content

Commit

Permalink
ci(coverage): remove already tested branches not showing up in coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jimthedev committed Jan 6, 2017
1 parent dd9298f commit a97e3f8
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"babel-preset-stage-2": "6.18.0",
"chai": "3.5.0",
"codecov.io": "0.1.6",
"cz-conventional-changelog-default-export": "0.0.0-semantically-released.1",
"eslint": "3.12.2",
"eslint-config-standard": "6.2.1",
"eslint-plugin-promise": "3.4.0",
Expand Down
7 changes: 5 additions & 2 deletions src/commitizen/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ function getNearestNodeModulesDirectory(options) {
// Get the nearest node_modules directories to the current working directory
let nodeModulesDirectories = findNodeModules(options);

// Make sure we find a node_modules folder
// Make sure we find a node_modules folder

/* istanbul ignore else */
if(nodeModulesDirectories && nodeModulesDirectories.length > 0) {
return nodeModulesDirectories[0];
} else {
Expand Down Expand Up @@ -113,7 +115,8 @@ function getPrompter(adapterPath) {

// Load the adapter
let adapter = require(resolvedAdapterPath);


/* istanbul ignore next */
if(adapter && adapter.prompter && isFunction(adapter.prompter)) {
return adapter.prompter;
} else if (adapter && adapter.default && adapter.default.prompter && isFunction(adapter.default.prompter)) {
Expand Down
1 change: 1 addition & 0 deletions src/git/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function commit(sh, repoPath, message, options, done) {
stdio: options.quiet ? 'ignore' : 'inherit'
}, function(error, stdout, stderror) {
if (error) {
/* istanbul ignore next */
error.message = [error.message, stderror].filter(Boolean).join('\n');
return done(error);
}
Expand Down
36 changes: 36 additions & 0 deletions test/tests/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,42 @@ describe('adapter', function() {
expect(function() {adapter.getPrompter(adapterConfig.path); }).not.to.throw(Error);
expect(isFunction(adapter.getPrompter(adapterConfig.path))).to.be.true;
});

it('gets adapter prompter functions for default export adapters', function(){

this.timeout(config.maxTimeout); // this could take a while

// SETUP

// Describe a repo and some files to add and commit
let repoConfig = {
path: config.paths.endUserRepo,
files: {
dummyfile: {
contents: `duck-duck-goose`,
filename: `mydummyfile.txt`,
},
gitignore: {
contents: `node_modules/`,
filename: `.gitignore`
}
}
};

// Describe an adapter
let adapterConfig = {
path: path.join(repoConfig.path, '/node_modules/cz-conventional-changelog-default-export'),
npmName: 'cz-conventional-changelog-default-export'
};

// Install an adapter
commitizenInit(sh, config.paths.endUserRepo, 'cz-conventional-changelog-default-export');

// TEST
expect(function() {adapter.getPrompter('IAMANIMPOSSIBLEPATH'); }).to.throw(Error);
expect(function() {adapter.getPrompter(adapterConfig.path); }).not.to.throw(Error);
expect(isFunction(adapter.getPrompter(adapterConfig.path))).to.be.true;
});

});

Expand Down
1 change: 1 addition & 0 deletions test/tests/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ before(function() {

beforeEach(function() {
this.timeout(config.maxTimeout); // this could take a while
/* istanbul ignore next */
repo.createEndUser(sh, config.paths.endUserRepo);
});

Expand Down

0 comments on commit a97e3f8

Please sign in to comment.