'skip in test' 在 build.sbt 中做什么?

What does 'skip in test' do in build.sbt?

我在根目录中找到了这个 build.sbt

skip in test := true

它有什么作用?我在 sbt 文档中找不到关于此的任何参考。我在我的 Scala 项目中使用 sbt 1.3.8。

如果设置为 truetest 任务将不会 运行 并且不会执行任何测试。

在您的上下文中,不会执行根项目的测试。

了解任务正在做什么以及其他任务如何使用它的一种方法是 运行 inspect 任务。

sbt "inspect test:skip"

产生:

[info] Task: Boolean
[info] Description:
[info]  For tasks that support it (currently only 'compile', 'update', and 'publish'), setting skip to true will force the task to not to do its work.  This exact semantics may vary by task.
[info] Provided by:
[info]  Global / skip
[info] Defined at:
[info]  (sbt.Defaults.globalSbtCore) Defaults.scala:294
[info] Delegates:
[info]  Test / skip
[info]  Runtime / skip
[info]  Compile / skip
[info]  skip
[info]  ThisBuild / Test / skip
[info]  ThisBuild / Runtime / skip
[info]  ThisBuild / Compile / skip
[info]  ThisBuild / skip
[info]  Zero / Test / skip
[info]  Zero / Runtime / skip
[info]  Zero / Compile / skip
[info]  Global / skip
[info] Related:
[info]  Global / skip

有说明

For tasks that support it (currently only 'compile', 'update', and 'publish'), setting skip to true will force the task to not to do its work. This exact semantics may vary by task.