Skip to content

Commit c791926

Browse files
devversionjelbourn
authored andcommitted
build: switch test targets to karma_web_test_suite (angular#16818)
Switches all `ts_web_test_suite` targets to the new `karma_web_test_suite` rule. `ts_web_test_suite` is based on the `karma_web_test_suite` rule but does not allow developers to have a custom karma configuration. In order to be able to provide a custom karma configuration for setting up Saucelabs and Browserstack, we switch all targets over to the `karma_web_test_suite` rule. See: bazelbuild/rules_typescript#363.
1 parent d5d7db4 commit c791926

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/cdk/coercion/BUILD.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package(default_visibility = ["//visibility:public"])
22

3-
load("//tools:defaults.bzl", "markdown_to_html", "ts_library", "ts_web_test_suite")
3+
load("//tools:defaults.bzl", "karma_web_test_suite", "markdown_to_html", "ts_library")
44

55
ts_library(
66
name = "coercion",
@@ -28,7 +28,7 @@ ts_library(
2828
],
2929
)
3030

31-
ts_web_test_suite(
31+
karma_web_test_suite(
3232
name = "unit_tests",
3333
deps = [":unit_test_sources"],
3434
)

src/cdk/keycodes/BUILD.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package(default_visibility = ["//visibility:public"])
22

3-
load("//tools:defaults.bzl", "markdown_to_html", "ts_library", "ts_web_test_suite")
3+
load("//tools:defaults.bzl", "karma_web_test_suite", "markdown_to_html", "ts_library")
44

55
ts_library(
66
name = "keycodes",
@@ -25,7 +25,7 @@ ts_library(
2525
],
2626
)
2727

28-
ts_web_test_suite(
28+
karma_web_test_suite(
2929
name = "unit_tests",
3030
deps = [":unit_test_sources"],
3131
)

src/material-moment-adapter/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ng_test_library(
3838
ng_web_test_suite(
3939
name = "unit_tests",
4040
# We need to load Moment statically since it is not a named AMD module and needs to
41-
# be manually configured through "require.js" which is used by "ts_web_test_suite".
41+
# be manually configured through "require.js" which is used by "karma_web_test_suite".
4242
static_files = [
4343
"@npm//moment",
4444
],

test/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ load("//tools:defaults.bzl", "ts_library")
66
ts_library(
77
name = "angular_test_init",
88
testonly = True,
9-
# This file *must* end with "spec" in order for ts_web_test to load it.
9+
# This file *must* end with "spec" in order for "karma_web_test_suite" to load it.
1010
srcs = ["angular-test-init-spec.ts"],
1111
deps = [
1212
"@npm//@angular/core",

tools/defaults.bzl

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
load("@npm_angular_bazel//:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package", _protractor_web_test_suite = "protractor_web_test_suite")
44
load("@npm_bazel_jasmine//:index.bzl", _jasmine_node_test = "jasmine_node_test")
55
load("@npm_bazel_typescript//:defs.bzl", _ts_library = "ts_library")
6-
load("@npm_bazel_karma//:defs.bzl", _ts_web_test_suite = "ts_web_test_suite")
6+
load("@npm_bazel_karma//:defs.bzl", _karma_web_test_suite = "karma_web_test_suite")
77
load("//tools/markdown-to-html:index.bzl", _markdown_to_html = "markdown_to_html")
88
load("//:packages.bzl", "ANGULAR_LIBRARY_UMDS", "VERSION_PLACEHOLDER_REPLACEMENTS")
99

@@ -108,8 +108,8 @@ def ng_e2e_test_library(deps = [], tsconfig = None, **kwargs):
108108
**kwargs
109109
)
110110

111-
def ts_web_test_suite(deps = [], srcs = [], **kwargs):
112-
_ts_web_test_suite(
111+
def karma_web_test_suite(deps = [], srcs = [], **kwargs):
112+
_karma_web_test_suite(
113113
deps = ["//tools/rxjs:rxjs_umd_modules"] + deps,
114114
# Required for running the compiled ng modules that use TypeScript import helpers.
115115
# TODO(jelbourn): remove UMDs from here once we don't have to manually include them
@@ -141,7 +141,7 @@ def ng_web_test_suite(deps = [], static_css = [], bootstrap = [], **kwargs):
141141
# Workaround for https://github.com/bazelbuild/rules_typescript/issues/301
142142
# Since some of our tests depend on CSS files which are not part of the `ng_module` rule,
143143
# we need to somehow load static CSS files within Karma (e.g. overlay prebuilt). Those styles
144-
# are required for successful test runs. Since the `ts_web_test_suite` rule currently only
144+
# are required for successful test runs. Since the `karma_web_test_suite` rule currently only
145145
# allows JS files to be included and served within Karma, we need to create a JS file that
146146
# loads the given CSS file.
147147
for css_label in static_css:
@@ -165,7 +165,7 @@ def ng_web_test_suite(deps = [], static_css = [], bootstrap = [], **kwargs):
165165
""" % css_label,
166166
)
167167

168-
ts_web_test_suite(
168+
karma_web_test_suite(
169169
# Depend on our custom test initialization script. This needs to be the first dependency.
170170
deps = [
171171
"//test:angular_test_init",

0 commit comments

Comments
 (0)