Skip to content

Commit ef35fcc

Browse files
chmoueltheakshaypant
authored andcommitted
test: use gotestsum for unit test if available
Updated the unit test command to use `gotestsum` when available to provide more readable test output, while maintaining compatibility with the standard Go test runner. Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
1 parent 92b37cf commit ef35fcc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ test-no-cache: test-clean test-unit ## Run test-unit without caching
6767
test-unit: ## Run unit tests
6868
@mkdir -p tmp/
6969
@echo "Running unit tests..."
70-
$(GO) test $(DEFAULT_GO_TEST_FLAGS) $(GO_TEST_FLAGS) -timeout $(TIMEOUT_UNIT) ./pkg/...
70+
@if command -v gotestsum >/dev/null 2>&1; then \
71+
gotestsum --format testdox -- $(DEFAULT_GO_TEST_FLAGS) $(GO_TEST_FLAGS) -timeout $(TIMEOUT_UNIT) ./pkg/...; \
72+
else \
73+
$(GO) test $(DEFAULT_GO_TEST_FLAGS) $(GO_TEST_FLAGS) -timeout $(TIMEOUT_UNIT) ./pkg/...; \
74+
fi
7175

7276
.PHONY: test-e2e-cleanup
7377
test-e2e-cleanup: ## cleanup test e2e namespace/pr left open

0 commit comments

Comments
 (0)