| load("@build_bazel_rules_nodejs//:index.bzl", "js_library") |
| load("@npm//@bazel/concatjs:index.bzl", "karma_web_test_suite") |
| load("@npm//@bazel/typescript:index.bzl", "ts_project") |
| |
| ts_project( |
| name = "compile", |
| srcs = ["decrement.ts"], |
| extends = "tsconfig.json", |
| tsconfig = { |
| "compilerOptions": { |
| "declaration": True, |
| }, |
| }, |
| ) |
| |
| js_library( |
| name = "lib", |
| package_name = "decrement-lib", |
| named_module_srcs = [":compile"], |
| deps = [":compile"], |
| ) |
| |
| ts_project( |
| name = "compile_tests", |
| testonly = 1, |
| srcs = glob(["*.spec.ts"]), |
| extends = "tsconfig.json", |
| tsconfig = { |
| "compilerOptions": { |
| "types": [ |
| "jasmine", |
| "node", |
| ], |
| }, |
| }, |
| deps = [ |
| ":lib", |
| "@npm//@types/jasmine", |
| "@npm//@types/node", |
| ], |
| ) |
| |
| js_library( |
| name = "tests", |
| testonly = 1, |
| named_module_srcs = [":compile_tests"], |
| deps = ["lib"], |
| ) |
| |
| ts_project( |
| name = "compile_tests_setup", |
| testonly = 1, |
| srcs = ["setup_script.ts"], |
| extends = "tsconfig.json", |
| tsconfig = {}, |
| deps = [ |
| "@npm//@types/jasmine", |
| "@npm//@types/node", |
| ], |
| ) |
| |
| js_library( |
| name = "tests_setup", |
| testonly = 1, |
| named_module_srcs = [":compile_tests_setup"], |
| ) |
| |
| karma_web_test_suite( |
| name = "config_test", |
| browsers = [ |
| "@io_bazel_rules_webtesting//browsers:chromium-local", |
| "@io_bazel_rules_webtesting//browsers:firefox-local", |
| ], |
| config_file = ":karma.conf.js", |
| static_files = [ |
| "static_script.js", |
| ], |
| tags = ["native"], |
| runtime_deps = [ |
| ":tests_setup", |
| ], |
| deps = [ |
| ":tests", |
| "@npm//karma-json-result-reporter", |
| ], |
| ) |
| |
| karma_web_test_suite( |
| name = "no_config_test", |
| browsers = [ |
| "@io_bazel_rules_webtesting//browsers:chromium-local", |
| "@io_bazel_rules_webtesting//browsers:firefox-local", |
| ], |
| static_files = [ |
| "static_script.js", |
| ], |
| tags = ["native"], |
| runtime_deps = [ |
| ":tests_setup", |
| ], |
| deps = [ |
| ":tests", |
| ], |
| ) |
| |
| # Just a dummy test so that we have a test target for //... on certain bazelci platforms with bazel_integration_test |
| sh_test( |
| name = "dummy_test", |
| srcs = ["dummy_test.sh"], |
| ) |