mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 14:27:10 +01:00
good start
This commit is contained in:
parent
08c81a1fd6
commit
713455873c
6 changed files with 301 additions and 0 deletions
45
__tests__/__outputs__/lcov-report-results.md
Normal file
45
__tests__/__outputs__/lcov-report-results.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||

|
||||
## ❌ <a id="user-content-r0" href="#r0">fixtures/lcov.json</a>
|
||||
**15** tests were completed in **0ms** with **7** passed, **8** failed and **0** skipped.
|
||||
|Test suite|Passed|Failed|Skipped|Time|
|
||||
|:---|---:|---:|---:|---:|
|
||||
|[src/core/dao.service.ts](#r0s0)|3✅|||0ms|
|
||||
|[src/domains/auth/auth.controller.ts](#r0s1)|2✅|1❌||0ms|
|
||||
|[src/shared/notif/providers/fcm/fcm.service.spec.ts](#r0s2)||3❌||0ms|
|
||||
|[src/shared/notif/providers/fcm/fcm.service.ts](#r0s3)|1✅|2❌||0ms|
|
||||
|[src/shared/notif/providers/mail/mail-service.ts](#r0s4)|1✅|2❌||0ms|
|
||||
### ✅ <a id="user-content-r0s0" href="#r0s0">src/core/dao.service.ts</a>
|
||||
```
|
||||
src/core/dao.service.ts
|
||||
✅ statement
|
||||
✅ fonction
|
||||
✅ branche
|
||||
```
|
||||
### ❌ <a id="user-content-r0s1" href="#r0s1">src/domains/auth/auth.controller.ts</a>
|
||||
```
|
||||
src/domains/auth/auth.controller.ts
|
||||
✅ statement
|
||||
❌ fonction
|
||||
✅ branche
|
||||
```
|
||||
### ❌ <a id="user-content-r0s2" href="#r0s2">src/shared/notif/providers/fcm/fcm.service.spec.ts</a>
|
||||
```
|
||||
src/shared/notif/providers/fcm/fcm.service.spec.ts
|
||||
❌ statement
|
||||
❌ fonction
|
||||
❌ branche
|
||||
```
|
||||
### ❌ <a id="user-content-r0s3" href="#r0s3">src/shared/notif/providers/fcm/fcm.service.ts</a>
|
||||
```
|
||||
src/shared/notif/providers/fcm/fcm.service.ts
|
||||
❌ statement
|
||||
❌ fonction
|
||||
✅ branche
|
||||
```
|
||||
### ❌ <a id="user-content-r0s4" href="#r0s4">src/shared/notif/providers/mail/mail-service.ts</a>
|
||||
```
|
||||
src/shared/notif/providers/mail/mail-service.ts
|
||||
❌ statement
|
||||
❌ fonction
|
||||
✅ branche
|
||||
```
|
||||
140
__tests__/__snapshots__/lcov.test.ts.snap
Normal file
140
__tests__/__snapshots__/lcov.test.ts.snap
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`lcov report coverage report from facebook/jest test results matches snapshot 1`] = `
|
||||
TestRunResult {
|
||||
"path": "fixtures/lcov.json",
|
||||
"suites": Array [
|
||||
TestSuiteResult {
|
||||
"groups": Array [
|
||||
TestGroupResult {
|
||||
"name": "src/core/dao.service.ts",
|
||||
"tests": Array [
|
||||
Object {
|
||||
"name": "statement",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
Object {
|
||||
"name": "fonction",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
Object {
|
||||
"name": "branche",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"name": "src/core/dao.service.ts",
|
||||
"totalTime": undefined,
|
||||
},
|
||||
TestSuiteResult {
|
||||
"groups": Array [
|
||||
TestGroupResult {
|
||||
"name": "src/domains/auth/auth.controller.ts",
|
||||
"tests": Array [
|
||||
Object {
|
||||
"name": "statement",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
Object {
|
||||
"name": "fonction",
|
||||
"result": "failed",
|
||||
"time": 0,
|
||||
},
|
||||
Object {
|
||||
"name": "branche",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"name": "src/domains/auth/auth.controller.ts",
|
||||
"totalTime": undefined,
|
||||
},
|
||||
TestSuiteResult {
|
||||
"groups": Array [
|
||||
TestGroupResult {
|
||||
"name": "src/shared/notif/providers/fcm/fcm.service.spec.ts",
|
||||
"tests": Array [
|
||||
Object {
|
||||
"name": "statement",
|
||||
"result": "failed",
|
||||
"time": 0,
|
||||
},
|
||||
Object {
|
||||
"name": "fonction",
|
||||
"result": "failed",
|
||||
"time": 0,
|
||||
},
|
||||
Object {
|
||||
"name": "branche",
|
||||
"result": "failed",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"name": "src/shared/notif/providers/fcm/fcm.service.spec.ts",
|
||||
"totalTime": undefined,
|
||||
},
|
||||
TestSuiteResult {
|
||||
"groups": Array [
|
||||
TestGroupResult {
|
||||
"name": "src/shared/notif/providers/fcm/fcm.service.ts",
|
||||
"tests": Array [
|
||||
Object {
|
||||
"name": "statement",
|
||||
"result": "failed",
|
||||
"time": 0,
|
||||
},
|
||||
Object {
|
||||
"name": "fonction",
|
||||
"result": "failed",
|
||||
"time": 0,
|
||||
},
|
||||
Object {
|
||||
"name": "branche",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"name": "src/shared/notif/providers/fcm/fcm.service.ts",
|
||||
"totalTime": undefined,
|
||||
},
|
||||
TestSuiteResult {
|
||||
"groups": Array [
|
||||
TestGroupResult {
|
||||
"name": "src/shared/notif/providers/mail/mail-service.ts",
|
||||
"tests": Array [
|
||||
Object {
|
||||
"name": "statement",
|
||||
"result": "failed",
|
||||
"time": 0,
|
||||
},
|
||||
Object {
|
||||
"name": "fonction",
|
||||
"result": "failed",
|
||||
"time": 0,
|
||||
},
|
||||
Object {
|
||||
"name": "branche",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"name": "src/shared/notif/providers/mail/mail-service.ts",
|
||||
"totalTime": undefined,
|
||||
},
|
||||
],
|
||||
"totalTime": undefined,
|
||||
}
|
||||
`;
|
||||
6
__tests__/fixtures/lcov.json
Normal file
6
__tests__/fixtures/lcov.json
Normal file
File diff suppressed because one or more lines are too long
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