[Gradle, JS] Move KJS configuration cache tests to other KJS tests

Previously some JS IR tasks weren't covered by tests
#KT-45745 In Progress
#KT-49253 In Progress
This commit is contained in:
Alexander Likhachev
2021-11-18 21:52:29 +03:00
parent f48e8dd35e
commit 32839c7ba2
4 changed files with 46 additions and 53 deletions
@@ -127,36 +127,6 @@ class ConfigurationCacheIT : AbstractConfigurationCacheIT() {
}
}
@DisplayName("instant execution is working for JS project")
@GradleTest
fun testInstantExecutionForJs(gradleVersion: GradleVersion) {
project("instantExecutionToJs", gradleVersion) {
testConfigurationCacheOf(
"assemble",
executedTaskNames = listOf(":compileKotlinJs")
)
}
}
@DisplayName("is working for JS project")
@GradleTest
fun testConfigurationCacheJsPlugin(gradleVersion: GradleVersion) {
project("kotlin-js-browser-project", gradleVersion) {
buildGradleKts.modify(::transformBuildScriptWithPluginsDsl)
testConfigurationCacheOf(
":app:build",
executedTaskNames = listOf(
":app:packageJson",
":app:publicPackageJson",
":app:compileKotlinJs",
":app:processDceKotlinJs",
":app:browserProductionWebpack",
)
)
}
}
@DisplayName("works with Dukat")
@GradleTest
fun testConfigurationCacheDukatSrc(gradleVersion: GradleVersion) {
@@ -200,19 +170,6 @@ class ConfigurationCacheIT : AbstractConfigurationCacheIT() {
}
}
}
@DisplayName("KT-48241: works in JS with test dependencies")
@GradleTest
fun testConfigurationCacheJsWithTestDependencies(gradleVersion: GradleVersion) {
project("kotlin-js-project-with-test-dependencies", gradleVersion) {
buildGradleKts.modify(::transformBuildScriptWithPluginsDsl)
testConfigurationCacheOf(
"assemble",
executedTaskNames = listOf(":kotlinNpmInstall")
)
}
}
}
@SimpleGradlePluginTests
@@ -380,7 +380,7 @@ abstract class AbstractKotlin2JsGradlePluginIT(protected val irBackend: Boolean)
jsCompilerType = if (irBackend) KotlinJsCompilerType.IR else KotlinJsCompilerType.LEGACY,
)
override val defaultBuildOptions =
final override val defaultBuildOptions =
super.defaultBuildOptions.copy(
jsOptions = defaultJsOptions,
warningMode = WarningMode.Summary
@@ -1015,6 +1015,38 @@ abstract class AbstractKotlin2JsGradlePluginIT(protected val irBackend: Boolean)
}
}
@DisplayName("configuration cache is working for kotlin2js plugin")
@GradleTest
fun testConfigurationCache(gradleVersion: GradleVersion) {
project("instantExecutionToJs", gradleVersion) {
assertSimpleConfigurationCacheScenarioWorks(
"assemble",
buildOptions = defaultBuildOptions.withConfigurationCache,
executedTaskNames = listOf(":compileKotlinJs")
)
}
}
@DisplayName("configuration cache is working for kotlin/js browser project")
@GradleTest
fun testConfigurationCacheBrowser(gradleVersion: GradleVersion) {
project("kotlin-js-browser-project", gradleVersion) {
buildGradleKts.modify(::transformBuildScriptWithPluginsDsl)
assertSimpleConfigurationCacheScenarioWorks(
":app:build",
buildOptions = defaultBuildOptions.withConfigurationCache,
executedTaskNames = listOf(
":app:packageJson",
":app:publicPackageJson",
":app:compileKotlinJs",
if (irBackend) ":app:compileProductionExecutableKotlinJs" else ":app:processDceKotlinJs",
":app:browserProductionWebpack",
)
)
}
}
private fun TestProject.getSubprojectPackageJson(subProject: String, projectName: String? = null) =
projectPath.resolve("build/js/packages/${projectName ?: projectName}-$subProject")
.resolve(NpmProject.PACKAGE_JSON)
@@ -1084,4 +1116,16 @@ class GeneralKotlin2JsGradlePluginIT : KGPBaseTest() {
}
}
}
@DisplayName("KT-48241: configuration cache works with test dependencies")
@GradleTest
fun testConfigurationCacheJsWithTestDependencies(gradleVersion: GradleVersion) {
project("kotlin-js-project-with-test-dependencies", gradleVersion) {
assertSimpleConfigurationCacheScenarioWorks(
"assemble",
buildOptions = defaultBuildOptions.withConfigurationCache,
executedTaskNames = listOf(":kotlinNpmInstall")
)
}
}
}
@@ -1,5 +1,5 @@
plugins {
kotlin("js").version("<pluginMarkerVersion>")
kotlin("js")
}
group = "com.example"
@@ -1,8 +0,0 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
rootProject.name = "kotlin-js-project-with-test-dependencies"