angular/integration/ng-modules-importability/index.bzl
Paul Gschwendtner a4f144a366 test: ng-modules-importability test should import every module in isolation (#60503)
This will make the test even more useful, as it ensures that we aren't
accidentally relying on the compiler potentially discovering best
guessed modules from other imports that previously were part of the same
file (importing all modules as part of the test).

PR Close #60503
2025-03-21 14:36:27 -07:00

24 lines
872 B
Python

load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("//tools:defaults.bzl", "nodejs_test")
def module_test(name, npm_packages, skipped_entry_points = [], additional_deps = [], **kwargs):
write_file(
name = "%s_config" % name,
out = "%s_config.json" % name,
content = [json.encode({
"packages": [pkg[1] for pkg in npm_packages.items()],
"skipEntryPoints": skipped_entry_points,
})],
)
nodejs_test(
name = "test",
data = [
":%s_config" % name,
"//integration/ng-modules-importability:test_lib",
] + additional_deps + [pkg[0] for pkg in npm_packages.items()],
entry_point = "//integration/ng-modules-importability:index.ts",
enable_linker = True,
templated_args = ["$(rootpath :%s_config)" % name],
**kwargs
)