[Gradle, JS] Add test on simple js binary library
^KT-41566 fixed
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
|
import org.jetbrains.kotlin.gradle.util.modify
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
class KotlinJsIrLibraryGradlePluginIT : BaseGradleIT() {
|
||||||
|
override fun defaultBuildOptions(): BuildOptions =
|
||||||
|
super.defaultBuildOptions().copy(
|
||||||
|
jsIrBackend = true,
|
||||||
|
jsCompilerType = KotlinJsCompilerType.IR
|
||||||
|
)
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testSimpleJsBinaryLibrary() {
|
||||||
|
val project = Project("js-library")
|
||||||
|
|
||||||
|
project.setupWorkingDir()
|
||||||
|
project.gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||||
|
project.build("build") {
|
||||||
|
assertSuccessful()
|
||||||
|
|
||||||
|
assertFileExists("build/productionLibrary/js-library.js")
|
||||||
|
assertFileExists("build/productionLibrary/package.json")
|
||||||
|
assertFileExists("build/productionLibrary/main.js")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
plugins {
|
||||||
|
kotlin("js") version "<pluginMarkerVersion>"
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "com.example"
|
||||||
|
version = "1.0"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
js {
|
||||||
|
binaries.library()
|
||||||
|
nodejs()
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "js-library"
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.example
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
println("Hello, Yarn")
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
console.log("hello")
|
||||||
Reference in New Issue
Block a user