Test Coverage - Branch Names
Successfully generating test coverage for your branches, but not seeing the results populated in GitHub via the browser extension or PR statuses?
Code Climate Needs:
Here's the basic troubleshooting checklist, with additional details below:
- Get debug output from your CI build using the
- View the output
- Check your CI's env var names
- Adjust your coverage setup
Get debug output
The cc-test-reporter command has an option to output additional debug messages during operation.
For single builds, use:
For tests run in parallel, use:
View CI output
Once you've added the
--debug option, you'll find the branch name identified in your build log, like this:
Check your CI's environmental variable names
When looking at a payload, Code Climate looks for a specific set of environmental variable names.
Double-check to make sure your CI's
GIT_BRANCH variable names can be matched against the ones listed at the bottom of this file:
Additionally, the test reporter must be able to determine the time of commit. We'll attempt to read this information from git if no ENV VAR is explicitly set, but it may be necessary to set
Adjust coverage setup as needed
Working with a Docker container?
When using docker, it’s common to not export the git directory to the workspace, which means our test reporter requires environment variables to get the information it needs. Make sure to pass the environment variables through.
You could pass the env variable to the docker container doing something like this:
docker run \ --env CI \ --env CIRCLECI \ --env CIRCLE_BUILD_NUM \ --env CIRCLE_BRANCH \ --env CIRCLE_SHA1 \ your-org/app bundle exec rspec
AWS Codebuild and Azure Pipelines
Find additional information on getting Branch names and other env vars here:
Updated 4 months ago