Is the underlying "_jest_test" function a macro that inspects the arguments? If not, you should be able to use a select here.
Define a bool_flag() in a BUILD file and set it in your --config=ci config. Then you'll want to patch the jest_test that you linked to look something like this:
templated_args = [
"--no-cache",
"--no-watchman",
"--ci",
] + select({
"//path/to:flag_config_setting": ["--colors"],
"//conditions:default": [],
})
templated_args += ["--config", "$(rootpath %s)" % jest_config]
for src in srcs:
templated_args += ["--runTestsByPath", "$(rootpath %s)" % src]
I.e. select() supports the + operator, but it doesn't support ".extend()".
Hope that makes sense.
Phil