Reputation: 1598
How can an application tell if it's running under an 'sbt test' context? Is there a system property that can be checked?
Upvotes: 7
Views: 826
Reputation: 67280
There are probably different ways. I found the following works:
testOptions += Tests.Setup(_ => sys.props("testing") = "true")
And then you can just test for sys.props.get("testing")
in your class.
Upvotes: 10