1
0
Fork 0
mirror of https://github.com/dorny/test-reporter.git synced 2026-03-22 07:52:14 +01:00

Add support for NUnit 2.6 test output

This commit is contained in:
Shamus Taylor 2025-03-05 01:09:16 -06:00
parent 41662db5ca
commit fe58594536
No known key found for this signature in database
GPG key ID: C44FC1AA547ACE39
8 changed files with 606 additions and 0 deletions

View file

@ -0,0 +1,29 @@
import * as fs from 'fs'
import * as path from 'path'
import {DotnetNunitLegacyParser} from '../src/parsers/dotnet-nunit-legacy/dotnet-nunit-legacy-parser'
import {ParseOptions} from '../src/test-parser'
import {getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
describe('dotnet-nunit-legacy tests', () => {
it('report from ./reports/dotnet test results matches snapshot', async () => {
const fixturePath = path.join(__dirname, 'fixtures', 'dotnet-nunit-legacy.xml')
const outputPath = path.join(__dirname, '__outputs__', 'dotnet-nunit-legacy.md')
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
const opts: ParseOptions = {
parseErrors: true,
trackedFiles: ['DotnetTests.Unit/Calculator.cs', 'DotnetTests.NUnitLegacyTests/CalculatorTests.cs']
}
const parser = new DotnetNunitLegacyParser(opts)
const result = await parser.parse(filePath, fileContent)
expect(result).toMatchSnapshot()
const report = getReport([result])
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, report)
})
})