Add createCheck to display test results in GitHub UI

pull/97/head
David Finol 2021-02-21 19:03:06 -06:00
parent 160e6265d0
commit 68336896a2
4 changed files with 42 additions and 41 deletions

View File

@ -16,6 +16,7 @@
"settings": { "react": { "version": "latest" } },
"rules": {
"prettier/prettier": "error",
"import/no-extraneous-dependencies": 0
"import/no-extraneous-dependencies": 0,
"no-underscore-dangle": 0
}
}

File diff suppressed because one or more lines are too long

View File

@ -8,11 +8,11 @@ class ReportConverter {
const run = report['test-run'];
const meta = new RunMeta(filename);
meta.total = Number(run.attributes.total);
meta.failed = Number(run.attributes.failed);
meta.skipped = Number(run.attributes.skipped);
meta.passed = Number(run.attributes.passed);
meta.duration = Number(run.attributes.duration);
meta.total = Number(run._attributes.total);
meta.failed = Number(run._attributes.failed);
meta.skipped = Number(run._attributes.skipped);
meta.passed = Number(run._attributes.passed);
meta.duration = Number(run._attributes.duration);
meta.addTests(ReportConverter.convertSuite(run['test-suite']));
@ -28,7 +28,7 @@ class ReportConverter {
return result;
}
core.debug(`Analyze suite ${suites.attributes.type} / ${suites.attributes.fullname}`);
core.debug(`Analyze suite ${suites._attributes.type} / ${suites._attributes.fullname}`);
const result = [];
const innerSuite = suites['test-suite'];
if (innerSuite) {
@ -37,7 +37,7 @@ class ReportConverter {
const tests = suites['test-case'];
if (tests) {
result.push(...ReportConverter.convertTests(suites.attributes.fullname, tests));
result.push(...ReportConverter.convertTests(suites._attributes.fullname, tests));
}
return result;
@ -56,7 +56,7 @@ class ReportConverter {
}
static convertTestCase(suite, testCase) {
const { name, fullname, result, failure, duration } = testCase.attributes;
const { name, fullname, result, failure, duration } = testCase._attributes;
const meta = new TestMeta(suite, name);
meta.result = result;
meta.duration = Number(duration);

View File

@ -1,58 +1,58 @@
interface CommonAttributes {
id: string;
result: string;
asserts: string;
id: string;
result: string;
asserts: string;
'start-time': string;
'end-time': string;
duration: string;
'start-time': string;
'end-time': string;
duration: string;
}
interface CommonSuiteAttributes extends CommonAttributes {
total: string;
passed: string;
failed: string;
skipped: string;
total: string;
passed: string;
failed: string;
skipped: string;
}
export interface TestRun {
attributes: TestRunAttributes;
'test-suite': TestSuite | TestSuite[];
_attributes: TestRunAttributes;
'test-suite': TestSuite | TestSuite[];
}
export interface TestRunAttributes extends CommonSuiteAttributes {
testcasecount: string;
'engine-version': string;
testcasecount: string;
'engine-version': string;
}
export interface TestSuite {
attributes: TestSuiteAttributes;
'test-suite': TestSuite | TestSuite[];
'test-case': TestCase | TestCase[];
failure?: FailureMessage;
_attributes: TestSuiteAttributes;
'test-suite': TestSuite | TestSuite[];
'test-case': TestCase | TestCase[];
failure?: FailureMessage;
}
export interface TestSuiteAttributes extends CommonSuiteAttributes {
type: string;
name: string;
fullname: string;
type: string;
name: string;
fullname: string;
}
export interface TestCase {
attributes: TestCaseAttributes;
failure?: FailureMessage;
_attributes: TestCaseAttributes;
failure?: FailureMessage;
}
export interface TestCaseAttributes extends CommonAttributes {
name: string;
fullname: string;
methodname: string;
classname: string;
runstate: string;
seed: string;
name: string;
fullname: string;
methodname: string;
classname: string;
runstate: string;
seed: string;
}
export interface FailureMessage {
message: {cdata: string};
'stack-trace'?: {cdata: string};
message: { cdata: string };
'stack-trace'?: { cdata: string };
}