From 47b18128089d9dbc7a8a388906d86ae38145d2f9 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Sun, 15 Feb 2026 09:26:33 -0800 Subject: Add code coverage to 'make check' and add 'cover' and 'coverage-html' targets --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 26fbcfa..4a9bba4 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ VERSION=0.3 BUILD=`git rev-parse HEAD` LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}" -.PHONY: default all clean ui build install test test-race test-frontend test-e2e ui-check lint check ci run dev docs install-hooks +.PHONY: default all clean ui build install test test-race test-frontend test-e2e ui-check lint check ci run dev docs install-hooks cover coverage-html default: build @@ -32,12 +32,19 @@ install: build cp ${BINARY} ${GOBIN} test: - ${GO} test ./... + ${GO} test -cover ./... cd frontend && ${NPM} test -- --run test-race: ${GO} test -race ./... +cover: + ${GO} test -coverprofile=coverage.out ./... + ${GO} tool cover -func=coverage.out + +coverage-html: cover + ${GO} tool cover -html=coverage.out + test-frontend: cd frontend && ${NPM} run lint cd frontend && ${NPM} test -- --run -- cgit v1.2.3