# Description: CSP Checks for CSP Evaluator.

load("//javascript/typescript:build_defs.bzl", "ts_development_sources", "ts_library")
load("//testing/karma/builddefs:karma_web_test_suite.bzl", "karma_web_test_suite")
load("//testing/web/build_defs:web.bzl", "custom_browser")

licenses(["notice"])

package_group(
    name = "csp_evaluator",
    packages = [
        "//javascript/security/csp/csp_evaluator/...",
        "//third_party/csp_evaluator/...",
    ],
)

package(default_visibility = [":csp_evaluator"])

ts_library(
    name = "lighthouse_checks",
    srcs = [
        "lighthouse_checks.ts",
    ],
    deps = [
        "//third_party/csp_evaluator:csp",
        "//third_party/csp_evaluator:finding",
        "//third_party/csp_evaluator/checks:checker",
        "//third_party/csp_evaluator/checks:parser_checks",
        "//third_party/csp_evaluator/checks:security_checks",
        "//third_party/csp_evaluator/checks:strictcsp_checks",
    ],
)

ts_library(
    name = "lighthouse_test_lib",
    testonly = True,
    srcs = ["lighthouse_checks_test.ts"],
    deps = [
        ":lighthouse_checks",
        "//third_party/csp_evaluator:csp",
        "//third_party/csp_evaluator:finding",
        "//third_party/csp_evaluator:parser",
        "//third_party/javascript/typings/jasmine",
    ],
)

ts_development_sources(
    name = "lighthouse_dev",
    testonly = True,
    deps = [
        ":lighthouse_test_lib",
    ],
)

custom_browser(
    name = "safari-iphone-stable",
    browser = "//testing/web/browsers/mobile/v12_0:safari-iphone",
)

karma_web_test_suite(
    name = "lighthouse_tests",
    browsers = [
        ":safari-iphone-stable",
        "//testing/web/browsers:chrome-linux",
        "//testing/web/browsers:chrome-win7",
        "//testing/web/browsers/v63_0:firefox-linux",
        "//testing/web/browsers/v90_0:firefox-win7",
    ],
    manifest = ":lighthouse_dev",
)
