diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f183e19..38818e0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: go-version: ${{ matrix.go-version }} cache: true - name: Test - run: go test -coverpkg=$(go list ./internal/..|grep -v mock) -race -vet=off -count=1 -coverprofile unit.txt -covermode atomic ./... + run: go test -coverpkg=$(go list ./internal/... | grep -v mocks | tr '\n' ',') -race -vet=off -count=1 -coverprofile unit.txt -covermode atomic ./... - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: diff --git a/Makefile b/Makefile index 734b0fc..9805211 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,8 @@ audit: test: @echo 'Running unit tests' # By using -coverpkg=$$(go list ./internal/..|grep -v mock) we exclude "mock" folder from codecov report - go test -coverpkg=$$(go list ./internal/..|grep -v mock) -race -vet=off -count=1 -coverprofile unit.txt -covermode atomic ./... + ALL_PACKAGES_EXCLUDE_MOCKS=$(go list ./internal/... | grep -v mocks | tr '\n' ',') + go test -coverpkg=$$ALL_PACKAGES_EXCLUDE_MOCKS -race -vet=off -count=1 -coverprofile unit.txt -covermode atomic ./... ## unit-test-report: display unit coverage report in html format .PHONY: unit-test-report