add lcov as reporter

This commit is contained in:
Julien Catania 2024-01-02 17:05:11 +01:00
parent 713455873c
commit 440cc5265e
2 changed files with 4 additions and 0 deletions

View file

@ -20,6 +20,7 @@ import {SwiftXunitParser} from './parsers/swift-xunit/swift-xunit-parser'
import {normalizeDirPath, normalizeFilePath} from './utils/path-utils' import {normalizeDirPath, normalizeFilePath} from './utils/path-utils'
import {getCheckRunContext} from './utils/github-utils' import {getCheckRunContext} from './utils/github-utils'
import {Icon} from './utils/markdown-utils' import {Icon} from './utils/markdown-utils'
import {LcovParser} from './parsers/lcov-json/lcov-parser'
async function main(): Promise<void> { async function main(): Promise<void> {
try { try {
@ -222,6 +223,8 @@ class TestReporter {
return new MochaJsonParser(options) return new MochaJsonParser(options)
case 'swift-xunit': case 'swift-xunit':
return new SwiftXunitParser(options) return new SwiftXunitParser(options)
case 'lcov':
return new LcovParser(options)
default: default:
throw new Error(`Input variable 'reporter' is set to invalid value '${reporter}'`) throw new Error(`Input variable 'reporter' is set to invalid value '${reporter}'`)
} }

View file

@ -4,6 +4,7 @@ import {TestCaseResult, TestGroupResult, TestRunResult, TestSuiteResult} from '.
import {CovParsedStat, CovStats, LcovReport} from './lcov-types' import {CovParsedStat, CovStats, LcovReport} from './lcov-types'
export class LcovParser implements TestParser { export class LcovParser implements TestParser {
constructor(readonly options: ParseOptions) {}
async parse(path: string, content: string): Promise<TestRunResult> { async parse(path: string, content: string): Promise<TestRunResult> {
const report = this.parseFile(path, content) const report = this.parseFile(path, content)
return this.getTestRunResult(path, report) return this.getTestRunResult(path, report)