Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Accept undefined pluginConfig #16

Merged
merged 1 commit into from
Sep 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/);
});