angular-docs-cn/packages/elements/test/BUILD.bazel

62 lines
1.9 KiB
Python

load("//tools:defaults.bzl", "karma_web_test_suite", "ts_library")
load("//tools/circular_dependency_test:index.bzl", "circular_dependency_test")
load("//tools:utils.bzl", "transpile_js_to_es5")
circular_dependency_test(
name = "circular_deps_test",
entry_point = "angular/packages/elements/index.js",
deps = ["//packages/elements"],
)
ts_library(
name = "test_lib",
testonly = True,
srcs = glob(["**/*.ts"]),
deps = [
"//packages:types",
"//packages/compiler",
"//packages/core",
"//packages/core/testing",
"//packages/elements",
"//packages/platform-browser",
"//packages/platform-browser-dynamic",
"//packages/platform-browser-dynamic/testing",
"//packages/platform-browser/testing",
"@npm//rxjs",
],
)
# This file is shipped as es2015 to npm. We have to transpile
# it to es5 in order to run the tests against older browsers.
transpile_js_to_es5(
name = "custom_elements_native_shim",
js_file = "@npm//:node_modules/@webcomponents/custom-elements/src/native-shim.js",
)
filegroup(
name = "elements_test_bootstrap_scripts",
testonly = True,
# do not sort
srcs = [
"@npm//:node_modules/core-js-bundle/index.js",
# Required for browsers that do not natively support Custom Elements.
"@npm//:node_modules/@webcomponents/custom-elements/custom-elements.min.js",
# Required for ES5 code to work with a native Custom Elements implementation.
# (See https://www.npmjs.com/package/@webcomponents/custom-elements#es5-vs-es2015.)
":custom_elements_native_shim",
"@npm//:node_modules/reflect-metadata/Reflect.js",
"//packages/zone.js/bundles:zone.umd.js",
"//packages/zone.js/bundles:zone-testing.umd.js",
],
)
karma_web_test_suite(
name = "test",
bootstrap = [
":elements_test_bootstrap_scripts",
],
deps = [
":test_lib",
],
)