Add test for yarn setup by kotlinYarnSetup task
This commit is contained in:
+23
@@ -1,6 +1,7 @@
|
|||||||
package org.jetbrains.kotlin.gradle
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
import org.gradle.api.logging.LogLevel
|
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.tasks.USING_JS_INCREMENTAL_COMPILATION_MESSAGE
|
||||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||||
import org.jetbrains.kotlin.gradle.util.getFilesByNames
|
import org.jetbrains.kotlin.gradle.util.getFilesByNames
|
||||||
@@ -413,4 +414,26 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
assertFileExists("build/js/node_modules/puppeteer/.local-chromium")
|
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
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+27
@@ -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()
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
kotlin.tests.individualTaskReports=true
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "yarn-setup"
|
||||||
+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")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user