Check Karma exit code with disabled failOnFailingTestSuite
https://github.com/karma-runner/karma/pull/3116
This commit is contained in:
+1
@@ -15,6 +15,7 @@ data class KarmaConfig(
|
||||
val client: KarmaClient = KarmaClient(),
|
||||
val browsers: MutableList<String> = mutableListOf(),
|
||||
val customLaunchers: MutableMap<String, CustomLauncher> = mutableMapOf(),
|
||||
val failOnFailingTestSuite: Boolean = false,
|
||||
val reporters: MutableList<String> = mutableListOf(),
|
||||
val preprocessors: MutableMap<String, MutableList<String>> = mutableMapOf(),
|
||||
var coverageReporter: CoverageReporter? = null
|
||||
|
||||
+2
-21
@@ -325,22 +325,15 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) : KotlinJsTestF
|
||||
return object : JSServiceMessagesTestExecutionSpec(
|
||||
forkOptions,
|
||||
args,
|
||||
false,
|
||||
true,
|
||||
clientSettings
|
||||
) {
|
||||
lateinit var progressLogger: ProgressLogger
|
||||
|
||||
var isLaunchFailed: Boolean = false
|
||||
|
||||
override fun wrapExecute(body: () -> Unit) {
|
||||
project.operation("Running and building tests with karma and webpack") {
|
||||
progressLogger = this
|
||||
body()
|
||||
|
||||
if (isLaunchFailed) {
|
||||
showSuppressedOutput()
|
||||
throw IllegalStateException("Launch of some browsers was failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +351,7 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) : KotlinJsTestF
|
||||
val value = text.trimEnd()
|
||||
progressLogger.progress(value)
|
||||
|
||||
parseConsole(value)
|
||||
super.printNonTestOutput(text)
|
||||
}
|
||||
|
||||
override fun processStackTrace(stackTrace: String): String =
|
||||
@@ -389,16 +382,6 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) : KotlinJsTestF
|
||||
|
||||
return rawSuiteNameOnly.replace(" ", ".") // sample.a.DeepPackageTest.Inner
|
||||
}
|
||||
|
||||
private fun parseConsole(text: String) {
|
||||
if (KARMA_PROBLEM.matches(text)) {
|
||||
log.error(text)
|
||||
isLaunchFailed = true
|
||||
return
|
||||
}
|
||||
|
||||
super.printNonTestOutput(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -418,7 +401,5 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) : KotlinJsTestF
|
||||
companion object {
|
||||
const val CHROME_BIN = "CHROME_BIN"
|
||||
const val CHROME_CANARY_BIN = "CHROME_CANARY_BIN"
|
||||
|
||||
val KARMA_PROBLEM = "(?m)^.*\\d{2} \\d{2} \\d{4,} \\d{2}:\\d{2}:\\d{2}.\\d{3}:(ERROR|WARN) \\[.*]: (.*)\$".toRegex()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user