简体   繁体   English

我可以让 Bazel 在规则测试中始终出现 output 错误吗?

[英]Can I make Bazel always output errors on tests from a rule?

I want to make it so that every time I run bazel test in my project, I can see errors in the console.我想让它每次在我的项目中运行bazel test时,我都可以在控制台中看到错误。 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?这相当于每次都将--test_output=errors作为标志传递,但我想知道是否有一种方法可以从我的java_test规则中做到这一点,这样我就不必每次都传递那个标志?

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.我认为这不能针对每个目标进行设置,但是 Bazel 可以从可以添加到项目中的.bazelrc文件中获取选项。

A .bazelrc file could be added with the following contents:可以添加具有以下内容的.bazelrc文件:

test --test_output=errors

Which would set the --test_output flag for the test command.这将为test命令设置--test_output标志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以使用 _deploy.jar 使 bazel java_binary 规则替换默认 jar - Can I make bazel java_binary rule replace default jar with with _deploy.jar 如何使规则引擎始终选择具有更高显着性的规则? - How can I make the rule engine always choose the rule with higher Salience? Bazel-我可以通过系统属性来测试JVM(云雀规则)吗? - Bazel- Can I pass system property to test JVM (skylark rule)? 我可以在不进行安装的情况下从Java代码调用Bazel吗? - Can I call Bazel from Java code without installation? 反序列化json时如何使lightcouch输出正确的错误? - How can I make lightcouch output proper errors when deserializing json? 为什么在 java_test 规则上运行 bazel 测试时 Bazel 找不到我的测试 class? - Why can't Bazel find my test class when running bazel test on a java_test rule? 我可以让@OnApplicationStart不在测试中运行吗? - Can I make @OnApplicationStart not run on tests? 我可以创建一个从另一个规则文件导入规则的规则文件吗? - Can I create a rule file which imports rule(s) from another rule file? 如何使Bazel包含用于主机架构以外的其他体系结构的JRE? - How can I get Bazel to include a JRE for a different architecture from the host computer? 如何使此输出更容易? - How can i make this output easier?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM