diff --git a/.gitignore b/.gitignore index 47aabc929..2cf34eb63 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,8 @@ dist/ # Go workspace file go.work -go.work.sum \ No newline at end of file +go.work.sum + +# Test coverage reports +coverage.out +coverage.html diff --git a/CONTRIBUTION.md b/CONTRIBUTION.md index be0a54346..07af2da47 100644 --- a/CONTRIBUTION.md +++ b/CONTRIBUTION.md @@ -31,6 +31,7 @@ These commands can be executed from the project root: - `make lint`: lint the code - `make generate-docs`: generate Markdown documentation for every command - `make test`: run unit tests +- `make coverage`: create unit test coverage report (output file: `coverage.html`) ### Repository structure diff --git a/Makefile b/Makefile index 7657fc059..373d2b0fb 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,12 @@ test: @echo ">> Running tests for the CLI application" @go test ./... -count=1 +# Test coverage +coverage: + @echo ">> Creating test coverage report for the CLI application" + @go test ./... -coverprofile=coverage.out || true + @go tool cover -html=coverage.out -o coverage.html + # Generate docs generate-docs: @echo ">> Generating docs..."