Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration key 'test-runner' is not picked up by command-runner #718

Open
mdbergmann opened this issue Feb 6, 2021 · 6 comments
Open
Labels
bug Something isn't working

Comments

@mdbergmann
Copy link

Relates to: #36

Summary

Trying to run stryker4s using command-runner fails because it does not pick up the test-runner configuration key and hence doesn't run the Gradle tests.

Running with coursier:

coursier launch io.stryker-mutator::stryker4s-command-runner:0.11.0
11:20:33.524 WARN Stryker4s: The following configuration key(s) are not used, they could stem from an older stryker4s version: 'test-runner, log-level'.

Stryker4s config

stryker4s {
  reporters = ["console", "html"]
  scala-dialect = "2.12"
  test-runner {
      command = "./gradlew"
      args = "test"
  }
  log-level = DEBUG
  mutate = [ "src/main/**/*.scala" ]
}

Stryker4s environment

stryker4s 0.11.0

Also happens with stryker4s 0.10.1.

Your Environment

software version(s)
Scala version 2.12
Build tool & version Gradle 6.8.1
Operating System macOS
@mdbergmann
Copy link
Author

I can have a look but some guidance would be helpful.
I'd imagine it should be somewhere in core where the config is read, or?

@hugo-vrijswijk
Copy link
Member

hugo-vrijswijk commented Feb 9, 2021

Yes! The issue comes from reading config twice into two different case classes. Stryker4s reads the user Config once in core and the ProcessRunnerConfig in command-runner.

The first config reading in core has validation that checks if the config doesn't contain unused keys that could be misconfiguration. Because the command-runner config is in a separate case class it's recognized as an unused key for the core Config.

The proper fix for this I think is to only read the config once into a single case class in ConfigReader#readConfig. The ProcessRunnerConfig could extend the core Config, so all validation includes the command-runner config keys.

Out of scope for any fix, but this would be useful for the other modules, too! There's configuration in the core config case class that only applies to the sbt plugin config and I can imagine the Maven plugin could get that in the future as well.

Also, if you're at it. Please rename ProcessRunnerConfig to CommandRunnerConfig! There's too many Runner configs haha.

@hugo-vrijswijk hugo-vrijswijk added the bug Something isn't working label May 10, 2021
@cbrunnkvist
Copy link
Contributor

cbrunnkvist commented Jul 21, 2021

On a related note: How do we change the task (1) sbt test command (equiv. "goal") that gets used by the sbt plugin? Is it supposed to be possible, but missed in its implementation?

(1): Keep in mind it's not necessarily a single task - I might need to set it to something like ; resetSomethingCustomTask ; customConfig:test

@hugo-vrijswijk
Copy link
Member

@cbrunnkvist All test information is now gathered from the Test scope (https://github.com/stryker-mutator/stryker4s/blob/master/sbt/src/main/scala/stryker4s/sbt/Stryker4sSbtRunner.scala#L89). That scope could be configurable to e.g. IntegrationTest or whatever sbt scope someone has configured. I'm not sure if we can change the sbt 'task' if someone has a custom script that test calls because the plugin works with by collecting all test class information and starting a Java process with it.

@aishfenton
Copy link

Any update on this fix? Or any work around?

@hugo-vrijswijk
Copy link
Member

@aishfenton Could you expand on what you are running into? For the the command-runner, you can ignore the log warning as it is still picked up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants