diff --git a/index.js b/index.js index 8537b789..80c6d168 100644 --- a/index.js +++ b/index.js @@ -66,12 +66,17 @@ async function publish(pluginConfig, context) { } catch (error) { debug(stdout); debug(error); + context.logger.log( `The command ${pluginConfig.publishCmd || pluginConfig.cmd} wrote invalid JSON to stdout. The stdout content will be ignored.` ); } + + return undefined; } + + return false; } async function success(pluginConfig, context) { diff --git a/test/publish.test.js b/test/publish.test.js index f1873efc..590cb33a 100644 --- a/test/publish.test.js +++ b/test/publish.test.js @@ -76,3 +76,11 @@ test('Use "publishCmd" even if "cmd" is defined', async t => { const result = await publish(pluginConfig, context); t.deepEqual(result, {name: 'Release name', url: 'https://host.com/release/1.0.0'}); }); + +test('Return "false" if neither "publishCmd" nor "cmd" is defined', async t => { + const pluginConfig = {}; + const context = {stdout: t.context.stdout, stderr: t.context.stderr, logger: t.context.logger}; + + const result = await publish(pluginConfig, context); + t.is(result, false); +});