Dokimi provides some helper commands for testing in Go.
Table of Contents
go install github.com/farbodsalimi/dokimi@latest
Usage:
dokimi check-coverage [flags]
Flags:
-c, --coverprofile string coverprofile (default "coverage.out")
-d, --do-not-fail do-not-fail
-h, --help help for check-coverage
-t, --threshold float threshold (default 100)
Example:
dokimi check-coverage --threshold=90 --do-not-fail
Usage:
dokimi report [flags]
Flags:
-h, --help help for report
-i, --input string Path to input file
-o, --output string Path to output file
-r, --reporter string Reporter name e.g. istanbul, lcov, ...
--show Shows written reports
-
Go inside your project directory and run your tests:
go test -v -coverprofile=coverage.out ./...
-
Show your coverage in Istanbul UI:
dokimi report --input=coverage.out --output=coverage.json --reporter=istanbul --show
-
Go inside your project directory and run your tests:
go test -v -coverprofile=coverage.out ./...
-
Generate Istanbul json file:
dokimi report --input=coverage.out --output=coverage.json --reporter=istanbul