Simplify installing / running template tests

Also fixed a bug in the script that would cause it to ignore half of the
arguments.

Change-Id: Id407c76bc9433804db01cfc4a9d6ede9692b9601
This commit is contained in:
Ole Rehmsen 2019-05-16 10:06:03 +02:00
parent 0021ba0062
commit eec6781260
4 changed files with 12 additions and 19 deletions

View File

@ -7,11 +7,14 @@
"eslint": "^5.16.0",
"eslint-config-google": "^0.13.0",
"eslint-plugin-html": "^5.0.5",
"fried-twinkie": "^0.2.2",
"typescript": "^2.x.x",
"web-component-tester": "^6.5.0"
},
"scripts": {
"test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh",
"eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0"
"eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0",
"test-template": "./polygerrit-ui/app/run_template_test.sh"
},
"repository": {
"type": "git",

View File

@ -32,10 +32,7 @@ dependencies can be installed with:
```sh
npm install
sudo npm install -g \
typescript \
fried-twinkie \
polylint
sudo npm install -g polylint
```
It may complain about a missing `typescript@2.3.4` peer dependency, which is
@ -195,6 +192,12 @@ To run on all files, execute the following command:
./polygerrit-ui/app/run_template_test.sh
```
or
```sh
npm run test-template
```
To run on a specific top level directory (ex: change-list)
```sh
TEMPLATE_NO_DEFAULT=true ./polygerrit-ui/app/run_template_test.sh //polygerrit-ui/app:template_test_change-list

View File

@ -3,7 +3,7 @@
if [[ -z "${TEMPLATE_NO_DEFAULT}" ]]; then
bazel test \
--test_env="HOME=$HOME" \
//polygerrit-ui/app:all
//polygerrit-ui/app:all \
--test_tag_filters=template \
"$@" \
--test_output errors \

View File

@ -14,19 +14,6 @@ if [[ -z "$npm_bin" ]]; then
exit 1
fi
fried_twinkie_config=$(npm list -g | grep -c fried-twinkie)
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"
exit 1
fi
twinkie_version=$(npm list -g fried-twinkie@\>0.1 | grep fried-twinkie || :)
if [ -z "$twinkie_version" ]; then
echo "Outdated version of fried-twinkie found. Bypassing template check."
exit 0
fi
# Have to find where node_modules are installed and set the NODE_PATH
get_node_path() {