|
1 | 1 | load("@aspect_bazel_lib//lib:copy_to_bin.bzl", _copy_to_bin = "copy_to_bin") |
| 2 | +load("@aspect_rules_jasmine//jasmine:defs.bzl", _jasmine_test = "jasmine_test") |
2 | 3 | load("@aspect_rules_js//js:defs.bzl", _js_binary = "js_binary") |
3 | | -load("@devinfra//bazel/jasmine:jasmine.bzl", _jasmine_test = "jasmine_test") |
4 | 4 | load("@devinfra//bazel/ts_project:index.bzl", "strict_deps_test") |
5 | 5 | load("@rules_angular//src/ng_package:index.bzl", _ng_package = "ng_package") |
6 | 6 | load("@rules_angular//src/ts_project:index.bzl", _ts_project = "ts_project") |
@@ -59,15 +59,21 @@ def ng_package(deps = [], extra_substitutions = {}, **kwargs): |
59 | 59 | **kwargs |
60 | 60 | ) |
61 | 61 |
|
62 | | -def jasmine_test(args = [], tsconfig = "//:test-tsconfig", **kwargs): |
| 62 | +def jasmine_test(data = [], args = [], **kwargs): |
| 63 | + # Create relative path to root, from current package dir. Necessary as |
| 64 | + # we change the `chdir` below to the package directory. |
| 65 | + relative_to_root = "/".join([".."] * len(native.package_name().split("/"))) |
| 66 | + |
63 | 67 | _jasmine_test( |
64 | 68 | node_modules = "//:node_modules", |
65 | | - tsconfig = tsconfig, |
66 | 69 | chdir = native.package_name(), |
67 | 70 | args = [ |
| 71 | + "--require=%s/node_modules/source-map-support/register.js" % relative_to_root, |
| 72 | + # Escape so that the `js_binary` launcher triggers Bash expansion. |
68 | 73 | "'**/*+(.|_)spec.js'", |
69 | 74 | "'**/*+(.|_)spec.mjs'", |
70 | 75 | "'**/*+(.|_)spec.cjs'", |
71 | 76 | ] + args, |
| 77 | + data = data + ["//:node_modules/source-map-support"], |
72 | 78 | **kwargs |
73 | 79 | ) |
0 commit comments