feat: allow publish plugins to return false in order to signify no release was done

This commit is contained in:
Pierre Vanduynslager 2018-12-14 15:58:58 -05:00
parent 2aa65ad668
commit 47484f5eb2
No known key found for this signature in database
GPG Key ID: E7684268B8C7E0A3
3 changed files with 5 additions and 4 deletions

View File

@ -73,7 +73,7 @@ module.exports = {
transform: (release, step, {nextRelease}) => ({ transform: (release, step, {nextRelease}) => ({
...nextRelease, ...nextRelease,
...(release || {}), ...(release || {}),
...step, ...(release === false ? {} : step),
}), }),
}), }),
}, },

View File

@ -22,7 +22,7 @@ test('The "generateNotes" plugin output, if defined, must be a string', t => {
t.true(plugins.generateNotes.outputValidator('string')); t.true(plugins.generateNotes.outputValidator('string'));
}); });
test('The "publish" plugin output, if defined, must be an object', t => { test('The "publish" plugin output, if defined, must be an object or "false"', t => {
t.false(plugins.publish.outputValidator(1)); t.false(plugins.publish.outputValidator(1));
t.false(plugins.publish.outputValidator('string')); t.false(plugins.publish.outputValidator('string'));
@ -30,6 +30,7 @@ test('The "publish" plugin output, if defined, must be an object', t => {
t.true(plugins.publish.outputValidator()); t.true(plugins.publish.outputValidator());
t.true(plugins.publish.outputValidator(null)); t.true(plugins.publish.outputValidator(null));
t.true(plugins.publish.outputValidator('')); t.true(plugins.publish.outputValidator(''));
t.true(plugins.publish.outputValidator(false));
}); });
test('The "addChannel" plugin output, if defined, must be an object', t => { test('The "addChannel" plugin output, if defined, must be an object', t => {

View File

@ -1139,7 +1139,7 @@ test('Allow local releases with "noCi" option', async t => {
t.is(success.callCount, 1); t.is(success.callCount, 1);
}); });
test('Accept "undefined" value returned by the "generateNotes" plugins', async t => { test('Accept "undefined" value returned by "generateNotes" and "false" by "publish"', async t => {
// Create a git repository, set the current working directory at the root of the repo // Create a git repository, set the current working directory at the root of the repo
const {cwd, repositoryUrl} = await gitRepo(true); const {cwd, repositoryUrl} = await gitRepo(true);
// Add commits to the master branch // Add commits to the master branch
@ -1170,7 +1170,7 @@ test('Accept "undefined" value returned by the "generateNotes" plugins', async t
const generateNotes1 = stub().resolves(); const generateNotes1 = stub().resolves();
const notes2 = 'Release notes 2'; const notes2 = 'Release notes 2';
const generateNotes2 = stub().resolves(notes2); const generateNotes2 = stub().resolves(notes2);
const publish = stub().resolves(); const publish = stub().resolves(false);
const options = { const options = {
branches: ['master'], branches: ['master'],