Skip to content

Commit 34aee9e

Browse files
committed
fix: Accept undefined pluginConfig
1 parent 1a64f07 commit 34aee9e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const DEFAULT_RELEASE_RULES = require('./default/release-rules');
1515
/**
1616
* Determine the type of release to create based on a list of commits.
1717
*
18-
* @param {Object} pluginConfig semantic-release configuration
18+
* @param {Object} [pluginConfig={}] semantic-release configuration
1919
* @param {string} pluginConfig.preset conventional-changelog preset ('angular', 'atom', 'codemirror', 'ember', 'eslint', 'express', 'jquery', 'jscs', 'jshint')
2020
* @param {string} pluginConfig.config requierable npm package with a custom conventional-changelog preset
2121
* @param {string|Array} pluginConfig.releaseRules a string to load an external module or an `Array` of rules.
@@ -24,7 +24,7 @@ const DEFAULT_RELEASE_RULES = require('./default/release-rules');
2424
* @param {Array} options.commits array of commits
2525
* @param {commitAnalyzerCallback} callback The callback called with the release type.
2626
*/
27-
module.exports = async (pluginConfig, {commits}, callback) => {
27+
module.exports = async (pluginConfig = {}, {commits}, callback) => {
2828
try {
2929
const releaseRules = loadReleaseRules(pluginConfig);
3030
const config = await loadParserConfig(pluginConfig);

test/integration.test.js

+7
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,10 @@ test('Handle error in "conventional-changelog-parser" and wrap in "SemanticRelea
187187

188188
t.true(error instanceof SemanticReleaseError);
189189
});
190+
191+
test('Accept an undefined "pluginConfig"', async t => {
192+
const commits = [{message: 'fix(scope1): First fix'}, {message: 'feat(scope2): Second feature'}];
193+
const releaseType = await pify(commitAnalyzer)(undefined, {commits});
194+
195+
t.is(releaseType, 'minor');
196+
});

0 commit comments

Comments
 (0)