Skip to content

Commit d7dee2c

Browse files
authored
fix: Improve code coverage reporting in codecov (#2715)
* fix: Remove explicit coverpkg github.com/coder/coder/codersdk This package is already covered by ./... * fix: Ignore test utils in coverage (clitest, coderdtest, ptytest)
1 parent 6c5a142 commit d7dee2c

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trim_trailing_whitespace = true
77
insert_final_newline = true
88
indent_style = tab
99

10-
[*.{md,json,yaml,tf,tfvars}]
10+
[*.{md,json,yaml,yml,tf,tfvars}]
1111
indent_style = space
1212
indent_size = 2
1313

.github/codecov.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ ignore:
3434
- scripts
3535
- site/.storybook
3636
- rules.go
37+
# Packages used for writing tests.
38+
- cli/clitest
39+
- coderd/coderdtest
40+
- pty/ptytest

.github/workflows/coder.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ jobs:
297297
# systems.
298298
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
299299
echo ::set-output name=cover::true
300-
export COVERAGE_FLAGS='-covermode=atomic -coverprofile="gotests.coverage" -coverpkg=./...,github.com/coder/coder/codersdk'
300+
export COVERAGE_FLAGS='-covermode=atomic -coverprofile="gotests.coverage" -coverpkg=./...'
301301
else
302302
echo ::set-output name=cover::false
303303
fi

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@
117117
"go.coverOnSave": true,
118118
// The codersdk is used by coderd another other packages extensively.
119119
// To reduce redundancy in tests, it's covered by other packages.
120-
"go.testFlags": ["-short", "-coverpkg=./.,github.com/coder/coder/codersdk"],
120+
// Since package coverage pairing can't be defined, all packages cover
121+
// all other packages.
122+
"go.testFlags": ["-short", "-coverpkg=./..."],
121123
"go.coverageDecorator": {
122124
"type": "gutter",
123125
"coveredHighlightColor": "rgba(64,128,128,0.5)",

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ test: test-clean
176176
test-postgres: test-clean test-postgres-docker
177177
DB=ci DB_FROM=$(shell go run scripts/migrate-ci/main.go) gotestsum --junitfile="gotests.xml" --packages="./..." -- \
178178
-covermode=atomic -coverprofile="gotests.coverage" -timeout=20m \
179-
-coverpkg=./...,github.com/coder/coder/codersdk \
179+
-coverpkg=./... \
180180
-count=1 -race -failfast
181181
.PHONY: test-postgres
182182

0 commit comments

Comments
 (0)