From 4fefec82bb1ee34350cfc4dd61140c2f1ce8afb0 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sun, 4 Feb 2024 16:11:14 +0700 Subject: make: generate test coverage --- .gitignore | 2 ++ Makefile | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ef692d1..59f964f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ /_www/wui.local /example/testdata /trunks +cover.html +cover.out diff --git a/Makefile b/Makefile index 0875d72..8f945f5 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ ## SPDX-FileCopyrightText: 2021 M. Shulhan ## SPDX-License-Identifier: GPL-3.0-or-later +COVER_OUT:=cover.out +COVER_HTML:=cover.html + .PHONY: all all: lint test go run ./internal/cmd/trunks build @@ -17,7 +20,8 @@ lint-www: .PHONY: test test: - CGO_ENABLED=1 go test -v -race ./... + CGO_ENABLED=1 go test -failfast -timeout=1m -race -coverprofile=$(COVER_OUT) ./... + go tool cover -html=$(COVER_OUT) -o $(COVER_HTML) .PHONY: dev dev: -- cgit v1.3