我可以让 Bazel 总是在规则的测试中输出错误吗?

huangapple go评论73阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年4月6日 11:58:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/61052745.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定