Add createCheck to display test results in GitHub UI
parent
910354f331
commit
6fbe3354bf
File diff suppressed because one or more lines are too long
|
@ -32,7 +32,7 @@ class ReportConverter {
|
||||||
const result = [];
|
const result = [];
|
||||||
const innerSuite = suites['test-suite'];
|
const innerSuite = suites['test-suite'];
|
||||||
if (innerSuite) {
|
if (innerSuite) {
|
||||||
result.push(...ReportConverter.convertSuite(innerSuite, ReportConverter.convertTests));
|
result.push(...ReportConverter.convertSuite(innerSuite));
|
||||||
}
|
}
|
||||||
|
|
||||||
const tests = suites['test-case'];
|
const tests = suites['test-case'];
|
||||||
|
@ -62,7 +62,7 @@ class ReportConverter {
|
||||||
meta.duration = Number(duration);
|
meta.duration = Number(duration);
|
||||||
|
|
||||||
if (!failure) {
|
if (!failure) {
|
||||||
core.isDebug(`Skip test ${fullname} without failure data`);
|
core.info(`Skip test ${fullname} without failure data`);
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class ReportConverter {
|
||||||
end_line: point.line,
|
end_line: point.line,
|
||||||
annotation_level: 'failure',
|
annotation_level: 'failure',
|
||||||
title: fullname,
|
title: fullname,
|
||||||
message: failure.message.cdata,
|
message: failure.message._cdata,
|
||||||
raw_details: trace,
|
raw_details: trace,
|
||||||
};
|
};
|
||||||
core.info(`- ${meta.annotation.path}:${meta.annotation.start_line} - ${meta.annotation.title}`);
|
core.info(`- ${meta.annotation.path}:${meta.annotation.start_line} - ${meta.annotation.title}`);
|
||||||
|
|
|
@ -55,22 +55,19 @@ class ResultsCheck {
|
||||||
|
|
||||||
static async createCheck(githubToken, runs, runSummary, annotations) {
|
static async createCheck(githubToken, runs, runSummary, annotations) {
|
||||||
const pullRequest = github.context.payload.pull_request;
|
const pullRequest = github.context.payload.pull_request;
|
||||||
const link = (pullRequest && pullRequest.html_url) || github.context.ref;
|
|
||||||
const headSha = (pullRequest && pullRequest.head.sha) || github.context.sha;
|
const headSha = (pullRequest && pullRequest.head.sha) || github.context.sha;
|
||||||
const conclusion = runSummary.failed === 0 ? 'success' : 'failure';
|
|
||||||
core.info(
|
|
||||||
`Posting status 'completed' with conclusion '${conclusion}' to ${link} (sha: ${headSha})`,
|
|
||||||
);
|
|
||||||
|
|
||||||
const summary = await ResultsCheck.renderSummary(runs);
|
const summary = await ResultsCheck.renderSummary(runs);
|
||||||
const text = await ResultsCheck.renderText(runs);
|
const text = await ResultsCheck.renderText(runs);
|
||||||
const title = runSummary.summary;
|
const title = runSummary.summary;
|
||||||
|
|
||||||
|
core.info(`Posting results for ${headSha}`);
|
||||||
const createCheckRequest = {
|
const createCheckRequest = {
|
||||||
...github.context.repo,
|
...github.context.repo,
|
||||||
name: 'Test Results',
|
name: 'Test Results',
|
||||||
head_sha: headSha,
|
head_sha: headSha,
|
||||||
status: 'completed',
|
status: 'completed',
|
||||||
conclusion,
|
conclusion: 'neutral',
|
||||||
output: {
|
output: {
|
||||||
title,
|
title,
|
||||||
summary,
|
summary,
|
||||||
|
|
|
@ -53,6 +53,6 @@ export interface TestCaseAttributes extends CommonAttributes {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FailureMessage {
|
export interface FailureMessage {
|
||||||
message: { cdata: string };
|
message: { _cdata: string };
|
||||||
'stack-trace'?: { cdata: string };
|
'stack-trace'?: { _cdata: string };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue