Skip to content

Commit b43a09a

Browse files
oharboeclaude
andcommitted
bazel: use variables to reduce repetition in js_test BUILD targets
Define JS_FILES and DOM_TEST_DATA variables to avoid repeating the same data and no_copy_to_bin lists across all js_test targets. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent 28f4a3a commit b43a09a

1 file changed

Lines changed: 27 additions & 32 deletions

File tree

src/web/test/BUILD

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,86 +36,81 @@ filegroup(
3636
data = [":test_resources"],
3737
) for test_name in TESTS]
3838

39+
JS_FILES = ["//src/web:js_files"]
40+
41+
DOM_TEST_DATA = [
42+
"js/setup-dom.js",
43+
":node_modules/jsdom",
44+
] + JS_FILES
45+
3946
js_test(
4047
name = "coordinates_test",
41-
data = ["//src/web:js_files"],
48+
data = JS_FILES,
4249
entry_point = "js/test-coordinates.js",
43-
no_copy_to_bin = ["//src/web:js_files"],
50+
no_copy_to_bin = JS_FILES,
4451
)
4552

4653
js_test(
4754
name = "vis_tree_test",
48-
data = [
49-
"js/setup-dom.js",
50-
":node_modules/jsdom",
51-
"//src/web:js_files",
52-
],
55+
data = DOM_TEST_DATA,
5356
entry_point = "js/test-vis-tree.js",
54-
no_copy_to_bin = ["//src/web:js_files"],
57+
no_copy_to_bin = JS_FILES,
5558
)
5659

5760
js_test(
5861
name = "websocket_manager_test",
59-
data = ["//src/web:js_files"],
62+
data = JS_FILES,
6063
entry_point = "js/test-websocket-manager.js",
61-
no_copy_to_bin = ["//src/web:js_files"],
64+
no_copy_to_bin = JS_FILES,
6265
)
6366

6467
js_test(
6568
name = "checkbox_tree_model_test",
66-
data = ["//src/web:js_files"],
69+
data = JS_FILES,
6770
entry_point = "js/test-checkbox-tree-model.js",
68-
no_copy_to_bin = ["//src/web:js_files"],
71+
no_copy_to_bin = JS_FILES,
6972
)
7073

7174
js_test(
7275
name = "display_controls_test",
73-
data = ["//src/web:js_files"],
76+
data = JS_FILES,
7477
entry_point = "js/test-display-controls.js",
75-
no_copy_to_bin = ["//src/web:js_files"],
78+
no_copy_to_bin = JS_FILES,
7679
)
7780

7881
js_test(
7982
name = "clock_tree_widget_test",
80-
data = ["//src/web:js_files"],
83+
data = JS_FILES,
8184
entry_point = "js/test-clock-tree-widget.js",
82-
no_copy_to_bin = ["//src/web:js_files"],
85+
no_copy_to_bin = JS_FILES,
8386
)
8487

8588
js_test(
8689
name = "charts_widget_test",
87-
data = ["//src/web:js_files"],
90+
data = JS_FILES,
8891
entry_point = "js/test-charts-widget.js",
89-
no_copy_to_bin = ["//src/web:js_files"],
92+
no_copy_to_bin = JS_FILES,
9093
)
9194

9295
js_test(
9396
name = "inspector_test",
94-
data = [
95-
"js/setup-dom.js",
96-
":node_modules/jsdom",
97-
"//src/web:js_files",
98-
],
97+
data = DOM_TEST_DATA,
9998
entry_point = "js/test-inspector.js",
100-
no_copy_to_bin = ["//src/web:js_files"],
99+
no_copy_to_bin = JS_FILES,
101100
)
102101

103102
js_test(
104103
name = "ruler_test",
105-
data = ["//src/web:js_files"],
104+
data = JS_FILES,
106105
entry_point = "js/test-ruler.js",
107-
no_copy_to_bin = ["//src/web:js_files"],
106+
no_copy_to_bin = JS_FILES,
108107
)
109108

110109
js_test(
111110
name = "tcl_completer_test",
112-
data = [
113-
"js/setup-dom.js",
114-
":node_modules/jsdom",
115-
"//src/web:js_files",
116-
],
111+
data = DOM_TEST_DATA,
117112
entry_point = "js/test-tcl-completer.js",
118-
no_copy_to_bin = ["//src/web:js_files"],
113+
no_copy_to_bin = JS_FILES,
119114
)
120115

121116
cc_test(

0 commit comments

Comments
 (0)