Files
gerrit/polygerrit-ui/app/run_test.sh
David Pursehouse 29f62da730 Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  run_test.sh: Fix bazelisk location detection
  PolyGerrit: Run WCT tests using bazelisk

Change-Id: Ia5d3c3da14ac3c9e416550d704d56364bba52983
2019-09-02 09:41:38 +09:00

33 lines
932 B
Bash
Executable File

#!/usr/bin/env bash
npm_bin=$(which npm)
if [[ -z "$npm_bin" ]]; then
echo "NPM must be on the path. (https://www.npmjs.com/)"
exit 1
fi
wct_bin=$(which wct)
if [[ -z "$wct_bin" ]]; then
echo "WCT must be on the path. (https://github.com/Polymer/web-component-tester)"
exit 1
fi
bazel_bin=$(which bazelisk 2>/dev/null)
if [[ -z "$bazel_bin" ]]; then
echo "Warning: bazelisk is not installed; falling back to bazel."
bazel_bin=bazel
fi
# WCT tests are not hermetic, and need extra environment variables.
# TODO(hanwen): does $DISPLAY even work on OSX?
${bazel_bin} test \
--test_env="HOME=$HOME" \
--test_env="WCT=${wct_bin}" \
--test_env="WCT_ARGS=${WCT_ARGS}" \
--test_env="NPM=${npm_bin}" \
--test_env="DISPLAY=${DISPLAY}" \
--test_env="WCT_HEADLESS_MODE=${WCT_HEADLESS_MODE}" \
"$@" \
//polygerrit-ui/app:embed_test \
//polygerrit-ui/app:wct_test