From 30bc86c1dbca6ecda455a659fa68b75736e0b3e1 Mon Sep 17 00:00:00 2001 From: Long Ho Date: Mon, 17 May 2021 11:43:18 -0700 Subject: [PATCH] fix: make generated_file_test `.update`'s visibility same as test rule (#2677) --- internal/generated_file_test/generated_file_test.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/generated_file_test/generated_file_test.bzl b/internal/generated_file_test/generated_file_test.bzl index a16a1799ff..d0d63e7620 100644 --- a/internal/generated_file_test/generated_file_test.bzl +++ b/internal/generated_file_test/generated_file_test.bzl @@ -2,7 +2,7 @@ load("@build_bazel_rules_nodejs//internal/node:node.bzl", "nodejs_binary", "nodejs_test") -def generated_file_test(name, generated, src, substring_search = False, src_dbg = None, **kwargs): +def generated_file_test(name, generated, src, substring_search = False, src_dbg = None, visibility = None, **kwargs): """Tests that a file generated by Bazel has identical content to a file in the workspace. This is useful for testing, where a "snapshot" or "golden" file is checked in, @@ -16,6 +16,7 @@ def generated_file_test(name, generated, src, substring_search = False, src_dbg anywhere within the generated file. Note that the .update rule is not generated in substring mode. src_dbg: if the build uses `--compilation_mode dbg` then some rules will produce different output. In this case you can specify what the dbg version of the output should look like + visibility: visibility for both test target & update target **kwargs: extra arguments passed to the underlying nodejs_test """ data = [src, generated] @@ -36,6 +37,7 @@ def generated_file_test(name, generated, src, substring_search = False, src_dbg loc % generated, ], data = data, + visibility = visibility, **kwargs ) @@ -46,4 +48,5 @@ def generated_file_test(name, generated, src, substring_search = False, src_dbg entry_point = "@build_bazel_rules_nodejs//internal/generated_file_test:bundle.js", templated_args = ["--out", loc % src, loc % src_dbg, loc % generated], data = data, + visibility = visibility, )