Add own reporter that reports only browser log in specific format
This commit is contained in:
+29
@@ -52,6 +52,7 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) : KotlinJsTestF
|
||||
init {
|
||||
requiredDependencies.add(versions.karma)
|
||||
|
||||
useLogReporter()
|
||||
useTeamcityReporter()
|
||||
useMocha()
|
||||
useWebpack()
|
||||
@@ -66,6 +67,34 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) : KotlinJsTestF
|
||||
config.reporters.add("teamcity")
|
||||
}
|
||||
|
||||
private fun useLogReporter() {
|
||||
config.reporters.add("karma-browser-log-reporter")
|
||||
|
||||
confJsWriters.add {
|
||||
//language=ES6
|
||||
it.appendln(
|
||||
"""
|
||||
// reporter for browser logs
|
||||
const LogReporter = function (baseReporterDecorator) {
|
||||
baseReporterDecorator(this);
|
||||
|
||||
this.onBrowserLog = (browser, log, type) => {
|
||||
this.write("##browser[" + "browser='" + browser + "' " + "type='" + type + "' " + "log=" + log + "]##browser\n");
|
||||
}
|
||||
};
|
||||
|
||||
LogReporter.${'$'}inject = ['baseReporterDecorator'];
|
||||
|
||||
config.plugins = config.plugins || [];
|
||||
config.plugins.push('karma-*'); // default
|
||||
config.plugins.push({
|
||||
'reporter:karma-browser-log-reporter': ['type', LogReporter]
|
||||
});
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun watch() {
|
||||
config.singleRun = false
|
||||
config.autoWatch = true
|
||||
|
||||
Reference in New Issue
Block a user