Downport "Simplify installing / running template tests"
Also fixed a bug in the script that would cause it to ignore half of the arguments. Change-Id: Iba65c8d2e10a35c06946d28cfcaa76c61314e2b0
This commit is contained in:

committed by
Thomas Draebing

parent
d43f779f6b
commit
47403815d6
@@ -7,11 +7,14 @@
|
|||||||
"eslint": "^5.16.0",
|
"eslint": "^5.16.0",
|
||||||
"eslint-config-google": "^0.13.0",
|
"eslint-config-google": "^0.13.0",
|
||||||
"eslint-plugin-html": "^5.0.5",
|
"eslint-plugin-html": "^5.0.5",
|
||||||
|
"fried-twinkie": "^0.2.2",
|
||||||
|
"typescript": "^2.x.x",
|
||||||
"web-component-tester": "^6.5.0"
|
"web-component-tester": "^6.5.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh",
|
"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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@@ -28,10 +28,7 @@ dependencies can be installed with:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm install
|
npm install
|
||||||
sudo npm install -g \
|
sudo npm install -g polylint
|
||||||
typescript \
|
|
||||||
fried-twinkie \
|
|
||||||
polylint
|
|
||||||
```
|
```
|
||||||
|
|
||||||
It may complain about a missing `typescript@2.3.4` peer dependency, which is
|
It may complain about a missing `typescript@2.3.4` peer dependency, which is
|
||||||
@@ -191,6 +188,12 @@ To run on all files, execute the following command:
|
|||||||
./polygerrit-ui/app/run_template_test.sh
|
./polygerrit-ui/app/run_template_test.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run test-template
|
||||||
|
```
|
||||||
|
|
||||||
To run on a specific top level directory (ex: change-list)
|
To run on a specific top level directory (ex: change-list)
|
||||||
```sh
|
```sh
|
||||||
TEMPLATE_NO_DEFAULT=true ./polygerrit-ui/app/run_template_test.sh //polygerrit-ui/app:template_test_change-list
|
TEMPLATE_NO_DEFAULT=true ./polygerrit-ui/app/run_template_test.sh //polygerrit-ui/app:template_test_change-list
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
if [[ -z "${TEMPLATE_NO_DEFAULT}" ]]; then
|
if [[ -z "${TEMPLATE_NO_DEFAULT}" ]]; then
|
||||||
bazel test \
|
bazel test \
|
||||||
--test_env="HOME=$HOME" \
|
--test_env="HOME=$HOME" \
|
||||||
//polygerrit-ui/app:all
|
//polygerrit-ui/app:all \
|
||||||
--test_tag_filters=template \
|
--test_tag_filters=template \
|
||||||
"$@" \
|
"$@" \
|
||||||
--test_output errors \
|
--test_output errors \
|
||||||
|
@@ -14,19 +14,6 @@ if [[ -z "$npm_bin" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fried_twinkie_config=$(npm list -g | grep -c fried-twinkie) && true
|
|
||||||
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 || :) && true
|
|
||||||
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
|
# Have to find where node_modules are installed and set the NODE_PATH
|
||||||
|
|
||||||
get_node_path() {
|
get_node_path() {
|
||||||
|
Reference in New Issue
Block a user