This commit is contained in:
R-Raposo 2025-11-14 18:46:58 +01:00 committed by GitHub
commit 88f10e9226
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 38 additions and 35 deletions

15
dist/index.js generated vendored
View file

@ -425,6 +425,7 @@ class TestReporter {
});
core.info('Summary content:');
core.info(summary);
core.setOutput('summary', summary);
core.summary.addRaw(`# ${shortSummary}`);
await core.summary.addRaw(summary).write();
}
@ -965,7 +966,8 @@ class DotnetTrxParser {
}
}
getTestClasses(trx) {
if (trx.TestRun.TestDefinitions === undefined || trx.TestRun.Results === undefined ||
if (trx.TestRun.TestDefinitions === undefined ||
trx.TestRun.Results === undefined ||
!trx.TestRun.TestDefinitions.some(td => td.UnitTest && Array.isArray(td.UnitTest))) {
return [];
}
@ -981,7 +983,7 @@ class DotnetTrxParser {
}));
const testClasses = {};
for (const r of unitTestsResults) {
const className = r.test.TestMethod[0].$.className ?? "Unclassified";
const className = r.test.TestMethod[0].$.className ?? 'Unclassified';
let tc = testClasses[className];
if (tc === undefined) {
tc = new TestClass(className);
@ -1098,7 +1100,10 @@ class GolangJsonParser {
return this.getTestRunResult(path, events);
}
async getGolangTestEvents(path, content) {
return content.trim().split('\n').map((line, index) => {
return content
.trim()
.split('\n')
.map((line, index) => {
try {
return JSON.parse(line);
}
@ -1146,9 +1151,7 @@ class GolangJsonParser {
suite.groups.push(group);
}
const lastEvent = eventGroup.at(-1);
const result = lastEvent.Action === 'pass' ? 'success'
: lastEvent.Action === 'skip' ? 'skipped'
: 'failed';
const result = lastEvent.Action === 'pass' ? 'success' : lastEvent.Action === 'skip' ? 'skipped' : 'failed';
if (lastEvent.Elapsed === undefined) {
throw new Error('missing elapsed on final test event');
}