add name to report, combine failures into a list

This commit is contained in:
A.J. Kaptijn 2024-03-20 14:44:57 +01:00
parent 52df78dda0
commit cb25e45d8e
2 changed files with 35 additions and 20 deletions

View file

@ -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')
}
})
}
})