mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 22:37:09 +01:00
feat: add summary to action output
This commit is contained in:
parent
34d8269ede
commit
eb2310cec8
6 changed files with 38 additions and 35 deletions
15
dist/index.js
generated
vendored
15
dist/index.js
generated
vendored
|
|
@ -419,6 +419,7 @@ class TestReporter {
|
|||
});
|
||||
core.info('Summary content:');
|
||||
core.info(summary);
|
||||
core.setOutput('summary', summary);
|
||||
core.summary.addRaw(`# ${shortSummary}`);
|
||||
await core.summary.addRaw(summary).write();
|
||||
}
|
||||
|
|
@ -958,7 +959,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 [];
|
||||
}
|
||||
|
|
@ -974,7 +976,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);
|
||||
|
|
@ -1091,7 +1093,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);
|
||||
}
|
||||
|
|
@ -1139,9 +1144,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');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue