diff --git a/__tests__/dotnet-trx.test.ts b/__tests__/dotnet-trx.test.ts index d4d5dac..498abcb 100644 --- a/__tests__/dotnet-trx.test.ts +++ b/__tests__/dotnet-trx.test.ts @@ -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') diff --git a/__tests__/fixtures/empty/dotnet-trx-empty-test-definitions.trx b/__tests__/fixtures/empty/dotnet-trx-empty-test-definitions.trx new file mode 100644 index 0000000..7066144 --- /dev/null +++ b/__tests__/fixtures/empty/dotnet-trx-empty-test-definitions.trx @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + No test is available in (...). Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + + + +