Add createCheck to display test results in GitHub UI

pull/97/head
David Finol 2021-02-21 07:42:17 -06:00
parent e207201236
commit 0dba5f77e1
2 changed files with 8 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -19,11 +19,11 @@ class ReportConverter {
return meta; return meta;
} }
static convertSuite(suites, convertTestsFunction = ReportConverter.convertTests) { static convertSuite(suites) {
if (Array.isArray(suites)) { if (Array.isArray(suites)) {
const result = []; const result = [];
suites.array.forEach(suite => { suites.array.forEach(suite => {
result.concat(ReportConverter.convertSuite(suite, convertTestsFunction)); result.concat(ReportConverter.convertSuite(suite));
}); });
return result; return result;
} }
@ -45,23 +45,19 @@ class ReportConverter {
return result; return result;
} }
static convertTests(suite, tests, convertTestCaseFunction = ReportConverter.convertTests) { static convertTests(suite, tests) {
if (Array.isArray(tests)) { if (Array.isArray(tests)) {
const result = []; const result = [];
tests.array.forEach(test => { tests.array.forEach(test => {
result.concat(ReportConverter.convertTests(suite, test, convertTestCaseFunction)); result.concat(ReportConverter.convertTests(suite, test));
}); });
return result; return result;
} }
return [ReportConverter.convertTestCaseFunction(suite, tests)]; return [ReportConverter.convertTestCase(suite, tests)];
} }
static convertTestCase( static convertTestCase(suite, testCase) {
suite,
testCase,
findAnnotationPointFunction = ReportConverter.findAnnotationPoint,
) {
const { name, fullname, result, failure, duration } = testCase; const { name, fullname, result, failure, duration } = testCase;
const meta = new TestMeta(suite, name); const meta = new TestMeta(suite, name);
meta.result = result; meta.result = result;
@ -79,7 +75,7 @@ class ReportConverter {
} }
const trace = failure['stack-trace'].cdata; const trace = failure['stack-trace'].cdata;
const point = findAnnotationPointFunction(trace); const point = ReportConverter.findAnnotationPoint(trace);
if (point === undefined) { if (point === undefined) {
core.warning('Not able to find entry point for failed test! Test trace:'); core.warning('Not able to find entry point for failed test! Test trace:');
core.warning(trace); core.warning(trace);