Skip to content

hasit/opacover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opacover

Generate HTML representation of OPA test coverage.

Install

Make sure you have Go installed on your machine.

$ go version
go version go1.13 darwin/amd64

Get opacover. The following command will download the source code and place a runnable binary inside $GOPATH/bin.

$ go get -u https://github.com/hasit/opacover

Use

Whenever in doubt, --help flag will guide you.

$ go run main.go --help
generate HTML representation of OPA test coverage

Usage:
  opacover [flags]

Flags:
  -h, --help             help for opacover
  -i, --input string     input file in JSON
  -m, --modules string   directory path of Rego modules

To generate an HTML coverage report of OPA's test coverage, you will need a JSON formatted coverage file.

$ opa test <path-to-rego-files>/ -v --coverage > coverage.json

We will use this JSON file as input to opacover.

$ $GOPATH/bin/opacover --input coverage.json --modules ./ > coverage.html

Now, open the newly generated coverage.html file in your default browser to view it.

Contribute

Feel free to open issues and pull requests to improve opacover.

Inspirations

  1. OPA
  2. Go's Cover Tool

About

Generate HTML representation of OPA test coverage

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages