Skip to content

Latest commit

 

History

History
73 lines (46 loc) · 6.04 KB

README.md

File metadata and controls

73 lines (46 loc) · 6.04 KB

Lcov reporter action

This action comments a pull request with a HTML test coverage report.

The report is based on the lcov coverage report generated by your test runner.

Note that this action does not run any tests, but instead expects the tests to have been run by another action already.

Example output

Coverage after merging feat/test into master

71.63

Coverage Report
File% Stmts% Branches% Funcs% Lines
src
   cli.js0000
   comment.js73.3366.6710075
   html.js100100100100
   index.js0000
   lcov.js100100100100
   report.js94.1282.0510098.61
   tabulate.js97.2795.9210097.96

Example output with base-lcov, show-color-emoji, show-increase-per-files

Coverage after merging feat/test into master

60.10(+30.54) 🟢

Coverage Report
File% Stmts% Branches% Funcs% Lines
src
   lcov.js0(-100) 🔴0(-100) 🔴0(-100) 🔴0(-100) 🔴
   report.js94.12(+94.12) 🟢82.05(+82.05) 🟢100(+100) 🟢98.61(+98.61) 🟢

Example output using base-lcov with all other options enabled

Coverage after merging feat/test into master

29.56 60.10(+30.54) 🟢

Coverage Report
File% Stmts% Branches% Funcs% LinesUncovered Lines
src
   lcov.js100 0(-100) 🔴100 0(-100) 🔴100 0(-100) 🔴100 0(-100) 🔴5–9, 11
   report.jsN/A 94.12(+94.12) 🟢N/A 82.05(+82.05) 🟢N/A 100(+100) 🟢N/A 98.61(+98.61) 🟢11, 53, 83–84, 139–140, 153, 157

Inputs

github-token (Required)

Github token used for posting the comment. To use the key provided by the GitHub action runner, use ${{ secrets.GITHUB_TOKEN }}.

lcov-file (Optional)

The location of the lcov file to read the coverage report from. Defaults to ./coverage/lcov.info.

lcov-base (Optional)

The location of the lcov file resulting from running the tests in the base branch. When this is set a diff of the coverage percentages is shown.

show-uncovered-lines (Optional)

When set to true will show the uncovered lines column. Defaults to false;

show-color-emoji (Optional)

When set to true will show a colored emoji if the coverage decreased 🔴 or increased 🟢, like "98.61(+2.61) 🟢 ". Defaults to false;

show-old-value-for-files (Optional)

When set to true will show the old coverage result value, like: "94,65 98.61". Defaults to true;

show-increase-per-files (Optional)

When set to true will show the increase/decrease difference of the coverage, like: "98.61(+2.61)". Defaults to false;

Example usage

uses: eberlitz/[email protected]
with:
  github-token: ${{ secrets.GITHUB_TOKEN }}
  lcov-file: ./coverage/lcov.info
  base-file: ./coverage/base-lcov.info
  show-uncovered-lines: false
  show-color-emoji: true
  show-old-value-for-files: false
  show-increase-per-files: true

Acknowledgements

The initial code is based on romeovs/lcov-reporter-action which was previously based on ziishaned/jest-reporter-action. I also got some ideas from hrgui/lcov-reporter-action;