【问题标题】:Why won't scalatest compile?为什么 scalatest 不编译?
【发布时间】:2018-11-29 08:43:50
【问题描述】:

我有一个简单的测试设置,比如

package unit

import net.kolotyluk.leaderboard.scorekeeping._
import net.kolotyluk.leaderboard.telemetry.Metrics
import net.kolotyluk.scala.extras.Logging
import org.scalatest.{FlatSpec, GivenWhenThen, Matchers, SequentialNestedSuiteExecution}

import scala.collection.mutable.ArrayBuffer
import scala.concurrent.{Await,Future}
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.{Failure, Random, Success}

class LeaderboardSpec
  extends FlatSpec
    with SequentialNestedSuiteExecution
    with GivenWhenThen
    with Matchers
    with Logging {

  behavior of "Leaderboard"

  it must "handle initial conditions correctly" in {

但是当我尝试编译我的测试时,我得到了 53 个错误,例如

[IJ]sbt:leaderboard> test
[info] Compiling 1 Scala source to C:\Users\ERIC\Documents\git\repos\leaderboard\target\scala-2.12\test-classes ...
[error] C:\Users\ERIC\Documents\git\repos\leaderboard\src\test\scala\unit\LeaderboardSpec.scala:21:12: could not find implicit value for parameter pos: org.scalactic.source.Position
[error]   behavior of "Leaderboard"
[error]            ^

这实际上并没有传达任何有关问题所在的有用信息。我只能假设在我的 build.sbt 文件或其他地方没有正确配置某些东西。

这段代码在某个时候确实有效,但在我清理的过程中,事情发生了变化,现在它在没有良好诊断的情况下被破坏了。

任何人都可以建议要寻找的东西吗?

【问题讨论】:

标签: scala scalatest


【解决方案1】:

因此,似乎可以正确编译和运行的一种解决方法是停止使用 SBT 并改用 Maven。

我认为这是迄今为止我在 SBT 中发现的第三个主要缺陷。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-21
    • 2016-05-09
    • 2017-10-12
    • 2020-12-04
    • 2020-12-16
    • 2012-10-24
    • 1970-01-01
    相关资源
    最近更新 更多