Skip to content

Commit

Permalink
feat: allow publish plugins to return false in order to signify n…
Browse files Browse the repository at this point in the history
…o release was done
  • Loading branch information
pvdlg committed Dec 14, 2018
1 parent 2aa65ad commit 47484f5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/definitions/plugins.js
Expand Up @@ -73,7 +73,7 @@ module.exports = {
transform: (release, step, {nextRelease}) => ({
...nextRelease,
...(release || {}),
...step,
...(release === false ? {} : step),
}),
}),
},
Expand Down
3 changes: 2 additions & 1 deletion test/definitions/plugins.test.js
Expand Up @@ -22,14 +22,15 @@ test('The "generateNotes" plugin output, if defined, must be a string', t => {
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('string'));

t.true(plugins.publish.outputValidator({}));
t.true(plugins.publish.outputValidator());
t.true(plugins.publish.outputValidator(null));
t.true(plugins.publish.outputValidator(''));
t.true(plugins.publish.outputValidator(false));
});

test('The "addChannel" plugin output, if defined, must be an object', t => {
Expand Down
4 changes: 2 additions & 2 deletions test/index.test.js
Expand Up @@ -1139,7 +1139,7 @@ test('Allow local releases with "noCi" option', async t => {
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
const {cwd, repositoryUrl} = await gitRepo(true);
// Add commits to the master branch
Expand Down Expand Up @@ -1170,7 +1170,7 @@ test('Accept "undefined" value returned by the "generateNotes" plugins', async t
const generateNotes1 = stub().resolves();
const notes2 = 'Release notes 2';
const generateNotes2 = stub().resolves(notes2);
const publish = stub().resolves();
const publish = stub().resolves(false);

const options = {
branches: ['master'],
Expand Down

0 comments on commit 47484f5

Please sign in to comment.