mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-15 22:07:09 +01:00
parent
a6b3e93884
commit
2312e637f3
4 changed files with 187 additions and 1 deletions
|
|
@ -3,7 +3,7 @@ import * as path from 'path'
|
|||
|
||||
import {DotnetTrxParser} from '../src/parsers/dotnet-trx/dotnet-trx-parser'
|
||||
import {ParseOptions} from '../src/test-parser'
|
||||
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
|
||||
import {DEFAULT_OPTIONS, getReport, ReportOptions} from '../src/report/get-report'
|
||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
||||
|
||||
describe('dotnet-trx tests', () => {
|
||||
|
|
@ -60,6 +60,32 @@ describe('dotnet-trx tests', () => {
|
|||
fs.writeFileSync(outputPath, report)
|
||||
})
|
||||
|
||||
it('matches report snapshot (only failed tests)', async () => {
|
||||
const fixturePath = path.join(__dirname, 'fixtures', 'dotnet-trx.trx')
|
||||
const outputPath = path.join(__dirname, '__outputs__', 'dotnet-trx-only-failed.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']
|
||||
//workDir: 'C:/Users/Michal/Workspace/dorny/test-check/reports/dotnet/'
|
||||
}
|
||||
|
||||
const parser = new DotnetTrxParser(opts)
|
||||
const result = await parser.parse(filePath, fileContent)
|
||||
expect(result).toMatchSnapshot()
|
||||
|
||||
const reportOptions: ReportOptions = {
|
||||
...DEFAULT_OPTIONS,
|
||||
listSuites: 'all',
|
||||
listTests: 'failed'
|
||||
}
|
||||
const report = getReport([result], reportOptions)
|
||||
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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue