load("@npm//:defs.bzl", "npm_link_all_packages")
load("//tools:defaults.bzl", "jasmine_test", "ts_project")

package(default_visibility = ["//visibility:public"])

npm_link_all_packages()

ts_project(
    name = "builder",
    testonly = True,
    srcs = glob(
        include = [
            "src/**/*.ts",
        ],
        exclude = [
            "src/**/*_spec.ts",
        ],
    ),
    data = [
        # Needed at runtime by some builder tests relying on SSR being
        # resolvable in the test project.
        ":node_modules/@angular/ssr",
    ] + glob(["projects/**/*"]),
    deps = [
        ":node_modules/@angular-devkit/architect",
        ":node_modules/@angular-devkit/core",
        "//:node_modules/@types/node",
        "//:node_modules/rxjs",
    ],
)

ts_project(
    name = "unit_test_lib",
    testonly = True,
    srcs = glob(
        include = [
            "src/**/*_spec.ts",
        ],
    ),
    deps = [
        ":builder",
        ":node_modules/@angular-devkit/architect",
    ],
)

jasmine_test(
    name = "unit_test",
    data = [":unit_test_lib"],
)
