https://github.com/hasit/opacover
Generate HTML representation of OPA test coverage
https://github.com/hasit/opacover
html opa rego testing-tools
Last synced: 5 months ago
JSON representation
Generate HTML representation of OPA test coverage
- Host: GitHub
- URL: https://github.com/hasit/opacover
- Owner: hasit
- License: mit
- Created: 2019-10-04T18:56:43.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-07T21:16:01.000Z (over 6 years ago)
- Last Synced: 2025-08-15T00:38:49.768Z (10 months ago)
- Topics: html, opa, rego, testing-tools
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# opacover
Generate HTML representation of OPA test coverage.
## Install
Make sure you have `Go` installed on your machine.
```shell
$ 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`.
```shell
$ go get -u https://github.com/hasit/opacover
```
## Use
Whenever in doubt, `--help` flag will guide you.
```shell
$ 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.
```shell
$ opa test / -v --coverage > coverage.json
```
We will use this JSON file as input to `opacover`.
```shell
$ $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](https://www.openpolicyagent.org/)
2. [Go's Cover Tool](https://golang.org/cmd/cover/)