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" } }, "settings": { "react": { "version": "latest" } },
"rules": { "rules": {
"prettier/prettier": "error", "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 run = report['test-run'];
const meta = new RunMeta(filename); const meta = new RunMeta(filename);
meta.total = Number(run.attributes.total); meta.total = Number(run._attributes.total);
meta.failed = Number(run.attributes.failed); meta.failed = Number(run._attributes.failed);
meta.skipped = Number(run.attributes.skipped); meta.skipped = Number(run._attributes.skipped);
meta.passed = Number(run.attributes.passed); meta.passed = Number(run._attributes.passed);
meta.duration = Number(run.attributes.duration); meta.duration = Number(run._attributes.duration);
meta.addTests(ReportConverter.convertSuite(run['test-suite'])); meta.addTests(ReportConverter.convertSuite(run['test-suite']));
@ -28,7 +28,7 @@ class ReportConverter {
return result; 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 result = [];
const innerSuite = suites['test-suite']; const innerSuite = suites['test-suite'];
if (innerSuite) { if (innerSuite) {
@ -37,7 +37,7 @@ class ReportConverter {
const tests = suites['test-case']; const tests = suites['test-case'];
if (tests) { if (tests) {
result.push(...ReportConverter.convertTests(suites.attributes.fullname, tests)); result.push(...ReportConverter.convertTests(suites._attributes.fullname, tests));
} }
return result; return result;
@ -56,7 +56,7 @@ class ReportConverter {
} }
static convertTestCase(suite, testCase) { 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); const meta = new TestMeta(suite, name);
meta.result = result; meta.result = result;
meta.duration = Number(duration); meta.duration = Number(duration);

View File

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