Browse Source

Merge pull request #208 from seriyps/enable-coverage

Enable test-coverage
Sergey Prokhorov 5 years ago
parent
commit
e080b6c985
1 changed files with 13 additions and 3 deletions
  1. 13 3
      Makefile

+ 13 - 3
Makefile

@@ -1,4 +1,5 @@
 REBAR = ./rebar3
+MINIMAL_COVERAGE = 55
 
 all: compile
 
@@ -15,8 +16,17 @@ clean: $(REBAR)
 src/epgsql_errcodes.erl:
 	./generate_errcodes_src.sh > src/epgsql_errcodes.erl
 
-test: compile
-	@$(REBAR) do ct -v
+common-test:
+	$(REBAR) ct -v -c
+
+eunit:
+	$(REBAR) eunit -c
+
+# Fail the build if coverage falls below 55%
+cover:
+	$(REBAR) cover -v --min_coverage $(MINIMAL_COVERAGE)
+
+test: compile eunit common-test cover
 
 dialyzer: compile
 	@$(REBAR) dialyzer
@@ -24,4 +34,4 @@ dialyzer: compile
 elvis: $(REBAR)
 	@$(REBAR) as lint lint
 
-.PHONY: all compile clean test dialyzer elvis
+.PHONY: all compile clean common-test eunit cover test dialyzer elvis