Skip to content

Commit

Permalink
Merge pull request #126 from mikepenz/fix/105_2
Browse files Browse the repository at this point in the history
Improved title format for report
  • Loading branch information
mikepenz authored Apr 19, 2021
2 parents f74a8de + dc6e231 commit 6248b82
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 17 deletions.
20 changes: 10 additions & 10 deletions __tests__/testParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ describe('parseFile', () => {
"raw_details": "false == something.loadXml(xml_string)\nFile: /dumm/core/tests/testFailure.cpp\nLine: 77",
"start_column": 0,
"start_line": 1,
"title": "loadFromXMLString_When_Should2Test.loadFromXMLString_When_Should2Test",
"title": "loadFromXMLString_When_Should2Test",
},
]);
});
Expand Down Expand Up @@ -275,7 +275,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
"start_column": 0,
"end_column": 0,
"annotation_level": "failure",
"title": "A.All tests/tests/packet/TestA/A",
"title": "All tests/tests/packet/TestA/A",
"message": "failure",
"raw_details": ""
}, {
Expand All @@ -285,7 +285,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
"start_column": 0,
"end_column": 0,
"annotation_level": "failure",
"title": "B.All tests/tests/packet/TestB/B",
"title": "All tests/tests/packet/TestB/B",
"message": "failure",
"raw_details": ""
}, {
Expand All @@ -295,7 +295,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
"start_column": 0,
"end_column": 0,
"annotation_level": "failure",
"title": "A.All tests/tests/packet/A",
"title": "All tests/tests/packet/A",
"message": "failure",
"raw_details": ""
}]);
Expand All @@ -313,7 +313,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
start_column: 0,
end_column: 0,
annotation_level: "failure",
title: "factorial_of_value_from_fixture.factorial/factorial_of_value_from_fixture",
title: "factorial/factorial_of_value_from_fixture",
message: "tests/failed/main.cpp:58: error: check_eq(3628800, 3628801)",
raw_details: "",
}, {
Expand All @@ -323,7 +323,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
start_column: 0,
end_column: 0,
annotation_level: "failure",
title: "factorial_of_value_from_fixture[0].factorial/factorial_of_value_from_fixture[0]",
title: "factorial/factorial_of_value_from_fixture[0]",
message: "tests/failed/main.cpp:97: error: condition was false",
raw_details: "",
}, {
Expand All @@ -333,7 +333,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
start_column: 0,
end_column: 0,
annotation_level: "failure",
title: "positive_arguments_must_produce_expected_result.factorial/positive_arguments_must_produce_expected_result",
title: "factorial/positive_arguments_must_produce_expected_result",
message: "uncaught std::exception: thrown by test",
raw_details: "",
}, {
Expand All @@ -343,7 +343,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
start_column: 0,
end_column: 0,
annotation_level: "failure",
title: "positive_arguments_must_produce_expected_result[2].factorial/positive_arguments_must_produce_expected_result[2]",
title: "factorial/positive_arguments_must_produce_expected_result[2]",
message: "tests/failed/main.cpp:73: error: condition was false",
raw_details: "",
}, {
Expand All @@ -353,7 +353,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
start_column: 0,
end_column: 0,
annotation_level: "failure",
title: "test_which_fails_check_eq_with_custom_message.factorial/test_which_fails_check_eq_with_custom_message",
title: "factorial/test_which_fails_check_eq_with_custom_message",
message: "tests/failed/main.cpp:49: error: check_eq(6, 7): hello world!",
raw_details: "",
}, {
Expand All @@ -363,7 +363,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
start_column: 0,
end_column: 0,
annotation_level: "failure",
title: "test_which_throws_unknown_exception.factorial/test_which_throws_unknown_exception",
title: "factorial/test_which_throws_unknown_exception",
message: "uncaught unknown exception",
raw_details: "",
}]);
Expand Down
14 changes: 11 additions & 3 deletions 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.

14 changes: 11 additions & 3 deletions src/testParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,17 @@ async function parseSuite(
)

const path = await resolvePath(pos.fileName)
const title = suiteName
? `${pos.fileName}.${suiteName}/${testcase._attributes.name}`
: `${pos.fileName}.${testcase._attributes.name}`
let title = ''
if (pos.fileName !== testcase._attributes.name) {
title = suiteName
? `${pos.fileName}.${suiteName}/${testcase._attributes.name}`
: `${pos.fileName}.${testcase._attributes.name}`
} else {
title = suiteName
? `${suiteName}/${testcase._attributes.name}`
: `${testcase._attributes.name}`
}

core.info(`${path}:${pos.line} | ${message.replace(/\n/g, ' ')}`)

annotations.push({
Expand Down

0 comments on commit 6248b82

Please sign in to comment.