英文:
Can I make Bazel always output errors on tests from a rule?
问题
我想做到每次在我的项目中运行bazel test
时,都能在控制台中看到错误。这相当于每次传递--test_output=errors
作为标志,但我想知道是否有一种方法可以从我的java_test
规则内部完成,以便我不必每次都传递那个标志?
英文:
I want to make it so that every time I run bazel test
in my project, I can see errors in the console. This is the equivalent of passing --test_output=errors
as a flag every time, but I was wondering if there is a way I can do it from within my java_test
rule so that I don't have to pass that flag every time?
答案1
得分: 2
我认为这不能在每个目标的基础上进行设置,但是 Bazel 可以从一个名为 .bazelrc
的文件中获取选项,该文件可以添加到项目中。
可以添加一个 .bazelrc
文件,内容如下:
test --test_output=errors
这会为 test
命令设置 --test_output
标志。
英文:
I don't think this can be set on a per target basis, however Bazel can take options from a .bazelrc
file which can be added to the project.
A .bazelrc
file could be added with the following contents:
test --test_output=errors
Which would set the --test_output
flag for the test
command.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论