Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here are the steps for setting up a status check on Github that shows lines of code that are not covered by testing:

  1. First, you should have a repository with a codebase and automated testing framework in place to identify code coverage.

  2. Select an existing or create a new framework to capture code coverage. Examples include Jest, Istanbul, and Simplecov.

  3. You can then set up your test suite to capture code coverage metrics. This varies depending on your testing framework, but usually requires you to run the tests in a specific way or with specific arguments.

  4. Once you have code coverage metrics set up, you can integrate them with Github.

  5. To add status checks for code coverage, go to your repository settings and navigate to "Branches". There, you will find an option to configure branch protection rules.

  6. To add a new rule, click "Add rule".

  7. Under the "Require status checks to pass before merging" section, select your code coverage status check.

  8. Save the changes.

  9. The next time a pull request is submitted, the status check will run and display any lines of code that are not covered by tests.

  10. If you want to make sure that all code changes are properly tested, you can enforce this rule by requiring all new code to be covered by tests before submitting a pull request using the “Require branches to be up to date before merging” option.

That's it. Now you have a status check on Github that shows lines of code that are not covered by testing.