From 017d67cdf81e05496e4cf73f0f912ecef94e7bb3 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Fri, 11 May 2018 09:43:06 -0700 Subject: [PATCH] test: switch to ts_web_test_suite (#23859) Unit tests now run on Firefox too PR Close #23859 --- WORKSPACE | 6 +++--- packages/common/test/BUILD.bazel | 4 ++-- packages/compiler-cli/test/BUILD.bazel | 2 +- packages/compiler-cli/test/diagnostics/BUILD.bazel | 2 +- packages/compiler-cli/test/metadata/BUILD.bazel | 2 +- packages/compiler-cli/test/ngtsc/BUILD.bazel | 2 +- packages/compiler-cli/test/transformers/BUILD.bazel | 2 +- packages/compiler/test/BUILD.bazel | 4 ++-- packages/compiler/test/render3/BUILD.bazel | 2 +- packages/core/test/BUILD.bazel | 4 ++-- packages/core/test/render3/BUILD.bazel | 4 ++-- packages/elements/test/BUILD.bazel | 4 ++-- packages/forms/test/BUILD.bazel | 4 ++-- packages/http/test/BUILD.bazel | 4 ++-- packages/language-service/test/BUILD.bazel | 2 +- packages/platform-browser-dynamic/test/BUILD.bazel | 4 ++-- packages/platform-browser/test/BUILD.bazel | 4 ++-- packages/platform-webworker/test/BUILD.bazel | 4 ++-- packages/router/test/BUILD.bazel | 4 ++-- packages/service-worker/test/BUILD.bazel | 4 ++-- packages/upgrade/test/BUILD.bazel | 4 ++-- tools/defaults.bzl | 13 ++++++++++--- 22 files changed, 46 insertions(+), 39 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 263151e343..d18ec153e0 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -13,9 +13,9 @@ http_archive( http_archive( name = "io_bazel_rules_webtesting", - url = "https://github.com/bazelbuild/rules_webtesting/archive/ca7b8062d9cf4ef2fde9193c7d37a0764c4262d7.zip", - strip_prefix = "rules_webtesting-ca7b8062d9cf4ef2fde9193c7d37a0764c4262d7", - sha256 = "28c73cf9d310fa6dba30e66bdb98071341c99c3feb8662f2d3883a632de97d72", + url = "https://github.com/bazelbuild/rules_webtesting/archive/cfcaaf98553fee8e7063b5f5c11fd1b77e43d683.zip", + strip_prefix = "rules_webtesting-cfcaaf98553fee8e7063b5f5c11fd1b77e43d683", + sha256 = "636c7a9ac2ca13a04d982c2f9c874876ecc90a7b9ccfe4188156122b26ada7b3", ) http_archive( diff --git a/packages/common/test/BUILD.bazel b/packages/common/test/BUILD.bazel index 2d6f2e59e1..268d0a8bfc 100644 --- a/packages/common/test/BUILD.bazel +++ b/packages/common/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( @@ -29,7 +29,7 @@ jasmine_node_test( ], ) -ts_web_test( +ts_web_test_suite( name = "test_web", deps = [ ":test_lib", diff --git a/packages/compiler-cli/test/BUILD.bazel b/packages/compiler-cli/test/BUILD.bazel index e6cb2ebf07..f0e842f65b 100644 --- a/packages/compiler-cli/test/BUILD.bazel +++ b/packages/compiler-cli/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") # Uses separate test rules to allow the tests to run in parallel diff --git a/packages/compiler-cli/test/diagnostics/BUILD.bazel b/packages/compiler-cli/test/diagnostics/BUILD.bazel index baa020bf9b..18cc00ffc2 100644 --- a/packages/compiler-cli/test/diagnostics/BUILD.bazel +++ b/packages/compiler-cli/test/diagnostics/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( diff --git a/packages/compiler-cli/test/metadata/BUILD.bazel b/packages/compiler-cli/test/metadata/BUILD.bazel index 1b075bb62b..e118490d37 100644 --- a/packages/compiler-cli/test/metadata/BUILD.bazel +++ b/packages/compiler-cli/test/metadata/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( diff --git a/packages/compiler-cli/test/ngtsc/BUILD.bazel b/packages/compiler-cli/test/ngtsc/BUILD.bazel index a7bbbb77a3..dfa3f80bfa 100644 --- a/packages/compiler-cli/test/ngtsc/BUILD.bazel +++ b/packages/compiler-cli/test/ngtsc/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( diff --git a/packages/compiler-cli/test/transformers/BUILD.bazel b/packages/compiler-cli/test/transformers/BUILD.bazel index 2e4649fe9c..d42c527516 100644 --- a/packages/compiler-cli/test/transformers/BUILD.bazel +++ b/packages/compiler-cli/test/transformers/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( diff --git a/packages/compiler/test/BUILD.bazel b/packages/compiler/test/BUILD.bazel index e7aaa323cf..fb32cbad43 100644 --- a/packages/compiler/test/BUILD.bazel +++ b/packages/compiler/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") # Test that should only be run in node @@ -80,7 +80,7 @@ jasmine_node_test( ], ) -ts_web_test( +ts_web_test_suite( name = "test_web", deps = [ ":test_lib", diff --git a/packages/compiler/test/render3/BUILD.bazel b/packages/compiler/test/render3/BUILD.bazel index 82c60a34e3..27bd131ce3 100644 --- a/packages/compiler/test/render3/BUILD.bazel +++ b/packages/compiler/test/render3/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( diff --git a/packages/core/test/BUILD.bazel b/packages/core/test/BUILD.bazel index dc353d14bc..bf1c7473b0 100644 --- a/packages/core/test/BUILD.bazel +++ b/packages/core/test/BUILD.bazel @@ -1,6 +1,6 @@ package(default_visibility = ["//visibility:public"]) -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( @@ -60,7 +60,7 @@ jasmine_node_test( ], ) -ts_web_test( +ts_web_test_suite( name = "test_web", deps = [ ":test_lib", diff --git a/packages/core/test/render3/BUILD.bazel b/packages/core/test/render3/BUILD.bazel index 091e1506c0..b3c3334c71 100644 --- a/packages/core/test/render3/BUILD.bazel +++ b/packages/core/test/render3/BUILD.bazel @@ -1,6 +1,6 @@ package(default_visibility = ["//visibility:public"]) -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( @@ -52,7 +52,7 @@ jasmine_node_test( ], ) -ts_web_test( +ts_web_test_suite( name = "render3_web", deps = [ ":render3_lib", diff --git a/packages/elements/test/BUILD.bazel b/packages/elements/test/BUILD.bazel index 68817ebd99..bdf3c5912c 100644 --- a/packages/elements/test/BUILD.bazel +++ b/packages/elements/test/BUILD.bazel @@ -1,5 +1,5 @@ load("//tools:defaults.bzl", "ts_library") -load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test") +load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( @@ -31,7 +31,7 @@ filegroup( ], ) -ts_web_test( +ts_web_test_suite( name = "test", bootstrap = [ ":elements_test_bootstrap_scripts", diff --git a/packages/forms/test/BUILD.bazel b/packages/forms/test/BUILD.bazel index f4023b41be..7daeea9391 100644 --- a/packages/forms/test/BUILD.bazel +++ b/packages/forms/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( @@ -25,7 +25,7 @@ jasmine_node_test( ], ) -ts_web_test( +ts_web_test_suite( name = "test_web", deps = [ ":test_lib", diff --git a/packages/http/test/BUILD.bazel b/packages/http/test/BUILD.bazel index 5359429195..05c83ed83a 100644 --- a/packages/http/test/BUILD.bazel +++ b/packages/http/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( @@ -25,7 +25,7 @@ jasmine_node_test( ], ) -ts_web_test( +ts_web_test_suite( name = "test_web", deps = [ ":test_lib", diff --git a/packages/language-service/test/BUILD.bazel b/packages/language-service/test/BUILD.bazel index d4e73e9c0d..89e4f08f24 100644 --- a/packages/language-service/test/BUILD.bazel +++ b/packages/language-service/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( diff --git a/packages/platform-browser-dynamic/test/BUILD.bazel b/packages/platform-browser-dynamic/test/BUILD.bazel index 234a193ac3..35d9f51d27 100644 --- a/packages/platform-browser-dynamic/test/BUILD.bazel +++ b/packages/platform-browser-dynamic/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( @@ -27,7 +27,7 @@ jasmine_node_test( ], ) -ts_web_test( +ts_web_test_suite( name = "test_web", # disable since tests are running but not yet passing tags = ["manual"], diff --git a/packages/platform-browser/test/BUILD.bazel b/packages/platform-browser/test/BUILD.bazel index 4858aa258e..996e9a29cf 100644 --- a/packages/platform-browser/test/BUILD.bazel +++ b/packages/platform-browser/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( @@ -33,7 +33,7 @@ jasmine_node_test( ], ) -ts_web_test( +ts_web_test_suite( name = "test_web", # disable since tests are running but not yet passing tags = ["manual"], diff --git a/packages/platform-webworker/test/BUILD.bazel b/packages/platform-webworker/test/BUILD.bazel index 89b2f0de0a..d0937bdf77 100644 --- a/packages/platform-webworker/test/BUILD.bazel +++ b/packages/platform-webworker/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( @@ -27,7 +27,7 @@ jasmine_node_test( ], ) -ts_web_test( +ts_web_test_suite( name = "test_web", deps = [ ":test_lib", diff --git a/packages/router/test/BUILD.bazel b/packages/router/test/BUILD.bazel index 1b20bb54ff..7dfa2b62b4 100644 --- a/packages/router/test/BUILD.bazel +++ b/packages/router/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( @@ -29,7 +29,7 @@ jasmine_node_test( ], ) -ts_web_test( +ts_web_test_suite( name = "test_web", deps = [ ":test_lib", diff --git a/packages/service-worker/test/BUILD.bazel b/packages/service-worker/test/BUILD.bazel index 54fababb35..fcf967139b 100644 --- a/packages/service-worker/test/BUILD.bazel +++ b/packages/service-worker/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( @@ -27,7 +27,7 @@ jasmine_node_test( ], ) -ts_web_test( +ts_web_test_suite( name = "test_web", deps = [ ":test_lib", diff --git a/packages/upgrade/test/BUILD.bazel b/packages/upgrade/test/BUILD.bazel index 9e40647ba0..635eef6a57 100644 --- a/packages/upgrade/test/BUILD.bazel +++ b/packages/upgrade/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library", "ts_web_test") +load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") ts_library( @@ -18,7 +18,7 @@ ts_library( ], ) -ts_web_test( +ts_web_test_suite( name = "test_web", bootstrap = [ # "//:angularjs", diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 8c0591f153..8a956ca64f 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -1,6 +1,6 @@ """Re-export of some bazel rules with repository-wide defaults.""" load("@build_bazel_rules_nodejs//:defs.bzl", _npm_package = "npm_package") -load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library", _ts_web_test = "ts_web_test") +load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library", _ts_web_test_suite = "ts_web_test_suite") load("//packages/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package") load("//packages/bazel/src:ng_module.bzl", _ivy_ng_module = "internal_ivy_ng_module") @@ -68,7 +68,7 @@ def npm_package(name, replacements = {}, **kwargs): replacements = dict(replacements, **PKG_GROUP_REPLACEMENTS), **kwargs) -def ts_web_test(bootstrap = [], deps = [], **kwargs): +def ts_web_test_suite(bootstrap = [], deps = [], **kwargs): if not bootstrap: bootstrap = ["//:web_test_bootstrap_scripts"] local_deps = [ @@ -76,9 +76,16 @@ def ts_web_test(bootstrap = [], deps = [], **kwargs): "//tools/testing:browser", ] + deps - _ts_web_test( + _ts_web_test_suite( bootstrap = bootstrap, deps = local_deps, + # Run unit tests on Chromium and Firefox by default. + # You can exclude tests based on tags, e.g. to skip Firefox testing, + # `bazel test --test_tag_filters=-browser:firefox-local [targets]` + browsers = [ + "@io_bazel_rules_webtesting//browsers:chromium-local", + "@io_bazel_rules_webtesting//browsers:firefox-local", + ], **kwargs) def ivy_ng_module(name, tsconfig = None, **kwargs):