Skip to content

Instantly share code, notes, and snippets.

@Daenyth
Created April 30, 2024 15:37
Show Gist options
  • Save Daenyth/a008964c61b1740974767b833064cc5e to your computer and use it in GitHub Desktop.
Save Daenyth/a008964c61b1740974767b833064cc5e to your computer and use it in GitHub Desktop.
Allow scalatest/scalamock to not ruin -Wnonunit-statement
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"
)
@Daenyth
Copy link
Author

Daenyth commented May 2, 2024

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

@vpatryshev
Copy link

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