nebula-plugins / nebula-test

Test harness for Gradle plugins
Apache License 2.0
45 stars 18 forks source link

nebula-test 10.0.0+ requires manual registration of junitplatform #139

Closed jeremyjliu closed 3 years ago

jeremyjliu commented 3 years ago

After upgrading nebula-test to 10.0.0+, tests written in a subproject with just nebula-test are not included in the ./gradlew test run. This silently drops tests from running.

Adding the following to the project's build.gradle fixes the issue:

// Spock 2 is based on JUnit Platform and needs to be enabled explicitly.
tasks.withType(Test).configureEach {
    useJUnitPlatform()
}

which was taken from: https://docs.gradle.org/current/userguide/upgrading_version_6.html#building_gradle_plugins_with_groovy_3

Is there a way for nebula-test to automatically register with the junit platform (like it did before) to avoid this pitfall?

chali commented 3 years ago

Hi @jeremyjliu unfortunately nebula-test itself is "only" a java library and it doesn't have any ability to configure builds where it is being used. I will update the how-to-use example in docs. Before it worked with a default option in Gradle but with the new Spock it requires this explicit configuration.