chore: run tests with coverage in Makefile (#3418)

This commit is contained in:
Léo Vincent
2023-07-03 14:11:23 +02:00
committed by GitHub
parent 766f520c17
commit 6919b3dea6
2 changed files with 21 additions and 1 deletions

3
.gitignore vendored
View File

@ -36,3 +36,6 @@ db-tools/
# VSCode
.vscode
# Coverage report
lcov.info

View File

@ -105,6 +105,23 @@ build-release-tarballs: ## Create a series of `.tar.gz` files in the BIN_DIR dir
##@ Test
UNIT_TEST_ARGS := --locked --workspace --all-features -E 'kind(lib)' -E 'kind(bin)' -E 'kind(proc-macro)'
COV_FILE := lcov.info
.PHONY: test-unit
test-unit: ## Run unit tests.
cargo nextest run $(UNIT_TEST_ARGS)
.PHONY: cov-unit
cov-unit: ## Run unit tests with coverage.
rm -f $(COV_FILE)
cargo llvm-cov nextest --lcov --output-path $(COV_FILE) $(UNIT_TEST_ARGS)
.PHONY: cov-report-html
cov-report-html: cov-unit ## Generate a HTML coverage report and open it in the browser.
cargo llvm-cov report --html
open target/llvm-cov/html/index.html
# Downloads and unpacks Ethereum Foundation tests in the `$(EF_TESTS_DIR)` directory.
#
# Requires `wget` and `tar`