Remove leading result icon + add external .net fixture

This commit is contained in:
Michal Dorner 2021-01-28 22:03:01 +01:00
parent e3bb634029
commit f55c0119bb
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
12 changed files with 9910 additions and 430 deletions

View file

@ -6,15 +6,18 @@ import {ParseOptions} from '../src/parsers/parser-types'
import {getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/file-utils'
const fixturePath = path.join(__dirname, 'fixtures', 'dotnet-trx.trx')
const outputPath = path.join(__dirname, '__outputs__', 'dotnet-trx.md')
const xmlFixture = {
path: normalizeFilePath(path.relative(__dirname, fixturePath)),
content: fs.readFileSync(fixturePath, {encoding: 'utf8'})
}
describe('dotnet-trx tests', () => {
it('matches report snapshot', async () => {
const fixturePath = path.join(__dirname, 'fixtures', 'dotnet-trx.trx')
const outputPath = path.join(__dirname, '__outputs__', 'dotnet-trx.md')
const xmlFixture = {
path: normalizeFilePath(path.relative(__dirname, fixturePath)),
content: fs.readFileSync(fixturePath, {encoding: 'utf8'})
}
const opts: ParseOptions = {
annotations: true,
trackedFiles: ['DotnetTests.Unit/Calculator.cs', 'DotnetTests.XUnitTests/CalculatorTests.cs'],
@ -28,4 +31,26 @@ describe('dotnet-trx tests', () => {
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, report)
})
it('report from FluentValidation test results matches snapshot', async () => {
const fixturePath = path.join(__dirname, 'fixtures', 'external', 'FluentValidation.Tests.trx')
const outputPath = path.join(__dirname, '__outputs__', 'fluent-validation-test-results.md')
const xmlFixture = {
path: normalizeFilePath(path.relative(__dirname, fixturePath)),
content: fs.readFileSync(fixturePath, {encoding: 'utf8'})
}
const opts: ParseOptions = {
trackedFiles: [],
annotations: true,
workDir: ''
}
const result = await parseDotnetTrx([xmlFixture], opts)
expect(result).toMatchSnapshot()
const report = getReport(result.testRuns, {listTests: 'only-failed'})
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, report)
})
})