Skip to content

Commit abe00f8

Browse files
authored
chore: add make option to create test coverage reports (#659)
1 parent e609e33 commit abe00f8

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ dist/
1111

1212
# Go workspace file
1313
go.work
14-
go.work.sum
14+
go.work.sum
15+
16+
# Test coverage reports
17+
coverage.out
18+
coverage.html

CONTRIBUTION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ These commands can be executed from the project root:
3131
- `make lint`: lint the code
3232
- `make generate-docs`: generate Markdown documentation for every command
3333
- `make test`: run unit tests
34+
- `make coverage`: create unit test coverage report (output file: `coverage.html`)
3435

3536
### Repository structure
3637

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ test:
3333
@echo ">> Running tests for the CLI application"
3434
@go test ./... -count=1
3535

36+
# Test coverage
37+
coverage:
38+
@echo ">> Creating test coverage report for the CLI application"
39+
@go test ./... -coverprofile=coverage.out || true
40+
@go tool cover -html=coverage.out -o coverage.html
41+
3642
# Generate docs
3743
generate-docs:
3844
@echo ">> Generating docs..."

0 commit comments

Comments
 (0)