go-testcoverage

command module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

README

go-testcoverage

lint test Go Report Card codecov GoDoc Release

go-testcoverage 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-testcoverage@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) 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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL