refactor: handle breaking changes in rules_nodejs 1.0.0 (#34736)

The major one that affects the angular repo is the removal of the bootstrap attribute in nodejs_binary, nodejs_test and jasmine_node_test in favor of using templated_args --node_options=--require=/path/to/script. The side-effect of this is that the bootstrap script does not get the require.resolve patches with explicitly loading the targets _loader.js file.

PR Close #34736
This commit is contained in:
Greg Magolan 2019-12-28 18:14:36 -08:00 committed by Matias Niemelä
parent ba662fa7a9
commit dcff76e8b9
70 changed files with 319 additions and 133 deletions

View File

@ -16,10 +16,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -13,10 +13,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -12,11 +12,12 @@ filegroup(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
"//packages/bazel/src/schematics/ng-add:test", "//packages/bazel/src/schematics/ng-add:test",
"//packages/bazel/src/schematics/ng-new:test", "//packages/bazel/src/schematics/ng-new:test",
"//packages/bazel/src/schematics/utility:test", "//packages/bazel/src/schematics/utility:test",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -15,12 +15,13 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//packages/benchpress", "//packages/benchpress",
"//packages/core/testing", "//packages/core/testing",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
"@npm//protractor", "@npm//protractor",
], ],
) )

View File

@ -19,10 +19,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -17,10 +17,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -24,10 +24,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -16,9 +16,10 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -21,12 +21,13 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//packages/platform-server", "//packages/platform-server",
"//packages/platform-server/testing", "//packages/platform-server/testing",
"//packages/private/testing", "//packages/private/testing",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -22,12 +22,13 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
tags = [ tags = [
"ivy-only", "ivy-only",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -33,13 +33,13 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"],
data = [ data = [
"//packages/compiler-cli/test/ngtsc/fake_core:npm_package", "//packages/compiler-cli/test/ngtsc/fake_core:npm_package",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )
@ -64,7 +64,6 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "integration", name = "integration",
timeout = "long", timeout = "long",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"],
data = [ data = [
"//packages/common:npm_package", "//packages/common:npm_package",
"//packages/core:npm_package", "//packages/core:npm_package",
@ -75,9 +74,10 @@ jasmine_node_test(
# Disabled in AOT mode because we want ngcc to compile non-AOT Angular packages. # Disabled in AOT mode because we want ngcc to compile non-AOT Angular packages.
"no-ivy-aot", "no-ivy-aot",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":integration_lib", ":integration_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
"@npm//canonical-path", "@npm//canonical-path",
"@npm//convert-source-map", "@npm//convert-source-map",
], ],

View File

@ -29,9 +29,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -21,9 +21,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -19,9 +19,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -18,9 +18,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -22,9 +22,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -23,9 +23,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -24,9 +24,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -20,9 +20,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -24,9 +24,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -17,9 +17,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -24,9 +24,8 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], bootstrap = ["//tools/testing:node_no_angular_es5"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular",
], ],
) )

View File

@ -24,9 +24,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -20,9 +20,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -40,7 +40,6 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "extract_i18n", name = "extract_i18n",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
data = [ data = [
"//packages/core:npm_package", "//packages/core:npm_package",
], ],
@ -49,11 +48,13 @@ jasmine_node_test(
# tool will likely work differently. # tool will likely work differently.
"no-ivy-aot", "no-ivy-aot",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":extract_i18n_lib", ":extract_i18n_lib",
"//packages/common:npm_package", "//packages/common:npm_package",
"//packages/core", "//packages/core",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
"@npm//minimist", "@npm//minimist",
], ],
) )
@ -76,7 +77,6 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "ngc", name = "ngc",
timeout = "long", # 900 seconds timeout = "long", # 900 seconds
bootstrap = ["angular/tools/testing/init_node_spec.js"],
data = [ data = [
"//packages/common:npm_package", "//packages/common:npm_package",
"//packages/core:npm_package", "//packages/core:npm_package",
@ -88,10 +88,12 @@ jasmine_node_test(
# own tests under //packages/compiler-cli/test/ngtsc. # own tests under //packages/compiler-cli/test/ngtsc.
"no-ivy-aot", "no-ivy-aot",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":ngc_lib", ":ngc_lib",
"//packages/core", "//packages/core",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
"@npm//minimist", "@npm//minimist",
"@npm//rxjs", "@npm//rxjs",
"@npm//tsickle", "@npm//tsickle",
@ -116,14 +118,15 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "perform_watch", name = "perform_watch",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
data = [ data = [
"//packages/core:npm_package", "//packages/core:npm_package",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":perform_watch_lib", ":perform_watch_lib",
"//packages/core", "//packages/core",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )
@ -143,13 +146,14 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "perform_compile", name = "perform_compile",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
data = [ data = [
"//packages/core:npm_package", "//packages/core:npm_package",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":perform_compile_lib", ":perform_compile_lib",
"//packages/core", "//packages/core",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -18,7 +18,6 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "compliance", name = "compliance",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"],
data = [ data = [
"//packages/compiler-cli/test/ngtsc/fake_core:npm_package", "//packages/compiler-cli/test/ngtsc/fake_core:npm_package",
], ],
@ -26,8 +25,9 @@ jasmine_node_test(
tags = [ tags = [
"ivy-only", "ivy-only",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -15,7 +15,6 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "check_types", name = "check_types",
timeout = "long", # 900 seconds timeout = "long", # 900 seconds
bootstrap = ["angular/tools/testing/init_node_spec.js"],
data = [ data = [
"//packages/common:npm_package", "//packages/common:npm_package",
"//packages/core:npm_package", "//packages/core:npm_package",
@ -25,10 +24,12 @@ jasmine_node_test(
# compiler has its own typechecking implementation and tests. # compiler has its own typechecking implementation and tests.
"no-ivy-aot", "no-ivy-aot",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":check_types_lib", ":check_types_lib",
"//packages/core", "//packages/core",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )
@ -45,11 +46,10 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "typescript_version", name = "typescript_version",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
data = [
],
deps = [ deps = [
":typescript_version_lib", ":typescript_version_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -16,12 +16,13 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
data = [ data = [
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//packages/core", "//packages/core",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -23,14 +23,14 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "ngtsc", name = "ngtsc",
timeout = "long", timeout = "long",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"],
data = [ data = [
"//packages/compiler-cli/test/ngtsc/fake_core:npm_package", "//packages/compiler-cli/test/ngtsc/fake_core:npm_package",
], ],
shard_count = 4, shard_count = 4,
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":ngtsc_lib", ":ngtsc_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
"@npm//minimist", "@npm//minimist",
], ],
) )

View File

@ -19,7 +19,6 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
timeout = "long", # 900 seconds timeout = "long", # 900 seconds
bootstrap = ["angular/tools/testing/init_node_spec.js"],
data = [ data = [
"//packages/common:npm_package", "//packages/common:npm_package",
"//packages/core:npm_package", "//packages/core:npm_package",
@ -30,10 +29,12 @@ jasmine_node_test(
# of these transformer utilities. # of these transformer utilities.
"no-ivy-aot", "no-ivy-aot",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//packages/core", "//packages/core",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
"@npm//source-map", "@npm//source-map",
], ],
) )

View File

@ -70,7 +70,6 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
data = [ data = [
"//packages/animations:npm_package", "//packages/animations:npm_package",
"//packages/common:npm_package", "//packages/common:npm_package",
@ -80,10 +79,12 @@ jasmine_node_test(
# Disabled as these tests pertain to the old ngc compilation and are not relevant in Ivy. # Disabled as these tests pertain to the old ngc compilation and are not relevant in Ivy.
"no-ivy-aot", "no-ivy-aot",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
":test_node_only_lib", ":test_node_only_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
"@npm//base64-js", "@npm//base64-js",
"@npm//source-map", "@npm//source-map",
], ],

View File

@ -16,10 +16,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "css_parser", name = "css_parser",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":css_parser_lib", ":css_parser_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -15,10 +15,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "expression_parser", name = "expression_parser",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":expression_parser_lib", ":expression_parser_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -13,10 +13,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "ml_parser", name = "ml_parser",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":ml_parser_lib", ":ml_parser_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -18,9 +18,10 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -17,10 +17,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "selector", name = "selector",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":selector_lib", ":selector_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -59,8 +59,8 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
shard_count = 4, shard_count = 4,
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
":test_node_only_lib", ":test_node_only_lib",
@ -68,6 +68,7 @@ jasmine_node_test(
"//packages/platform-server/testing", "//packages/platform-server/testing",
"//packages/zone.js/lib:zone_d_ts", "//packages/zone.js/lib:zone_d_ts",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
"@npm//base64-js", "@npm//base64-js",
"@npm//source-map", "@npm//source-map",
], ],

View File

@ -37,11 +37,12 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "acceptance", name = "acceptance",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":acceptance_lib", ":acceptance_lib",
"//packages/zone.js/lib:zone_d_ts", "//packages/zone.js/lib:zone_d_ts",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
"@npm//base64-js", "@npm//base64-js",
"@npm//source-map", "@npm//source-map",
], ],

View File

@ -61,10 +61,10 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "render3", name = "render3",
bootstrap = [ templated_args = ["--node_options=--require=$(rlocation $(location :domino_es5))"],
"angular/packages/core/test/render3/load_domino",
],
deps = [ deps = [
":domino",
":domino_es5",
":render3_node_lib", ":render3_node_lib",
"//packages/zone.js/lib", "//packages/zone.js/lib",
], ],

View File

@ -16,15 +16,14 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "ivy", name = "ivy",
bootstrap = [
"angular/packages/core/test/render3/load_domino",
],
tags = [ tags = [
"ivy-only", "ivy-only",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //packages/core/test/render3:domino_es5))"],
deps = [ deps = [
":ivy_lib", ":ivy_lib",
"//packages/core/test/render3:domino", "//packages/core/test/render3:domino",
"//packages/core/test/render3:domino_es5",
"//packages/zone.js/lib", "//packages/zone.js/lib",
], ],
) )

View File

@ -6,6 +6,15 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
if (process.env['TEST_SRCDIR']) {
// bootstrap the bazel require resolve patch since this
// script is a bootstrap script loaded with --node_options=--require=...
const path = require('path');
require(path.posix.join(
process.env['TEST_SRCDIR'], process.env['TEST_WORKSPACE'],
(process.env['TEST_BINARY'] as string).replace(/\.(sh|bat)$/, '_loader.js'), ));
}
// Needed to run animation tests // Needed to run animation tests
import 'zone.js/lib/node/rollup-main'; import 'zone.js/lib/node/rollup-main';
import '@angular/compiler'; // For JIT mode. Must be in front of any other @angular/* imports. import '@angular/compiler'; // For JIT mode. Must be in front of any other @angular/* imports.

View File

@ -34,14 +34,15 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "view", name = "view",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
tags = [ tags = [
"no-ivy-aot", "no-ivy-aot",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":view_lib", ":view_lib",
":view_node_only_lib", ":view_node_only_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -78,9 +78,10 @@ protractor_web_test_suite(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":core_tests_lib", ":core_tests_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -15,9 +15,10 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":fake_async_lib", ":fake_async_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -20,10 +20,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -20,10 +20,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -43,9 +43,10 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -14,11 +14,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = [ templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
"angular/tools/testing/init_node_no_angular_spec.js",
],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -22,12 +22,10 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = [ templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
"angular/tools/testing/init_node_no_angular_spec.js",
],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
"@npm//glob", "@npm//glob",
], ],
) )

View File

@ -14,18 +14,16 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "integration", name = "integration",
bootstrap = [
"angular/tools/testing/init_node_no_angular_spec.js",
],
data = glob( data = glob(
[ [
"locales/**", "locales/**",
"test_files/**", "test_files/**",
], ],
), ),
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
"@npm//glob", "@npm//glob",
"@npm//yargs", "@npm//yargs",
], ],

View File

@ -14,11 +14,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = [ templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
"angular/tools/testing/init_node_no_angular_spec.js",
],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -16,11 +16,9 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = [ templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
"angular/tools/testing/init_node_no_angular_spec.js",
],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node_no_angular", "//tools/testing:node_no_angular_es5",
], ],
) )

View File

@ -18,10 +18,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -24,10 +24,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -29,10 +29,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -22,11 +22,12 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
tags = [ tags = [
], ],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -21,10 +21,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -23,10 +23,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -27,9 +27,10 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":aot_test_lib", ":aot_test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -14,11 +14,12 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//packages/service-worker/config", "//packages/service-worker/config",
"//packages/service-worker/config/testing", "//packages/service-worker/config/testing",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -18,10 +18,11 @@ ts_library(
jasmine_node_test( jasmine_node_test(
name = "test", name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"], templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [ deps = [
":test_lib", ":test_lib",
"//tools/testing:node", "//tools/testing:node",
"//tools/testing:node_es5",
], ],
) )

View File

@ -68,8 +68,6 @@ ts_library(
testonly = True, testonly = True,
srcs = glob(["node/*.ts"]) + [ srcs = glob(["node/*.ts"]) + [
"node-env-setup.ts", "node-env-setup.ts",
"node_entry_point.ts",
"node_entry_point_no_patch_clock.ts",
"test-env-setup-jasmine-no-patch-clock.ts", "test-env-setup-jasmine-no-patch-clock.ts",
], ],
deps = [ deps = [
@ -85,12 +83,45 @@ ts_library(
], ],
) )
ts_library(
name = "node_entry_point",
testonly = True,
srcs = ["node_entry_point.ts"],
deps = [
":common_spec_env",
":common_spec_srcs",
":common_spec_util",
"//packages/zone.js/lib",
"@npm//@types/shelljs",
"@npm//@types/systemjs",
"@npm//rxjs",
"@npm//shelljs",
"@npm//systemjs",
],
)
ts_library(
name = "node_entry_point_no_patch_clock",
testonly = True,
srcs = ["node_entry_point_no_patch_clock.ts"],
deps = [
":common_spec_env",
":common_spec_srcs",
":common_spec_util",
"//packages/zone.js/lib",
"@npm//@types/shelljs",
"@npm//@types/systemjs",
"@npm//rxjs",
"@npm//shelljs",
"@npm//systemjs",
],
)
ts_library( ts_library(
name = "bluebird_spec", name = "bluebird_spec",
testonly = True, testonly = True,
srcs = [ srcs = [
"extra/bluebird.spec.ts", "extra/bluebird.spec.ts",
"node_bluebird_entry_point.ts",
], ],
deps = [ deps = [
":common_spec_env", ":common_spec_env",
@ -100,13 +131,33 @@ ts_library(
) )
ts_library( ts_library(
name = "error_spec", name = "node_bluebird_entry_point",
testonly = True, testonly = True,
srcs = [ srcs = ["node_bluebird_entry_point.ts"],
"node_error_disable_policy_entry_point.ts", deps = [
"node_error_entry_point.ts", ":common_spec_env",
"node_error_lazy_policy_entry_point.ts", "//packages/zone.js/lib",
"@npm//bluebird",
], ],
)
ts_library(
name = "node_error_disable_policy_entry_point",
testonly = True,
srcs = ["node_error_disable_policy_entry_point.ts"],
deps = [
":common_spec_env",
":common_spec_util",
":error_spec_srcs",
":node_error_entry_point",
"//packages/zone.js/lib",
],
)
ts_library(
name = "node_error_entry_point",
testonly = True,
srcs = ["node_error_entry_point.ts"],
deps = [ deps = [
":common_spec_env", ":common_spec_env",
":common_spec_util", ":common_spec_util",
@ -115,53 +166,61 @@ ts_library(
], ],
) )
ts_library(
name = "node_error_lazy_policy_entry_point",
testonly = True,
srcs = ["node_error_lazy_policy_entry_point.ts"],
deps = [
":common_spec_env",
":common_spec_util",
":error_spec_srcs",
":node_error_entry_point",
"//packages/zone.js/lib",
],
)
jasmine_node_test( jasmine_node_test(
name = "test_node", name = "test_node",
bootstrap = [ templated_args = ["--node_options=--require=$(rlocation $(location :node_entry_point_es5))"],
"angular/packages/zone.js/test/node_entry_point.js",
],
deps = [ deps = [
":node_entry_point_es5",
":test_node_lib", ":test_node_lib",
], ],
) )
jasmine_node_test( jasmine_node_test(
name = "test_node_no_jasmine_clock", name = "test_node_no_jasmine_clock",
bootstrap = [ templated_args = ["--node_options=--require=$(rlocation $(location :node_entry_point_no_patch_clock_es5))"],
"angular/packages/zone.js/test/node_entry_point_no_patch_clock.js",
],
deps = [ deps = [
":node_entry_point_no_patch_clock_es5",
":test_node_lib", ":test_node_lib",
], ],
) )
jasmine_node_test( jasmine_node_test(
name = "test_node_bluebird", name = "test_node_bluebird",
bootstrap = [ templated_args = ["--node_options=--require=$(rlocation $(location :node_bluebird_entry_point_es5))"],
"angular/packages/zone.js/test/node_bluebird_entry_point.js",
],
deps = [ deps = [
":bluebird_spec", ":bluebird_spec",
":node_bluebird_entry_point_es5",
], ],
) )
jasmine_node_test( jasmine_node_test(
name = "test_node_error_disable_policy", name = "test_node_error_disable_policy",
bootstrap = [ templated_args = ["--node_options=--require=$(rlocation $(location :node_error_disable_policy_entry_point_es5))"],
"angular/packages/zone.js/test/node_error_disable_policy_entry_point.js",
],
deps = [ deps = [
":error_spec", ":node_error_disable_policy_entry_point",
":node_error_disable_policy_entry_point_es5",
], ],
) )
jasmine_node_test( jasmine_node_test(
name = "test_node_error_lazy_policy", name = "test_node_error_lazy_policy",
bootstrap = [ templated_args = ["--node_options=--require=$(rlocation $(location :node_error_lazy_policy_entry_point_es5))"],
"angular/packages/zone.js/test/node_error_lazy_policy_entry_point.js",
],
deps = [ deps = [
":error_spec", ":node_error_lazy_policy_entry_point",
":node_error_lazy_policy_entry_point_es5",
], ],
) )

View File

@ -6,6 +6,15 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
if (process.env['TEST_SRCDIR']) {
// bootstrap the bazel require resolve patch since this
// script is a bootstrap script loaded with --node_options=--require=...
const path = require('path');
require(path.posix.join(
process.env['TEST_SRCDIR'], process.env['TEST_WORKSPACE'],
(process.env['TEST_BINARY'] as string).replace(/\.(sh|bat)$/, '_loader.js'), ));
}
// Must be loaded before zone loads, so that zone can detect WTF. // Must be loaded before zone loads, so that zone can detect WTF.
import './test_fake_polyfill'; import './test_fake_polyfill';

View File

@ -13,6 +13,15 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
if (process.env['TEST_SRCDIR']) {
// bootstrap the bazel require resolve patch since this
// script is a bootstrap script loaded with --node_options=--require=...
const path = require('path');
require(path.posix.join(
process.env['TEST_SRCDIR'], process.env['TEST_WORKSPACE'],
(process.env['TEST_BINARY'] as string).replace(/\.(sh|bat)$/, '_loader.js'), ));
}
// Must be loaded before zone loads, so that zone can detect WTF. // Must be loaded before zone loads, so that zone can detect WTF.
import './node-env-setup'; import './node-env-setup';
import './test_fake_polyfill'; import './test_fake_polyfill';

View File

@ -13,6 +13,15 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
if (process.env['TEST_SRCDIR']) {
// bootstrap the bazel require resolve patch since this
// script is a bootstrap script loaded with --node_options=--require=...
const path = require('path');
require(path.posix.join(
process.env['TEST_SRCDIR'], process.env['TEST_WORKSPACE'],
(process.env['TEST_BINARY'] as string).replace(/\.(sh|bat)$/, '_loader.js'), ));
}
// Must be loaded before zone loads, so that zone can detect WTF. // Must be loaded before zone loads, so that zone can detect WTF.
import './node-env-setup'; import './node-env-setup';
import './test_fake_polyfill'; import './test_fake_polyfill';

View File

@ -6,6 +6,15 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
if (process.env['TEST_SRCDIR']) {
// bootstrap the bazel require resolve patch since this
// script is a bootstrap script loaded with --node_options=--require=...
const path = require('path');
require(path.posix.join(
process.env['TEST_SRCDIR'], process.env['TEST_WORKSPACE'],
(process.env['TEST_BINARY'] as string).replace(/\.(sh|bat)$/, '_loader.js'), ));
}
process.env['errorpolicy'] = (global as any)['__Zone_Error_BlacklistedStackFrames_policy'] = process.env['errorpolicy'] = (global as any)['__Zone_Error_BlacklistedStackFrames_policy'] =
'disable'; 'disable';
import './node_error_entry_point'; import './node_error_entry_point';

View File

@ -6,5 +6,14 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
if (process.env['TEST_SRCDIR']) {
// bootstrap the bazel require resolve patch since this
// script is a bootstrap script loaded with --node_options=--require=...
const path = require('path');
require(path.posix.join(
process.env['TEST_SRCDIR'], process.env['TEST_WORKSPACE'],
(process.env['TEST_BINARY'] as string).replace(/\.(sh|bat)$/, '_loader.js'), ));
}
process.env['errorpolicy'] = (global as any)['__Zone_Error_BlacklistedStackFrames_policy'] = 'lazy'; process.env['errorpolicy'] = (global as any)['__Zone_Error_BlacklistedStackFrames_policy'] = 'lazy';
import './node_error_entry_point'; import './node_error_entry_point';

View File

@ -1,6 +1,6 @@
"""Re-export of some bazel rules with repository-wide defaults.""" """Re-export of some bazel rules with repository-wide defaults."""
load("@build_bazel_rules_nodejs//:index.bzl", _nodejs_binary = "nodejs_binary", _npm_package = "npm_package") load("@build_bazel_rules_nodejs//:index.bzl", _nodejs_binary = "nodejs_binary", _pkg_npm = "pkg_npm")
load("@npm_bazel_jasmine//:index.bzl", _jasmine_node_test = "jasmine_node_test") load("@npm_bazel_jasmine//:index.bzl", _jasmine_node_test = "jasmine_node_test")
load("@npm_bazel_karma//:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite") load("@npm_bazel_karma//:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite")
load("@npm_bazel_typescript//:index.bzl", _ts_devserver = "ts_devserver", _ts_library = "ts_library") load("@npm_bazel_typescript//:index.bzl", _ts_devserver = "ts_devserver", _ts_library = "ts_library")
@ -93,7 +93,7 @@ def ts_devserver(**kwargs):
**kwargs **kwargs
) )
def ts_library(tsconfig = None, testonly = False, deps = [], module_name = None, **kwargs): def ts_library(name, tsconfig = None, testonly = False, deps = [], module_name = None, **kwargs):
"""Default values for ts_library""" """Default values for ts_library"""
deps = deps + ["@npm//tslib"] deps = deps + ["@npm//tslib"]
if testonly: if testonly:
@ -108,6 +108,7 @@ def ts_library(tsconfig = None, testonly = False, deps = [], module_name = None,
module_name = _default_module_name(testonly) module_name = _default_module_name(testonly)
_ts_library( _ts_library(
name = name,
tsconfig = tsconfig, tsconfig = tsconfig,
testonly = testonly, testonly = testonly,
deps = deps, deps = deps,
@ -115,6 +116,17 @@ def ts_library(tsconfig = None, testonly = False, deps = [], module_name = None,
**kwargs **kwargs
) )
# Select the es5 .js output of the ts_library for use in downstream boostrap targets
# with `output_group = "es5_sources"`. This exposes an internal detail of ts_library
# that is not ideal.
# TODO(gregmagolan): clean this up by using tsc() in these cases rather than ts_library
native.filegroup(
name = "%s_es5" % name,
srcs = [":%s" % name],
testonly = testonly,
output_group = "es5_sources",
)
def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps = [], module_name = None, bundle_dts = True, **kwargs): def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps = [], module_name = None, bundle_dts = True, **kwargs):
"""Default values for ng_module""" """Default values for ng_module"""
deps = deps + ["@npm//tslib"] deps = deps + ["@npm//tslib"]

View File

@ -6,6 +6,15 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
if (process.env['TEST_SRCDIR']) {
// bootstrap the bazel require resolve patch since this
// script is a bootstrap script loaded with --node_options=--require=...
const path = require('path');
require(path.posix.join(
process.env['TEST_SRCDIR'], process.env['TEST_WORKSPACE'],
(process.env['TEST_BINARY'] as string).replace(/\.(sh|bat)$/, '_loader.js'), ));
}
import 'zone.js/lib/node/rollup-main'; import 'zone.js/lib/node/rollup-main';
import 'zone.js/lib/zone-spec/long-stack-trace'; import 'zone.js/lib/zone-spec/long-stack-trace';
import 'zone.js/lib/zone-spec/task-tracking'; import 'zone.js/lib/zone-spec/task-tracking';

View File

@ -55,7 +55,10 @@ pkg_npm(
ts_library( ts_library(
name = "test_lib", name = "test_lib",
testonly = True, testonly = True,
srcs = glob(["test/*.ts"]), srcs = glob(
["test/*.ts"],
exclude = ["test/bootstrap.ts"],
),
tsconfig = "//tools:tsconfig-test", tsconfig = "//tools:tsconfig-test",
deps = [ deps = [
":lib", ":lib",
@ -68,18 +71,40 @@ ts_library(
], ],
) )
ts_library(
name = "bootstrap",
testonly = True,
srcs = ["test/bootstrap.ts"],
tsconfig = "//tools:tsconfig-test",
deps = ["@npm//@types/node"],
)
# Select the es5 .js output of the ts_library :boostrap target
# with `output_group = "es5_sources"` for use in the jasmine_node_test
# below. This exposes an internal detail of ts_library that is not ideal.
# TODO(gregmagolan): clean this up by using tsc() in this case rather than ts_library
filegroup(
name = "bootstrap_es5",
testonly = True,
srcs = [":bootstrap"],
output_group = "es5_sources",
)
jasmine_node_test( jasmine_node_test(
name = "tests", name = "tests",
srcs = [":test_lib"], srcs = [
bootstrap = ["angular/tools/ts-api-guardian/test/bootstrap.js"], ":test_lib",
],
data = glob([ data = glob([
"test/fixtures/*.ts", "test/fixtures/*.ts",
"test/fixtures/*.patch", "test/fixtures/*.patch",
]) + [ ]) + [
":bootstrap_es5",
":ts-api-guardian", ":ts-api-guardian",
# TODO: remove this once the boostrap.js workaround has been removed. # TODO: remove this once the boostrap.js workaround has been removed.
":package.json", ":package.json",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location :bootstrap_es5))"],
) )
# END-INTERNAL # END-INTERNAL