Files
angular__angular/packages/bazel/test/ng_package/BUILD.bazel
Paul Gschwendtner f8a1ea0c11 fix(bazel): do not error if files part of srcs are outside of package (#45622)
We recently refactored how the ng package rule deals with static files.
As part of this refactoring, transitive files outside of the current
Bazel package were flagged as errors, while previously this was just
ignored. We need to revert back this behavior (even though code remains
much simpler and predicable now) since sass library targets for example
reference all transtive files in the default info and break packages then

PR Close #45622
2022-04-14 14:58:27 -07:00

105 lines
2.6 KiB
Python

load("//tools:defaults.bzl", "jasmine_node_test", "nodejs_binary", "ts_library")
exports_files([
"package.json",
"outside_package.txt",
])
# The tests in this package must run in separate targets, since they change
# working directory and therefore have mutable global state that causes test
# isolation failures.
ts_library(
name = "test_utils_lib",
testonly = True,
srcs = ["test_utils.ts"],
deps = [
"//packages:types",
],
)
ts_library(
name = "core_spec_lib",
testonly = True,
srcs = ["core_package.spec.ts"],
deps = [
":test_utils_lib",
"//packages:types",
"@npm//@bazel/runfiles",
"@npm//@types/shelljs",
],
)
jasmine_node_test(
name = "core_package",
srcs = [":core_spec_lib"],
data = [
"//packages/core:npm_package",
"@npm//@types/shelljs",
"@npm//shelljs",
],
)
ts_library(
name = "common_spec_lib",
testonly = True,
srcs = ["common_package.spec.ts"],
deps = [
":test_utils_lib",
"//packages:types",
"@npm//@bazel/runfiles",
"@npm//@types/shelljs",
],
)
jasmine_node_test(
name = "common_package",
srcs = [":common_spec_lib"],
data = [
"//packages/common:npm_package",
"@npm//shelljs",
],
)
ts_library(
name = "example_spec_lib",
testonly = True,
srcs = ["example_package.spec.ts"],
deps = [
"//packages:types",
"@npm//@bazel/runfiles",
"@npm//@types/diff",
],
)
jasmine_node_test(
name = "example_package",
srcs = [":example_spec_lib"],
data = [
"example_package.golden",
"example_with_ts_library_package.golden",
"//packages/bazel/test/ng_package/example:npm_package",
"//packages/bazel/test/ng_package/example-with-ts-library:npm_package",
],
# We don't want to run the example_package golden test with Ivy yet. Currently the golden
# file is based on non-ivy output and therefore won't work for ngc and Ivy at the same time.
# TODO: Update test to rely on Ivy partial compilation after View Engine's removal, update the
# golden files as appropriate for the change in compilation.
deps = ["@npm//diff"],
)
nodejs_binary(
name = "example_package.accept",
testonly = True,
data = [
"example_package.golden",
"example_with_ts_library_package.golden",
":example_spec_lib",
"//packages/bazel/test/ng_package/example:npm_package",
"//packages/bazel/test/ng_package/example-with-ts-library:npm_package",
"@npm//diff",
],
entry_point = ":example_package.spec.ts",
templated_args = ["--accept"],
)