Add test for yarn setup by kotlinYarnSetup task

This commit is contained in:
Ilya Goncharov
2019-09-05 14:07:06 +03:00
parent f609e21c82
commit 48c06aeeba
5 changed files with 69 additions and 0 deletions
@@ -1,6 +1,7 @@
package org.jetbrains.kotlin.gradle
import org.gradle.api.logging.LogLevel
import org.gradle.wrapper.GradleUserHomeLookup
import org.jetbrains.kotlin.gradle.tasks.USING_JS_INCREMENTAL_COMPILATION_MESSAGE
import org.jetbrains.kotlin.gradle.util.getFileByName
import org.jetbrains.kotlin.gradle.util.getFilesByNames
@@ -413,4 +414,26 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
assertFileExists("build/js/node_modules/puppeteer/.local-chromium")
}
}
@Test
fun testYarnSetup() = with(Project("yarn-setup", GradleVersionRequired.AtLeast("4.10.2"))) {
setupWorkingDir()
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
gradleSettingsScript().modify(::transformBuildScriptWithPluginsDsl)
GradleUserHomeLookup.gradleUserHome().resolve("yarn").deleteRecursively()
build("kotlinYarnSetup") {
assertSuccessful()
assertTasksExecuted(
":kotlinYarnSetup"
)
assertFileExists(
path = GradleUserHomeLookup.gradleUserHome().resolve("yarn").canonicalPath,
inWorkingDir = false
)
}
}
}
@@ -0,0 +1,27 @@
import org.jetbrains.kotlin.gradle.targets.js.yarn.yarn
plugins {
kotlin("js") version "<pluginMarkerVersion>"
}
group = "com.example"
version = "1.0"
repositories {
mavenLocal()
jcenter()
}
yarn
kotlin.sourceSets {
getByName("main") {
dependencies {
implementation(kotlin("stdlib-js"))
}
}
}
kotlin.target {
nodejs()
}
@@ -0,0 +1 @@
kotlin.tests.individualTaskReports=true
@@ -0,0 +1,8 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
rootProject.name = "yarn-setup"
@@ -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")
}