diff --git a/polygerrit-ui/README.md b/polygerrit-ui/README.md index 713b073823..cbf8eb18ce 100644 --- a/polygerrit-ui/README.md +++ b/polygerrit-ui/README.md @@ -205,19 +205,19 @@ These tests require the `typescript` and `fried-twinkie` npm packages. To run on all files, execute the following command: ```sh -bazel test //polygerrit-ui/app:all --test_tag_filters=template --test_output errors +./polygerrit-ui/app/run_template_test.sh ``` To run on a specific top level directory (ex: change-list) ```sh -bazel test //polygerrit-ui/app:template_test_change-list --test_output errors +TEMPLATE_NO_DEFAULT=true ./polygerrit-ui/app/run_template_test.sh //polygerrit-ui/app:template_test_change-list ``` To run on a specific file (ex: gr-change-list-view), execute the following command: ```sh -bazel test //polygerrit-ui/app:template_test_ --test_arg= --test_output errors +TEMPLATE_NO_DEFAULT=true ./polygerrit-ui/app/run_template_test.sh //polygerrit-ui/app:template_test_ --test_arg= ``` ```sh -bazel test //polygerrit-ui/app:template_test_change-list --test_arg=gr-change-list-view --test_output errors +TEMPLATE_NO_DEFAULT=true ./polygerrit-ui/app/run_template_test.sh //polygerrit-ui/app:template_test_change-list --test_arg=gr-change-list-view ``` diff --git a/polygerrit-ui/app/run_template_test.sh b/polygerrit-ui/app/run_template_test.sh new file mode 100755 index 0000000000..4cd6e7f611 --- /dev/null +++ b/polygerrit-ui/app/run_template_test.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +if [[ -z "${TEMPLATE_NO_DEFAULT}" ]]; then +bazel test \ + --test_env="HOME=$HOME" \ + //polygerrit-ui/app:all + --test_tag_filters=template \ + "$@" \ + --test_output errors \ + --nocache_test_results +else +bazel test \ + --test_env="HOME=$HOME" \ + "$@" \ + --test_output errors \ + --nocache_test_results +fi diff --git a/polygerrit-ui/app/template_test.sh b/polygerrit-ui/app/template_test.sh index a9710cd6bd..fcadc1bdaf 100755 --- a/polygerrit-ui/app/template_test.sh +++ b/polygerrit-ui/app/template_test.sh @@ -2,20 +2,19 @@ set -ex -npm_bin=$(which npm) -if [ -z "$npm_bin" ]; then - echo "NPM must be on the path." - exit 1 -fi - node_bin=$(which node) if [ -z "$node_bin" ]; then echo "node must be on the path." exit 1 fi +npm_bin=$(which npm) +if [[ -z "$npm_bin" ]]; then + echo "NPM must be on the path. (https://www.npmjs.com/)" + exit 1 +fi + fried_twinkie_config=$(npm list -g | grep -c fried-twinkie) -typescript_config=$(npm list -g | grep -c typescript) if [ -z "$npm_bin" ] || [ "$fried_twinkie_config" -eq "0" ]; then echo "You must install fried twinkie and its dependencies from NPM." echo "> npm install -g fried-twinkie"