Open hfhbd opened 3 months ago
Alternatively, only depend on tasks.test
("unit-test" type when using jvm-test-suite plugin) by default and you need to opt-in to depend on other test tasks.
This also allows you to remove some filtering hacks in kover:
kover.currentProject {
sources {
srcDirs("integrationTest") // same behavior like builtin sourceSets
}
instrumentation {
include(tests.integrationTest)
}
}
Hi,
this is because Kover Gradle Plugin use the matching function to locate test tasks but it is not lazy - it causes the creation of an instance of the task. For this reason, even if you exclude a task by name using matching
, it is still created.
This can be circumvented by using the new named function, however it will only work in Gradle starting with version 8.6
But what about using opt-in of other tasks instead to not configure the tasks by default?
But what about using opt-in of other tasks instead to not configure the tasks by default?
This can be done, but in this case it is necessary to significantly redesign the workflow for the plugin.
Since you are using Gradle version 8.7, we will implement usage of the new named
function, and in this case the integrationTest
task instance will not be created when writing
kover.currentProject {
instrumentation {
disabledForTestTasks.add("integrationTest")
}
}
Unfortunately, the named {}
function in Gradle still contains a similar error, and it causes the creation of all tasks (see example).
Therefore, at the moment it is difficult to write a search for test tasks by name without configuring all test tasks.
The use of named("name")
is unreliable, because the task can be created after, and the use of TaskProvider
s requires significant changing of the DSL.
We are waiting for the fix to be released in Gradle.
I found a solution (for my use-case): I switched to the new settings plugin and everything works now without configuring the integration test tasks, nice!
But I have one question left: How do I setup rules in settings plugin?
But I have one question left: How do I setup rules in settings plugin?
There is no verify task in settings plugin right now, but I think we will add it in the next release
@hfhbd, verification was added in 0.9.0-RC
Describe the bug I use the
jvm-test-suite
plugin and add anintegrationTest
but I don't want to include the task/test results in kover.Errors
./gradlew build
=>Expected behavior
./gradlew build
=> no errorReproducer
Reports If applicable, report files or screenshots.
Environment