status-go/_assets/scripts/test-with-coverage.sh
Igor Sirotin 7623f68679
fix_: nightly test runs (#5791)
* fix_: run nightly protocol tests as separate processes

* fix_: calculate timeout

* fix_: TEST_WITH_COVERAGE_REPORTS_DIR

* fix_: proper filter protocol package

* chore_: log run_unit_tests stages

* fix_: coverage reports merging

* chore_: more logs

* chore_: fix typo

* chore_: increase test timeouts

* fix_: properly filter packages

* feat_: UNIT_TEST_DRY_RUN flag for tests run

* fix_: UNIT_TEST_PACKAGES_FILTERED calculation

* fix_: remove the force-run waku test first

* fix_: delete unused file
2024-09-03 12:50:09 +01:00

23 lines
724 B
Bash
Executable File

#!/usr/bin/env bash
set -eu
packages=""
coverage_file_path="$(mktemp coverage.out.rerun.XXXXXXXXXX --tmpdir="${TEST_WITH_COVERAGE_REPORTS_DIR}")"
count=1
# This is a hack to workaround gotestsum behaviour. When using a --raw-command,
# gotestsum will only pass the package when rerunning a test. Otherwise we should pass the package ourselves.
# https://github.com/gotestyourself/gotestsum/blob/03568ab6d48faabdb632013632ac42687b5f17d1/cmd/main.go#L331-L336
if [[ "$*" != *"-test.run"* ]]; then
packages="${TEST_WITH_COVERAGE_PACKAGES}"
count=${TEST_WITH_COVERAGE_COUNT}
fi
go test -json \
${packages} \
-count=${count} \
-covermode=atomic \
-coverprofile="${coverage_file_path}" \
-coverpkg ./... \
"$@"