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 91e575b commit 51b5e8d
Show file tree
Hide file tree
Showing 2 changed files with 12 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 @@ -11,15 +11,15 @@ const loadChangelogConfig = require('./load/changelog-config');
/**
* Generate the changelog for all the commits since the last release.
*
* @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 {Object} pluginConfig.parserOpts additional `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`.
* @param {Object} pluginConfig.writerOpts additional `conventional-changelog-writer` options that will overwrite ones loaded by `preset` or `config`.
* @param {Object} options semantic-release options
* @param {releaseNotesGeneratorCallback} callback The callback called with the release note.
*/
module.exports = async (pluginConfig, options, callback) => {
module.exports = async (pluginConfig = {}, options, callback) => {
const cb = typeof options === 'function' ? options : callback;

try {
Expand Down
10 changes: 10 additions & 0 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,13 @@ test.serial('Handle error in "conventional-changelog" and wrap in "SemanticRelea

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

test.serial('Accept an undefined "pluginConfig"', async t => {
await commits(['fix(scope1): First fix', 'feat(scope2): Second feature']);
const changelog = await pify(releaseNotesGenerator)(undefined);

t.regex(changelog, /### Bug Fixes/);
t.regex(changelog, /\* \*\*scope1:\*\* First fix/);
t.regex(changelog, /### Features/);
t.regex(changelog, /\* \*\*scope2:\*\* Second feature/);
});

0 comments on commit 51b5e8d

Please sign in to comment.