Skip to content

Commit

Permalink
[Gradle, JS] Save stack trace for nodejs errors
Browse files Browse the repository at this point in the history
#KT-38109 fixed
  • Loading branch information
ilgonmic committed Apr 16, 2020
1 parent fb638c2 commit 61e9d13
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) :

private val failedBrowsers: MutableList<String> = mutableListOf()

private var previousLine: String = ""

override fun printNonTestOutput(text: String, type: String?) {
val value = text.trimEnd()
progressLogger.progress(value)
Expand All @@ -435,21 +437,30 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) :

private fun parseConsole(text: String, type: String?) {

var actualText = text
val actualType = if (text.trim().startsWith("at ")) {
parseConsole(previousLine, ERROR)
previousLine = ""
ERROR
} else {
previousLine = text
type
}

val launcherMessage = KARMA_LAUNCHER_MESSAGE.matchEntire(text)

if (launcherMessage != null) {
val actualText = if (launcherMessage != null) {
val (message) = launcherMessage.destructured
actualText = message
when (type?.toLowerCase()) {
when (actualType?.toLowerCase()) {
WARN, ERROR -> {
processFailedBrowsers(text)
}
}
message
} else {
text
}

type?.let { log.processLogMessage(actualText, it) }
actualType?.let { log.processLogMessage(actualText, it) }
}

private fun processFailedBrowsers(text: String) {
Expand Down

0 comments on commit 61e9d13

Please sign in to comment.