Skip to content

Commit b0864f0

Browse files
authored
fix testonly with js_binary
the current logic is wrong because it tries to test `js_binary` when `testonly` is passed. We actually want the inverse which is we don't want to run js_binary as a test if it is marked as test_only
1 parent 6aa86cf commit b0864f0

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

js/private/js_binary.bzl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -559,11 +559,8 @@ def _js_binary_impl(ctx):
559559

560560
providers = []
561561

562-
if ctx.attr.testonly and ctx.configuration.coverage_enabled:
563-
# We have to instruct rule implementers to have this attribute present.
564-
if not hasattr(ctx.attr, "_lcov_merger"):
565-
fail("_lcov_merger attribute is missing and coverage was requested")
566-
562+
# We have to instruct test rule implementers to have this attribute present.
563+
if ctx.attr.testonly and ctx.configuration.coverage_enabled and hasattr(ctx.attr, "_lcov_merger"):
567564
# We have to propagate _lcov_merger runfiles since bazel does not treat _lcov_merger as a proper tool.
568565
# See: https://github.com/bazelbuild/bazel/issues/4033
569566
runfiles = runfiles.merge(ctx.attr._lcov_merger[DefaultInfo].default_runfiles)

0 commit comments

Comments
 (0)