274dc15452
TypeScript 4.2 has changed its emitted syntax for synthetic constructors when using `downlevelIteration`, which affects ES5 bundles that have been downleveled from ES2015 bundles. This is typically the case for UMD bundles in the APF spec, as they are generated by downleveling the ESM2015 bundle into ES5. The reflection capabilities in the runtime need to recognize this new form to correctly deal with synthesized constructors, as otherwise JIT compilation could generate invalid factory functions. Fixes #41298 PR Close #41305
116 lines
3.4 KiB
Python
116 lines
3.4 KiB
Python
load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
|
|
load("//tools/circular_dependency_test:index.bzl", "circular_dependency_test")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
circular_dependency_test(
|
|
name = "circular_deps_test",
|
|
entry_point = "angular/packages/core/index.js",
|
|
deps = ["//packages/core"],
|
|
)
|
|
|
|
circular_dependency_test(
|
|
name = "testing_circular_deps_test",
|
|
entry_point = "angular/packages/core/testing/index.js",
|
|
deps = ["//packages/core/testing"],
|
|
)
|
|
|
|
genrule(
|
|
name = "downleveled_es5_fixture",
|
|
srcs = ["reflection/es2015_inheritance_fixture.ts"],
|
|
outs = ["reflection/es5_downleveled_inheritance_fixture.js"],
|
|
cmd = """
|
|
es2015_out_dir="/tmp/downleveled_es5_fixture/"
|
|
es2015_out_file="$$es2015_out_dir/es2015_inheritance_fixture.js"
|
|
|
|
# Build the ES2015 output and then downlevel it to ES5.
|
|
$(execpath @npm//typescript/bin:tsc) $< --outDir $$es2015_out_dir --target ES2015 \
|
|
--types --module umd
|
|
$(execpath @npm//typescript/bin:tsc) --outFile $@ $$es2015_out_file --allowJs \
|
|
--types --target ES5 --downlevelIteration
|
|
""",
|
|
tools = ["@npm//typescript/bin:tsc"],
|
|
)
|
|
|
|
ts_library(
|
|
name = "test_lib",
|
|
testonly = True,
|
|
srcs = glob(
|
|
["**/*.ts"],
|
|
exclude = [
|
|
"**/*_node_only_spec.ts",
|
|
"reflection/es2015_inheritance_fixture.ts",
|
|
],
|
|
),
|
|
# Visible to //:saucelabs_unit_tests_poc target
|
|
visibility = ["//:__pkg__"],
|
|
deps = [
|
|
"//packages/animations",
|
|
"//packages/animations/browser",
|
|
"//packages/animations/browser/testing",
|
|
"//packages/common",
|
|
"//packages/common/locales",
|
|
"//packages/compiler",
|
|
"//packages/compiler/testing",
|
|
"//packages/core",
|
|
"//packages/core/src/di/interface",
|
|
"//packages/core/src/interface",
|
|
"//packages/core/src/reflection",
|
|
"//packages/core/src/util",
|
|
"//packages/core/testing",
|
|
"//packages/localize/init",
|
|
"//packages/platform-browser",
|
|
"//packages/platform-browser-dynamic",
|
|
"//packages/platform-browser/animations",
|
|
"//packages/platform-browser/testing",
|
|
"//packages/private/testing",
|
|
"//packages/router",
|
|
"//packages/router/testing",
|
|
"//packages/zone.js/lib:zone_d_ts",
|
|
"@npm//rxjs",
|
|
],
|
|
)
|
|
|
|
ts_library(
|
|
name = "test_node_only_lib",
|
|
testonly = True,
|
|
srcs = glob(["**/*_node_only_spec.ts"]),
|
|
deps = [
|
|
":test_lib",
|
|
"//packages/compiler",
|
|
"//packages/compiler/testing",
|
|
"//packages/core",
|
|
"//packages/core/src/compiler",
|
|
"//packages/core/testing",
|
|
"//packages/platform-server",
|
|
"//packages/platform-server/testing",
|
|
"//packages/private/testing",
|
|
],
|
|
)
|
|
|
|
jasmine_node_test(
|
|
name = "test",
|
|
bootstrap = ["//tools/testing:node_es5"],
|
|
data = [
|
|
":downleveled_es5_fixture",
|
|
],
|
|
shard_count = 4,
|
|
deps = [
|
|
":test_lib",
|
|
":test_node_only_lib",
|
|
"//packages/platform-server",
|
|
"//packages/platform-server/testing",
|
|
"//packages/zone.js/lib:zone_d_ts",
|
|
"@npm//base64-js",
|
|
"@npm//source-map",
|
|
],
|
|
)
|
|
|
|
karma_web_test_suite(
|
|
name = "test_web",
|
|
runtime_deps = [":downleveled_es5_fixture"],
|
|
deps = [
|
|
":test_lib",
|
|
],
|
|
)
|