mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 22:37:09 +01:00
Update interfaces to accept multiple reports to parse
This commit is contained in:
parent
656ede0390
commit
659bb4fff3
8 changed files with 36 additions and 22 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import {Annotation, ParseOptions, TestResult} from '../parser-types'
|
||||
import {Annotation, FileContent, ParseOptions, TestResult} from '../parser-types'
|
||||
|
||||
import getReport from '../../report/get-report'
|
||||
import {normalizeFilePath} from '../../utils/file-utils'
|
||||
|
|
@ -68,8 +68,8 @@ class TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
export async function parseDartJson(content: string, options: ParseOptions): Promise<TestResult> {
|
||||
const testRun = getTestRun(content)
|
||||
export async function parseDartJson(files: FileContent[], options: ParseOptions): Promise<TestResult> {
|
||||
const testRun = getTestRun(files[0].content)
|
||||
const icon = testRun.success ? Icon.success : Icon.fail
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import {ErrorInfo, Outcome, TestMethod, TrxReport} from './dotnet-trx-types'
|
||||
|
||||
import {Annotation, ParseOptions, TestResult} from '../parser-types'
|
||||
import {Annotation, FileContent, ParseOptions, TestResult} from '../parser-types'
|
||||
import {parseStringPromise} from 'xml2js'
|
||||
|
||||
import {normalizeFilePath} from '../../utils/file-utils'
|
||||
|
|
@ -41,8 +41,8 @@ class Test {
|
|||
}
|
||||
}
|
||||
|
||||
export async function parseDotnetTrx(content: string, options: ParseOptions): Promise<TestResult> {
|
||||
const trx = (await parseStringPromise(content, {
|
||||
export async function parseDotnetTrx(files: FileContent[], options: ParseOptions): Promise<TestResult> {
|
||||
const trx = (await parseStringPromise(files[0].content, {
|
||||
attrValueProcessors: [parseAttribute]
|
||||
})) as TrxReport
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {Annotation, ParseOptions, TestResult} from '../parser-types'
|
||||
import {Annotation, FileContent, ParseOptions, TestResult} from '../parser-types'
|
||||
import {parseStringPromise} from 'xml2js'
|
||||
|
||||
import {JunitReport, TestCase, TestSuite} from './jest-junit-types'
|
||||
|
|
@ -15,8 +15,8 @@ import {
|
|||
} from '../../report/test-results'
|
||||
import getReport from '../../report/get-report'
|
||||
|
||||
export async function parseJestJunit(content: string, options: ParseOptions): Promise<TestResult> {
|
||||
const junit = (await parseStringPromise(content, {
|
||||
export async function parseJestJunit(files: FileContent[], options: ParseOptions): Promise<TestResult> {
|
||||
const junit = (await parseStringPromise(files[0].content, {
|
||||
attrValueProcessors: [parseAttribute]
|
||||
})) as JunitReport
|
||||
const testsuites = junit.testsuites
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ export type Annotation = {
|
|||
raw_details?: string
|
||||
}
|
||||
|
||||
export type ParseTestResult = (content: string, options: ParseOptions) => Promise<TestResult>
|
||||
export type ParseTestResult = (files: FileContent[], options: ParseOptions) => Promise<TestResult>
|
||||
|
||||
export type FileContent = {path: string; content: string}
|
||||
|
||||
export interface ParseOptions {
|
||||
name: string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue