通过 SBT 运行 Specs 时如何消除堆栈跟踪?
我有一个 Scala 项目,正在使用 SBT 和 Specs。当我运行 sbt test 时,它可以正确运行我的测试,但失败的测试会导致巨大的堆栈跟踪。
[info]
== caravan.DependenciesSpec ==
[info] specifies
[info] x Status should mirror single job
org.specs.specification.FailureExceptionWithResult: 'caravan.Status(2)' is not equal to 'caravan.Status(3)'
at caravan.DependenciesSpec$$anonfun$1.apply(DependenciesSpec.scala:13)
...about 70 lines of stack trace though specs...
[error] org.specs.specification.FailureExceptionWithResult: 'caravan.Status(2)' is not equal to 'caravan.Status(3)'
我所期望的是它只是报告测试失败。我正在使用 Scala 2.7.5 运行规范 1.6.0 和 SBT 0.5.5。我的规格写为:
object DependenciesSpec extends Specification {
...
有什么办法可以从规格/SBT 中获得可用的输出吗?
I have a Scala project that I'm using SBT and Specs on. When I run sbt test, it correctly runs my tests, but a failing test results in a huge stack trace.
[info]
== caravan.DependenciesSpec ==
[info] specifies
[info] x Status should mirror single job
org.specs.specification.FailureExceptionWithResult: 'caravan.Status(2)' is not equal to 'caravan.Status(3)'
at caravan.DependenciesSpec$anonfun$1.apply(DependenciesSpec.scala:13)
...about 70 lines of stack trace though specs...
[error] org.specs.specification.FailureExceptionWithResult: 'caravan.Status(2)' is not equal to 'caravan.Status(3)'
What I would expect is that it just reports the test failed. I'm running specs 1.6.0 and SBT 0.5.5 with Scala 2.7.5. My specs are written as:
object DependenciesSpec extends Specification {
...
Is there any way to get usable output out of Specs/SBT?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚看到新的 xsbt 启动器 0.6.10 添加了一个
trace on|off|
命令来控制堆栈跟踪输出。请参阅 sbt google 论坛上的帖子,了解发布公告和问题报告。显然,这取决于
Specs
是否也将堆栈跟踪发送到sbt
。I just saw that the new xsbt launcher 0.6.10 added a
trace on|off|<n>
command to control stack trace outputs. See this thread on the sbt google group for release announcement and the issue report.Apparently it will depend on whether
Specs
sends the stack trace tosbt
too.