Skip to content

Commit

Permalink
Merge branch 'feature/add-classname-to-check-title-template'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz authored May 30, 2024
2 parents 9379f0c + a40320b commit 0405bc6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
| `require_passed_tests` | Optional. Fail if no passed test are found. (This is stricter than `require_tests`, which accepts skipped tests). |
| `include_passed` | Optional. By default the action will skip passed items for the annotations. Enable this flag to include them. |
| `check_retries` | Optional. If a testcase is retried, ignore the original failure. |
| `check_title_template` | Optional. Template to configure the title format. Placeholders: {{FILE_NAME}}, {{SUITE_NAME}}, {{TEST_NAME}}. |
| `check_title_template` | Optional. Template to configure the title format. Placeholders: {{FILE_NAME}}, {{SUITE_NAME}}, {{TEST_NAME}}, {{CLASS_NAME}}. |
| `summary` | Optional. Additional text to summary output |
| `check_annotations` | Optional. Defines if the checks will include annotations. If disabled skips all annotations for the check. (This does not affect `annotate_only`, which uses no checks). |
| `update_check` | Optional. Uses an alternative API to update checks, use for cases with more than 50 annotations. Default: `false`. |
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ inputs:
default: 'false'
check_title_template:
description: |-
Template to configure the title format. Placeholders: {{FILE_NAME}}, {{SUITE_NAME}}, {{TEST_NAME}}.
Template to configure the title format. Placeholders: {{FILE_NAME}}, {{SUITE_NAME}}, {{TEST_NAME}}, {{CLASS_NAME}}.
required: false
summary:
description: 'Additional text to summary output'
Expand Down
7 changes: 6 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/testParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,17 @@ async function parseSuite(
let title = ''
if (checkTitleTemplate) {
// ensure to not duplicate the test_name if file_name is equal

const fileName = pos.fileName !== testcase._attributes.name ? pos.fileName : ''
const baseClassName = testcase._attributes.classname
? testcase._attributes.classname
: testcase._attributes.name
const className = baseClassName.split('.').slice(-1)[0]
title = checkTitleTemplate
.replace(templateVar('FILE_NAME'), fileName)
.replace(templateVar('SUITE_NAME'), suiteName ?? '')
.replace(templateVar('TEST_NAME'), testcase._attributes.name)
.replace(templateVar('CLASS_NAME'), className)
} else if (pos.fileName !== testcase._attributes.name) {
title = suiteName
? `${pos.fileName}.${suiteName}/${testcase._attributes.name}`
Expand Down

0 comments on commit 0405bc6

Please sign in to comment.