Skip to content

Commit

Permalink
web: karma runner patch (#1597)
Browse files Browse the repository at this point in the history
* web: karma runner patch

* web: karma runner patch

Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>
  • Loading branch information
eymar and Oleksandr Karpovich authored Dec 15, 2021
1 parent 004e2f2 commit e32ef7b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
// This is a workaround for https://github.com/karma-runner/karma-teamcity-reporter/issues/86

// logger is needed only to log cases when `browser.id` is not in browserResults
const logger = require('../../../build/js/node_modules/karma/lib/logger')

const kotlinReporterModule = require("../../../build/js/packages_imported/kotlin-test-js-runner/1.6.10/karma-kotlin-reporter");

const KotlinReporter = kotlinReporterModule['reporter:karma-kotlin-reporter'][1];

const NewReporter = function(baseReporterDecorator, config, emitter) {
KotlinReporter.call(this, baseReporterDecorator, config, emitter);

const consoleLog = logger.create("NewReporter-KotlinReporter");

const onBrowserLogOriginal = this.onBrowserLog;
const onSpecCompleteOriginal = this.onSpecComplete;
const onBrowserStartOriginal = this.onBrowserStart;


this.onBrowserStart = (browser) => {
consoleLog.info("onBrowserStart: id = " + browser.id);
onBrowserStartOriginal(browser);
}

this.onBrowserLog = (browser, log, type) => {
if (!this.browserResults[browser.id]) {
this.initializeBrowser(browser);
consoleLog.info("onBrowserLog: force onBrowserStart id=" + browser.id);
this.onBrowserStart(browser);
}
onBrowserLogOriginal(browser, log, type);
}

this.onSpecComplete = function (browser, result) {
if (!this.browserResults[browser.id]) {
this.initializeBrowser(browser);
consoleLog.info("onSpecComplete: force onBrowserStart id=" + browser.id);
this.onBrowserStart(browser);
}
onSpecCompleteOriginal(browser, result);
}
Expand Down
3 changes: 2 additions & 1 deletion web/test-utils/conf/karma.config.common.d/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ config.plugins = config.plugins || [];
config.plugins = config.plugins.filter(it => it !== "kotlin-test-js-runner/karma-kotlin-reporter.js");
config.plugins.push("../../../../../test-utils/conf/karma-kotlin-runner-decorator/karma-kotlin-reporter-decorated.js");


config.client.mocha = config.client.mocha || {};
config.client.mocha.timeout = 10000;

config.browserNoActivityTimeout = 10000;
config.browserDisconnectTimeout = 10000;
config.browserDisconnectTolerance = 3;
config.browserConsoleLogOptions = {level: "debug", format: "%b %T: %m", terminal: true};
config.logLevel = config.LOG_DEBUG;

0 comments on commit e32ef7b

Please sign in to comment.