Skip to content

Commit 745d0fa

Browse files
committed
fix: return false in publish if package if step is skipped
1 parent 9d8bcb7 commit 745d0fa

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
@@ -66,12 +66,17 @@ async function publish(pluginConfig, context) {
6666
} catch (error) {
6767
debug(stdout);
6868
debug(error);
69+
6970
context.logger.log(
7071
`The command ${pluginConfig.publishCmd ||
7172
pluginConfig.cmd} wrote invalid JSON to stdout. The stdout content will be ignored.`
7273
);
7374
}
75+
76+
return undefined;
7477
}
78+
79+
return false;
7580
}
7681

7782
async function success(pluginConfig, context) {

test/publish.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,11 @@ test('Use "publishCmd" even if "cmd" is defined', async t => {
7676
const result = await publish(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 "publishCmd" 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 publish(pluginConfig, context);
85+
t.is(result, false);
86+
});

0 commit comments

Comments
 (0)