Skip to content

Commit d12a029

Browse files
committed
fix: return false in addChannel if step is skipped
1 parent 48fc813 commit d12a029

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,16 @@ async function addChannel(pluginConfig, context) {
9090
} catch (error) {
9191
debug(stdout);
9292
debug(error);
93+
9394
context.logger.log(
9495
`The command ${pluginConfig.cmd} wrote invalid JSON to stdout. The stdout content will be ignored.`
9596
);
97+
98+
return undefined;
9699
}
97100
}
101+
102+
return false;
98103
}
99104

100105
async function success(pluginConfig, context) {

test/add-channel.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,11 @@ test('Use "addChannelCmd" even if "cmd" is defined', async t => {
7676
const result = await addChannel(pluginConfig, context);
7777
t.deepEqual(result, {name: 'Release name', url: 'https://host.com/release/1.0.0'});
7878
});
79+
80+
test('Return "false" if neither "addChannelCmd" nor "cmd" is defined', async t => {
81+
const pluginConfig = {};
82+
const context = {stdout: t.context.stdout, stderr: t.context.stderr, logger: t.context.logger};
83+
84+
const result = await addChannel(pluginConfig, context);
85+
t.is(result, false);
86+
});

0 commit comments

Comments
 (0)