Skip to content

Commit 142dd15

Browse files
authored
Merge pull request #680 from JonasSchubert/fix/properly-parse-create-fail-issue
fix(fail): properly parse issue creation response to log in terminal
2 parents 6e0aee6 + 4014f51 commit 142dd15

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

lib/fail.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ export default async (pluginConfig, context) => {
5353
debug("create issue: %O", newIssue);
5454

5555
/* eslint camelcase: off */
56-
const { id, web_url } = await got.post(issuesEndpoint, {
57-
...apiOptions,
58-
json: newIssue,
59-
});
56+
const { id, web_url } = await got
57+
.post(issuesEndpoint, {
58+
...apiOptions,
59+
json: newIssue,
60+
})
61+
.json();
6062
logger.log("Created issue #%d: %s.", id, web_url);
6163
}
6264
}

test/fail.test.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,16 @@ Your **[semantic-release](https://github.com/semantic-release/semantic-release)*
7272
labels: "semantic-release",
7373
title: "The automated release is failing 🚨",
7474
})
75-
.reply(200);
75+
.reply(200, { id: 3, web_url: "https://gitlab.com/test_user/test_repo/-/issues/3" });
7676

7777
await fail(pluginConfig, { env, options, branch, errors, logger: t.context.logger });
7878

7979
t.true(gitlab.isDone());
80+
t.deepEqual(t.context.log.args[0], [
81+
"Created issue #%d: %s.",
82+
3,
83+
"https://gitlab.com/test_user/test_repo/-/issues/3",
84+
]);
8085
});
8186

8287
test.serial("Post comments to existing issue", async (t) => {

0 commit comments

Comments
 (0)