angular/packages/compiler-cli/test/BUILD.bazel
Paul Gschwendtner c9415e4d75 build: ensure bootstrap transitive runfiles are made available (#48521)
Since we generate a `.mjs` file as entry-point for jasmine tests,
a couple of issues prevented the transitive dependencies from
bootstrap targets to be brought in (causing resolution errors):

1. The `_files` (previously `_esm2015`) targets are no longer needed,
   and they also miss all the information on runfiles.
2. The aspect for computing linker mappings does not respect the
   `bootstrap` attribute from the `spec_entrypoint` so we manually
   add the extract ESM output targets (this rule works with the aspect
   and forwards linker mappings).

PR Close #48521
2022-12-19 19:50:41 +00:00

167 lines
3.4 KiB
Text

load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")
# Uses separate test rules to allow the tests to run in parallel
ts_library(
name = "test_utils",
testonly = True,
srcs = [
"mocks.ts",
"test_support.ts",
],
visibility = [
":__subpackages__",
"//packages/language-service/test:__subpackages__",
],
deps = [
"//packages:types",
"//packages/compiler",
"//packages/compiler-cli",
"//packages/compiler-cli/src/ngtsc/file_system",
"//packages/compiler-cli/src/ngtsc/testing",
"@npm//typescript",
],
)
# extract_18n_spec
ts_library(
name = "extract_i18n_lib",
testonly = True,
srcs = [
"extract_i18n_spec.ts",
],
deps = [
":test_utils",
"//packages/compiler",
"//packages/compiler-cli",
"@npm//typescript",
],
)
jasmine_node_test(
name = "extract_i18n",
bootstrap = ["//tools/testing:node"],
data = [
"//packages/core:npm_package",
],
deps = [
":extract_i18n_lib",
"//packages/common:npm_package",
"//packages/core",
"@npm//yargs",
],
)
ts_library(
name = "downlevel_decorator_transform_lib",
testonly = True,
srcs = [
"downlevel_decorators_transform_spec.ts",
],
deps = [
":test_utils",
"//packages/compiler-cli/src/ngtsc/reflection",
"//packages/compiler-cli/src/transformers/downlevel_decorators_transform",
"@npm//typescript",
],
)
jasmine_node_test(
name = "downlevel_decorator_transform",
bootstrap = ["//tools/testing:node"],
deps = [
":downlevel_decorator_transform_lib",
],
)
# perform_watch_spec
ts_library(
name = "perform_watch_lib",
testonly = True,
srcs = [
"perform_watch_spec.ts",
],
deps = [
":test_utils",
"//packages/compiler",
"//packages/compiler-cli",
"//packages/private/testing",
"@npm//typescript",
],
)
jasmine_node_test(
name = "perform_watch",
bootstrap = ["//tools/testing:node"],
data = [
"//packages/core:npm_package",
],
deps = [
":perform_watch_lib",
"//packages/core",
],
)
# perform_compile_spec
ts_library(
name = "perform_compile_lib",
testonly = True,
srcs = [
"perform_compile_spec.ts",
],
deps = [
":test_utils",
"//packages/compiler",
"//packages/compiler-cli",
"@npm//typescript",
],
)
jasmine_node_test(
name = "perform_compile",
bootstrap = ["//tools/testing:node"],
data = [
"//packages/core:npm_package",
],
deps = [
":perform_compile_lib",
"//packages/core",
],
)
ts_library(
name = "typescript_support_lib",
testonly = True,
srcs = [
"typescript_support_spec.ts",
],
deps = [
"//packages/compiler-cli",
],
)
jasmine_node_test(
name = "typescript_support",
bootstrap = ["//tools/testing:node"],
deps = [
":typescript_support_lib",
],
)
# version_helpers_spec
ts_library(
name = "version_helpers_lib",
testonly = True,
srcs = ["version_helpers_spec.ts"],
deps = [
"//packages/compiler-cli",
],
)
jasmine_node_test(
name = "version_helpers",
bootstrap = ["//tools/testing:node"],
deps = [
":version_helpers_lib",
],
)