[Gradle, JS] Add test with dynamic webpack.config.d

This commit is contained in:
Ilya Goncharov
2021-05-27 17:00:53 +03:00
committed by teamcityserver
parent 01c14a709a
commit 157046153f
4 changed files with 65 additions and 0 deletions
@@ -830,4 +830,20 @@ abstract class AbstractKotlin2JsGradlePluginIT(val irBackend: Boolean) : BaseGra
}
}
}
@Test
fun testDynamicWebpackConfigD() {
with(Project("js-dynamic-webpack-config-d")) {
setupWorkingDir()
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
build(
"build"
) {
assertSuccessful()
assertFileExists("build/js/packages/js-dynamic-webpack-config-d")
assertFileContains("build/js/packages/js-dynamic-webpack-config-d/webpack.config.js", "// hello from patch.js")
}
}
}
}
@@ -0,0 +1,36 @@
plugins {
kotlin("js") version "<pluginMarkerVersion>"
}
group = "com.example"
version = "1.0"
repositories {
mavenLocal()
mavenCentral()
}
kotlin {
js {
binaries.executable()
browser()
}
}
tasks.register("foo") {
doLast {
val dir = projectDir.resolve("webpack.config.d")
dir.mkdirs()
val file = dir.resolve("patch.js")
file.createNewFile()
file.writeText("// hello from patch.js")
}
}
tasks.named("browserTest") {
enabled = false
}
tasks.withType<org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack> {
dependsOn("foo")
}
@@ -0,0 +1,8 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
rootProject.name = "js-dynamic-webpack-config-d"
@@ -0,0 +1,5 @@
package com.example
fun main() {
println("Hello, Webpack")
}