I'm trying to set jvmargs for unit tests using kotlin-dsl and I can't get it to work.
This is so that I can add the "-noverify" argument and allow intellji test runner to collect code coverage info.
Groovy, works:
testOptions {
unitTests.all {
jvmArgs '-noverify'
}
}
Kotlin, doesn't work:
testOptions {
unitTests.all(KotlinClosure1<Any, Test>({
(this as Test).also { jvmArgs("-noverify") }
}, this))
}
This too:
testOptions {
unitTests.all(KotlinClosure1<Any, Test>({
(this as Test).also { jvmArgs = listOf("-noverify") }
}, this))
}
Nothing seems to work, what am I missing?
I was having the same issue. The following snippet works.
tasks.withType<Test>().all {
jvmArgs("-noverify")
}
Ref - https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html#jvmArgs-java.lang.Object...-
Verified using Gradle-5.1.-all version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With