Add createCheck to display test results in GitHub UI
parent
0a58091273
commit
4e41fc178c
File diff suppressed because one or more lines are too long
|
|
@ -3,7 +3,7 @@ import { RunMeta, TestMeta } from './ts/meta.ts';
|
||||||
|
|
||||||
class ReportConverter {
|
class ReportConverter {
|
||||||
static convertReport(filename, report) {
|
static convertReport(filename, report) {
|
||||||
core.debug('Start analyzing report:');
|
core.info(`Start analyzing report: ${filename}`);
|
||||||
core.debug(JSON.stringify(report));
|
core.debug(JSON.stringify(report));
|
||||||
const run = report['test-run'];
|
const run = report['test-run'];
|
||||||
const meta = new RunMeta(filename);
|
const meta = new RunMeta(filename);
|
||||||
|
|
@ -68,13 +68,13 @@ class ReportConverter {
|
||||||
meta.duration = Number(duration);
|
meta.duration = Number(duration);
|
||||||
|
|
||||||
if (!failure) {
|
if (!failure) {
|
||||||
core.debug(`Skip test ${fullname} without failure data`);
|
core.isDebug(`Skip test ${fullname} without failure data`);
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
core.debug(`Convert data for test ${fullname}`);
|
core.debug(`Convert data for test ${fullname}`);
|
||||||
if (failure['stack-trace'] === undefined) {
|
if (failure['stack-trace'] === undefined) {
|
||||||
core.warning(`Not stack trace for test case: ${fullname}`);
|
core.warning(`No stack trace for test case: ${fullname}`);
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ class ResultsCheck {
|
||||||
const files = fs.readdirSync(artifactsPath);
|
const files = fs.readdirSync(artifactsPath);
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
files.map(async filepath => {
|
files.map(async filepath => {
|
||||||
|
if (!filepath.endsWith('.xml')) return;
|
||||||
const filename = filepath.replace(workspace, '');
|
const filename = filepath.replace(workspace, '');
|
||||||
core.startGroup(`Processing file ${filename}...`);
|
core.startGroup(`Processing file ${filename}...`);
|
||||||
const fileData = await ResultsCheck.parseReport(filepath, filename);
|
const fileData = await ResultsCheck.parseReport(filepath, filename);
|
||||||
|
|
@ -46,10 +47,10 @@ class ResultsCheck {
|
||||||
}
|
}
|
||||||
|
|
||||||
static async parseReport(filepath, filename) {
|
static async parseReport(filepath, filename) {
|
||||||
core.debug(`Trying to open ${filepath}`);
|
core.info(`Trying to open ${filepath}`);
|
||||||
const file = await fs.promises.readFile(filepath, 'utf8');
|
const file = await fs.promises.readFile(filepath, 'utf8');
|
||||||
const report = xmljs.xml2js(file, { compact: true });
|
const report = xmljs.xml2js(file, { compact: true });
|
||||||
core.debug(`File ${filepath} parsed...`);
|
core.info(`File ${filepath} parsed...`);
|
||||||
|
|
||||||
return ReportConverter.convertReport(filename, report);
|
return ReportConverter.convertReport(filename, report);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue