build: ts_web_test & ts_web_test_suite deprecated in favor of karma_web_test & karma_web_test_suite (#33802)

This is a breaking change in nodejs rules 0.40.0 as part of the API review & cleanup for the 1.0 release. Their APIs are identical as ts_web_test was just karma_web_test without the config_file attribute.

PR Close #33802
This commit is contained in:
Greg Magolan 2019-11-13 09:08:38 -08:00 committed by Kara Erickson
parent 78912093f8
commit 9a68f23dd2
33 changed files with 67 additions and 120 deletions

View File

@ -1,6 +1,6 @@
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
load("@npm_bazel_karma//:index.bzl", "ts_web_test_suite") load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite")
load("@npm_bazel_typescript//:index.bzl", "ts_library") load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary") load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary")
load("@npm_angular_bazel//:index.bzl", "ng_module", "ng_package") load("@npm_angular_bazel//:index.bzl", "ng_module", "ng_package")
@ -43,7 +43,7 @@ ts_library(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test", name = "test",
bootstrap = [ bootstrap = [
"@npm//:node_modules/zone.js/dist/zone-testing-bundle.js", "@npm//:node_modules/zone.js/dist/zone-testing-bundle.js",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -23,7 +23,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -20,7 +20,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,7 +1,7 @@
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
load("@npm_angular_bazel//:index.bzl", "ng_module") load("@npm_angular_bazel//:index.bzl", "ng_module")
load("@npm_bazel_karma//:index.bzl", "ts_web_test_suite") load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite")
load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package") load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package")
load("@npm//history-server:index.bzl", "history_server") load("@npm//history-server:index.bzl", "history_server")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle") load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
@ -137,7 +137,7 @@ ts_library(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test", name = "test",
srcs = [ srcs = [
"@npm//:node_modules/tslib/tslib.js", "@npm//:node_modules/tslib/tslib.js",

View File

@ -1,6 +1,6 @@
/** /**
* @fileoverview Provides a script to initialize TestBed before tests are run. * @fileoverview Provides a script to initialize TestBed before tests are run.
* This file should be included in the "runtime_deps" of a "ts_web_test_suite" * This file should be included in the "runtime_deps" of a "karma_web_test_suite"
* rule. * rule.
*/ */
import {TestBed} from '@angular/core/testing'; import {TestBed} from '@angular/core/testing';

View File

@ -1,7 +1,7 @@
/** /**
* @fileoverview Provides named UMD shims for `rxjs/operators` and `rxjs/testing`. * @fileoverview Provides named UMD shims for `rxjs/operators` and `rxjs/testing`.
* This file should be included in the "scripts" of a "ts_devserver" * This file should be included in the "scripts" of a "ts_devserver"
* rule and the "deps" of a "ts_web_test_suite" rule. * rule and the "deps" of a "karma_web_test_suite" rule.
*/ */
// rxjs/operators // rxjs/operators
(function(factory) { (function(factory) {

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -26,7 +26,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -24,7 +24,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -31,7 +31,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
# Test that should only be run in node # Test that should only be run in node
NODE_ONLY = [ NODE_ONLY = [
@ -89,7 +89,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
tags = [ tags = [
# Disabled as these tests pertain to the old ngc compilation and are not relevant in Ivy. # Disabled as these tests pertain to the old ngc compilation and are not relevant in Ivy.

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "css_parser_lib", name = "css_parser_lib",
@ -23,7 +23,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "css_parser_web", name = "css_parser_web",
deps = [ deps = [
":css_parser_lib", ":css_parser_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "expression_parser_lib", name = "expression_parser_lib",
@ -22,7 +22,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "expression_parser_web", name = "expression_parser_web",
deps = [ deps = [
":expression_parser_lib", ":expression_parser_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "ml_parser_lib", name = "ml_parser_lib",
@ -20,7 +20,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "ml_parser_web", name = "ml_parser_web",
deps = [ deps = [
":ml_parser_lib", ":ml_parser_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "selector_lib", name = "selector_lib",
@ -24,7 +24,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "selector_web", name = "selector_web",
deps = [ deps = [
":selector_lib", ":selector_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -73,7 +73,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,6 +1,6 @@
package(default_visibility = ["//visibility:private"]) package(default_visibility = ["//visibility:private"])
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "acceptance_lib", name = "acceptance_lib",
@ -45,7 +45,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "acceptance_web", name = "acceptance_web",
deps = [ deps = [
":acceptance_lib", ":acceptance_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -70,7 +70,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "render3_web", name = "render3_web",
deps = [ deps = [
":render3_lib", ":render3_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -45,7 +45,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "view_web", name = "view_web",
tags = [ tags = [
"no-ivy-aot", "no-ivy-aot",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -30,7 +30,7 @@ filegroup(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test", name = "test",
bootstrap = [ bootstrap = [
":elements_test_bootstrap_scripts", ":elements_test_bootstrap_scripts",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -27,7 +27,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -27,7 +27,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -25,7 +25,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
static_files = [ static_files = [
"//packages/platform-browser/test:static_assets/test.html", "//packages/platform-browser/test:static_assets/test.html",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -31,7 +31,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
exports_files([ exports_files([
"browser/static_assets/200.html", "browser/static_assets/200.html",
@ -36,7 +36,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
static_files = [ static_files = [
":static_assets/test.html", ":static_assets/test.html",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -28,7 +28,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -30,7 +30,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -14,7 +14,7 @@ ts_library(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -25,7 +25,7 @@ jasmine_node_test(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test_web", name = "test_web",
deps = [ deps = [
":test_lib", ":test_lib",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -12,7 +12,7 @@ ts_library(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test", name = "test",
static_files = [ static_files = [
"//:angularjs_scripts", "//:angularjs_scripts",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -17,7 +17,7 @@ ts_library(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test", name = "test",
static_files = [ static_files = [
"//:angularjs_scripts", "//:angularjs_scripts",

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -18,7 +18,7 @@ ts_library(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test", name = "test",
static_files = [ static_files = [
"//:angularjs_scripts", "//:angularjs_scripts",

View File

@ -1,6 +1,6 @@
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite") load("//tools:defaults.bzl", "karma_web_test_suite", "ts_library")
ts_library( ts_library(
name = "test_lib", name = "test_lib",
@ -18,7 +18,7 @@ ts_library(
], ],
) )
ts_web_test_suite( karma_web_test_suite(
name = "test", name = "test",
static_files = [ static_files = [
"//:angularjs_scripts", "//:angularjs_scripts",

View File

@ -2,7 +2,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", _nodejs_binary = "nodejs_binary", _npm_package = "npm_package", _rollup_bundle = "rollup_bundle") load("@build_bazel_rules_nodejs//:index.bzl", _nodejs_binary = "nodejs_binary", _npm_package = "npm_package", _rollup_bundle = "rollup_bundle")
load("@npm_bazel_jasmine//:index.bzl", _jasmine_node_test = "jasmine_node_test") load("@npm_bazel_jasmine//:index.bzl", _jasmine_node_test = "jasmine_node_test")
load("@npm_bazel_karma//:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite", _ts_web_test = "ts_web_test", _ts_web_test_suite = "ts_web_test_suite") load("@npm_bazel_karma//:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite")
load("@npm_bazel_typescript//:index.bzl", _ts_library = "ts_library") load("@npm_bazel_typescript//:index.bzl", _ts_library = "ts_library")
load("//packages/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package") load("//packages/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
load("//tools/ng_rollup_bundle:ng_rollup_bundle.bzl", _ng_rollup_bundle = "ng_rollup_bundle") load("//tools/ng_rollup_bundle:ng_rollup_bundle.bzl", _ng_rollup_bundle = "ng_rollup_bundle")
@ -164,62 +164,6 @@ def npm_package(name, replacements = {}, **kwargs):
**kwargs **kwargs
) )
def ts_web_test(bootstrap = [], deps = [], runtime_deps = [], **kwargs):
"""Default values for ts_web_test"""
if not bootstrap:
bootstrap = ["//:web_test_bootstrap_scripts"]
local_deps = [
"@npm//:node_modules/tslib/tslib.js",
"//tools/rxjs:rxjs_umd_modules",
] + deps
local_runtime_deps = [
"//tools/testing:browser",
] + runtime_deps
_ts_web_test(
runtime_deps = local_runtime_deps,
bootstrap = bootstrap,
deps = local_deps,
**kwargs
)
def ts_web_test_suite(bootstrap = [], deps = [], runtime_deps = [], **kwargs):
"""Default values for ts_web_test_suite"""
if not bootstrap:
bootstrap = ["//:web_test_bootstrap_scripts"]
local_deps = [
"@npm//:node_modules/tslib/tslib.js",
"//tools/rxjs:rxjs_umd_modules",
] + deps
local_runtime_deps = [
"//tools/testing:browser",
] + runtime_deps
tags = kwargs.pop("tags", [])
# rules_webtesting has a required_tag "native" for `chromium-local` browser
if not "native" in tags:
tags = tags + ["native"]
_ts_web_test_suite(
runtime_deps = local_runtime_deps,
bootstrap = bootstrap,
deps = local_deps,
# Run unit tests on local Chromium by default.
# You can exclude tests based on tags, e.g. to skip Firefox testing,
# `yarn bazel test --test_tag_filters=-browser:firefox-local [targets]`
browsers = [
"@io_bazel_rules_webtesting//browsers:chromium-local",
# Don't test on local Firefox by default, for faster builds.
# We think that bugs in Angular tend to be caught the same in any
# evergreen browser.
# "@io_bazel_rules_webtesting//browsers:firefox-local",
# TODO(alexeagle): add remote browsers on SauceLabs
],
tags = tags,
**kwargs
)
def karma_web_test(bootstrap = [], deps = [], data = [], runtime_deps = [], **kwargs): def karma_web_test(bootstrap = [], deps = [], data = [], runtime_deps = [], **kwargs):
"""Default values for karma_web_test""" """Default values for karma_web_test"""
if not bootstrap: if not bootstrap:
@ -247,7 +191,7 @@ def karma_web_test(bootstrap = [], deps = [], data = [], runtime_deps = [], **kw
**kwargs **kwargs
) )
def karma_web_test_suite(bootstrap = [], deps = [], **kwargs): def karma_web_test_suite(bootstrap = [], deps = [], runtime_deps = [], **kwargs):
"""Default values for karma_web_test_suite""" """Default values for karma_web_test_suite"""
if not bootstrap: if not bootstrap:
bootstrap = ["//:web_test_bootstrap_scripts"] bootstrap = ["//:web_test_bootstrap_scripts"]
@ -255,6 +199,9 @@ def karma_web_test_suite(bootstrap = [], deps = [], **kwargs):
"@npm//:node_modules/tslib/tslib.js", "@npm//:node_modules/tslib/tslib.js",
"//tools/rxjs:rxjs_umd_modules", "//tools/rxjs:rxjs_umd_modules",
] + deps ] + deps
local_runtime_deps = [
"//tools/testing:browser",
] + runtime_deps
tags = kwargs.pop("tags", []) tags = kwargs.pop("tags", [])