Skip to content

Commit 41a3188

Browse files
committed
Merge branch 'MIJOTHY-fix_check-title-template-param'
2 parents e0d5079 + 888386a commit 41a3188

File tree

7 files changed

+21
-10
lines changed

7 files changed

+21
-10
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
check_name: Example JUnit Test Report
2323
report_paths: '**/surefire-reports/TEST-*.xml'
2424
summary: '<table><thead><tr><th> Application (src/applications) </th></tr></thead><tbody><tr><td> test </td></tr></tbody></table>'
25+
check_title_template: '{{SUITE_NAME}} | {{TEST_NAME}}'
2526
- name: Test PyTest test import
2627
uses: ./
2728
if: endsWith(github.ref, 'main') == false
@@ -60,4 +61,3 @@ jobs:
6061
prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-b') || contains(github.ref, '-a') }}
6162
env:
6263
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63-

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
| `fail_on_failure` | Optional. Fail the build in case of a test failure. |
8383
| `require_tests` | Optional. Fail if no test are found.. |
8484
| `check_retries` | Optional. If a testcase is retried, ignore the original failure. |
85-
| `check_title_template` | Optional. Template to configure the title format. Placeholders: ${{FILE_NAME}}, ${{SUITE_NAME}}, ${{TEST_NAME}}. |
85+
| `check_title_template` | Optional. Template to configure the title format. Placeholders: {{FILE_NAME}}, {{SUITE_NAME}}, {{TEST_NAME}}. |
8686
| `summary` | Optional. Additional text to summary output |
8787
| `update_check` | Optional. Uses an alternative API to update checks, use for cases with more than 50 annotations. |
8888
| `annotate_only` | Optional. Will only annotate the results on the files, won't create a check run. |

__tests__/testParser.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
426426
});
427427

428428
it('parse mocha test case, custom title template', async () => {
429-
const { count, skipped, annotations } = await parseFile('test_results/mocha/mocha.xml', '*', true, false, ['/build/', '/__pycache__/'], '${{TEST_NAME}}');
429+
const { count, skipped, annotations } = await parseFile('test_results/mocha/mocha.xml', '*', true, false, ['/build/', '/__pycache__/'], '{{TEST_NAME}}');
430430

431431
expect(count).toBe(1);
432432
expect(skipped).toBe(0);

action.yml

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ inputs:
5050
description: 'Include passed tests in the report'
5151
required: false
5252
default: 'false'
53+
check_title_template:
54+
description: |-
55+
Template to configure the title format. Placeholders: {{FILE_NAME}}, {{SUITE_NAME}}, {{TEST_NAME}}.
56+
required: false
5357
summary:
5458
description: 'Additional text to summary output'
5559
required: false

dist/index.js

+6-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/testParser.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ export async function parseFile(
151151
)
152152
}
153153

154+
function templateVar(varName: string): string {
155+
return `{{${varName}}}`
156+
}
157+
154158
async function parseSuite(
155159
/* eslint-disable @typescript-eslint/no-explicit-any */
156160
suite: any,
@@ -296,9 +300,9 @@ async function parseSuite(
296300
const fileName =
297301
pos.fileName !== testcase._attributes.name ? pos.fileName : ''
298302
title = checkTitleTemplate
299-
.replace('${{FILE_NAME}}', fileName)
300-
.replace('${{SUITE_NAME}}', suiteName ?? '')
301-
.replace('${{TEST_NAME}}', testcase._attributes.name)
303+
.replace(templateVar('FILE_NAME'), fileName)
304+
.replace(templateVar('SUITE_NAME'), suiteName ?? '')
305+
.replace(templateVar('TEST_NAME'), testcase._attributes.name)
302306
} else if (pos.fileName !== testcase._attributes.name) {
303307
title = suiteName
304308
? `${pos.fileName}.${suiteName}/${testcase._attributes.name}`

0 commit comments

Comments
 (0)