1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Adjust KotlinTestRunner.

This commit is contained in:
Cedric Beust 2017-01-15 07:56:21 -08:00
parent a80e19d53a
commit 9a249c2a6c
2 changed files with 9 additions and 1 deletions

View file

@ -18,6 +18,8 @@ abstract class GenericTestRunner: ITestRunnerContributor {
abstract fun args(project: Project, context: KobaltContext, classpath: List<IClasspathDependency>, abstract fun args(project: Project, context: KobaltContext, classpath: List<IClasspathDependency>,
testConfig: TestConfig) : List<String> testConfig: TestConfig) : List<String>
open fun filterTestClasses(classes: List<String>) : List<String> = classes
override fun run(project: Project, context: KobaltContext, configName: String, override fun run(project: Project, context: KobaltContext, configName: String,
classpath: List<IClasspathDependency>) classpath: List<IClasspathDependency>)
= TaskResult(runTests(project, context, classpath, configName)) = TaskResult(runTests(project, context, classpath, configName))
@ -53,7 +55,7 @@ abstract class GenericTestRunner: ITestRunnerContributor {
// } // }
context.logger.log(project.name, 2, "Found ${result.size} test classes") context.logger.log(project.name, 2, "Found ${result.size} test classes")
return result.map { it.second } return filterTestClasses(result.map { it.second })
} }
/** /**

View file

@ -6,5 +6,11 @@ package com.beust.kobalt.internal
*/ */
class KotlinTestRunner : JUnitRunner() { class KotlinTestRunner : JUnitRunner() {
override val dependencyName = "io.kotlintest" override val dependencyName = "io.kotlintest"
/**
* KotlinTestRunner runs tests in the init{} initializer, so ignore all the extra
* classes generated by the Kotlin compiler.
*/
override fun filterTestClasses(classes: List<String>) = classes.filter { ! it.contains("$") }
} }