mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
add name to report, combine failures into a list
This commit is contained in:
parent
52df78dda0
commit
cb25e45d8e
2 changed files with 35 additions and 20 deletions
27
dist/index.js
generated
vendored
27
dist/index.js
generated
vendored
|
|
@ -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);
|
||||
|
|
|
|||
28
src/main.ts
28
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')
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue