diff --git a/dist/index.js b/dist/index.js index b3e4603..10d5111 100644 --- a/dist/index.js +++ b/dist/index.js @@ -356,14 +356,19 @@ class TestReporter { core.info(`Check run details: ${resp.data.details_url}`); result.checkUrl = resp.data.html_url; if (this.slackWebhook && this.context.branch === 'master') { - const webhook = new webhook_1.IncomingWebhook(this.slackWebhook, { - username: name - }); + const webhook = new webhook_1.IncomingWebhook(this.slackWebhook); const passed = results.reduce((sum, tr) => sum + tr.passed, 0); const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0); const failed = results.reduce((sum, tr) => sum + tr.failed, 0); const req = { blocks: [ + { + type: 'section', + text: { + type: 'mrkdwn', + text: `*${name}*` + } + }, { type: 'section', text: { @@ -385,19 +390,21 @@ class TestReporter { } }); if (failed <= 10) { + const failedTests = []; tr.failedSuites.map(suite => { suite.failedGroups.map(group => { group.failedTests.map(test => { - req.blocks.push({ - type: 'section', - text: { - type: 'mrkdwn', - text: `:red_circle: <${suite.link}|${test.name}>` - } - }); + failedTests.push(`* <${suite.link}|${test.name}>`); }); }); }); + req.blocks.push({ + type: 'section', + text: { + type: 'mrkdwn', + text: failedTests.join('\n') + } + }); } }); yield webhook.send(req); diff --git a/src/main.ts b/src/main.ts index 1af624b..72ea555 100644 --- a/src/main.ts +++ b/src/main.ts @@ -300,15 +300,20 @@ class TestReporter { result.checkUrl = resp.data.html_url if (this.slackWebhook && this.context.branch === 'master') { - const webhook = new IncomingWebhook(this.slackWebhook, { - username: name - }) + const webhook = new IncomingWebhook(this.slackWebhook) const passed = results.reduce((sum, tr) => sum + tr.passed, 0) const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0) const failed = results.reduce((sum, tr) => sum + tr.failed, 0) const req = { blocks: [ + { + type: 'section', + text: { + type: 'mrkdwn', + text: `*${name}*` + } + }, { type: 'section', text: { @@ -332,19 +337,22 @@ class TestReporter { }) if (failed <= 10) { + const failedTests: string[] = [] tr.failedSuites.map(suite => { suite.failedGroups.map(group => { group.failedTests.map(test => { - req.blocks.push({ - type: 'section', - text: { - type: 'mrkdwn', - text: `:red_circle: <${suite.link}|${test.name}>` - } - }) + failedTests.push(`* <${suite.link}|${test.name}>`) }) }) }) + + req.blocks.push({ + type: 'section', + text: { + type: 'mrkdwn', + text: failedTests.join('\n') + } + }) } })