[Gradle, JS] Add test on simple js binary library

^KT-41566 fixed
This commit is contained in:
Ilya Goncharov
2020-08-31 15:51:40 +03:00
parent 9f04d353a0
commit 4a1bccc1e6
5 changed files with 70 additions and 0 deletions
@@ -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")
}
}
}
@@ -0,0 +1,18 @@
plugins {
kotlin("js") version "<pluginMarkerVersion>"
}
group = "com.example"
version = "1.0"
repositories {
mavenLocal()
jcenter()
}
kotlin {
js {
binaries.library()
nodejs()
}
}
@@ -0,0 +1,8 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
rootProject.name = "js-library"
@@ -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")
}