Skip to content
Open
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
6 changes: 4 additions & 2 deletions js/private/js_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,10 @@ def _js_binary_impl(ctx):

providers = []

if ctx.attr.testonly and ctx.configuration.coverage_enabled:
if ctx.attr.testonly and ctx.configuration.coverage_enabled and hasattr(ctx.attr, "_is_test"):
# We have to instruct rule implementers to have this attribute present.
if not hasattr(ctx.attr, "_lcov_merger"):
fail("_lcov_merger attribute is missing and coverage was requested")

# We have to propagate _lcov_merger runfiles since bazel does not treat _lcov_merger as a proper tool.
# See: https://github.com/bazelbuild/bazel/issues/4033
runfiles = runfiles.merge(ctx.attr._lcov_merger[DefaultInfo].default_runfiles)
Expand Down Expand Up @@ -641,6 +640,9 @@ the contract between Bazel and a test runner.""",
default = Label("//js/private/coverage:merger"),
cfg = "exec",
),
"_is_test": attr.bool(
default = True
)
}),
test = True,
toolchains = js_binary_lib.toolchains,
Expand Down