Add test on a trx report where the className attribute of TestMethod is missing

This reproduces issue #556
This commit is contained in:
Cédric Luthi 2025-06-22 16:18:52 +02:00
parent 18430db883
commit d1504ea554
11 changed files with 131 additions and 20 deletions

View file

@ -39,15 +39,18 @@ describe('dotnet-trx tests', () => {
expect(result.result).toBe('success')
})
it('matches report snapshot', async () => {
const fixturePath = path.join(__dirname, 'fixtures', 'dotnet-trx.trx')
const outputPath = path.join(__dirname, '__outputs__', 'dotnet-trx.md')
it.each([
['dotnet-trx'],
['dotnet-xunitv3']
])('matches %s report snapshot', async (reportName) => {
const fixturePath = path.join(__dirname, 'fixtures', `${reportName}.trx`)
const outputPath = path.join(__dirname, '__outputs__', `${reportName}.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.XUnitTests/CalculatorTests.cs']
trackedFiles: ['DotnetTests.Unit/Calculator.cs', 'DotnetTests.XUnitTests/CalculatorTests.cs', 'DotnetTests.XUnitV3Tests/FixtureTests.cs']
//workDir: 'C:/Users/Michal/Workspace/dorny/test-check/reports/dotnet/'
}