Skip to content

Commit

Permalink
fix: return false in publish if package if step is skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Dec 14, 2018
1 parent b2cd15e commit 48fc813
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.js
Expand Up @@ -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 addChannel(pluginConfig, context) {
Expand Down
8 changes: 8 additions & 0 deletions test/publish.test.js
Expand Up @@ -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);
});

0 comments on commit 48fc813

Please sign in to comment.