Browse Source

Kotlin testing reuse (#1562)

pull/1567/head
Shagen Ogandzhanian 3 years ago committed by GitHub
parent
commit
798f0ac1ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      web/build.gradle.kts
  2. 10
      web/buildSrc/build.gradle.kts
  3. 17
      web/buildSrc/src/main/kotlin/karmaconf.kt
  4. 6
      web/compose-compiler-integration/build.gradle.kts
  5. 6
      web/core/build.gradle.kts
  6. 5
      web/integration-core/build.gradle.kts
  7. 6
      web/integration-widgets/build.gradle.kts
  8. 6
      web/internal-web-core-runtime/build.gradle.kts
  9. 5
      web/svg/build.gradle.kts
  10. 6
      web/test-utils/build.gradle.kts
  11. 6
      web/widgets/build.gradle.kts

3
web/build.gradle.kts

@ -1,11 +1,14 @@
import org.gradle.api.tasks.testing.AbstractTestTask
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.compose.gradle.kotlinKarmaConfig
val COMPOSE_WEB_VERSION: String by project
val COMPOSE_REPO_USERNAME: String? by project
val COMPOSE_REPO_KEY: String? by project
val COMPOSE_WEB_BUILD_WITH_SAMPLES = project.property("compose.web.buildSamples")!!.toString().toBoolean()
kotlinKarmaConfig.rootDir = rootProject.rootDir.toString()
apply<jetbrains.compose.web.gradle.SeleniumDriverPlugin>()
fun Project.isSampleProject() = projectDir.parentFile.name == "examples"

10
web/buildSrc/build.gradle.kts

@ -12,3 +12,13 @@ repositories {
plugins {
id("org.jetbrains.kotlin.jvm") version "1.5.31"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31")
}

17
web/buildSrc/src/main/kotlin/karmaconf.kt

@ -0,0 +1,17 @@
package org.jetbrains.compose.gradle
import org.jetbrains.kotlin.gradle.targets.js.testing.karma.KotlinKarma
object kotlinKarmaConfig {
var rootDir: String? = null
}
fun KotlinKarma.standardConf() {
if (kotlinKarmaConfig.rootDir == null) {
throw Exception("kotlinKarmaConfig.rootDir should be set somewhere")
}
useConfigDirectory("${kotlinKarmaConfig.rootDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
}

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

@ -1,3 +1,5 @@
import org.jetbrains.compose.gradle.standardConf
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
@ -9,9 +11,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
standardConf()
}
}
}

6
web/core/build.gradle.kts

@ -1,3 +1,5 @@
import org.jetbrains.compose.gradle.standardConf
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
@ -10,9 +12,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
standardConf()
}
}
}

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

@ -1,3 +1,5 @@
import org.jetbrains.compose.gradle.standardConf
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
@ -19,8 +21,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
standardConf()
useFirefox()
}
}

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

@ -1,3 +1,5 @@
import org.jetbrains.compose.gradle.standardConf
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
@ -9,9 +11,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
standardConf()
}
}
}

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

@ -1,3 +1,5 @@
import org.jetbrains.compose.gradle.standardConf
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
@ -9,9 +11,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
standardConf()
}
}
}

5
web/svg/build.gradle.kts

@ -1,3 +1,5 @@
import org.jetbrains.compose.gradle.standardConf
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
@ -9,8 +11,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
standardConf()
}
}
}

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

@ -1,3 +1,5 @@
import org.jetbrains.compose.gradle.standardConf
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
@ -13,9 +15,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
standardConf()
}
}
}

6
web/widgets/build.gradle.kts

@ -1,3 +1,5 @@
import org.jetbrains.compose.gradle.standardConf
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
@ -10,9 +12,7 @@ kotlin {
browser() {
testTask {
useKarma {
useConfigDirectory("${rootProject.projectDir}/test-utils/conf/karma.config.common.d")
useChromeHeadless()
useFirefox()
standardConf()
}
}
}

Loading…
Cancel
Save