通过 SBT 运行 Specs 时如何消除堆栈跟踪?

发布于 2024-08-16 08:15:47 字数 747 浏览 5 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

舟遥客 2024-08-23 08:15:48

我刚刚看到新的 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 to sbt too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文