angular/packages/compiler-cli/test/BUILD.bazel
Kristiyan Kostadinov f5c566c079 fix(compiler-cli): identify aliased initializer functions (#54609)
Fixes that initializer functions weren't being recognized if they are aliased (e.g. `import {model as alias} from '@angular/core';`).

To do this efficiently, I had to introduce the `ImportedSymbolsTracker` which scans the top-level imports of a file and allows them to be checked quickly, without having to go through the type checker. It will be useful in the future when verifying that that initializer APIs aren't used in unexpected places.

I've also introduced tests specifically for the `tryParseInitializerApiMember` function so that we can test it in isolation instead of going through the various functions that call into it.

PR Close #54609
2024-02-26 18:27:15 -08:00

171 lines
3.5 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 = "jit_transforms_test_lib",
testonly = True,
srcs = [
"downlevel_decorators_transform_spec.ts",
"initializer_api_transforms_spec.ts",
"signal_queries_metadata_transform_spec.ts",
],
deps = [
":test_utils",
"//packages/compiler-cli/src/ngtsc/imports",
"//packages/compiler-cli/src/ngtsc/partial_evaluator",
"//packages/compiler-cli/src/ngtsc/reflection",
"//packages/compiler-cli/src/transformers/jit_transforms",
"@npm//typescript",
],
)
jasmine_node_test(
name = "jit_transforms_test",
bootstrap = ["//tools/testing:node"],
deps = [
":jit_transforms_test_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",
],
)