Skip to content

Commit

Permalink
Handle empty missing lines (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannseman authored Jan 11, 2021
1 parent 6b4e36a commit 67ec5c1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34985,7 +34985,7 @@ function markdownReport(report, commit, options) {
showLine ? `\`${fileLines}%\`` : undefined,
showBranch ? `\`${fileBranch}%\`` : undefined,
status(fileTotal),
showMissing ? `\`${fileMissing}\`` : undefined
showMissing ? (fileMissing ? `\`${fileMissing}\`` : " ") : undefined
]);
}
// Construct table
Expand Down
2 changes: 1 addition & 1 deletion src/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function markdownReport(report, commit, options) {
showLine ? `\`${fileLines}%\`` : undefined,
showBranch ? `\`${fileBranch}%\`` : undefined,
status(fileTotal),
showMissing ? `\`${fileMissing}\`` : undefined
showMissing ? (fileMissing ? `\`${fileMissing}\`` : " ") : undefined
]);
}
// Construct table
Expand Down
17 changes: 17 additions & 0 deletions src/action.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ const dummyReport = {
line: 80,
branch: 0,
missing: "23-24, 39-40"
},
{
name: "ClassMoo",
filename: "foo.py",
total: 75,
line: 100,
branch: 75,
missing: ""
}
]
};
Expand Down Expand Up @@ -211,6 +219,7 @@ test("markdownReport", () => {
| **All files** | \`78%\` | :white_check_mark: |
| \\_\\_init\\_\\_.py | \`80%\` | :white_check_mark: |
| bar.py | \`75%\` | :white_check_mark: |
| foo.py | \`75%\` | :white_check_mark: |
_Minimum allowed coverage is \`70%\`_
Expand All @@ -224,6 +233,7 @@ _Minimum allowed coverage is \`70%\`_
| **All files** | \`78%\` | :x: |
| \\_\\_init\\_\\_.py | \`80%\` | :x: |
| bar.py | \`75%\` | :x: |
| foo.py | \`75%\` | :x: |
_Minimum allowed coverage is \`100%\`_
Expand All @@ -238,6 +248,7 @@ _Minimum allowed coverage is \`100%\`_
| **All files** | \`78%\` | \`78%\` | :white_check_mark: |
| \\_\\_init\\_\\_.py | \`80%\` | \`80%\` | :white_check_mark: |
| bar.py | \`75%\` | \`80%\` | :white_check_mark: |
| foo.py | \`75%\` | \`100%\` | :white_check_mark: |
_Minimum allowed coverage is \`70%\`_
Expand All @@ -255,6 +266,7 @@ _Minimum allowed coverage is \`70%\`_
| **All files** | \`78%\` | \`0%\` | :white_check_mark: |
| \\_\\_init\\_\\_.py | \`80%\` | \`0%\` | :white_check_mark: |
| bar.py | \`75%\` | \`0%\` | :white_check_mark: |
| foo.py | \`75%\` | \`75%\` | :white_check_mark: |
_Minimum allowed coverage is \`70%\`_
Expand All @@ -273,6 +285,7 @@ _Minimum allowed coverage is \`70%\`_
| **All files** | \`78%\` | \`78%\` | \`0%\` | :white_check_mark: |
| \\_\\_init\\_\\_.py | \`80%\` | \`80%\` | \`0%\` | :white_check_mark: |
| bar.py | \`75%\` | \`80%\` | \`0%\` | :white_check_mark: |
| foo.py | \`75%\` | \`100%\` | \`75%\` | :white_check_mark: |
_Minimum allowed coverage is \`70%\`_
Expand All @@ -292,6 +305,7 @@ _Minimum allowed coverage is \`70%\`_
| **All files** | \`78%\` | \`78%\` | \`0%\` | :white_check_mark: | |
| \\_\\_init\\_\\_.py | \`80%\` | \`80%\` | \`0%\` | :white_check_mark: | \`24-26\` |
| bar.py | \`75%\` | \`80%\` | \`0%\` | :white_check_mark: | \`23-24, 39-40\` |
| foo.py | \`75%\` | \`100%\` | \`75%\` | :white_check_mark: | |
_Minimum allowed coverage is \`70%\`_
Expand All @@ -312,6 +326,7 @@ _Minimum allowed coverage is \`70%\`_
| **All files** | \`78%\` | \`78%\` | \`0%\` | :white_check_mark: | |
| \\_\\_init\\_\\_.py | \`80%\` | \`80%\` | \`0%\` | :white_check_mark: | \`24-26\` |
| bar.py | \`75%\` | \`80%\` | \`0%\` | :white_check_mark: | \`23-24...\` |
| foo.py | \`75%\` | \`100%\` | \`75%\` | :white_check_mark: | |
_Minimum allowed coverage is \`70%\`_
Expand All @@ -325,6 +340,7 @@ _Minimum allowed coverage is \`70%\`_
| **All files** | \`78%\` | :x: |
| \\_\\_init\\_\\_.py | \`80%\` | :white_check_mark: |
| bar.py | \`75%\` | :x: |
| foo.py | \`75%\` | :x: |
_Minimum allowed coverage is \`80%\`_
Expand All @@ -338,6 +354,7 @@ _Minimum allowed coverage is \`80%\`_
| **All files** | \`78%\` | :x: |
| ClassFoo | \`80%\` | :x: |
| ClassBar | \`75%\` | :x: |
| ClassMoo | \`75%\` | :x: |
_Minimum allowed coverage is \`100%\`_
Expand Down

0 comments on commit 67ec5c1

Please sign in to comment.