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(
name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [
":test_lib",
"//tools/testing:node",
"//tools/testing:node_es5",
],
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -33,13 +33,13 @@ ts_library(
jasmine_node_test(
name = "test",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"],
data = [
"//packages/compiler-cli/test/ngtsc/fake_core:npm_package",
],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)
@ -64,7 +64,6 @@ ts_library(
jasmine_node_test(
name = "integration",
timeout = "long",
bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"],
data = [
"//packages/common: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.
"no-ivy-aot",
],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_no_angular_es5))"],
deps = [
":integration_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
"@npm//canonical-path",
"@npm//convert-source-map",
],

View File

@ -29,9 +29,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

@ -21,9 +21,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

@ -19,9 +19,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

@ -18,9 +18,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

@ -22,9 +22,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

@ -23,9 +23,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

@ -24,9 +24,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

@ -20,9 +20,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

@ -24,9 +24,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

@ -17,9 +17,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

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

View File

@ -24,9 +24,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

@ -20,9 +20,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -70,7 +70,6 @@ ts_library(
jasmine_node_test(
name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
data = [
"//packages/animations: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.
"no-ivy-aot",
],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [
":test_lib",
":test_node_only_lib",
"//tools/testing:node",
"//tools/testing:node_es5",
"@npm//base64-js",
"@npm//source-map",
],

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,6 +6,15 @@
* 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
import 'zone.js/lib/node/rollup-main';
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(
name = "view",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
tags = [
"no-ivy-aot",
],
templated_args = ["--node_options=--require=$(rlocation $(location //tools/testing:node_es5))"],
deps = [
":view_lib",
":view_node_only_lib",
"//tools/testing:node",
"//tools/testing:node_es5",
],
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,11 +14,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

@ -22,12 +22,10 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
"@npm//glob",
],
)

View File

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

View File

@ -14,11 +14,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

@ -16,11 +16,9 @@ ts_library(
jasmine_node_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 = [
":test_lib",
"//tools/testing:node_no_angular",
"//tools/testing:node_no_angular_es5",
],
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -68,8 +68,6 @@ ts_library(
testonly = True,
srcs = glob(["node/*.ts"]) + [
"node-env-setup.ts",
"node_entry_point.ts",
"node_entry_point_no_patch_clock.ts",
"test-env-setup-jasmine-no-patch-clock.ts",
],
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(
name = "bluebird_spec",
testonly = True,
srcs = [
"extra/bluebird.spec.ts",
"node_bluebird_entry_point.ts",
],
deps = [
":common_spec_env",
@ -100,13 +131,33 @@ ts_library(
)
ts_library(
name = "error_spec",
name = "node_bluebird_entry_point",
testonly = True,
srcs = [
"node_error_disable_policy_entry_point.ts",
"node_error_entry_point.ts",
"node_error_lazy_policy_entry_point.ts",
srcs = ["node_bluebird_entry_point.ts"],
deps = [
":common_spec_env",
"//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 = [
":common_spec_env",
":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(
name = "test_node",
bootstrap = [
"angular/packages/zone.js/test/node_entry_point.js",
],
templated_args = ["--node_options=--require=$(rlocation $(location :node_entry_point_es5))"],
deps = [
":node_entry_point_es5",
":test_node_lib",
],
)
jasmine_node_test(
name = "test_node_no_jasmine_clock",
bootstrap = [
"angular/packages/zone.js/test/node_entry_point_no_patch_clock.js",
],
templated_args = ["--node_options=--require=$(rlocation $(location :node_entry_point_no_patch_clock_es5))"],
deps = [
":node_entry_point_no_patch_clock_es5",
":test_node_lib",
],
)
jasmine_node_test(
name = "test_node_bluebird",
bootstrap = [
"angular/packages/zone.js/test/node_bluebird_entry_point.js",
],
templated_args = ["--node_options=--require=$(rlocation $(location :node_bluebird_entry_point_es5))"],
deps = [
":bluebird_spec",
":node_bluebird_entry_point_es5",
],
)
jasmine_node_test(
name = "test_node_error_disable_policy",
bootstrap = [
"angular/packages/zone.js/test/node_error_disable_policy_entry_point.js",
],
templated_args = ["--node_options=--require=$(rlocation $(location :node_error_disable_policy_entry_point_es5))"],
deps = [
":error_spec",
":node_error_disable_policy_entry_point",
":node_error_disable_policy_entry_point_es5",
],
)
jasmine_node_test(
name = "test_node_error_lazy_policy",
bootstrap = [
"angular/packages/zone.js/test/node_error_lazy_policy_entry_point.js",
],
templated_args = ["--node_options=--require=$(rlocation $(location :node_error_lazy_policy_entry_point_es5))"],
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
*/
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.
import './test_fake_polyfill';

View File

@ -13,6 +13,15 @@
* 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.
import './node-env-setup';
import './test_fake_polyfill';

View File

@ -13,6 +13,15 @@
* 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.
import './node-env-setup';
import './test_fake_polyfill';

View File

@ -6,6 +6,15 @@
* 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'] =
'disable';
import './node_error_entry_point';

View File

@ -6,5 +6,14 @@
* 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';
import './node_error_entry_point';

View File

@ -1,6 +1,6 @@
"""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_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")
@ -93,7 +93,7 @@ def ts_devserver(**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"""
deps = deps + ["@npm//tslib"]
if testonly:
@ -108,6 +108,7 @@ def ts_library(tsconfig = None, testonly = False, deps = [], module_name = None,
module_name = _default_module_name(testonly)
_ts_library(
name = name,
tsconfig = tsconfig,
testonly = testonly,
deps = deps,
@ -115,6 +116,17 @@ def ts_library(tsconfig = None, testonly = False, deps = [], module_name = None,
**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):
"""Default values for ng_module"""
deps = deps + ["@npm//tslib"]

View File

@ -6,6 +6,15 @@
* 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/zone-spec/long-stack-trace';
import 'zone.js/lib/zone-spec/task-tracking';

View File

@ -55,7 +55,10 @@ pkg_npm(
ts_library(
name = "test_lib",
testonly = True,
srcs = glob(["test/*.ts"]),
srcs = glob(
["test/*.ts"],
exclude = ["test/bootstrap.ts"],
),
tsconfig = "//tools:tsconfig-test",
deps = [
":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(
name = "tests",
srcs = [":test_lib"],
bootstrap = ["angular/tools/ts-api-guardian/test/bootstrap.js"],
srcs = [
":test_lib",
],
data = glob([
"test/fixtures/*.ts",
"test/fixtures/*.patch",
]) + [
":bootstrap_es5",
":ts-api-guardian",
# TODO: remove this once the boostrap.js workaround has been removed.
":package.json",
],
templated_args = ["--node_options=--require=$(rlocation $(location :bootstrap_es5))"],
)
# END-INTERNAL