[Test] Provide utility for registering idea properties for proper test run
In Kotlin project they are set up automatically, but outside they should be set manually via build system or test framework
This commit is contained in:
committed by
teamcity
parent
afad6a564a
commit
a45cc17b1c
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.test
|
||||
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* For proper initialization of idea services those two properties should
|
||||
* be set in environment of test. You can setup them manually via build
|
||||
* system of run configurations or just `initIdeaConfiguration` before
|
||||
* running tests using abilities of core test framework you use
|
||||
*/
|
||||
fun initIdeaConfiguration() {
|
||||
System.setProperty("idea.home", computeHomeDirectory())
|
||||
System.setProperty("idea.ignore.disabled.plugins", "true")
|
||||
}
|
||||
|
||||
private fun computeHomeDirectory(): String {
|
||||
val userDir = System.getProperty("user.dir")
|
||||
return File(userDir ?: ".").canonicalPath
|
||||
}
|
||||
Reference in New Issue
Block a user