Merge "Add new shell script to run polygerrit template test"
This commit is contained in:
		@@ -211,19 +211,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"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user