diff --git a/package.json b/package.json index 526d201361..5b9046d6c4 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,6 @@ "eslint-plugin-import": "^2.20.1", "eslint-plugin-jsdoc": "^19.2.0", "eslint-plugin-prettier": "^3.1.3", - "fried-twinkie": "^0.2.2", "polymer-cli": "^1.9.11", "prettier": "2.0.5", "typescript": "^3.7.4", @@ -25,7 +24,6 @@ "safe_bazelisk": "if which bazelisk >/dev/null; then bazel_bin=bazelisk; else bazel_bin=bazel; fi && $bazel_bin", "eslint": "npm run safe_bazelisk test polygerrit-ui/app:lint_test", "eslintfix": "npm run safe_bazelisk run polygerrit-ui/app:lint_bin -- -- --fix $(pwd)/polygerrit-ui/app", - "test-template": "./polygerrit-ui/app/run_template_test.sh", "polylint": "npm run safe_bazelisk test polygerrit-ui/app:polylint_test" }, "repository": { diff --git a/polygerrit-ui/README.md b/polygerrit-ui/README.md index de25d79fb3..1cd8096ed4 100644 --- a/polygerrit-ui/README.md +++ b/polygerrit-ui/README.md @@ -226,47 +226,6 @@ or npm run polylint ``` -## Template Type Safety - -> **Warning**: This feature is temporary disabled, because it doesn't work with Polymer 2 and Polymer 3. Some of the checks are made by polymer linter. - -Polymer elements are not type checked against the element definition, making it -trivial to break the display when refactoring or moving code. We now run -additional tests to help ensure that template types are checked. - -A few notes to ensure that these tests pass -- Any functions with optional parameters will need closure annotations. -- Any Polymer parameters that are nullable or can be multiple types (other than - the one explicitly delared) will need type annotations. - -These tests require the `typescript` and `fried-twinkie` npm packages. - -To run on all files, execute the following command: - -```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) -```sh -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 -TEMPLATE_NO_DEFAULT=true ./polygerrit-ui/app/run_template_test.sh //polygerrit-ui/app:template_test_ --test_arg= -``` - -```sh -TEMPLATE_NO_DEFAULT=true ./polygerrit-ui/app/run_template_test.sh //polygerrit-ui/app:template_test_change-list --test_arg=gr-change-list-view -``` - ## Contributing Our users report bugs / feature requests related to the UI through [Monorail Issues - PolyGerrit](https://bugs.chromium.org/p/gerrit/issues/list?q=component%3APolyGerrit). diff --git a/polygerrit-ui/app/.eslintrc.js b/polygerrit-ui/app/.eslintrc.js index 0302a76485..42a6564120 100644 --- a/polygerrit-ui/app/.eslintrc.js +++ b/polygerrit-ui/app/.eslintrc.js @@ -176,7 +176,7 @@ module.exports = { }, "overrides": [ { - "files": ["*.html", "test.js", "test-infra.js", "template_test.js"], + "files": ["*.html", "test.js", "test-infra.js"], "rules": { "jsdoc/require-file-overview": "off" }, @@ -219,7 +219,7 @@ module.exports = { } }, { - "files": ["test/functional/**/*.js", "wct.conf.js", "template_test.js"], + "files": ["test/functional/**/*.js", "wct.conf.js"], // Settings for functional tests. These scripts are node scripts. // Turn off "no-undef" to allow any global variable "env": { diff --git a/polygerrit-ui/app/BUILD b/polygerrit-ui/app/BUILD index ca021db542..5a3f140ea0 100644 --- a/polygerrit-ui/app/BUILD +++ b/polygerrit-ui/app/BUILD @@ -121,40 +121,3 @@ sh_test( "manual", ], ) - -DIRECTORIES = [ - "admin", - "change", - "change-list", - "core", - "diff", - "edit", - "plugins", - "settings", - "shared", - "gr-app", -] - -[sh_test( - name = "template_test_" + directory, - size = "enormous", - srcs = ["template_test.sh"], - args = [directory], - data = [ - ":pg_code", - ":template_test_srcs", - ], - tags = [ - # Should not run sandboxed. - "local", - "template", - ], -) for directory in DIRECTORIES] - -filegroup( - name = "template_test_srcs", - srcs = [ - "template_test_srcs/convert_for_template_tests.py", - "template_test_srcs/template_test.js", - ], -) diff --git a/polygerrit-ui/app/template_test.sh b/polygerrit-ui/app/template_test.sh deleted file mode 100755 index d42f23fd1d..0000000000 --- a/polygerrit-ui/app/template_test.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# TODO(dmfilippov): Update template_test to support Polymer 2/Polymer 3 or delete it completely -# The following line temporary disable template tests. Existing implementation doesn't compatible -# with Polymer 2 & 3 class-based components. Polymer linter makes some checks regarding -# templates and binding, but not all. -exit 0 - -set -ex - -node_bin=$(which node) && true -if [ -z "$node_bin" ]; then - echo "node must be on the path." - exit 1 -fi - -npm_bin=$(which npm) && true -if [[ -z "$npm_bin" ]]; then - echo "NPM must be on the path. (https://www.npmjs.com/)" - exit 1 -fi - -# Have to find where node_modules are installed and set the NODE_PATH - -get_node_path() { - cd $(dirname $node_bin) - cd ../lib/node_modules - pwd -} - -export NODE_PATH=$(get_node_path) - -unzip -o polygerrit-ui/polygerrit_components.bower_components.zip -d polygerrit-ui/app -python $TEST_SRCDIR/gerrit/polygerrit-ui/app/template_test_srcs/convert_for_template_tests.py -# Pass a file name argument from the --test_args (example: --test_arg=gr-list-view) -${node_bin} $TEST_SRCDIR/gerrit/polygerrit-ui/app/template_test_srcs/template_test.js $1 $2 diff --git a/polygerrit-ui/app/template_test_srcs/convert_for_template_tests.py b/polygerrit-ui/app/template_test_srcs/convert_for_template_tests.py deleted file mode 100644 index 579e783f7e..0000000000 --- a/polygerrit-ui/app/template_test_srcs/convert_for_template_tests.py +++ /dev/null @@ -1,129 +0,0 @@ -import json -import os -import re - -polymerRegex = r"Polymer\({" -polymerCompiledRegex = re.compile(polymerRegex) - -removeSelfInvokeRegex = r"\(function\(\) {\n(.+)}\)\(\);" -fnCompiledRegex = re.compile(removeSelfInvokeRegex, re.DOTALL) - -regexBehavior = r"