diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt index c45cc27b282..60d59d49240 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.js.test +import org.jetbrains.kotlin.backend.common.phaser.AnyNamedPhase import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig import org.jetbrains.kotlin.backend.common.phaser.toPhaseMap import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport @@ -118,8 +119,8 @@ abstract class BasicIrBoxTest( PhaseConfig( jsPhases, dumpToDirectory = dumpOutputDir.path, - toDumpStateAfter = allPhasesSet, - toValidateStateAfter = allPhasesSet, + toDumpStateAfter = fromSysPropertyOrAll("kotlin.js.test.phasesToDumpAfter", allPhasesSet), + toValidateStateAfter = fromSysPropertyOrAll("kotlin.js.test.phasesToValidateAfter", allPhasesSet), dumpOnlyFqName = null ) } else { @@ -188,6 +189,13 @@ abstract class BasicIrBoxTest( } } + private fun fromSysPropertyOrAll(key: String, all: Set): Set { + val phases = System.getProperty(key)?.split(',')?.toSet() ?: emptySet() + if (phases.isEmpty()) return all + + return all.filter { it.name in phases }.toSet() + } + private fun JsCode.writeTo(outputFile: File, config: JsConfig) { val wrappedCode = wrapWithModuleEmulationMarkers(mainModule, moduleId = config.moduleId, moduleKind = config.moduleKind)