I usually use this set of parameters to compile Scala code:
scalacOptions ++= Seq( "-deprecation", "-encoding", "UTF-8", "-feature", "-unchecked", "-language:higherKinds", "-language:implicitConversions", "-Xfatal-warnings", "-Xlint", "-Yinline-warnings", "-Yno-adapted-args", "-Ywarn-dead-code", "-Ywarn-numeric-widen", "-Ywarn-value-discard", "-Xfuture", "-Ywarn-unused-import" )
But some of them work poorly with ScalaTest, so I want to disable -Ywarn-dead-code and -Ywarn-value-discard when compiling tests.
I tried to add an area like this
scalacOptions in Compile ++= Seq(...)
or
scalacOptions in (Compile, compile) ++= Seq(...)
or even
val ignoredInTestScalacOptions = Set( "-Ywarn-dead-code", "-Ywarn-value-discard" ) scalacOptions in Test ~= { defaultOptions => defaultOptions filterNot ignoredInTestScalacOptions }
but the first two parameters are disabled for the normal compilation area, and the last ones do not affect the test compilation parameters.
How can I have a separate parameter list when compiling tests?
scala sbt
Tvaroh
source share