How to check if sbt is in test context?

How can an application say if it works in the context of 'sbt test'? Is there a system property that can be verified?

+5
source share
1 answer

There may be different ways. I found the following works:

testOptions += Tests.Setup(_ => sys.props("testing") = "true") 

And then you can just check sys.props.get("testing") in your class.

+5
source

Source: https://habr.com/ru/post/1206031/


All Articles