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 innerSuite = suites['test-suite'];
|
||||
if (innerSuite) {
|
||||
result.push(...ReportConverter.convertSuite(innerSuite, ReportConverter.convertTests));
|
||||
result.push(...ReportConverter.convertSuite(innerSuite));
|
||||
}
|
||||
|
||||
const tests = suites['test-case'];
|
||||
|
@ -62,7 +62,7 @@ class ReportConverter {
|
|||
meta.duration = Number(duration);
|
||||
|
||||
if (!failure) {
|
||||
core.isDebug(`Skip test ${fullname} without failure data`);
|
||||
core.info(`Skip test ${fullname} without failure data`);
|
||||
return meta;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ class ReportConverter {
|
|||
end_line: point.line,
|
||||
annotation_level: 'failure',
|
||||
title: fullname,
|
||||
message: failure.message.cdata,
|
||||
message: failure.message._cdata,
|
||||
raw_details: trace,
|
||||
};
|
||||
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) {
|
||||
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 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 text = await ResultsCheck.renderText(runs);
|
||||
const title = runSummary.summary;
|
||||
|
||||
core.info(`Posting results for ${headSha}`);
|
||||
const createCheckRequest = {
|
||||
...github.context.repo,
|
||||
name: 'Test Results',
|
||||
head_sha: headSha,
|
||||
status: 'completed',
|
||||
conclusion,
|
||||
conclusion: 'neutral',
|
||||
output: {
|
||||
title,
|
||||
summary,
|
||||
|
|
|
@ -53,6 +53,6 @@ export interface TestCaseAttributes extends CommonAttributes {
|
|||
}
|
||||
|
||||
export interface FailureMessage {
|
||||
message: { cdata: string };
|
||||
'stack-trace'?: { cdata: string };
|
||||
message: { _cdata: string };
|
||||
'stack-trace'?: { _cdata: string };
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue