[Gradle, JS] Less verbosity for karma parsing
#KT-38109 fixed
This commit is contained in:
+9
-12
@@ -82,7 +82,7 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) :
|
|||||||
config.loggers = [
|
config.loggers = [
|
||||||
{
|
{
|
||||||
type: 'kotlin-test-js-runner/tc-log-appender.js',
|
type: 'kotlin-test-js-runner/tc-log-appender.js',
|
||||||
layout: { type: 'pattern', pattern: '%[%d{DATE}:%p [%c]: %]%m' }
|
layout: { type: 'pattern', pattern: '%[[%c]: %]%m' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
@@ -438,24 +438,21 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) :
|
|||||||
|
|
||||||
private fun parseConsole(text: String, type: String?) {
|
private fun parseConsole(text: String, type: String?) {
|
||||||
|
|
||||||
val result = KARMA_MESSAGE.matchEntire(text)
|
var actualText = text
|
||||||
|
|
||||||
if (result != null) {
|
val launcherMessage = KARMA_LAUNCHER_MESSAGE.matchEntire(text)
|
||||||
|
|
||||||
val (logLevel, message) = result.destructured
|
if (launcherMessage != null) {
|
||||||
|
val (message) = launcherMessage.destructured
|
||||||
when (logLevel.toLowerCase()) {
|
actualText = message
|
||||||
|
when (type?.toLowerCase()) {
|
||||||
WARN, ERROR -> {
|
WARN, ERROR -> {
|
||||||
processFailedBrowsers(text)
|
processFailedBrowsers(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processLogMessage(message, logLevel)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type?.let { processLogMessage(text, it) }
|
type?.let { processLogMessage(actualText, it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processLogMessage(
|
private fun processLogMessage(
|
||||||
@@ -559,5 +556,5 @@ private const val INFO = "info"
|
|||||||
private const val DEBUG = "debug"
|
private const val DEBUG = "debug"
|
||||||
private const val LOG = "log"
|
private const val LOG = "log"
|
||||||
|
|
||||||
private val KARMA_MESSAGE = "^.*\\d{2} \\d{2} \\d{4,} \\d{2}:\\d{2}:\\d{2}.\\d{3}:(ERROR|WARN|INFO|DEBUG|LOG) \\[.*]: ([\\w\\W]*)\$"
|
private val KARMA_LAUNCHER_MESSAGE = "^.*\\[launcher]: ([\\w\\W]*)\$"
|
||||||
.toRegex()
|
.toRegex()
|
||||||
@@ -57,6 +57,8 @@ tasks {
|
|||||||
"karma-debug-runner.js",
|
"karma-debug-runner.js",
|
||||||
"karma-debug-framework.js",
|
"karma-debug-framework.js",
|
||||||
"mocha-kotlin-reporter.js",
|
"mocha-kotlin-reporter.js",
|
||||||
|
"tc-log-appender.js",
|
||||||
|
"tc-log-error-webpack.js",
|
||||||
"package.json",
|
"package.json",
|
||||||
"rollup.config.js",
|
"rollup.config.js",
|
||||||
"tsconfig.json",
|
"tsconfig.json",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export const TEST_END: string
|
|||||||
export const TEST_END_NO_DURATION: string
|
export const TEST_END_NO_DURATION: string
|
||||||
export const BLOCK_OPENED: string
|
export const BLOCK_OPENED: string
|
||||||
export const BLOCK_CLOSED: string
|
export const BLOCK_CLOSED: string
|
||||||
export const MESSAGE: string
|
export const TYPED_MESSAGE: string
|
||||||
|
|
||||||
export function tcEscape(str: string): string
|
export function tcEscape(str: string): string
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ export const TEST_END_NO_DURATION = `##teamcity[testFinished name='%s' flowId='%
|
|||||||
export const BLOCK_OPENED = `##teamcity[blockOpened name='%s' flowId='%s']`
|
export const BLOCK_OPENED = `##teamcity[blockOpened name='%s' flowId='%s']`
|
||||||
export const BLOCK_CLOSED = `##teamcity[blockClosed name='%s' flowId='%s']`
|
export const BLOCK_CLOSED = `##teamcity[blockClosed name='%s' flowId='%s']`
|
||||||
|
|
||||||
export const MESSAGE = `##teamcity[message text='%s']`
|
|
||||||
export const TYPED_MESSAGE = `##teamcity[message text='%s' type='%s']`
|
export const TYPED_MESSAGE = `##teamcity[message text='%s' type='%s']`
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,13 +5,22 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {formatMessage, MESSAGE} from "./src/teamcity-format"
|
import {formatMessage, TYPED_MESSAGE} from "./src/teamcity-format"
|
||||||
|
|
||||||
const consoleLog = console.log.bind(console);
|
const consoleLog = console.log.bind(console);
|
||||||
|
|
||||||
function consoleAppender(layout, timezoneOffset) {
|
function consoleAppender(layout, timezoneOffset) {
|
||||||
return (loggingEvent) => {
|
return (loggingEvent) => {
|
||||||
consoleLog(formatMessage(MESSAGE, layout(loggingEvent, timezoneOffset)));
|
consoleLog(
|
||||||
|
formatMessage(
|
||||||
|
TYPED_MESSAGE,
|
||||||
|
layout(
|
||||||
|
loggingEvent,
|
||||||
|
timezoneOffset
|
||||||
|
),
|
||||||
|
loggingEvent.level.toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user