add lcov as reporter

This commit is contained in:
Julien Catania 2024-01-02 17:05:11 +01:00
parent 0fc59a15c8
commit 62968bd2b2
2 changed files with 4 additions and 0 deletions

View file

@ -19,6 +19,7 @@ import {MochaJsonParser} from './parsers/mocha-json/mocha-json-parser'
import {normalizeDirPath, normalizeFilePath} from './utils/path-utils'
import {getCheckRunContext} from './utils/github-utils'
import {Icon} from './utils/markdown-utils'
import {LcovParser} from './parsers/lcov-json/lcov-parser'
async function main(): Promise<void> {
try {
@ -216,6 +217,8 @@ class TestReporter {
return new JestJunitParser(options)
case 'mocha-json':
return new MochaJsonParser(options)
case 'lcov':
return new LcovParser(options)
default:
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'
export class LcovParser implements TestParser {
constructor(readonly options: ParseOptions) {}
async parse(path: string, content: string): Promise<TestRunResult> {
const report = this.parseFile(path, content)
return this.getTestRunResult(path, report)