mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-15 22:07:09 +01:00
Implement NUnit 3 parser.
This commit is contained in:
parent
b34d4b1bfe
commit
49c1f3ae6c
5 changed files with 372 additions and 0 deletions
29
__tests__/dotnet-nunit.test.ts
Normal file
29
__tests__/dotnet-nunit.test.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
import {DotNetNunitParser} from '../src/parsers/dotnet-nunit/dotnet-nunit-parser'
|
||||
import {ParseOptions} from '../src/test-parser'
|
||||
import {getReport} from '../src/report/get-report'
|
||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
||||
|
||||
describe('dotnet-nunit tests', () => {
|
||||
it('report from ./reports/dotnet test results matches snapshot', async () => {
|
||||
const fixturePath = path.join(__dirname, 'fixtures', 'dotnet-nunit.xml')
|
||||
const outputPath = path.join(__dirname, '__outputs__', 'dotnet-nunit.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.NUnitV3Tests/CalculatorTests.cs']
|
||||
}
|
||||
|
||||
const parser = new DotNetNunitParser(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)
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue