can a jvm test suite be set to "soft fail" meaning...
# community-support
c
can a jvm test suite be set to "soft fail" meaning it passing or failing doesn't affect the result of build
a
Test tasks have
ignoreFailures
https://docs.gradle.org/current/kotlin-dsl/gradle/org.gradle.nativeplatform.test.tasks/-run-test-executable/ignore-failures.html It's a bit convoluted to access the task for each suite, because suites can have multiple variants (targets), but you can access the task like so:
Copy code
testing {
    suites.withType<JvmTestSuite>().configureEach {
        targets.configureEach {
            testTask.configure {
                ignoreFailures = true
            }
        }
    }
}
Does that help?
c
probably, it'll take a me a few to try it 😉
but yay for convolution, wonder if I should report a bug for consideration in the DSL... 😕
a
I'd +1 that feature request
It'd probably be nicer like this:
Copy code
testing {
    jvmSuites {
        ignoreFailures = true // set the default for all JVM Test tasks
        targets.main {
            testTask {
                ignoreFailures = false // override the default for target named 'main'
            }
        }
    }
}
c
I'd probably want something more like this, it feels intuitive to me. I think the bug could propose both, but honestly it's as much about consideration that the use case seems to not have been thought about
Copy code
testing {
  suites {
    val jmolecules by registering(JvmTestSuite::class) {
      ignoreFailures = true
    }
  }
}
sadly I don't think I can test this either way. Unrelated problem, for some reason my test suite which I'd think would be classpath is acting like it's using the module-path... 😕 oh well, lol