KT-15120 Gradle JS test compile task doesn't pick up production code
This commit is contained in:
+20
-4
@@ -15,9 +15,9 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
||||
assertReportExists()
|
||||
|
||||
assertContains(
|
||||
":libraryProject:jarSources\n",
|
||||
":mainProject:compileKotlin2Js\n",
|
||||
":libraryProject:compileKotlin2Js\n"
|
||||
":libraryProject:jarSources",
|
||||
":mainProject:compileKotlin2Js",
|
||||
":libraryProject:compileKotlin2Js"
|
||||
)
|
||||
|
||||
listOf("mainProject/web/js/app.js",
|
||||
@@ -75,6 +75,23 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCompileTestCouldAccessProduction() {
|
||||
val project = Project("kotlin2JsProjectWithTests", "2.10")
|
||||
|
||||
project.build("build") {
|
||||
assertSuccessful()
|
||||
|
||||
assertContains(
|
||||
":compileKotlin2Js",
|
||||
":compileTestKotlin2Js"
|
||||
)
|
||||
|
||||
assertFileExists("build/kotlin2js/main/module.js")
|
||||
assertFileExists("build/kotlin2js/test/module-tests.js")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testKotlinJsBuiltins() {
|
||||
val project = Project("kotlinBuiltins", "3.2")
|
||||
@@ -90,4 +107,3 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin2js'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-js-library:$kotlin_version"
|
||||
}
|
||||
|
||||
task jarSources(type: Jar) {
|
||||
from sourceSets.main.allSource
|
||||
classifier = 'source'
|
||||
}
|
||||
artifacts {
|
||||
compile jarSources
|
||||
}
|
||||
|
||||
compileKotlin2Js.kotlinOptions.outputFile = "${buildDir}/kotlin2js/main/module.js"
|
||||
compileTestKotlin2Js.kotlinOptions.outputFile = "${buildDir}/kotlin2js/test/module-tests.js"
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package example
|
||||
|
||||
class MyProductionClass {
|
||||
var i = 0
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package test
|
||||
|
||||
import org.junit.Test
|
||||
import example.MyProductionClass
|
||||
|
||||
class MyTest {
|
||||
@Test
|
||||
fun mySimpleTest() {
|
||||
MyProductionClass().i = 10
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user