Browse Source

web: workaround flaky CI test runner (#1550)

* web: workaround flaky CI test runner

* Move config path to test-utils/conf/karma.config.common.d

* Reusing same karma config everywhere aprt benchmarks

it looks like we can have only one karma config directory

Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>
Co-authored-by: Shagen Ogandzhanian <shagen.ogandzhanian@jetbrains.com>
pull/1511/head
Oleksandr Karpovich 3 years ago committed by GitHub
parent
commit
046f225846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      web/compose-compiler-integration/build.gradle.kts
  2. 1
      web/core/build.gradle.kts
  3. 1
      web/integration-core/build.gradle.kts
  4. 1
      web/integration-widgets/build.gradle.kts
  5. 1
      web/internal-web-core-runtime/build.gradle.kts
  6. 1
      web/svg/build.gradle.kts
  7. 1
      web/test-utils/build.gradle.kts
  8. 32
      web/test-utils/conf/karma-kotlin-runner-decorator/karma-kotlin-reporter-decorated.js
  9. 4
      web/test-utils/conf/karma.config.common.d/patch.js
  10. 1
      web/widgets/build.gradle.kts

1
web/compose-compiler-integration/build.gradle.kts

@ -9,6 +9,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
}

1
web/core/build.gradle.kts

@ -10,6 +10,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
//useFirefox()
}

1
web/integration-core/build.gradle.kts

@ -19,6 +19,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
}

1
web/integration-widgets/build.gradle.kts

@ -9,6 +9,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
}

1
web/internal-web-core-runtime/build.gradle.kts

@ -9,6 +9,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
}

1
web/svg/build.gradle.kts

@ -9,6 +9,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
}
}

1
web/test-utils/build.gradle.kts

@ -13,6 +13,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
}

32
web/test-utils/conf/karma-kotlin-runner-decorator/karma-kotlin-reporter-decorated.js

@ -0,0 +1,32 @@
// This is a workaround for https://github.com/karma-runner/karma-teamcity-reporter/issues/86
const kotlinReporterModule = require("../../../build/js/packages_imported/kotlin-test-js-runner/1.5.31/karma-kotlin-reporter");
const KotlinReporter = kotlinReporterModule['reporter:karma-kotlin-reporter'][1];
const NewReporter = function(baseReporterDecorator, config, emitter) {
KotlinReporter.call(this, baseReporterDecorator, config, emitter);
const onBrowserLogOriginal = this.onBrowserLog;
const onSpecCompleteOriginal = this.onSpecComplete;
this.onBrowserLog = (browser, log, type) => {
if (!this.browserResults[browser.id]) {
this.initializeBrowser(browser);
}
onBrowserLogOriginal(browser, log, type);
}
this.onSpecComplete = function (browser, result) {
if (!this.browserResults[browser.id]) {
this.initializeBrowser(browser);
}
onSpecCompleteOriginal(browser, result);
}
}
NewReporter.$inject = KotlinReporter.$inject;
module.exports = {
'reporter:karma-kotlin-reporter': ['type', NewReporter]
};

4
web/test-utils/conf/karma.config.common.d/patch.js

@ -0,0 +1,4 @@
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");

1
web/widgets/build.gradle.kts

@ -10,6 +10,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
}

Loading…
Cancel
Save