Question about Trait structure #5737
Replies: 1 comment 2 replies
-
The idea behind the language-specific inner test traits is, that you can can spare some redundant configuration steps, since typically test modules share their language setup with their base module. If this is not the case for you, you don't get much from a language-specific test trait, since it can't copy the specific settings from the base/outer module anyways. All that's needed to run tests is a If you have a Java base module object foo extends JavaModule {
object test extends ScalaModule with JavaTests {
}
}
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am having trouble defining a test module which has another language than its parent module. While developing the groovylib I am encountering the issue that I cannot create a test-module which has a different language than the parent module. In my case, I want the tests to be a
GroovyMavenTest
module while the parent is a plainJavaModule with MavenModule
. Even though less likely, this problem will also show up when you want to use Kotlin only for your tests or Scala (like when using Gatlin).Maybe I am just missing the right way to define the module but this is what I currently have.
This follows the conventions used for all module traits in Mill, where the test-trait is defined within the parent trait.
I would like to define it like this
But this is not possible, because GroovyMavenTests is defined within GroovyModule. I need to make the parent a GroovyModule
But this is wrong, and pollutes my main module with Groovy dependencies.
I tried to work around this by defining a local trait like this
But this result is duplicate module
test
when using it like this.Is this a design constraint, or am I missing something? As said, with my current understanding I would not be possible to define a test module with another language than its parent due to the trait structure.
Beta Was this translation helpful? Give feedback.
All reactions