Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ update-golden: build-e2e ## Regenerate golden files for pattern battery tests

check-coverage: ## Run tests with coverage and enforce minimum threshold
@echo "Running tests with coverage (threshold: $(COVERAGE_THRESHOLD)%)..."
@coverage_file=$$(mktemp); \
@set -e; \
coverage_file=$$(mktemp); \
trap 'rm -f "$$coverage_file"' EXIT; \
$(GOTEST) $$(go list ./... | grep -v /e2e) -coverprofile="$$coverage_file"; \
total=$$($(GOCMD) tool cover -func="$$coverage_file" | grep '^total' | awk '{print $$3}' | tr -d '%'); \
total=$$(awk 'NR>1 { tot+=$$2; if ($$3>0) cov+=$$2 } END { if (tot>0) printf "%.1f", 100*cov/tot; else print "0.0" }' "$$coverage_file"); \
echo "Total coverage: $${total}%"; \
if ! awk "BEGIN { exit !($$total >= $(COVERAGE_THRESHOLD)) }"; then \
echo "FAIL: coverage $${total}% is below threshold $(COVERAGE_THRESHOLD)%"; exit 1; \
Expand Down
6 changes: 5 additions & 1 deletion cmd/colref/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,13 @@ func TestCheckCmd_RunE_InvalidFormat(t *testing.T) {
"--orm", "django",
"--format", "xml",
})
if err := rootCmd.Execute(); err == nil {
err := rootCmd.Execute()
if err == nil {
t.Fatal("expected error for invalid --format")
}
if !strings.Contains(err.Error(), `unknown --format "xml"`) {
t.Fatalf("error is not the --format validation failure: %v", err)
}
}

func TestCheckCmd_RunE_InvalidColor(t *testing.T) {
Expand Down