Add integration test for empty TRX TestDefinitions

This commit is contained in:
Oles Galatsan 2025-05-16 10:25:02 +03:00
parent 2acf6c2ccd
commit 5b44774702
2 changed files with 38 additions and 0 deletions

View file

@ -23,6 +23,22 @@ describe('dotnet-trx tests', () => {
expect(result.result).toBe('success')
})
it('produces empty test run result when TestDefinitions is empty', async () => {
const fixturePath = path.join(__dirname, 'fixtures', 'empty', 'dotnet-trx-empty-test-definitions.trx')
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
const opts: ParseOptions = {
parseErrors: true,
trackedFiles: []
}
const parser = new DotnetTrxParser(opts)
const result = await parser.parse(filePath, fileContent)
expect(result.tests).toBe(0)
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')