good morning!!!!

Skip to content
Snippets Groups Projects
test.sh 890 B
Newer Older
Anmol Sethi's avatar
Anmol Sethi committed
#!/usr/bin/env bash

set -euo pipefail
cd "$(dirname "${0}")"
cd "$(git rev-parse --show-toplevel)"
Anmol Sethi's avatar
Anmol Sethi committed

argv=(
  go run gotest.tools/gotestsum
  # https://circleci.com/docs/2.0/collect-test-data/
  "--junitfile=ci/out/websocket/testReport.xml"
  "--format=short-verbose"
  --
  "-vet=off"
# Interactive usage does not want to turn off vet or use gotestsum by default.
if [[ $# -gt 0 ]]; then
  argv=(go test "$@")
fi

# We always want coverage and race detection.
  "-coverprofile=ci/out/coverage.prof"
  "-coverpkg=./..."
)

mkdir -p ci/out/websocket
"${argv[@]}"

# Removes coverage of generated files.
grep -v _string.go < ci/out/coverage.prof > ci/out/coverage2.prof
mv ci/out/coverage2.prof ci/out/coverage.prof
Anmol Sethi's avatar
Anmol Sethi committed

go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html
if [[ ${CI:-} ]]; then
Anmol Sethi's avatar
Anmol Sethi committed
  bash <(curl -s https://codecov.io/bash) -f ci/out/coverage.prof
fi