KJS: write minification's test results to separate directory
It allows excluding this directory from indexing inside IDEA and probably simplifies the main workflow.
This commit is contained in:
+2
-1
@@ -18,7 +18,8 @@ workspace.xml
|
|||||||
/ultimate/ideaSDK
|
/ultimate/ideaSDK
|
||||||
/ultimate/out
|
/ultimate/out
|
||||||
/ultimate/tmp
|
/ultimate/tmp
|
||||||
/js/js.translator/testData/**/out/
|
/js/js.translator/testData/out/
|
||||||
|
/js/js.translator/testData/out-min/
|
||||||
.gradle/
|
.gradle/
|
||||||
build/
|
build/
|
||||||
!**/src/**/build
|
!**/src/**/build
|
||||||
|
|||||||
@@ -74,13 +74,17 @@ import java.util.regex.Pattern
|
|||||||
|
|
||||||
abstract class BasicBoxTest(
|
abstract class BasicBoxTest(
|
||||||
protected val pathToTestDir: String,
|
protected val pathToTestDir: String,
|
||||||
private val pathToOutputDir: String,
|
testGroupOutputDirPrefix: String,
|
||||||
|
pathToRootOutputDir: String = BasicBoxTest.TEST_DATA_DIR_PATH,
|
||||||
private val typedArraysEnabled: Boolean = true,
|
private val typedArraysEnabled: Boolean = true,
|
||||||
private val generateSourceMap: Boolean = false,
|
private val generateSourceMap: Boolean = false,
|
||||||
private val generateNodeJsRunner: Boolean = true
|
private val generateNodeJsRunner: Boolean = true
|
||||||
) : KotlinTestWithEnvironment() {
|
) : KotlinTestWithEnvironment() {
|
||||||
val additionalCommonFileDirectories = mutableListOf<String>()
|
val additionalCommonFileDirectories = mutableListOf<String>()
|
||||||
|
|
||||||
|
private val testGroupOutputDirForCompilation = File(pathToRootOutputDir + "out/" + testGroupOutputDirPrefix)
|
||||||
|
private val testGroupOutputDirForMinification = File(pathToRootOutputDir + "out-min/" + testGroupOutputDirPrefix)
|
||||||
|
|
||||||
protected open fun getOutputPrefixFile(testFilePath: String): File? = null
|
protected open fun getOutputPrefixFile(testFilePath: String): File? = null
|
||||||
protected open fun getOutputPostfixFile(testFilePath: String): File? = null
|
protected open fun getOutputPostfixFile(testFilePath: String): File? = null
|
||||||
|
|
||||||
@@ -196,8 +200,9 @@ abstract class BasicBoxTest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val outputDirForMinification = getOutputDir(file, testGroupOutputDirForMinification)
|
||||||
minifyAndRun(
|
minifyAndRun(
|
||||||
workDir = File(File(outputDir, "min"), file.nameWithoutExtension),
|
workDir = File(outputDirForMinification, file.nameWithoutExtension),
|
||||||
allJsFiles = allJsFiles,
|
allJsFiles = allJsFiles,
|
||||||
generatedJsFiles = generatedJsFiles,
|
generatedJsFiles = generatedJsFiles,
|
||||||
expectedResult = expectedResult,
|
expectedResult = expectedResult,
|
||||||
@@ -254,13 +259,13 @@ abstract class BasicBoxTest(
|
|||||||
return sb.toString()
|
return sb.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun getOutputDir(file: File): File {
|
protected fun getOutputDir(file: File, testGroupOutputDir: File = testGroupOutputDirForCompilation): File {
|
||||||
val stopFile = File(pathToTestDir)
|
val stopFile = File(pathToTestDir)
|
||||||
return generateSequence(file.parentFile) { it.parentFile }
|
return generateSequence(file.parentFile) { it.parentFile }
|
||||||
.takeWhile { it != stopFile }
|
.takeWhile { it != stopFile }
|
||||||
.map { it.name }
|
.map { it.name }
|
||||||
.toList().asReversed()
|
.toList().asReversed()
|
||||||
.fold(File(pathToOutputDir), ::File)
|
.fold(testGroupOutputDir, ::File)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun TestModule.outputFileSimpleName(): String {
|
private fun TestModule.outputFileSimpleName(): String {
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ import java.io.File
|
|||||||
|
|
||||||
abstract class AbstractOutputPrefixPostfixTest : BasicBoxTest(
|
abstract class AbstractOutputPrefixPostfixTest : BasicBoxTest(
|
||||||
BasicBoxTest.TEST_DATA_DIR_PATH + "outputPrefixPostfix/",
|
BasicBoxTest.TEST_DATA_DIR_PATH + "outputPrefixPostfix/",
|
||||||
"${BasicBoxTest.TEST_DATA_DIR_PATH}/out/outputPrefixPostfix/",
|
"outputPrefixPostfix/",
|
||||||
generateNodeJsRunner = false
|
generateNodeJsRunner = false
|
||||||
) {
|
) {
|
||||||
override fun getOutputPrefixFile(testFilePath: String): File? {
|
override fun getOutputPrefixFile(testFilePath: String): File? {
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import javax.script.ScriptException
|
|||||||
|
|
||||||
abstract class AbstractWebDemoExamplesTest(relativePath: String) : BasicBoxTest(
|
abstract class AbstractWebDemoExamplesTest(relativePath: String) : BasicBoxTest(
|
||||||
BasicBoxTest.TEST_DATA_DIR_PATH + "/$relativePath/",
|
BasicBoxTest.TEST_DATA_DIR_PATH + "/$relativePath/",
|
||||||
BasicBoxTest.TEST_DATA_DIR_PATH + "out/$relativePath/",
|
relativePath,
|
||||||
generateNodeJsRunner = false
|
generateNodeJsRunner = false
|
||||||
) {
|
) {
|
||||||
override fun runGeneratedCode(
|
override fun runGeneratedCode(
|
||||||
|
|||||||
@@ -21,7 +21,10 @@ import org.jetbrains.kotlin.js.test.NashornJsTestChecker
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.script.ScriptException
|
import javax.script.ScriptException
|
||||||
|
|
||||||
class MultiModuleOrderTest : BasicBoxTest("$TEST_DATA_DIR_PATH/multiModuleOrder/cases/", "$TEST_DATA_DIR_PATH/multiModuleOrder/out/") {
|
private val testGroupDir = "multiModuleOrder/"
|
||||||
|
private val pathToTestGroupDir = BasicBoxTest.TEST_DATA_DIR_PATH + testGroupDir
|
||||||
|
|
||||||
|
class MultiModuleOrderTest : BasicBoxTest(pathToTestGroupDir, testGroupDir) {
|
||||||
fun testPlain() {
|
fun testPlain() {
|
||||||
runTest("plain")
|
runTest("plain")
|
||||||
}
|
}
|
||||||
@@ -31,7 +34,7 @@ class MultiModuleOrderTest : BasicBoxTest("$TEST_DATA_DIR_PATH/multiModuleOrder/
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun runTest(name: String) {
|
fun runTest(name: String) {
|
||||||
val fullPath = "$TEST_DATA_DIR_PATH/multiModuleOrder/cases/$name.kt"
|
val fullPath = pathToTestGroupDir + "$name.kt"
|
||||||
doTest(fullPath)
|
doTest(fullPath)
|
||||||
checkWrongOrderReported(fullPath, name)
|
checkWrongOrderReported(fullPath, name)
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.js.test.BasicBoxTest
|
|||||||
|
|
||||||
abstract class BorrowedInlineTest(relativePath: String) : BasicBoxTest(
|
abstract class BorrowedInlineTest(relativePath: String) : BasicBoxTest(
|
||||||
"compiler/testData/codegen/boxInline/$relativePath",
|
"compiler/testData/codegen/boxInline/$relativePath",
|
||||||
"${BasicBoxTest.TEST_DATA_DIR_PATH}/out/codegen/boxInline/$relativePath/"
|
"codegen/boxInline/$relativePath"
|
||||||
) {
|
) {
|
||||||
init {
|
init {
|
||||||
additionalCommonFileDirectories += BasicBoxTest.TEST_DATA_DIR_PATH + relativePath + "/_commonFiles/"
|
additionalCommonFileDirectories += BasicBoxTest.TEST_DATA_DIR_PATH + relativePath + "/_commonFiles/"
|
||||||
@@ -41,25 +41,25 @@ abstract class AbstractInlineDefaultValuesTests : BorrowedInlineTest("defaultVal
|
|||||||
|
|
||||||
abstract class AbstractBoxJsTest : BasicBoxTest(
|
abstract class AbstractBoxJsTest : BasicBoxTest(
|
||||||
BasicBoxTest.TEST_DATA_DIR_PATH + "box/",
|
BasicBoxTest.TEST_DATA_DIR_PATH + "box/",
|
||||||
BasicBoxTest.TEST_DATA_DIR_PATH + "out/box/"
|
"box/"
|
||||||
) {
|
) {
|
||||||
override val runMinifierByDefault: Boolean = true
|
override val runMinifierByDefault: Boolean = true
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class AbstractJsCodegenBoxTest : BasicBoxTest(
|
abstract class AbstractJsCodegenBoxTest : BasicBoxTest(
|
||||||
"compiler/testData/codegen/box/",
|
"compiler/testData/codegen/box/",
|
||||||
BasicBoxTest.TEST_DATA_DIR_PATH + "out/codegen/box/"
|
"codegen/box/"
|
||||||
)
|
)
|
||||||
|
|
||||||
abstract class AbstractJsLegacyPrimitiveArraysBoxTest : BasicBoxTest(
|
abstract class AbstractJsLegacyPrimitiveArraysBoxTest : BasicBoxTest(
|
||||||
"compiler/testData/codegen/box/arrays/",
|
"compiler/testData/codegen/box/arrays/",
|
||||||
BasicBoxTest.TEST_DATA_DIR_PATH + "out/codegen/box/arrays-legacy-primitivearrays/",
|
"codegen/box/arrays-legacy-primitivearrays/",
|
||||||
typedArraysEnabled = false
|
typedArraysEnabled = false
|
||||||
)
|
)
|
||||||
|
|
||||||
abstract class AbstractSourceMapGenerationSmokeTest : BasicBoxTest(
|
abstract class AbstractSourceMapGenerationSmokeTest : BasicBoxTest(
|
||||||
BasicBoxTest.TEST_DATA_DIR_PATH + "sourcemap/",
|
BasicBoxTest.TEST_DATA_DIR_PATH + "sourcemap/",
|
||||||
"${BasicBoxTest.TEST_DATA_DIR_PATH}/out/sourcemap/",
|
"sourcemap/",
|
||||||
generateSourceMap = true,
|
generateSourceMap = true,
|
||||||
generateNodeJsRunner = false
|
generateNodeJsRunner = false
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user