代码之家  ›  专栏  ›  技术社区  ›  mark_dj

SBT-仅覆盖测试

  •  0
  • mark_dj  · 技术社区  · 7 年前

    对于 testOnly 在sbt中,我想使用特定的 testOptions test 有不同的 )我还想设置一个环境变量。。

    有什么例子吗?

    1 回复  |  直到 7 年前
        1
  •  0
  •   mark_dj    7 年前

    我通过引入一个新的范围来修复它 Diagnose :

    
    lazy val Diagnose = config("diagnose") extend Test
    lazy val diagnoseSettings = inConfig(Build.Diagnose)(Defaults.testTasks ++ Seq(testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oD"), envVars := Map("TEST_LOG_LEVEL" -> "debug")))
    

    
    val p = (project in file("project")).configs(Build.Diagnose).settings(Build.diagnoseSettings).settings(testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-W", "5", "2"), testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oNCXEHLOPQRM"))
    

    现在当我跑步的时候 sbt test sbt diagnose:testOnly test-class