Override test options in sbt task

Viewed 163

I'm trying to define two sbt test tasks, but I want them to use different testOptions.

My first task looks like this:

TaskKey[Unit]("testServices") := {
  (testOnly in Test).toTask({
  ... //some logic here
  }).value
}

and testOptions in Test are set as:

testOptions in Test += Tests.Argument(
  TestFrameworks.ScalaTest,
  "-u", "target/results/junit",
  "-h", "target/results/html",
  "-M", "target/results/failures.log",
  "-C", "com.lorem.ipsum.reporter.MyReporter"
)

Now I want to define new task (lets call it testServicesSimplified) which should be exact copy of previous one but should use following testOptions:

testOptions in Test += Tests.Argument(
  TestFrameworks.ScalaTest,
  "-C", "com.lorem.ipsum.reporter.SimplifiedReporter",
)

Is there any way to override testOptions just for that one new task? Or maybe there is other way to be able to run same tests with two different reporters?

0 Answers
Related