I've encountered an issue related to mtkopone/scct#50 in which resource directories are not included in the instrumentation of tests.
My problem occurs when using Typesafe config with settings modified for test under /src/test/resources/application.conf. Tests pass with ./sbt test but fail with ./sbt scct:test. Fair warning, I'm fairly new to Scala development in general so I may be missing some unspoken best practice here.
val scctSettings = ScctPlugin.instrumentSettings ++ Seq(
// resourceDirectory in ScctPlugin.ScctTest <<= (resourceDirectory in Test), // this setting is optional
unmanagedResources in ScctPlugin.ScctTest <<= (unmanagedResources in Test)
)
Then, instead of settings(ScctPlugin.instrumentSettings: _*), use settings(scctSettings:_*):
/**
* ISSUE: Toggle the last two settings lines below and run ./sbt scct:test
*/
lazy val scctResourcesIssue = Project("scct-resources-issue", file("."))
.settings(Project.defaultSettings:_*)
.settings(appSettings:_*)
// .settings(ScctPlugin.instrumentSettings: _*) // Does not work with test resources
.settings(scctSettings:_*) // works with test resources
I'm not sure whether this is a feature request or a documentation request, but as in the linked issue I consider it unexpected behavior to run tests instrumented for code coverage with different results than non-instrumented tests.
I've encountered an issue related to mtkopone/scct#50 in which resource directories are not included in the instrumentation of tests.
My problem occurs when using Typesafe config with settings modified for test under /src/test/resources/application.conf. Tests pass with
./sbt test
but fail with./sbt scct:test
. Fair warning, I'm fairly new to Scala development in general so I may be missing some unspoken best practice here.I've created a sample project to demonstrate: https://github.com/jimschubert/scct-resources-issue
The fix is simple:
Then, instead of
settings(ScctPlugin.instrumentSettings: _*)
, usesettings(scctSettings:_*)
:I'm not sure whether this is a feature request or a documentation request, but as in the linked issue I consider it unexpected behavior to run tests instrumented for code coverage with different results than non-instrumented tests.
Thanks!