Make KarmaConfig as data class

This commit is contained in:
Ilya Goncharov
2019-09-12 14:06:27 +03:00
parent 8f7c5c13f8
commit 6277267563
@@ -5,43 +5,33 @@
package org.jetbrains.kotlin.gradle.targets.js.testing.karma
// https://karma-runner.github.io/3.0/config/configuration-file.html
class KarmaConfig {
var singleRun: Boolean = true
var autoWatch: Boolean = false
var basePath: String? = null
val files: MutableList<String> = mutableListOf()
val frameworks: MutableList<String> = mutableListOf()
val browsers: MutableList<String> = mutableListOf()
val customLaunchers: MutableMap<String, CustomLauncher> = mutableMapOf()
val reporters: MutableList<String> = mutableListOf()
val preprocessors: MutableMap<String, MutableList<String>> = mutableMapOf()
// https://karma-runner.github.io/4.0/config/configuration-file.html
data class KarmaConfig(
var singleRun: Boolean = true,
var autoWatch: Boolean = false,
var basePath: String? = null,
val files: MutableList<String> = mutableListOf(),
val frameworks: MutableList<String> = mutableListOf(),
val browsers: MutableList<String> = mutableListOf(),
val customLaunchers: MutableMap<String, CustomLauncher> = mutableMapOf(),
val reporters: MutableList<String> = mutableListOf(),
val preprocessors: MutableMap<String, MutableList<String>> = mutableMapOf(),
var coverageReporter: CoverageReporter? = null
) {
data class CoverageReporter(
var dir: String,
val reporters: MutableList<Reporter> = mutableListOf()
) {
class CoverageReporter(var dir: String) {
val reporters = mutableListOf<Reporter>()
class Reporter(
data class Reporter(
val type: String,
val subDir: String? = null,
val file: String? = null
) {
override fun toString(): String {
return "Reporter(type='$type', subDir=$subDir, file=$file)"
}
}
override fun toString(): String {
return "CoverageReporter(dir='$dir', reporters=$reporters)"
}
)
}
class CustomLauncher(var base: String) {
val flags = mutableListOf<String>()
var debug: Boolean? = null
}
override fun toString(): String {
return "KarmaConfig(singleRun=$singleRun, autoWatch=$autoWatch, basePath=$basePath, files=$files, frameworks=$frameworks, browsers=$browsers, reporters=$reporters, preprocessors=$preprocessors, coverageReporter=$coverageReporter)"
}
}