Move ts_web_test_suite to the same .bzl file with ts_web_test
This makes the documentation easier to navigate since both docs will live on the same page.
PiperOrigin-RevId: 196161292
diff --git a/BUILD.bazel b/BUILD.bazel
index 9ea6af7..e798d86 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -49,7 +49,6 @@
"//internal:ts_config.bzl",
"//internal/devserver:ts_devserver.bzl",
"//internal/karma:ts_web_test.bzl",
- "//internal/karma:ts_web_test_suite.bzl",
"//internal/protobufjs:ts_proto_library.bzl",
],
format = "html",
diff --git a/defs.bzl b/defs.bzl
index bb70c96..e7caea1 100644
--- a/defs.bzl
+++ b/defs.bzl
@@ -20,8 +20,9 @@
load("//internal:build_defs.bzl", _ts_library = "ts_library")
load("//internal:ts_config.bzl", _ts_config = "ts_config")
load("//internal/devserver:ts_devserver.bzl", _ts_devserver = "ts_devserver_macro")
-load("//internal/karma:ts_web_test.bzl", _ts_web_test = "ts_web_test_macro")
-load("//internal/karma:ts_web_test_suite.bzl", _ts_web_test_suite = "ts_web_test_suite")
+load("//internal/karma:ts_web_test.bzl",
+ _ts_web_test = "ts_web_test_macro",
+ _ts_web_test_suite = "ts_web_test_suite")
load("//internal/protobufjs:ts_proto_library.bzl", _ts_proto_library = "ts_proto_library")
ts_setup_workspace = _ts_setup_workspace
diff --git a/internal/karma/ts_web_test.bzl b/internal/karma/ts_web_test.bzl
index a502ea5..0e82f8f 100644
--- a/internal/karma/ts_web_test.bzl
+++ b/internal/karma/ts_web_test.bzl
@@ -211,3 +211,94 @@
# FIXME: maybe we can just ask the attr._karma for its runfiles attr
data = data + ["@build_bazel_rules_typescript//internal/karma:karma_bin"],
**kwargs)
+
+load("@io_bazel_rules_webtesting//web:web.bzl", "web_test_suite")
+load("@io_bazel_rules_webtesting//web/internal:constants.bzl", "DEFAULT_WRAPPED_TEST_TAGS")
+
+def ts_web_test_suite(
+ name,
+ browsers=["@io_bazel_rules_webtesting//browsers:chromium-local"],
+ args=None,
+ browser_overrides=None,
+ config=None,
+ flaky=None,
+ local=None,
+ shard_count=None,
+ size=None,
+ tags = [],
+ test_suite_tags=None,
+ timeout=None,
+ visibility=None,
+ web_test_data=[],
+ wrapped_test_tags=None,
+ **remaining_keyword_args):
+ """Defines a test_suite of web_test targets that wrap a ts_web_test target.
+
+ Args:
+ name: The base name of the test.
+ browsers: A sequence of labels specifying the browsers to use.
+ args: Args for web_test targets generated by this extension.
+ browser_overrides: Dictionary; optional; default is an empty dictionary. A
+ dictionary mapping from browser names to browser-specific web_test
+ attributes, such as shard_count, flakiness, timeout, etc. For example:
+ {'//browsers:chrome-native': {'shard_count': 3, 'flaky': 1}
+ '//browsers:firefox-native': {'shard_count': 1, 'timeout': 100}}.
+ config: Label; optional; Configuration of web test features.
+ flaky: A boolean specifying that the test is flaky. If set, the test will
+ be retried up to 3 times (default: 0)
+ local: boolean; optional.
+ shard_count: The number of test shards to use per browser. (default: 1)
+ size: A string specifying the test size. (default: 'large')
+ tags: A list of test tag strings to apply to each generated web_test target.
+ This macro adds a couple for ibazel.
+ test_suite_tags: A list of tag strings for the generated test_suite.
+ timeout: A string specifying the test timeout (default: computed from size)
+ visibility: List of labels; optional.
+ web_test_data: Data dependencies for the web_test.
+ wrapped_test_tags: A list of test tag strings to use for the wrapped test
+ **remaining_keyword_args: Arguments for the wrapped test target.
+ """
+ # Check explicitly for None so that users can set this to the empty list
+ if wrapped_test_tags == None:
+ wrapped_test_tags = DEFAULT_WRAPPED_TEST_TAGS
+
+ size = size or "large"
+
+ wrapped_test_name = name + "_wrapped_test"
+
+ # Users don't need to know that this tag is required to run under ibazel
+ tags = tags + ["ibazel_notify_changes"]
+
+ # Our binary dependency must be in data[] for collect_data to pick it up
+ # FIXME: maybe we can just ask the attr._karma for its runfiles attr
+ web_test_data = web_test_data + ["@build_bazel_rules_typescript//internal/karma:karma_bin"]
+
+ ts_web_test(
+ name=wrapped_test_name,
+ args=args,
+ flaky=flaky,
+ local=local,
+ shard_count=shard_count,
+ size=size,
+ tags=wrapped_test_tags,
+ timeout=timeout,
+ visibility=["//visibility:private"],
+ **remaining_keyword_args)
+
+ web_test_suite(
+ name=name,
+ launcher=":"+wrapped_test_name,
+ args=args,
+ browsers=browsers,
+ browser_overrides=browser_overrides,
+ config=config,
+ data=web_test_data,
+ flaky=flaky,
+ local=local,
+ shard_count=shard_count,
+ size=size,
+ tags=tags,
+ test=wrapped_test_name,
+ test_suite_tags=test_suite_tags,
+ timeout=timeout,
+ visibility=visibility)
diff --git a/internal/karma/ts_web_test_suite.bzl b/internal/karma/ts_web_test_suite.bzl
deleted file mode 100644
index f05b9c8..0000000
--- a/internal/karma/ts_web_test_suite.bzl
+++ /dev/null
@@ -1,106 +0,0 @@
-# Copyright 2017 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""Web Test rules for Typescript."""
-
-load(":ts_web_test.bzl", "ts_web_test")
-load("@io_bazel_rules_webtesting//web:web.bzl", "web_test_suite")
-load("@io_bazel_rules_webtesting//web/internal:constants.bzl", "DEFAULT_WRAPPED_TEST_TAGS")
-
-def ts_web_test_suite(
- name,
- browsers=["@io_bazel_rules_webtesting//browsers:chromium-local"],
- args=None,
- browser_overrides=None,
- config=None,
- flaky=None,
- local=None,
- shard_count=None,
- size=None,
- tags = [],
- test_suite_tags=None,
- timeout=None,
- visibility=None,
- web_test_data=[],
- wrapped_test_tags=None,
- **remaining_keyword_args):
- """Defines a test_suite of web_test targets that wrap a ts_web_test target.
-
- Args:
- name: The base name of the test.
- browsers: A sequence of labels specifying the browsers to use.
- args: Args for web_test targets generated by this extension.
- browser_overrides: Dictionary; optional; default is an empty dictionary. A
- dictionary mapping from browser names to browser-specific web_test
- attributes, such as shard_count, flakiness, timeout, etc. For example:
- {'//browsers:chrome-native': {'shard_count': 3, 'flaky': 1}
- '//browsers:firefox-native': {'shard_count': 1, 'timeout': 100}}.
- config: Label; optional; Configuration of web test features.
- flaky: A boolean specifying that the test is flaky. If set, the test will
- be retried up to 3 times (default: 0)
- local: boolean; optional.
- shard_count: The number of test shards to use per browser. (default: 1)
- size: A string specifying the test size. (default: 'large')
- tags: A list of test tag strings to apply to each generated web_test target.
- This macro adds a couple for ibazel.
- test_suite_tags: A list of tag strings for the generated test_suite.
- timeout: A string specifying the test timeout (default: computed from size)
- visibility: List of labels; optional.
- web_test_data: Data dependencies for the web_test.
- wrapped_test_tags: A list of test tag strings to use for the wrapped test
- **remaining_keyword_args: Arguments for the wrapped test target.
- """
- # Check explicitly for None so that users can set this to the empty list
- if wrapped_test_tags == None:
- wrapped_test_tags = DEFAULT_WRAPPED_TEST_TAGS
-
- size = size or "large"
-
- wrapped_test_name = name + "_wrapped_test"
-
- # Users don't need to know that this tag is required to run under ibazel
- tags = tags + ["ibazel_notify_changes"]
-
- # Our binary dependency must be in data[] for collect_data to pick it up
- # FIXME: maybe we can just ask the attr._karma for its runfiles attr
- web_test_data = web_test_data + ["@build_bazel_rules_typescript//internal/karma:karma_bin"]
-
- ts_web_test(
- name=wrapped_test_name,
- args=args,
- flaky=flaky,
- local=local,
- shard_count=shard_count,
- size=size,
- tags=wrapped_test_tags,
- timeout=timeout,
- visibility=["//visibility:private"],
- **remaining_keyword_args)
-
- web_test_suite(
- name=name,
- launcher=":"+wrapped_test_name,
- args=args,
- browsers=browsers,
- browser_overrides=browser_overrides,
- config=config,
- data=web_test_data,
- flaky=flaky,
- local=local,
- shard_count=shard_count,
- size=size,
- tags=tags,
- test=wrapped_test_name,
- test_suite_tags=test_suite_tags,
- timeout=timeout,
- visibility=visibility)
diff --git a/package.json b/package.json
index fbd4839..8bf47d6 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@bazel/typescript",
"description": "Build TypeScript with Bazel",
- "version": "0.9.0",
+ "version": "0.13.0",
"keywords": [
"typescript",
"bazel"