Skip to content

Commit

Permalink
fix: return false in addChannel 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 48fc813 commit d12a029
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ async function addChannel(pluginConfig, context) {
} catch (error) {
debug(stdout);
debug(error);

context.logger.log(
`The command ${pluginConfig.cmd} wrote invalid JSON to stdout. The stdout content will be ignored.`
);

return undefined;
}
}

return false;
}

async function success(pluginConfig, context) {
Expand Down
8 changes: 8 additions & 0 deletions test/add-channel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,11 @@ test('Use "addChannelCmd" even if "cmd" is defined', async t => {
const result = await addChannel(pluginConfig, context);
t.deepEqual(result, {name: 'Release name', url: 'https://host.com/release/1.0.0'});
});

test('Return "false" if neither "addChannelCmd" 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 addChannel(pluginConfig, context);
t.is(result, false);
});

0 comments on commit d12a029

Please sign in to comment.