1 /* 2 * Copyright 2017-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 package kotlinx.atomicfu.plugin.gradle 6 7 import org.gradle.testkit.runner.TaskOutcome 8 import org.junit.Test 9 import java.io.File 10 11 class JsProjectTest : BaseKotlinGradleTest() { 12 @Test <lambda>null13 fun testKotlin2JsPlugin() = project("js-simple") { 14 val tasksToCheck = arrayOf( 15 ":compileKotlin2Js", 16 ":compileTestKotlin2Js", 17 ":transformAtomicfuJsFiles", 18 ":transformTestAtomicfuJsFiles" 19 ) 20 21 build("build") { 22 checkOutcomes(TaskOutcome.SUCCESS, *tasksToCheck) 23 24 val testCompileClasspathFiles = projectDir.resolve("build/test_compile_classpath.txt") 25 .readLines().asSequence().flatMap { File(it).walk().filter(File::isFile) }.toHashSet() 26 27 projectDir.resolve("build/classes/kotlin/main/js-simple.js").let { 28 it.checkExists() 29 check(it in testCompileClasspathFiles) { "Original '$it' is missing from test compile classpath" } 30 // todo: check test runtime classpath when js test tasks are supported in plugin 31 } 32 33 projectDir.resolve("build/classes/atomicfu/main/js-simple.js").let { 34 it.checkExists() 35 check(it !in testCompileClasspathFiles) { "Transformed '$it' is present in test compile classpath" } 36 } 37 } 38 39 build("build") { 40 checkOutcomes(TaskOutcome.UP_TO_DATE, *tasksToCheck) 41 } 42 } 43 } 44