aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-15 09:26:33 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-15 09:26:33 -0800
commit47b18128089d9dbc7a8a388906d86ae38145d2f9 (patch)
treef664adc2634f1c63223968d5aa20074a8c2dcc98
parent01c7931a6b523c28d856ba05d2d6cd6ac7cc01b2 (diff)
downloadneko-47b18128089d9dbc7a8a388906d86ae38145d2f9.tar.gz
neko-47b18128089d9dbc7a8a388906d86ae38145d2f9.tar.bz2
neko-47b18128089d9dbc7a8a388906d86ae38145d2f9.zip
Add code coverage to 'make check' and add 'cover' and 'coverage-html' targets
-rw-r--r--Makefile11
1 files changed, 9 insertions, 2 deletions
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