mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
wip
This commit is contained in:
parent
a882f5b774
commit
5f540e5020
1 changed files with 20 additions and 15 deletions
35
src/main.ts
35
src/main.ts
|
|
@ -24,6 +24,7 @@ import fs from 'fs'
|
|||
//import fetch from 'node-fetch'
|
||||
import bent from 'bent'
|
||||
import { cwd } from 'process';
|
||||
import Zip from 'adm-zip'
|
||||
|
||||
async function main(): Promise<void> {
|
||||
try {
|
||||
|
|
@ -89,14 +90,14 @@ class TestReporter {
|
|||
|
||||
const inputProvider = this.artifact
|
||||
? new ArtifactProvider(
|
||||
this.octokit,
|
||||
this.artifact,
|
||||
this.name,
|
||||
pattern,
|
||||
this.context.sha,
|
||||
this.context.runId,
|
||||
this.token
|
||||
)
|
||||
this.octokit,
|
||||
this.artifact,
|
||||
this.name,
|
||||
pattern,
|
||||
this.context.sha,
|
||||
this.context.runId,
|
||||
this.token
|
||||
)
|
||||
: new LocalFileProvider(this.name, pattern)
|
||||
|
||||
const parseErrors = this.maxAnnotations > 0
|
||||
|
|
@ -117,10 +118,14 @@ class TestReporter {
|
|||
const results: TestRunResult[] = []
|
||||
const input = await inputProvider.load()
|
||||
|
||||
let version : string | null = null;
|
||||
let version: string | null = null;
|
||||
|
||||
if(input.versionArtifactPath) {
|
||||
version = fs.readFileSync(input.versionArtifactPath).toString();
|
||||
if (input.versionArtifactPath) {
|
||||
const zip = new Zip(input.versionArtifactPath)
|
||||
|
||||
const entry = zip.getEntry('version.txt')
|
||||
|
||||
version = zip.readAsText(entry);
|
||||
core.info(`Using EVA version ${version}, current directory: ${cwd()}`)
|
||||
}
|
||||
|
||||
|
|
@ -129,9 +134,9 @@ class TestReporter {
|
|||
|
||||
try {
|
||||
const post = bent(this.resultsEndpoint, 'POST', {}, 200);
|
||||
await post(`TestResults?Secret=${this.resultsEndpointSecret}${version ? "&EVAVersion=" + version : ''}`, readStream);
|
||||
const response = await post(`TestResults?Secret=${this.resultsEndpointSecret}${version ? "&EVAVersion=" + version : ''}`, readStream);
|
||||
core.info(`Uploaded TRX files: ${a}`)
|
||||
} catch (ex){
|
||||
} catch (ex) {
|
||||
core.warning(`Could not upload file ${a}: ${ex}`)
|
||||
}
|
||||
}
|
||||
|
|
@ -202,9 +207,9 @@ class TestReporter {
|
|||
})
|
||||
|
||||
core.info('Creating report summary')
|
||||
const {listSuites, listTests, onlySummary} = this
|
||||
const { listSuites, listTests, onlySummary } = this
|
||||
const baseUrl = createResp.data.html_url || ''
|
||||
const summary = getReport(results, {listSuites, listTests, baseUrl, onlySummary})
|
||||
const summary = getReport(results, { listSuites, listTests, baseUrl, onlySummary })
|
||||
|
||||
core.info('Creating annotations')
|
||||
const annotations = getAnnotations(results, this.maxAnnotations)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue