Ask Your Question
1

What is the process for setting up a status check on Github that shows lines of code that are not covered by testing?

asked 2021-05-19 11:00:00 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2023-02-04 18:00:00 +0000

ladyg gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-05-19 11:00:00 +0000

Seen: 7 times

Last updated: Feb 04 '23