Created
April 30, 2024 15:37
-
-
Save Daenyth/a008964c61b1740974767b833064cc5e to your computer and use it in GitHub Desktop.
Allow scalatest/scalamock to not ruin -Wnonunit-statement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test / scalacOptions ++= Seq( | |
// Allow using -Wnonunit-statement to find bugs in tests without exploding from scalatest assertions | |
"-Wconf:msg=unused value of type org.scalatest.Assertion:s", | |
"-Wconf:msg=unused value of type org.scalamock:s" | |
) |
Also intellij can't handle the scalacOptions being different between test and main when using the built-in compiler, if you're running into that remove the Test /
part and it'll use the same flags in both main and test. A little less clean but it gets the job done
I had to add more. Like this:
"-Wconf:msg=unused value of type org.scalatest.Assertion:s",
"-Wconf:msg=unused value of type org.specs2.specification.core.Fragment:s",
"-Wconf:msg=unused value of type org.specs2.matcher.MatchResult:s",
"-Wconf:msg=unused value of type org.scalamock:s"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Buggy in scala 3.3, but fixed in 3.4.1: scala/scala3#18804
And a possible workaround: typelevel/sbt-tpolecat#134 (comment)