mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 22:37:09 +01:00
good start
This commit is contained in:
parent
08c81a1fd6
commit
713455873c
6 changed files with 301 additions and 0 deletions
25
__tests__/lcov.test.ts
Normal file
25
__tests__/lcov.test.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
import {getReport} from '../src/report/get-report'
|
||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
||||
import { LcovParser } from "../src/parsers/lcov-json/lcov-parser";
|
||||
|
||||
describe('lcov report coverage', () => {
|
||||
|
||||
it('report from facebook/jest test results matches snapshot', async () => {
|
||||
const fixturePath = path.join(__dirname, 'fixtures', 'lcov.json')
|
||||
const outputPath = path.join(__dirname, '__outputs__', 'lcov-report-results.md')
|
||||
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
|
||||
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
|
||||
|
||||
|
||||
const parser = new LcovParser()
|
||||
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