blob: 2201199b8f23646709f8791ff5c9a662fa6b9ced (
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
|
/*
* Copyright 2017-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package kotlinx.atomicfu.plugin.gradle
import org.gradle.testkit.runner.TaskOutcome
import org.junit.Test
import java.io.File
class JsProjectTest : BaseKotlinGradleTest() {
@Test
fun testKotlin2JsPlugin() = project("js-simple") {
val tasksToCheck = arrayOf(
":compileKotlin2Js",
":compileTestKotlin2Js",
":transformAtomicfuJsFiles",
":transformTestAtomicfuJsFiles"
)
build("build") {
checkOutcomes(TaskOutcome.SUCCESS, *tasksToCheck)
val testCompileClasspathFiles = projectDir.resolve("build/test_compile_classpath.txt")
.readLines().asSequence().flatMap { File(it).walk().filter(File::isFile) }.toHashSet()
projectDir.resolve("build/classes/kotlin/main/js-simple.js").let {
it.checkExists()
check(it in testCompileClasspathFiles) { "Original '$it' is missing from test compile classpath" }
// todo: check test runtime classpath when js test tasks are supported in plugin
}
projectDir.resolve("build/classes/atomicfu/main/js-simple.js").let {
it.checkExists()
check(it !in testCompileClasspathFiles) { "Transformed '$it' is present in test compile classpath" }
}
}
build("build") {
checkOutcomes(TaskOutcome.UP_TO_DATE, *tasksToCheck)
}
}
}
|