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

HTML report is generated outside of the build directory #3306

Closed
aSemy opened this issue Nov 28, 2022 · 1 comment
Closed

HTML report is generated outside of the build directory #3306

aSemy opened this issue Nov 28, 2022 · 1 comment
Labels
bug 🐛 Issues that report a problem or error in the code. framework 🏗️ Pertains to the core structure and components of the Kotest framework.
Milestone

Comments

@aSemy
Copy link
Contributor

aSemy commented Nov 28, 2022

I've configured the Kotest HTML report. However, the files are generated outside of the build directory.

image

I tried configuring HtmlReporter to set the directory, but this didn't work

// https://kotest.io/docs/framework/project-config.html
internal class KotestConfig : AbstractProjectConfig() {

    override val specExecutionOrder = SpecExecutionOrder.Lexicographic

    override fun extensions(): List<Extension> = listOf(

        // https://kotest.io/docs/extensions/junit_xml.html
        JunitXmlReporter(
            includeContainers = false,
            useTestPathAsName = true,
        ),

        // https://kotest.io/docs/extensions/html_reporter.html
        HtmlReporter(
            // This doesn't seem to work:
            "./build/reports/test"
        ),
    )
    }
}

As a workaround I can configured the Gradle tasks to set the gradle.build.dir property.

// build.gradle.kts

tasks.withType<Test>().configureEach {

    // required by Kotest JUnit XML https://github.com/kotest/kotest/issues/3306
    systemProperty("gradle.build.dir", project.buildDir)

    // disable the Gradle reports - Kotest will generate them
    reports.html.required.set(false)
    reports.junitXml.required.set(false)
}

Versions

  • Kotlin 1.7.21
  • Kotest 5.5.4
  • Gradle 7.5.1
@LeoColman LeoColman added bug 🐛 Issues that report a problem or error in the code. framework 🏗️ Pertains to the core structure and components of the Kotest framework. labels Dec 5, 2022
@sksamuel sksamuel added this to the 5.5.5 milestone Jan 15, 2023
@sksamuel
Copy link
Member

sksamuel commented Feb 4, 2023

Fixed in 5.5.5

@sksamuel sksamuel closed this as completed Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Issues that report a problem or error in the code. framework 🏗️ Pertains to the core structure and components of the Kotest framework.
Projects
None yet
Development

No branches or pull requests

3 participants