[Gradle, JS] Karma kotlin reporter initialize browser if it was not initialized

^KT-54132
This commit is contained in:
Ilya Goncharov
2022-09-21 13:15:27 +00:00
committed by Space
parent fbc155ba17
commit 3a39a0d468
@@ -138,6 +138,7 @@ const KarmaKotlinReporter = function (baseReporterDecorator, config, emitter) {
};
this.onBrowserLog = (browser, log, type) => {
this.checkBrowserResult(browser)
const browserResult = this.browserResults[browser.id];
if (log.startsWith(END_KOTLIN_TEST)) {
@@ -153,6 +154,7 @@ const KarmaKotlinReporter = function (baseReporterDecorator, config, emitter) {
};
this.specSuccess = function (browser, result) {
this.checkBrowserResult(browser)
const log = this.getLog(browser, result)
const testName = result.description
@@ -165,6 +167,7 @@ const KarmaKotlinReporter = function (baseReporterDecorator, config, emitter) {
}
this.specFailure = function (browser, result) {
this.checkBrowserResult(browser)
const log = this.getLog(browser, result)
const testName = result.description
@@ -184,6 +187,7 @@ const KarmaKotlinReporter = function (baseReporterDecorator, config, emitter) {
}
this.specSkipped = function (browser, result) {
this.checkBrowserResult(browser)
const log = this.getLog(browser, result)
const testName = result.description
@@ -203,6 +207,12 @@ const KarmaKotlinReporter = function (baseReporterDecorator, config, emitter) {
self.write(formatMessage(BLOCK_CLOSED, 'JavaScript Unit Tests'))
}
this.checkBrowserResult = function(browser) {
if (!this.browserResults[browser.id]) {
initializeBrowser(browser)
}
}
this.getLog = function (browser, result) {
const browserResult = this.browserResults[browser.id]
let suiteName = browser.name