Skip to content

Commit f39baef

Browse files
authored
fix(test): Run test with coverage for all packages (#548)
1 parent d721cd7 commit f39baef

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ test/%: DIR=$*
2626
test/%:
2727
@echo ">>> Running tests for module: $(DIR)"
2828
@# We use '-count=1' to disable test caching.
29-
cd $(DIR) && $(GO) test -count=1 -timeout $(TIMEOUT)s $(ARGS) ./...
29+
(cd $(DIR) && $(GO) test -count=1 -timeout $(TIMEOUT)s $(ARGS) ./...)
3030
.PHONY: $(TEST_TARGETS) test
3131

3232
# Coverage
@@ -39,14 +39,12 @@ $(COVERAGE_REPORT_DIR):
3939
clean-report-dir: $(COVERAGE_REPORT_DIR)
4040
test $(COVERAGE_REPORT_DIR) && rm -f $(COVERAGE_REPORT_DIR)/*
4141
test-coverage: $(COVERAGE_REPORT_DIR) clean-report-dir ## Test with coverage enabled
42-
@set -e; \
4342
for dir in $(ALL_GO_MOD_DIRS); do \
4443
echo ">>> Running tests with coverage for module: $${dir}"; \
45-
echo "$(GO) test -count=1 -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" $${dir}/..."; \
4644
DIR_ABS=$$(python -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' $${dir}) ; \
4745
REPORT_NAME=$$(basename $${DIR_ABS}); \
4846
(cd "$${dir}" && \
49-
$(GO) test -count=1 -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" && \
47+
$(GO) test -count=1 -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" ./... && \
5048
cp $(COVERAGE_PROFILE) "$(COVERAGE_REPORT_DIR_ABS)/$${REPORT_NAME}_$(COVERAGE_PROFILE)" && \
5149
$(GO) tool cover -html=$(COVERAGE_PROFILE) -o coverage.html); \
5250
done;

0 commit comments

Comments
 (0)