StyraInc / regal

Regal is a linter and language server for Rego, bringing your policy development experience to the next level!

Home Page:https://docs.styra.com/regal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

100% test coverage

anderseknert opened this issue · comments

While this is mostly an expensive waste of time in most languages, it's fairly easy to achieve 100% test coverage in Rego, and without ever having to test "impossible" conditions. The fact that we've never measured test coverage in Regal and despite that have one above 98% is some evidence of that.

go run main.go test --coverage bundle
...
"not_covered_lines": 78,
"coverage": 98.1994459833795

It would be a useful exercise to get that number to 100% to see if there is anything important we currently miss in our tests. Once we have 100% coverage, we should add a build step that enforces that going forward.

In order to see which lines aren't covered, just run go run main.go test --coverage bundle and search the output for "not_covered".