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

Gradle 'check' task runs tests from all project, despite no verification rules are added. #168

Closed
varjasz opened this issue Apr 21, 2022 · 2 comments · Fixed by #190
Closed
Labels

Comments

@varjasz
Copy link

varjasz commented Apr 21, 2022

In a gradle multi project running a subproject 'check' task trigger all tests from all projects.
No verification rules are added to 'koverVerify' task.

The documentation said:
"if verification rules are added, then running tasks koverVerify or check will trigger the execution of all active tests from all projects!"

If no verification rules are added, then the 'koverVerify' task will be disabled (skipped), but it depends on all tests and 'check' task depends on 'koverVerify', so despite the 'koverVerify' is skipped it forces gradle to run all tests from all projects.

@shanshin
Copy link
Collaborator

shanshin commented Apr 21, 2022

Hi,
by default koverVerify task depends only on test tasks of it's project. If the task was started with a command like :subproject:check or :subproject:koverVerify then only the test tasks of the project subproject will be triggered.

This behavior can be changed only if you configure the Kover accordingly: it is enough to set the value for the flag runAllTestsForProjectTask to true, eg

//  in build.gradle.kts or build.gradle file of the root project
kover {
    // other settings
    runAllTestsForProjectTask = true
}

To better understand your issue, could you clarify the version of the plugin, the structure of the project and which command you run the checks with.

@shanshin shanshin added the Question Support request issue type label Apr 21, 2022
@varjasz
Copy link
Author

varjasz commented Apr 22, 2022

I have created a sample project:
https://github.com/varjasz/kover-issue

The Kover documentation contains the following:

By default, for the task koverVerify coverage is calculated only for the tests of the one project. If classes or functions are called from tests of another module, then you need to set a flag runAllTestsForProjectTask for KoverExtension to true (see).

In this case, if verification rules are added, then running tasks koverVerify or check will trigger the execution of all active tests from all projects!

The project configured with:

kover {
    runAllTestsForProjectTask = true
}
tasks.koverVerify {
    // No rules added
}

The expected behavior would be:

  • gradlew proj1:check run only that subproject tests: proj1:test
  • gradlew proj1:koverReport run all tests in all projects: proj1:test, proj2:test

@shanshin shanshin added Bug Bug issue type Kover Gradle Plugin and removed Question Support request issue type labels May 11, 2022
shanshin added a commit that referenced this issue Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants