File tree 3 files changed +21
-4
lines changed
3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -366,6 +366,7 @@ test-unit: export UNIT_TEST_PACKAGES_NOT_PARALLELIZABLE ?= \
366
366
test-unit : export UNIT_TEST_PACKAGES_WITH_EXTENDED_TIMEOUT ?= \
367
367
github.com/status-im/status-go/protocol
368
368
test-unit : # #@tests Run unit and integration tests
369
+ go install github.com/wadey/gocovmerge@latest
369
370
./_assets/scripts/run_unit_tests.sh
370
371
371
372
test-unit-race : export GOTEST_EXTRAFLAGS=-race
Original file line number Diff line number Diff line change @@ -79,15 +79,24 @@ run_test_for_package() {
79
79
gotestsum_flags=" ${gotestsum_flags} --junitfile=${report_file} --rerun-fails-report=${rerun_report_file} "
80
80
fi
81
81
82
- gotestsum --packages=" ${package} " ${gotestsum_flags} -- \
82
+ # Cleanup previous coverage reports
83
+ rm -f ${package_dir} /coverage.out.rerun.*
84
+
85
+ PACKAGE_DIR=${package_dir} gotestsum --packages=" ${package} " ${gotestsum_flags} --raw-command -- \
86
+ ./_assets/scripts/test-with-coverage.sh \
87
+ ${package} \
83
88
-v ${GOTEST_EXTRAFLAGS} \
84
89
-timeout " ${package_timeout} " \
85
90
-count 1 \
86
- -tags " ${BUILD_TAGS} " \
87
- -covermode=atomic \
88
- -coverprofile=" ${coverage_file} " | \
91
+ -tags " ${BUILD_TAGS} " |
89
92
redirect_stdout " ${output_file} "
90
93
94
+ # Merge package coverage results
95
+ gocovmerge ${package_dir} /coverage.out.rerun.* > ${coverage_file}
96
+
97
+ # Cleanup coverage reports
98
+ rm -f ${package_dir} /coverage.out.rerun.*
99
+
91
100
local go_test_exit=$?
92
101
echo " ${go_test_exit} " > " ${exit_code_file} "
93
102
if [[ " ${go_test_exit} " -ne 0 ]]; then
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -eu
3
+ coverage_file_path=" ${PACKAGE_DIR} /$( mktemp coverage.out.rerun.XXXXXXXXXX) "
4
+ go test -json \
5
+ -covermode=atomic \
6
+ -coverprofile=" ${coverage_file_path} " \
7
+ " $@ "
You can’t perform that action at this time.
0 commit comments