Skip to content

Commit

Permalink
fix: correctly handle skipped releases
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Dec 16, 2018
1 parent e1b418d commit 89663d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/definitions/plugins.js
Expand Up @@ -71,9 +71,9 @@ module.exports = {
pipelineConfig: () => ({
// Add `nextRelease` and plugin properties to published release
transform: (release, step, {nextRelease}) => ({
...nextRelease,
...(release || {}),
...(release === false ? {} : step),
...(release === false ? {} : nextRelease),
...release,
...step,
}),
}),
},
Expand All @@ -84,9 +84,9 @@ module.exports = {
pipelineConfig: () => ({
// Add `nextRelease` and plugin properties to published release
transform: (release, step, {nextRelease}) => ({
...nextRelease,
...(release || {}),
...(release === false ? {} : step),
...(release === false ? {} : nextRelease),
...release,
...step,
}),
}),
},
Expand Down
6 changes: 5 additions & 1 deletion test/index.test.js
Expand Up @@ -1165,6 +1165,7 @@ test('Accept "undefined" value returned by "generateNotes" and "false" by "publi
const generateNotes2 = stub().resolves(notes2);
const publish = stub().resolves(false);
const addChannel = stub().resolves(false);
const success = stub().resolves();

const options = {
branches: ['master', 'next'],
Expand All @@ -1176,7 +1177,7 @@ test('Accept "undefined" value returned by "generateNotes" and "false" by "publi
addChannel,
prepare: stub().resolves(),
publish,
success: stub().resolves(),
success,
fail: stub().resolves(),
};

Expand All @@ -1199,7 +1200,10 @@ test('Accept "undefined" value returned by "generateNotes" and "false" by "publi
t.is(generateNotes2.callCount, 2);
t.is(addChannel.callCount, 1);
t.is(publish.callCount, 1);
t.is(success.callCount, 2);
t.deepEqual(publish.args[0][1].nextRelease, {...nextRelease, notes: notes2});
t.deepEqual(success.args[0][1].releases, [{pluginName: '[Function: proxy]'}]);
t.deepEqual(success.args[1][1].releases, [{pluginName: '[Function: proxy]'}, {pluginName: '[Function: proxy]'}]);
});

test('Returns false if triggered by a PR', async t => {
Expand Down

0 comments on commit 89663d3

Please sign in to comment.