Skip to content

Commit

Permalink
chore: added variable to filter out unit test packages
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmoraes committed Mar 5, 2024
1 parent d776cd8 commit 0767537
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .make/golang.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ GOLANG_MERGED_GOCOV_FILE ?= ${GOLANG_COVERAGE_PATH}/merged.txt
GOLANG_RUN_REPORT_FILE ?= ${GOLANG_COVERAGE_PATH}/run-report.json
GOLANG_UNIT_TEST_GOCOV_FILE ?= ${GOLANG_COVERAGE_PATH}/unit.txt

GOLANG_TEST_PACKAGES ?= ./...
GOLANG_INTEGRATION_SRC_PATH ?=
GOLANG_INTEGRATION_PACKAGES ?=
GOLANG_INTEGRATION_ENABLED ?= $(if ${GOLANG_INTEGRATION_SRC_PATH},1)
Expand Down Expand Up @@ -52,7 +53,7 @@ golang-clean:

.PHONY: golang-test
golang-test:
@${GO} test ${GOLANG_FLAGS} -v ./...
@${GO} test ${GOLANG_FLAGS} -v ${GOLANG_TEST_PACKAGES}

.PHONY: golang-coverage-html
golang-coverage-html: ${GOLANG_COVERAGE_REPORT_TARGET}
Expand All @@ -74,7 +75,7 @@ ${GOLANG_COVERAGE_REPORT_TARGET}: ${GOLANG_COVERAGE_REPORT_SOURCE}
${GOLANG_UNIT_TEST_GOCOV_FILE}: ${SOURCE_FILES}
${GOLANG_UNIT_TEST_GOCOV_FILE}:
$(info running unit tests)
@${GO} test -v ${GOLANG_FLAGS} -coverprofile=$@ ./...
@${GO} test -v ${GOLANG_FLAGS} -coverprofile=$@ ${GOLANG_TEST_PACKAGES}

### only run integration test and merge test results if enabled
ifneq (${GOLANG_INTEGRATION_ENABLED},)
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CONTAINER_STRUCTURE_TEST_FILE = container-structure-test.yaml
CONTAINER_IMAGE = wwmoraes/anilistarr
GOLANG_INTEGRATION_SRC_PATH = cmd/internal/integration
GOLANG_INTEGRATION_PACKAGES = internal/usecases,internal/adapters
GOLANG_TEST_PACKAGES = ./internal/adapters/... ./internal/usecases/...

-include .make/*.mk

Expand Down

0 comments on commit 0767537

Please sign in to comment.