Fix coverage on re-run
* Fix coverage on re-run
Coverage doesn't work on re-runs, try to only pass the options on the
first run.
* Fix package parsing
@@ -5,18 +5,18 @@ set -e
RE_TEST='\^TestScenarios\$.*'
# Only match scenarios and not individual features or steps
RE_SCENARIO='\^TestScenarios\$/\^Feature_[^/]+/Scenario_[^/]+\$'
+COVERAGE_OPTIONS="-coverpkg=$(go list ./... | grep -v /test | paste -sd ',' -) -coverprofile=coverage.txt -covermode=atomic"
-CMD=( go test -coverpkg=$(go list ./... | grep -v /test | paste -sd "," -) -coverprofile=coverage.txt -covermode=atomic $(go list ./...) -json -v )
+CMD=( go test $(go list ./...) -json -v )
if [ "$#" -ne 2 ]; then
# Run only BDD tests if we specify BDD_TAGS to run
if [ -z $BDD_TAGS ]; then
- "${CMD[@]}"
+ "${CMD[@]}" $COVERAGE_OPTIONS
else
"${CMD[@]}" -run "TestScenarios"
fi
else
- PREFIX="-test.run="
RUN=$(echo $1 | sed 's/-test.run=//')
if [[ ${RUN} =~ ${RE_TEST} ]] && [[ ! ${RUN} =~ ${RE_SCENARIO} ]]; then
TEST=$(echo $RUN | tr -d '$^')
