Skip to content

Commit

Permalink
fix: Accept undefined pluginConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg authored and gr2m committed Sep 18, 2017
1 parent 1a64f07 commit 853a9fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const DEFAULT_RELEASE_RULES = require('./default/release-rules');
/**
* Determine the type of release to create based on a list of commits.
*
* @param {Object} pluginConfig semantic-release configuration
* @param {Object} [pluginConfig={}] semantic-release configuration
* @param {string} pluginConfig.preset conventional-changelog preset ('angular', 'atom', 'codemirror', 'ember', 'eslint', 'express', 'jquery', 'jscs', 'jshint')
* @param {string} pluginConfig.config requierable npm package with a custom conventional-changelog preset
* @param {string|Array} pluginConfig.releaseRules a string to load an external module or an `Array` of rules.
Expand All @@ -24,7 +24,7 @@ const DEFAULT_RELEASE_RULES = require('./default/release-rules');
* @param {Array} options.commits array of commits
* @param {commitAnalyzerCallback} callback The callback called with the release type.
*/
module.exports = async (pluginConfig, {commits}, callback) => {
module.exports = async (pluginConfig = {}, {commits}, callback) => {
try {
const releaseRules = loadReleaseRules(pluginConfig);
const config = await loadParserConfig(pluginConfig);
Expand Down
7 changes: 7 additions & 0 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,10 @@ test('Handle error in "conventional-changelog-parser" and wrap in "SemanticRelea

t.true(error instanceof SemanticReleaseError);
});

test('Accept an undefined "pluginConfig"', async t => {
const commits = [{message: 'fix(scope1): First fix'}, {message: 'feat(scope2): Second feature'}];
const releaseType = await pify(commitAnalyzer)(undefined, {commits});

t.is(releaseType, 'minor');
});

0 comments on commit 853a9fa

Please sign in to comment.