Skip to content

Commit

Permalink
Allows browsers to be specified with a default target.
Browse files Browse the repository at this point in the history
Refs #74.

For whatever reason, `web_test_suite` *requires* the target name to be explicit. `//foo:foo` is required instead of `//foo`. This appears to be an overly constrained string parsing behavior. To make this more usable, `jasmine_web_test_suite` now automatically expands any input targets from `//foo` to `//foo:foo` if necessary before passing them in to `web_test_suite`.
  • Loading branch information
dgp1130 committed Jul 29, 2023
1 parent ec64a34 commit 7bee1a2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tools/jasmine/jasmine_web_test_suite.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ https://github.com/bazelbuild/rules_webtesting/blob/6b47a3f11b7f302c2620a3552cf8
"""

load("@io_bazel_rules_webtesting//web:web.bzl", "web_test_suite")
load("//common:label.bzl", "absolute")
load(":jasmine_node_test.bzl", "jasmine_node_test")

visibility("private")
Expand Down Expand Up @@ -50,7 +51,7 @@ _DEFAULT_WEB_TEST_SUITE_TAGS = {

def jasmine_web_test_suite(
name,
browsers = ["//tools/browsers/chromium:chromium"],
browsers = ["//tools/browsers/chromium"],
browser_overrides = None,
config = None,
flaky = None,
Expand Down Expand Up @@ -80,8 +81,8 @@ def jasmine_web_test_suite(
```
{
"//tools/browsers/chromium:chromium": {"shard_count": 3, "flaky": 1},
"//tools/browsers/firefox:firefox": {"shard_count": 1, "timeout": 100},
"//tools/browsers/chromium": {"shard_count": 3, "flaky": 1},
"//tools/browsers/firefox": {"shard_count": 1, "timeout": 100},
}
```
config: Optional label to configure web test features.
Expand Down Expand Up @@ -127,7 +128,10 @@ def jasmine_web_test_suite(
web_test_suite(
name = name,
test = ":%s" % wrapped_test_name,
browsers = browsers,
# For whatever reason, `web_test_suite` _requires_ an explicit target.
# `//foo` isn't good enough, we need `//foo:foo`. Since this is easy to
# forget, we automatically do the conversion for users.
browsers = [absolute(browser) for browser in browsers],
browser_overrides = browser_overrides,
config = config,
data = [":%s" % wrapped_test_config],
Expand Down

0 comments on commit 7bee1a2

Please sign in to comment.