Socket
Socket
Sign inDemoInstall

github.phpd.cn/vladopajic/go-test-coverage

Package Overview
Dependencies
2
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.phpd.cn/vladopajic/go-test-coverage


Version published

Readme

Source

go-test-coverage

test lint Go Report Card GoDoc Release

go-test-coverage is tool which reports issues when test coverage of a file or package is below set threshold.

Usage

name: Go test coverage check
runs-on: ubuntu-latest
steps:
  - uses: actions/checkout@v3
  - uses: actions/setup-go@v3
  
  - name: test (generate coverage)
    run: go test ./... -coverprofile=./cover.out

  - name: check test coverage
    uses: vladopajic/go-test-coverage@v1
    with:
      config: ./.testcoverage.yml  # (config file is mandatory)

Config

Example of .testcoverage.yml config file.

# (mandatory) 
# Path to coverprofile file (output of `go test -coverprofile` command)
profile: cover.out

# (optional; default true)
# When set to `true` tool will output github-action friendly outputs
githubActionOutput: true

# (optional) 
# When specified reported file paths will not contain local prefix in the output
localPrefix: "github.com/org/project"

# Holds coverage thresholds percentages, values should be in range [0-100]
threshold:
  # (optional; default 0) 
  # The minimum coverage that each file should have
  file: 80

  # (optional; default 0) 
  # The minimum coverage that each package should have
  package: 80

  # (optional; default 50) 
  # The minimum total coverage project should have
  total: 95

Contribution

All contributions are useful, whether it is a simple typo, a more complex change, or just pointing out an issue. We welcome any contribution so feel free to open PR or issue.

FAQs

Last updated on 29 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc