fix: correctly handle skipped releases

This commit is contained in:
Pierre Vanduynslager 2018-12-16 15:54:21 -05:00
parent e1b418d0b5
commit 89663d3fcf
2 changed files with 11 additions and 7 deletions

View File

@ -71,9 +71,9 @@ module.exports = {
pipelineConfig: () => ({ pipelineConfig: () => ({
// Add `nextRelease` and plugin properties to published release // Add `nextRelease` and plugin properties to published release
transform: (release, step, {nextRelease}) => ({ transform: (release, step, {nextRelease}) => ({
...nextRelease, ...(release === false ? {} : nextRelease),
...(release || {}), ...release,
...(release === false ? {} : step), ...step,
}), }),
}), }),
}, },
@ -84,9 +84,9 @@ module.exports = {
pipelineConfig: () => ({ pipelineConfig: () => ({
// Add `nextRelease` and plugin properties to published release // Add `nextRelease` and plugin properties to published release
transform: (release, step, {nextRelease}) => ({ transform: (release, step, {nextRelease}) => ({
...nextRelease, ...(release === false ? {} : nextRelease),
...(release || {}), ...release,
...(release === false ? {} : step), ...step,
}), }),
}), }),
}, },

View File

@ -1165,6 +1165,7 @@ test('Accept "undefined" value returned by "generateNotes" and "false" by "publi
const generateNotes2 = stub().resolves(notes2); const generateNotes2 = stub().resolves(notes2);
const publish = stub().resolves(false); const publish = stub().resolves(false);
const addChannel = stub().resolves(false); const addChannel = stub().resolves(false);
const success = stub().resolves();
const options = { const options = {
branches: ['master', 'next'], branches: ['master', 'next'],
@ -1176,7 +1177,7 @@ test('Accept "undefined" value returned by "generateNotes" and "false" by "publi
addChannel, addChannel,
prepare: stub().resolves(), prepare: stub().resolves(),
publish, publish,
success: stub().resolves(), success,
fail: stub().resolves(), fail: stub().resolves(),
}; };
@ -1199,7 +1200,10 @@ test('Accept "undefined" value returned by "generateNotes" and "false" by "publi
t.is(generateNotes2.callCount, 2); t.is(generateNotes2.callCount, 2);
t.is(addChannel.callCount, 1); t.is(addChannel.callCount, 1);
t.is(publish.callCount, 1); t.is(publish.callCount, 1);
t.is(success.callCount, 2);
t.deepEqual(publish.args[0][1].nextRelease, {...nextRelease, notes: notes2}); 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 => { test('Returns false if triggered by a PR', async t => {