| # Copyright 2018 The Bazel Authors. All rights reserved. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "npm_package") |
| load("@build_bazel_rules_typescript//:version.bzl", "COMPAT_VERSION") |
| load("@build_bazel_rules_typescript//internal:defaults.bzl", "ts_library") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| # Exports to be consumed for generating skydoc. |
| exports_files([ |
| "karma_web_test.bzl", |
| "ts_web_test.bzl", |
| "web_test.bzl", |
| ]) |
| |
| ts_library( |
| name = "bazel_karma", |
| srcs = glob(["*.ts"]), |
| module_name = "@bazel/karma", |
| tsconfig = ":tsconfig.json", |
| deps = [ |
| "@npm//@types/node", |
| "@npm//tmp", |
| ], |
| ) |
| |
| nodejs_binary( |
| name = "karma_bin", |
| data = [ |
| ":bazel_karma", |
| "@npm//jasmine-core", |
| "@npm//karma", |
| "@npm//karma-chrome-launcher", |
| "@npm//karma-firefox-launcher", |
| "@npm//karma-jasmine", |
| "@npm//karma-requirejs", |
| "@npm//karma-sauce-launcher", |
| "@npm//karma-sourcemap-loader", |
| "@npm//requirejs", |
| "@npm//tmp", |
| ], |
| entry_point = "karma/bin/karma", |
| install_source_map_support = False, |
| ) |
| |
| genrule( |
| name = "license_copy", |
| srcs = ["@build_bazel_rules_typescript//:LICENSE"], |
| outs = ["LICENSE"], |
| cmd = "cp $< $@", |
| ) |
| |
| npm_package( |
| name = "npm_package", |
| srcs = [ |
| "BUILD.bazel", |
| "WORKSPACE", |
| "defaults.bzl", |
| "defs.bzl", |
| "karma.conf.js", |
| "karma.js", |
| "karma_web_test.bzl", |
| "package.bzl", |
| "package.json", |
| "ts_web_test.bzl", |
| "web_test.bzl", |
| ], |
| replacements = { |
| "0.0.0-COMPAT_VERSION": COMPAT_VERSION, |
| }, |
| deps = [ |
| ":bazel_karma", |
| ":license_copy", |
| ], |
| ) |
| |
| exports_files(["karma.conf.js"]) |