Normally I use this set of options for compiling 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 don't play well with ScalaTest, so I would like to disable -Ywarn-dead-code
and -Ywarn-value-discard
when compiling tests.
I tried adding scope 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 disable options for normal compile scope as well while the latter doesn't affect tests compilation options.
How could I have a separate list of options when compiling tests?