Skip to content

Commit

Permalink
Merge pull request #361 from dkhunt27/hideFlags
Browse files Browse the repository at this point in the history
Hide flags
  • Loading branch information
dkhunt27 authored Apr 3, 2024
2 parents 1f4aec1 + cfcca97 commit ecae468
Show file tree
Hide file tree
Showing 21 changed files with 28,610 additions and 6,629 deletions.
4 changes: 3 additions & 1 deletion .github/samples/main-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
if-no-files-found: error

- name: Create Code Coverage Badge
uses: dkhunt27/nx-code-coverage@v1
uses: dkhunt27/nx-code-coverage@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
no-coverage-ran: false
Expand All @@ -66,3 +66,5 @@ jobs:
gist-id: SOME_GIST_ID
color: green
named-logo: jest
hide-coverage-reports: false
hide-unchanged: false
4 changes: 3 additions & 1 deletion .github/samples/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
continue-on-error: true

- 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 @@ -73,4 +73,6 @@ jobs:
gist-id: SOME_GIST_ID
color: green
named-logo: jest
hide-coverage-reports: false
hide-unchanged: false

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 diffs
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 ecae468

Please sign in to comment.