Add new shell script to run polygerrit template test
Change-Id: Iafef37b0df14f0a1de90b9f297604ce28b4b4171
This commit is contained in:
parent
ae3db829f9
commit
4112ff2b08
@ -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_<TOP_LEVEL_DIRECTORY> --test_arg=<VIEW_NAME> --test_output errors
|
||||
TEMPLATE_NO_DEFAULT=true ./polygerrit-ui/app/run_template_test.sh //polygerrit-ui/app:template_test_<TOP_LEVEL_DIRECTORY> --test_arg=<VIEW_NAME>
|
||||
```
|
||||
|
||||
```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
|
||||
```
|
||||
|
17
polygerrit-ui/app/run_template_test.sh
Executable file
17
polygerrit-ui/app/run_template_test.sh
Executable file
@ -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
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user