aboutsummaryrefslogtreecommitdiff
path: root/atomicfu-gradle-plugin/src/test/kotlin/kotlinx/atomicfu/plugin/gradle/test/JsProjectTest.kt
blob: 0b349555de154e9b65855def73b04bec5eecf454 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package kotlinx.atomicfu.plugin.gradle.test

import kotlinx.atomicfu.plugin.gradle.internal.*
import kotlinx.atomicfu.plugin.gradle.internal.BaseKotlinScope
import org.junit.Test

/**
 * Test that ensures correctness of `atomicfu-gradle-plugin` application to the JS project:
 * - post-compilation js transformation tasks are created
 *   (legacy transformation is tested here, compiler plugin is not applied).
 * - original non-transformed classes are not left in compile/runtime classpath.
 */
class JsLegacyTransformationTest : BaseKotlinGradleTest("js-simple") {

    override fun BaseKotlinScope.createProject() {
        buildGradleKts {
            resolve("projects/js-simple/js-simple.gradle.kts")
        }
        settingsGradleKts {
            resolve("projects/js-simple/settings.gradle.kts")
        }
        dir("src/main/kotlin") {}
        kotlin("IntArithmetic.kt", "main") {
            resolve("projects/js-simple/src/main/kotlin/IntArithmetic.kt")
        }
        dir("src/test/kotlin") {}
        kotlin("ArithmeticTest.kt", "test") {
            resolve("projects/js-simple/src/test/kotlin/ArithmeticTest.kt")
        }
    }

    @Test
    fun testPluginApplication() =
        checkTaskOutcomes(
            executedTasks = listOf(
                ":compileKotlinJs",
                ":transformJsMainAtomicfu",
                ":compileTestKotlinJs",
                ":transformJsTestAtomicfu"
            ),
            excludedTasks = emptyList()
        )

    @Test
    fun testClasspath() {
        runner.build()
        checkJsCompilationClasspath()
    }
}