Add reporter, eslint, formatting.

This commit is contained in:
Kevin Ring 2023-01-19 13:52:46 +11:00 committed by Jozef Izso
parent 953e623fd8
commit ce340de8b9
5 changed files with 14 additions and 9 deletions

View file

@ -11,6 +11,7 @@ import {getAnnotations} from './report/get-annotations'
import {getReport} from './report/get-report'
import {DartJsonParser} from './parsers/dart-json/dart-json-parser'
import {DotNetNunitParser} from './parsers/dotnet-nunit/dotnet-nunit-parser'
import {DotnetTrxParser} from './parsers/dotnet-trx/dotnet-trx-parser'
import {JavaJunitParser} from './parsers/java-junit/java-junit-parser'
import {JestJunitParser} from './parsers/jest-junit/jest-junit-parser'
@ -214,6 +215,8 @@ class TestReporter {
switch (reporter) {
case 'dart-json':
return new DartJsonParser(options, 'dart')
case 'dotnet-nunit':
return new DotNetNunitParser(options)
case 'dotnet-trx':
return new DotnetTrxParser(options)
case 'flutter-json':

View file

@ -1,7 +1,7 @@
import {ParseOptions, TestParser} from '../../test-parser'
import {parseStringPromise} from 'xml2js'
import {NunitReport, TestCase, TestRun, TestSuite} from './dotnet-nunit-types'
import {NunitReport, TestCase, TestSuite} from './dotnet-nunit-types'
import {getExceptionSource} from '../../utils/node-utils'
import {getBasePath, normalizeFilePath} from '../../utils/path-utils'
@ -50,23 +50,23 @@ export class DotNetNunitParser implements TestParser {
return
}
testSuites.forEach(suite => {
for (const suite of testSuites) {
suitePath.push(suite)
this.populateTestCasesRecursive(result, suitePath, suite['test-suite'])
const testcases = suite['test-case']
if (testcases !== undefined) {
testcases.forEach(testcase => {
for (const testcase of testcases) {
this.addTestCase(result, suitePath, testcase)
})
}
}
suitePath.pop()
})
}
}
private addTestCase(result: TestSuiteResult[], suitePath: TestSuite[], testCase: TestCase) {
private addTestCase(result: TestSuiteResult[], suitePath: TestSuite[], testCase: TestCase): void {
// The last suite in the suite path is the "group".
// The rest are concatenated together to form the "suite".
// But ignore "Theory" suites.
@ -125,8 +125,8 @@ export class DotNetNunitParser implements TestParser {
}
return {
path: path,
line: line,
path,
line,
message: details.message && details.message.length > 0 ? details.message[0] : '',
details: details['stack-trace'] && details['stack-trace'].length > 0 ? details['stack-trace'][0] : ''
}

View file

@ -1,5 +1,5 @@
export interface NunitReport {
"test-run": TestRun
'test-run': TestRun
}
export interface TestRun {