Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions tools/defaults.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", _copy_to_bin = "copy_to_bin")
load("@aspect_rules_jasmine//jasmine:defs.bzl", _jasmine_test = "jasmine_test")
load("@aspect_rules_js//js:defs.bzl", _js_binary = "js_binary")
load("@devinfra//bazel/jasmine:jasmine.bzl", _jasmine_test = "jasmine_test")
load("@devinfra//bazel/ts_project:index.bzl", "strict_deps_test")
load("@rules_angular//src/ng_package:index.bzl", _ng_package = "ng_package")
load("@rules_angular//src/ts_project:index.bzl", _ts_project = "ts_project")
Expand Down Expand Up @@ -59,15 +59,21 @@ def ng_package(deps = [], extra_substitutions = {}, **kwargs):
**kwargs
)

def jasmine_test(args = [], tsconfig = "//:test-tsconfig", **kwargs):
def jasmine_test(data = [], args = [], **kwargs):
# Create relative path to root, from current package dir. Necessary as
# we change the `chdir` below to the package directory.
relative_to_root = "/".join([".."] * len(native.package_name().split("/")))

_jasmine_test(
node_modules = "//:node_modules",
tsconfig = tsconfig,
chdir = native.package_name(),
args = [
"--require=%s/node_modules/source-map-support/register.js" % relative_to_root,
# Escape so that the `js_binary` launcher triggers Bash expansion.
"'**/*+(.|_)spec.js'",
"'**/*+(.|_)spec.mjs'",
"'**/*+(.|_)spec.cjs'",
] + args,
data = data + ["//:node_modules/source-map-support"],
**kwargs
)