fix: Accept undefined values for the getLastRelease and generateNotes plugins

Adapt tests and default value to the plugin definitions (`definitions.js`)
This commit is contained in:
Pierre Vanduynslager
2017-11-29 18:06:14 -05:00
parent a7359bffb6
commit d7b323dd00
4 changed files with 55 additions and 6 deletions
+2 -1
View File
@@ -18,6 +18,7 @@ const getVersionHead = require('./get-version-head');
* @typedef {Object} LastRelease
* @property {string} version The version number of the last release.
* @property {string} [gitHead] The commit sha used to make the last release.
* @property {string} [gitTag] The tag used to make the last release.
*/
/**
@@ -45,7 +46,7 @@ const getVersionHead = require('./get-version-head');
* @throws {SemanticReleaseError} with code `ENOTINHISTORY` if `lastRelease.gitHead` or the commit sha derived from `config.lastRelease.version` is not in the direct history of `branch`.
* @throws {SemanticReleaseError} with code `ENOGITHEAD` if `lastRelease.gitHead` is undefined and no commit sha can be found for the `config.lastRelease.version`.
*/
module.exports = async ({version, gitHead}, branch, logger) => {
module.exports = async ({version, gitHead} = {}, branch, logger) => {
let gitTag;
if (gitHead || version) {
try {