Skip to content

Commit

Permalink
added hide-coverage-reports and hide-unchanged
Browse files Browse the repository at this point in the history
  • Loading branch information
dkhunt27 committed Apr 3, 2024
1 parent 1f4aec1 commit 51e9cbd
Show file tree
Hide file tree
Showing 19 changed files with 28,604 additions and 6,627 deletions.
8 changes: 3 additions & 5 deletions .npmcheckrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"depcheck":
{
"ignoreMatches":
[
"depcheck": {
"ignoreMatches": [
"@types/*",
"npm-check-pr397",
"@jest/globals",
"yorkie"
]
}
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ The report is based on the coverage report generated by your test runner.
cache-seconds:
description: 'The cache lifetime in seconds (must be greater than 300)'
required: false
hide-coverage-reports:
description: true/false to hide the coverage reports
type: boolean
required: true
hide-unchanged:
description: true/false to hide the coverage results that have no change
type: boolean
required: true
```
## Setup
Expand All @@ -79,7 +87,7 @@ The report is based on the coverage report generated by your test runner.
```yaml
- name: Comment Code Coverage on PR
uses: dkhunt27/nx-code-coverage@v1
uses: dkhunt27/nx-code-coverage@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
no-coverage-ran: false
Expand All @@ -90,6 +98,8 @@ The report is based on the coverage report generated by your test runner.
gist-id: d7e6b443a01eba615fd2a7c1215aec91
color: green
named-logo: jest
hide-coverage-reports: false
hide-unchanged: false
```
- See sample workflows
Expand Down
33 changes: 33 additions & 0 deletions __tests__/__snapshots__/comment.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`comment tests buildComment when hiding coverage reports when hiding unchanged when all results in one then return as expected 1`] = `"Code Coverage:<p></p><table><tbody><tr><th>app diff -</th><th>50.00%</th><th>❌ ▾ -25.00%</th></tr></tbody></table> <br/><table><tbody><tr><th>app diff +</th><th>50.00%</th><th>✅ ▴ +25.00%</th></tr></tbody></table> <br/><table><tbody><tr><th>app diff null</th><th>unknown%</th></tr></tbody></table> <br/>"`;

exports[`comment tests buildComment when hiding coverage reports when hiding unchanged when result coverage is undefined then unknown diff in code coverage comment 1`] = `"Code Coverage:<p></p><table><tbody><tr><th>app A</th><th>unknown%</th></tr></tbody></table> <br/>"`;

exports[`comment tests buildComment when hiding coverage reports when hiding unchanged when result diff is 0 then no code coverage comment 1`] = `"Code Coverage:<p></p>"`;

exports[`comment tests buildComment when hiding coverage reports when hiding unchanged when result diff is negative then negative diff in code coverage comment 1`] = `"Code Coverage:<p></p><table><tbody><tr><th>app A</th><th>50.00%</th><th>❌ ▾ -25.00%</th></tr></tbody></table> <br/>"`;

exports[`comment tests buildComment when hiding coverage reports when hiding unchanged when result diff is positive then positive diff in code coverage comment 1`] = `"Code Coverage:<p></p><table><tbody><tr><th>app A</th><th>50.00%</th><th>✅ ▴ +25.00%</th></tr></tbody></table> <br/>"`;

exports[`comment tests buildComment when hiding coverage reports when not hiding unchanged when all results in one then return as expected 1`] = `"Code Coverage:<p></p><table><tbody><tr><th>app diff 0</th><th>50.00%</th><th>✅ 0.00%</th></tr></tbody></table> <br/><table><tbody><tr><th>app diff -</th><th>50.00%</th><th>❌ ▾ -25.00%</th></tr></tbody></table> <br/><table><tbody><tr><th>app diff +</th><th>50.00%</th><th>✅ ▴ +25.00%</th></tr></tbody></table> <br/><table><tbody><tr><th>app diff null</th><th>unknown%</th></tr></tbody></table> <br/>"`;

exports[`comment tests buildComment when hiding coverage reports when not hiding unchanged when result coverage is undefined then unknown diff in code coverage comment 1`] = `"Code Coverage:<p></p><table><tbody><tr><th>app A</th><th>unknown%</th></tr></tbody></table> <br/>"`;

exports[`comment tests buildComment when hiding coverage reports when not hiding unchanged when result diff is 0 then 0 diff in code coverage comment 1`] = `"Code Coverage:<p></p><table><tbody><tr><th>app A</th><th>50.00%</th><th>✅ 0.00%</th></tr></tbody></table> <br/>"`;

exports[`comment tests buildComment when hiding coverage reports when not hiding unchanged when result diff is negative then negative diff in code coverage comment 1`] = `"Code Coverage:<p></p><table><tbody><tr><th>app A</th><th>50.00%</th><th>❌ ▾ -25.00%</th></tr></tbody></table> <br/>"`;

exports[`comment tests buildComment when hiding coverage reports when not hiding unchanged when result diff is positive then positive diff in code coverage comment 1`] = `"Code Coverage:<p></p><table><tbody><tr><th>app A</th><th>50.00%</th><th>✅ ▴ +25.00%</th></tr></tbody></table> <br/>"`;

exports[`comment tests buildComment when not hiding coverage reports when all results in one then return as expected 1`] = `
"Code Coverage:<p></p><table><tbody><tr><th>app diff 0</th><th>50.00%</th><th>✅ 0.00%</th></tr></tbody></table>
<details><summary>Coverage Report</summary><table><tbody><tr><th>File </th><th> % Stmts </th><th> % Branch </th><th> % Funcs </th><th> % Lines </th><th> Uncovered Line #s </th></tr><tr><td>All&nbsp;files </td><td>&nbsp; 96.42 </td><td>&nbsp; 60 </td><td>&nbsp; 96.66 </td><td>&nbsp; 96.59 </td><td>&nbsp; </td></tr></tbody></table></details> <br/><table><tbody><tr><th>app diff -</th><th>50.00%</th><th>❌ ▾ -25.00%</th></tr></tbody></table>
<details><summary>Coverage Report</summary><table><tbody><tr><th>File </th><th> % Stmts </th><th> % Branch </th><th> % Funcs </th><th> % Lines </th><th> Uncovered Line #s </th></tr><tr><td>All&nbsp;files </td><td>&nbsp; 96.42 </td><td>&nbsp; 60 </td><td>&nbsp; 96.66 </td><td>&nbsp; 96.59 </td><td>&nbsp; </td></tr></tbody></table></details> <br/><table><tbody><tr><th>app diff +</th><th>50.00%</th><th>✅ ▴ +25.00%</th></tr></tbody></table>
<details><summary>Coverage Report</summary><table><tbody><tr><th>File </th><th> % Stmts </th><th> % Branch </th><th> % Funcs </th><th> % Lines </th><th> Uncovered Line #s </th></tr><tr><td>All&nbsp;files </td><td>&nbsp; 96.42 </td><td>&nbsp; 60 </td><td>&nbsp; 96.66 </td><td>&nbsp; 96.59 </td><td>&nbsp; </td></tr></tbody></table></details> <br/><table><tbody><tr><th>app diff null</th><th>unknown%</th></tr></tbody></table>
<details><summary>Coverage Report</summary><table><tbody><tr><th>File </th><th> % Stmts </th><th> % Branch </th><th> % Funcs </th><th> % Lines </th><th> Uncovered Line #s </th></tr><tr><td>All&nbsp;files </td><td>&nbsp; 96.42 </td><td>&nbsp; 60 </td><td>&nbsp; 96.66 </td><td>&nbsp; 96.59 </td><td>&nbsp; </td></tr></tbody></table></details> <br/>"
`;
Loading

0 comments on commit 51e9cbd

Please sign in to comment.