-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (27 loc) · 917 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
.PHONY: test
test:
go test -v ./...
.PHONY: coverage
coverage:
go test ./... -coverprofile to_filter.cov -coverpkg ./...
grep -v "test\|mocks" to_filter.cov > coverage.cov
rm -f to_filter.cov
go tool cover -func coverage.cov
.PHONY: clean
clean: mocks-clean
rm -f coverage.cov
# Install mockery for generating test mocks
.PHONY: mockery-install
mockery-install:
go install github.com/vektra/mockery/[email protected]
# Iterate over project directory and generate mocks in packages where they must be.
# FYI: --recursively not working, because then mockery creates mock in root dirs, not putting them to /mocks folder.
.PHONY: mocks-generate
mocks-generate: mockery-install
@echo "Generating mocks with config..."
mockery --config=.mockery.yaml
# Removing all mocks in the project.
.PHONY: mocks-clean
mocks-clean:
@echo "Cleaning up all 'mocks' directories..."
@find . -type d -name 'mocks' -exec rm -rf {} +