Generate HTML representation of OPA test coverage.
Make sure you have Go installed on your machine.
$ go version
go version go1.13 darwin/amd64Get opacover. The following command will download the source code and place a runnable binary inside $GOPATH/bin.
$ go get -u https://github.com/hasit/opacoverWhenever 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 modulesTo 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.jsonWe will use this JSON file as input to opacover.
$ $GOPATH/bin/opacover --input coverage.json --modules ./ > coverage.htmlNow, open the newly generated coverage.html file in your default browser to view it.
Feel free to open issues and pull requests to improve opacover.