Sitelet https://github.com/orgoro/coverage/pull/249/files
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ jobs:
| `thresholdAll` | ✅ | the minimal average line coverage | 0.8 |
| `thresholdNew` | ✅ | the minimal average new files line coverage | 0.9 |
| `thresholdModified` | ✅ | the minimal average modified files line coverage | 0.0 |
| `passIcon` | ✅ | the indicator to use for files that passed | 🟢 |
| `failIcon` | ✅ | the indicator to use for files that passed | 🔴 |
30 changes: 28 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/format.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import {AverageCoverage, Coverage} from './coverage'
import {markdownTable} from 'markdown-table'
import * as core from '@actions/core'

const passOrFailIndicator = (predicate: boolean): string => (predicate ? '🟢' : '🔴')
const passIcon = core.getInput('passIcon') || '🟢'
const failIcon = core.getInput('failIcon') || '🔴'
const passOrFailIndicator = (predicate: boolean): string => (predicate ? passIcon : failIcon)

function averageCover(cover: Coverage[]): string {
const filterd = cover.filter(file => file.cover >= 0)
Expand All @@ -23,7 +26,8 @@ export function formatFilesTable(cover: Coverage[]): {coverTable: string; pass:
...cover.map(coverFile => {
const coverPrecent = `${(coverFile.cover * 100).toFixed()}%`
const indicator = passOrFailIndicator(coverFile.pass)
return [coverFile.file, coverPrecent, indicator]
const formatedFile = coverFile.file.replace("_", "\\_")
return [formatedFile, coverPrecent, indicator]
}),
['**TOTAL**', avgCover, averageIndicator]
],
Expand Down