Hi, community. Can someone help me? I need an exam...
# kotest
m
Hi, community. Can someone help me? I need an example of using Kotest with PiTest for JDK 1.8. The extension 'kotest-extensions-pitest' requires JDK 11.
build.gradle.kts
Copy code
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.7.4")
    }
}

plugins {
    kotlin("jvm") version "1.6.21"
    id("info.solidsoft.pitest") version "1.7.4"
}

group = "org.example"
version = "1.0-SNAPSHOT"

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    testImplementation(kotlin("test"))

    /* Kotlin */
    implementation(kotlin("stdlib-jdk8"))

    /* Test */
    testImplementation(kotlin("test-junit5"))

    /* Junit */
    testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
    testImplementation("org.junit.jupiter:junit-jupiter-engine:5.8.2")
    testImplementation("org.junit.jupiter:junit-jupiter-params:5.8.2")
    testImplementation("org.junit.platform:junit-platform-engine:1.8.2")
    testImplementation("org.junit.platform:junit-platform-launcher:1.8.2")
    testImplementation("org.junit.platform:junit-platform-launcher:1.8.2")

    /* Kotest */
    testImplementation("io.kotest:kotest-runner-junit5:5.3.0")
    testImplementation("io.kotest:kotest-assertions-core:5.3.0")
    testImplementation("io.kotest:kotest-framework-datatest:5.3.0")

    /* PITest */
    testImplementation("org.pitest:pitest-junit5-plugin:0.15")
    testImplementation("io.kotest.extensions:kotest-extensions-pitest:1.1.0")
}

tasks {

    test {
        useJUnitPlatform()
    }
    
    configure<info.solidsoft.gradle.pitest.PitestPluginExtension> {
        threads.set(4)
        testPlugin.set("junit5")
        junit5PluginVersion.set("0.15")
        pitestVersion.set("1.8.0")
        mutators.set(mutableListOf("STRONGER"))
        outputFormats.set(listOf("XML", "HTML"))
        targetClasses.set(mutableListOf("com.github.*"))
        targetTests.set(mutableListOf("com.github.*"))
        avoidCallsTo.set(mutableListOf("kotlin", "kotlin.jvm.internal", "kotlin.collections"))
        timestampedReports.set(false)
        exportLineCoverage.set(true)
    }
}

tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "1.8"
}