mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: test material with bazel (#13670)
* build: test material with bazel * Supports testing `src/lib` with Bazel. * Add prebuilt theme to all Material tests * Always include prebuilt theme. Rebase changes for paginator spec
This commit is contained in:
committed by
mmalerba
parent
3cabf781a8
commit
bec5823719
+10
-3
@@ -72,7 +72,13 @@ def ng_test_library(deps = [], tsconfig = None, **kwargs):
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def ng_web_test_suite(deps = [], srcs = [], static_css = [], **kwargs):
|
||||
def ng_web_test_suite(deps = [], srcs = [], static_css = [], bootstrap = [], **kwargs):
|
||||
# Always include a prebuilt theme in the test suite because otherwise tests, which depend on CSS
|
||||
# that is needed for measuring, will unexpectedly fail. Also always adding a prebuilt theme
|
||||
# reduces the amount of setup that is needed to create a test suite Bazel target. Note that the
|
||||
# prebuilt theme will be also added to CDK test suites but shouldn't affect anything.
|
||||
static_css = static_css + ["//src/lib/prebuilt-themes:indigo-pink"]
|
||||
|
||||
# Workaround for https://github.com/bazelbuild/rules_typescript/issues/301
|
||||
# Since some of our tests depend on CSS files which are not part of the `ng_module` rule,
|
||||
# we need to somehow load static CSS files within Karma (e.g. overlay prebuilt). Those styles
|
||||
@@ -80,7 +86,7 @@ def ng_web_test_suite(deps = [], srcs = [], static_css = [], **kwargs):
|
||||
# allows JS files to be included and served within Karma, we need to create a JS file that
|
||||
# loads the given CSS file.
|
||||
for css_label in static_css:
|
||||
css_id = "static-css-file-%s" % (css_label.strip(':').strip('/'))
|
||||
css_id = "static-css-file-%s" % (css_label.replace("/", "_").replace(":", "-"))
|
||||
deps += [":%s" % css_id]
|
||||
|
||||
native.genrule(
|
||||
@@ -108,6 +114,7 @@ def ng_web_test_suite(deps = [], srcs = [], static_css = [], **kwargs):
|
||||
bootstrap = [
|
||||
"@npm//node_modules/zone.js:dist/zone-testing-bundle.js",
|
||||
"@npm//node_modules/reflect-metadata:Reflect.js",
|
||||
],
|
||||
"@npm//node_modules/hammerjs:hammer.js",
|
||||
] + bootstrap,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user