gpt4 book ai didi

scala - 由于 "Forked test harness failed",sbt 测试失败

转载 作者:行者123 更新时间:2023-12-03 14:42:41 25 4
gpt4 key购买 nike

我有一个 Scala 项目,正在与 sbt 一起构建.运行时 sbt test ,测试本身通过,但随后命令失败并显示“ fork 测试工具失败:java.io.EOFException”。

build.sbt 文件未指定 fork in Test .

运行后失败的错误示例 sbt test :

[info] Run completed in 5 seconds, 494 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 0, aborted 0
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[error] Error during tests:
[error] Forked test harness failed: java.io.EOFException
[error] at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2959)
[error] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1539)
[error] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
[error] at sbt.React.react(ForkTests.scala:177)
[error] at sbt.ForkTests$Acceptor$1$.run(ForkTests.scala:108)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (serverTests / Test / test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 14 s, completed Mar 12, 2020 4:35:26 PM

失败的最小测试示例:
package com.example

import akka.http.scaladsl.testkit.ScalatestRouteTest
import org.scalatest.FreeSpecLike

class ForkedTestHarnessFailedForNoReasonSpec extends FreeSpecLike with ScalatestRouteTest {
"This test" - {
"should not fail" in {
assert("Foo" == "Foo")
}
}
}

此错误表明什么以及应该如何解决它?

最佳答案

就我而言,原因是 AKKA 在协调关闭时关闭了 JVM。把它放到你的测试配置中(在我的例子中是 src/test/resources/reference.conf):

akka.coordinated-shutdown.exit-jvm = off

关于scala - 由于 "Forked test harness failed",sbt 测试失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60662087/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com