diff --git a/README.md b/README.md index c88257a..8806999 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,27 @@ To use environment variables in the config file, wrap the environment variable n ![teams-summary-report](https://github.com/test-results-reporter/reporter/raw/main/assets/slack/test-summary-single-suite.png) +### Options + +#### reports + +| Property | Description | Attribute | +|----------|------------------------------------|-----------| +| targets | list of targets to publish reports | Required | +| results | list of results to parse | Required | +| options | common options for all targets | Optional | + +##### targets + +| Property | Description | Attribute | +|--------------|--------------------------------|-------------------| +| name | name of the target | Required/Optional | +| url | url of the target | Required/Optional | +| publish | type of report to publish | Required/Optional | +| links | links to be part of the report | Optional | +| title | title of the report | Optional | +| title_suffix | suffix to add to title | Optional | + ## Supports ### Targets diff --git a/package-lock.json b/package-lock.json index 3c23243..e2f7c79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "test-results-reporter", - "version": "0.0.11", + "version": "0.0.12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4bd50b8..f8dfe1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "test-results-reporter", - "version": "0.0.11", + "version": "0.0.12", "description": "Publish test results to Microsoft Teams and Slack", "main": "src/index.js", "bin": { diff --git a/src/targets/slack.js b/src/targets/slack.js index c03bc21..a5d7355 100644 --- a/src/targets/slack.js +++ b/src/targets/slack.js @@ -10,6 +10,9 @@ function getRootPayload() { function getTitleText(result, options) { const title = options.title ? options.title : result.name; + if (options.title_suffix) { + return `*${title} ${options.title_suffix}*`; + } return `*${title}*`; } diff --git a/src/targets/teams.js b/src/targets/teams.js index e02480d..664610e 100644 --- a/src/targets/teams.js +++ b/src/targets/teams.js @@ -2,8 +2,16 @@ const request = require('phin-retry'); const { toColonNotation } = require('colon-notation'); const { getPercentage, getReportType, getUrl, truncate } = require('../helpers/helper'); +function getTitleText(result, options) { + const title = options.title ? options.title : result.name; + if (options.title_suffix) { + return `${title} ${options.title_suffix}`; + } + return `${title}`; +} + function getTitleTextBlock(testResult, opts) { - const title = opts.title ? opts.title : testResult.name; + const title = getTitleText(testResult, opts); const emoji = testResult.status === 'PASS' ? '✅' : '❌'; return { "type": "TextBlock",