Fix dotnet-trx parser failing on passed tests with non-empty error info

This commit is contained in:
Michal Dorner 2021-04-20 21:38:55 +02:00
parent 4fcb1ce90b
commit 43d89d5ee5
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
7 changed files with 1431 additions and 7 deletions

View file

@ -63,4 +63,24 @@ describe('dotnet-trx tests', () => {
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, report)
})
it('report from SilentNotes test results matches snapshot', async () => {
const fixturePath = path.join(__dirname, 'fixtures', 'external', 'SilentNotes.trx')
const outputPath = path.join(__dirname, '__outputs__', 'silent-notes-test-results.md')
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
const opts: ParseOptions = {
trackedFiles: [],
parseErrors: true
}
const parser = new DotnetTrxParser(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)
})
})