Skip to content

Commit 8384562

Browse files
gregmagolanalexeagle
authored andcommitted
feat(karma): remove ts_web_test and ts_web_test_suite rules
BREAKING CHANGES: The `ts_web_test` and `ts_web_test_suite` rules were duplicates of `karma_web_test` and `karma_web_test_suite` rules minus the `config_file` attribute. The `karma_web_test` and `karma_web_test_suite`, which have identical APIs, should now be used instead. They can be loaded from `load("@npm_bazel_karma//:index.bzl", "karma_web_test")` and `load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite")`.
1 parent b07f65f commit 8384562

26 files changed

Lines changed: 109 additions & 395 deletions

File tree

examples/angular/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ $ bazel test //e2e/...
7979
```
8080

8181
In this example, there is a unit test for the `hello-world` component which uses
82-
the `ts_web_test_suite` rule. There are also protractor e2e tests for both the
82+
the `karma_web_test_suite` rule. There are also protractor e2e tests for both the
8383
`prodserver` and `devserver` which use the `protractor_web_test_suite` rule.
8484

8585
Note that Bazel will only re-run the tests whose inputs changed since the last run.

examples/angular/src/app/hello-world/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
22
load("@npm_angular_bazel//:index.bzl", "ng_module")
33
load("@npm_bazel_typescript//:index.bzl", "ts_library")
4-
load("//tools:defaults.bzl", "ts_web_test_suite")
4+
load("//tools:defaults.bzl", "karma_web_test_suite")
55

66
package(default_visibility = ["//:__subpackages__"])
77

@@ -52,7 +52,7 @@ ts_library(
5252
],
5353
)
5454

55-
ts_web_test_suite(
55+
karma_web_test_suite(
5656
name = "test",
5757
srcs = [
5858
# We are manaully adding the bazel generated named-UMD date-fns bundle here as

examples/angular/src/initialize_testbed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @fileoverview Provides a script to initialize TestBed before tests are run.
3-
* This file should be included in the "runtime_deps" of a "ts_web_test_suite"
3+
* This file should be included in the "runtime_deps" of a "karma_web_test_suite"
44
* rule.
55
*/
66
import {TestBed} from '@angular/core/testing';

examples/angular/tools/defaults.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"Set some defaults for karma rules"
22

3-
load("@npm_bazel_karma//:index.bzl", _ts_web_test_suite = "ts_web_test_suite")
3+
load("@npm_bazel_karma//:index.bzl", _karma_web_test_suite = "karma_web_test_suite")
44

5-
def ts_web_test_suite(name, browsers = [], tags = [], **kwargs):
6-
_ts_web_test_suite(
5+
def karma_web_test_suite(name, browsers = [], tags = [], **kwargs):
6+
_karma_web_test_suite(
77
name = name,
88
tags = tags + ["native", "no-bazelci"],
99
browsers = browsers,
@@ -13,7 +13,7 @@ def ts_web_test_suite(name, browsers = [], tags = [], **kwargs):
1313
# BazelCI docker images are missing shares libs to run a subset browser tests:
1414
# mac: firefox does not work, chrome works
1515
# ubuntu: firefox and chrome do not work --- there are 0 tests to run
16-
_ts_web_test_suite(
16+
_karma_web_test_suite(
1717
name = "bazelci_" + name,
1818
tags = tags + ["native", "no-circleci"],
1919
browsers = [

examples/angular_view_engine/src/app/hello-world/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
22
load("@npm_angular_bazel//:index.bzl", "ng_module")
33
load("@npm_bazel_typescript//:index.bzl", "ts_library")
4-
load("//tools:defaults.bzl", "ts_web_test_suite")
4+
load("//tools:defaults.bzl", "karma_web_test_suite")
55

66
package(default_visibility = ["//:__subpackages__"])
77

@@ -52,7 +52,7 @@ ts_library(
5252
],
5353
)
5454

55-
ts_web_test_suite(
55+
karma_web_test_suite(
5656
name = "test",
5757
srcs = [
5858
# We are manaully adding the bazel generated named-UMD date-fns bundle here as

examples/angular_view_engine/src/initialize_testbed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @fileoverview Provides a script to initialize TestBed before tests are run.
3-
* This file should be included in the "runtime_deps" of a "ts_web_test_suite"
3+
* This file should be included in the "runtime_deps" of a "karma_web_test_suite"
44
* rule.
55
*/
66
import {TestBed} from '@angular/core/testing';

examples/angular_view_engine/tools/defaults.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"Set some defaults for karma rules"
22

3-
load("@npm_bazel_karma//:index.bzl", _ts_web_test_suite = "ts_web_test_suite")
3+
load("@npm_bazel_karma//:index.bzl", _karma_web_test_suite = "karma_web_test_suite")
44

5-
def ts_web_test_suite(name, browsers = [], tags = [], **kwargs):
6-
_ts_web_test_suite(
5+
def karma_web_test_suite(name, browsers = [], tags = [], **kwargs):
6+
_karma_web_test_suite(
77
name = name,
88
tags = tags + ["native", "no-bazelci"],
99
browsers = browsers,
@@ -13,7 +13,7 @@ def ts_web_test_suite(name, browsers = [], tags = [], **kwargs):
1313
# BazelCI docker images are missing shares libs to run a subset browser tests:
1414
# mac: firefox does not work, chrome works
1515
# ubuntu: firefox and chrome do not work --- there are 0 tests to run
16-
_ts_web_test_suite(
16+
_karma_web_test_suite(
1717
name = "bazelci_" + name,
1818
tags = tags + ["native", "no-circleci"],
1919
browsers = [

examples/protocol_buffers/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ load("@npm_bazel_protractor//:index.bzl", "protractor_web_test_suite")
44
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
55
load("@npm_bazel_terser//:index.bzl", "terser_minified")
66
load("@npm_bazel_typescript//:index.bzl", "ts_config", "ts_devserver", "ts_library")
7-
load("//:defaults.bzl", "ts_web_test_suite")
7+
load("//:defaults.bzl", "karma_web_test_suite")
88

99
proto_library(
1010
name = "tire_proto",
@@ -45,7 +45,7 @@ ts_library(
4545
],
4646
)
4747

48-
ts_web_test_suite(
48+
karma_web_test_suite(
4949
name = "test",
5050
bootstrap = ["@npm_bazel_labs//protobufjs:bootstrap_scripts"],
5151
browsers = [

examples/protocol_buffers/defaults.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
"""Overrides for ts_web_test_suite to support bazelci testing
15+
"""Overrides for karma_web_test_suite to support bazelci testing
1616
"""
1717

18-
load("@npm_bazel_karma//:index.bzl", _ts_web_test_suite = "ts_web_test_suite")
18+
load("@npm_bazel_karma//:index.bzl", _karma_web_test_suite = "karma_web_test_suite")
1919

20-
def ts_web_test_suite(name, browsers = [], tags = [], **kwargs):
20+
def karma_web_test_suite(name, browsers = [], tags = [], **kwargs):
2121
# BazelCI docker images are missing shares libs to run a subset browser tests:
2222
# mac: firefox does not work, chrome works
2323
# ubuntu: firefox and chrome do not work --- there are 0 tests to run
2424
# windows: firefox (disabled by rules_webtesting) and chrome do not work --- there are 0 tests to run
2525
# TODO(gregmagolan): fix underlying issue in bazelci and remove this macro
2626

2727
# For CircleCI and local testing
28-
_ts_web_test_suite(
28+
_karma_web_test_suite(
2929
name = name,
3030
tags = tags + ["no-bazelci"],
3131
browsers = browsers,
3232
**kwargs
3333
)
3434

3535
# For BazelCI mac only
36-
_ts_web_test_suite(
36+
_karma_web_test_suite(
3737
name = "bazelci_chrome_" + name,
3838
tags = tags + ["no-circleci", "no-bazelci-ubuntu", "no-bazelci-windows", "no-local"],
3939
browsers = [

examples/web_testing/BUILD.bazel

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@npm_bazel_typescript//:index.bzl", "ts_config", "ts_library")
2-
load("//:defaults.bzl", "karma_web_test_suite", "ts_web_test_suite")
2+
load("//:defaults.bzl", "karma_web_test_suite")
33

44
ts_library(
55
name = "lib",
@@ -36,7 +36,7 @@ ts_library(
3636
)
3737

3838
karma_web_test_suite(
39-
name = "testing_karma",
39+
name = "config_test",
4040
browsers = [
4141
"@io_bazel_rules_webtesting//browsers:chromium-local",
4242
"@io_bazel_rules_webtesting//browsers:firefox-local",
@@ -56,24 +56,7 @@ karma_web_test_suite(
5656
)
5757

5858
karma_web_test_suite(
59-
name = "testing_karma_sauce",
60-
browsers = [
61-
"@io_bazel_rules_webtesting//browsers/sauce:chrome-win10",
62-
],
63-
tags = [
64-
"exclusive",
65-
"sauce",
66-
"native",
67-
# TODO(alexeagle): enable on CI once we have set the SAUCE env variables
68-
"manual",
69-
],
70-
deps = [
71-
":tests",
72-
],
73-
)
74-
75-
ts_web_test_suite(
76-
name = "testing",
59+
name = "no_config_test",
7760
browsers = [
7861
"@io_bazel_rules_webtesting//browsers:chromium-local",
7962
"@io_bazel_rules_webtesting//browsers:firefox-local",
@@ -90,8 +73,8 @@ ts_web_test_suite(
9073
],
9174
)
9275

93-
ts_web_test_suite(
94-
name = "testing_sauce",
76+
karma_web_test_suite(
77+
name = "sauce_test",
9578
browsers = [
9679
"@io_bazel_rules_webtesting//browsers/sauce:chrome-win10",
9780
],

0 commit comments

Comments
 (0)