mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 14:57:09 +01:00
trying to add link as output
This commit is contained in:
parent
0a5dc1ab75
commit
c82c974817
3 changed files with 25 additions and 7 deletions
18
src/main.ts
18
src/main.ts
|
|
@ -107,12 +107,16 @@ class TestReporter {
|
|||
const parser = this.getParser(this.reporter, options)
|
||||
|
||||
const results: TestRunResult[] = []
|
||||
const outputHtml: string[] = []
|
||||
const input = await inputProvider.load()
|
||||
for (const [reportName, files] of Object.entries(input)) {
|
||||
try {
|
||||
core.startGroup(`Creating test report ${reportName}`)
|
||||
const tr = await this.createReport(parser, reportName, files)
|
||||
const [tr, html] = await this.createReport(parser, reportName, files)
|
||||
results.push(...tr)
|
||||
if (html != null) {
|
||||
outputHtml.push(html)
|
||||
}
|
||||
} finally {
|
||||
core.endGroup()
|
||||
}
|
||||
|
|
@ -124,12 +128,14 @@ class TestReporter {
|
|||
const failed = results.reduce((sum, tr) => sum + tr.failed, 0)
|
||||
const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0)
|
||||
const time = results.reduce((sum, tr) => sum + tr.time, 0)
|
||||
const html = [...new Set(outputHtml)].join(',')
|
||||
|
||||
core.setOutput('conclusion', conclusion)
|
||||
core.setOutput('passed', passed)
|
||||
core.setOutput('failed', failed)
|
||||
core.setOutput('skipped', skipped)
|
||||
core.setOutput('time', time)
|
||||
core.setOutput('runHtmlUrl', html)
|
||||
|
||||
if (this.failOnError && isFailed) {
|
||||
core.setFailed(`Failed test were found and 'fail-on-error' option is set to ${this.failOnError}`)
|
||||
|
|
@ -142,10 +148,14 @@ class TestReporter {
|
|||
}
|
||||
}
|
||||
|
||||
async createReport(parser: TestParser, name: string, files: FileContent[]): Promise<TestRunResult[]> {
|
||||
async createReport(
|
||||
parser: TestParser,
|
||||
name: string,
|
||||
files: FileContent[]
|
||||
): Promise<[TestRunResult[], string | null]> {
|
||||
if (files.length === 0) {
|
||||
core.warning(`No file matches path ${this.path}`)
|
||||
return []
|
||||
return [[], '']
|
||||
}
|
||||
|
||||
core.info(`Processing test results for check run ${name}`)
|
||||
|
|
@ -204,7 +214,7 @@ class TestReporter {
|
|||
console.log(`::notice title=Test Results::${resp.data.html_url}`)
|
||||
}
|
||||
|
||||
return results
|
||||
return [results, resp.data.html_url]
|
||||
}
|
||||
|
||||
getParser(reporter: string, options: ParseOptions): TestParser {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue