### Filter Diagnostic Messages by Severity Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt Access and filter compilation diagnostic messages by severity level. Use `messagesWithSeverity` to get specific error, warning, or info messages. ```kotlin import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import com.tschuchort.compiletesting.DiagnosticSeverity import com.tschuchort.compiletesting.DiagnosticMessage import org.assertj.core.api.Assertions.assertThat val result = KotlinCompilation().apply { sources = listOf( SourceFile.kotlin("Warnings.kt", """ @Deprecated("Use newMethod instead") fun oldMethod() {} fun caller() { oldMethod() // Should produce deprecation warning } """) ) verbose = true }.compile() // Access all diagnostic messages with severity info val diagnostics: List = result.diagnosticMessages diagnostics.forEach { msg -> println("${msg.severity}: ${msg.message}") } // Filter messages by severity val errors = result.messagesWithSeverity(DiagnosticSeverity.ERROR) val warnings = result.messagesWithSeverity(DiagnosticSeverity.WARNING) val infos = result.messagesWithSeverity(DiagnosticSeverity.INFO) // Check for specific diagnostic assertThat(result.diagnosticMessages).anyMatch { it.severity == DiagnosticSeverity.WARNING && it.message.contains("Deprecated") } // Multiple severity levels val errorsAndWarnings = result.messagesWithSeverity( DiagnosticSeverity.ERROR, DiagnosticSeverity.WARNING ) ``` -------------------------------- ### Create Arbitrary Source File Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt Use `SourceFile.new` to create source files with any extension. This is useful for including arbitrary files in the compilation working directory, such as configuration files or scripts. ```kotlin import com.tschuchort.compiletesting.SourceFile // Create a generic source file val customSource = SourceFile.new( "config.properties", """ app.name=MyApplication app.version=1.0.0 """) // Create Kotlin script file val scriptSource = SourceFile.new( "build.gradle.kts", """ plugins { kotlin("jvm") version "2.0.0" } """) ``` -------------------------------- ### Create Source Files for Compilation Source: https://github.com/zacsweers/kotlin-compile-testing/blob/main/README.md Define Kotlin and Java source files using SourceFile factory methods for use in compilation tests. ```Kotlin class TestEnvClass {} @Test fun `test my annotation processor`() { val kotlinSource = SourceFile.kotlin( "KClass.kt", """ class KClass { fun foo() { // Classes from the test environment are visible to the compiled sources val testEnvClass = TestEnvClass() } } """ ) val javaSource = SourceFile.java( "JClass.java", """ public class JClass { public void bar() { // compiled Kotlin classes are visible to Java sources KClass kClass = new KClass(); } } """ ) } ``` -------------------------------- ### Create Java Source File Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt Use `SourceFile.java` to create Java source files for compilation. The file name must end with `.java`. Automatic indent trimming is enabled by default but can be disabled. ```kotlin import com.tschuchort.compiletesting.SourceFile // Create a simple Java source file val javaSource = SourceFile.java( "MyService.java", """ package com.example; public class MyService { public String process(String input) { return input.toUpperCase(); } } """) // Create Java interface val interfaceSource = SourceFile.java( "Repository.java", """ package com.example; public interface Repository { T findById(long id); void save(T entity); } """) ``` -------------------------------- ### Configure KSP Options Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt Fine-tune KSP behavior with options for incremental processing, logging levels, and custom processor arguments. Use `configureKsp` for detailed settings or direct properties for simpler configurations. ```kotlin import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import com.tschuchort.compiletesting.configureKsp import com.tschuchort.compiletesting.kspIncremental import com.tschuchort.compiletesting.kspAllWarningsAsErrors import com.tschuchort.compiletesting.kspProcessorOptions import com.tschuchort.compiletesting.kspLoggingLevels import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import java.util.EnumSet val compilation = KotlinCompilation().apply { sources = listOf( SourceFile.kotlin("Example.kt", """ @com.example.Generated class Example """) ) inheritClassPath = true configureKsp { // Add processor providers symbolProcessorProviders += MyProcessorProvider() // Incremental processing incremental = true incrementalLog = true // Error handling allWarningsAsErrors = true // Custom processor options (passed to your processors) processorOptions["generateBuilders"] = "true" processorOptions["outputPackage"] = "com.example.generated" // Control logging verbosity loggingLevels = EnumSet.of( CompilerMessageSeverity.ERROR, CompilerMessageSeverity.WARNING, CompilerMessageSeverity.INFO ) } } // Alternative property-based configuration val compilation2 = KotlinCompilation().apply { sources = listOf(/* ... */) inheritClassPath = true kspIncremental = true kspAllWarningsAsErrors = false kspProcessorOptions = mutableMapOf( "debug" to "true", "flavor" to "production" ) } ``` -------------------------------- ### Dependency Versions Source: https://github.com/zacsweers/kotlin-compile-testing/blob/main/CHANGELOG.md List of library dependencies for version 0.2.0. ```text Kotlin (and its associated artifacts) 1.8.0 KSP 1.8.0 Classgraph: 4.8.153 ``` -------------------------------- ### Configure KSP Processors for Compilation Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt Use `configureKsp` to add KSP processor providers. Ensure KSP is correctly set up to process annotations and generate code. ```kotlin import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import com.tschuchort.compiletesting.symbolProcessorProviders import com.tschuchort.compiletesting.kspSourcesDir import com.tschuchort.compiletesting.configureKsp import com.google.devtools.ksp.processing.* import com.google.devtools.ksp.symbol.* import org.assertj.core.api.Assertions.assertThat // Define a KSP processor provider class GeneratorProcessorProvider : SymbolProcessorProvider { override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor { return GeneratorProcessor(environment.codeGenerator, environment.logger) } } class GeneratorProcessor( private val codeGenerator: CodeGenerator, private val logger: KSPLogger ) : SymbolProcessor { override fun process(resolver: Resolver): List { resolver.getSymbolsWithAnnotation("com.example.Generate") .filterIsInstance() .forEach { val packageName = it.packageName.asString() val className = "${it.simpleName.asString()}Impl" codeGenerator.createNewFile( Dependencies(false, it.containingFile!!), packageName, className ).bufferedWriter().use { it.write(""" package $packageName class $className : ${it.simpleName.asString()} { override fun execute() = "Generated implementation" } """.trimIndent()) } logger.info("Generated $className") } return emptyList() } } // Compile with KSP val compilation = KotlinCompilation().apply { sources = listOf( SourceFile.kotlin("Generate.kt", """ package com.example annotation class Generate """, SourceFile.kotlin("Service.kt", """ package com.example @Generate interface Service { fun execute(): String } """) ) inheritClassPath = true configureKsp { symbolProcessorProviders += GeneratorProcessorProvider() } } val result = compilation.compile() assertThat(result.exitCode).isEqualTo(KotlinCompilation.ExitCode.OK) // Check KSP generated sources directory val generatedFiles = compilation.kspSourcesDir.walkTopDown() .filter { it.isFile } .toList() assertThat(generatedFiles.map { it.name }).contains("ServiceImpl.kt") // Load and use generated class val implClass = result.classLoader.loadClass("com.example.ServiceImpl") val instance = implClass.getDeclaredConstructor().newInstance() val method = implClass.getMethod("execute") assertThat(method.invoke(instance)).isEqualTo("Generated implementation") ``` -------------------------------- ### Configure Kotlin Compilation Options Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt Set language version, JVM target, classpath, and output streams for Kotlin compilation. Inherit classpaths from the test environment for convenience. ```kotlin import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import java.io.ByteArrayOutputStream import java.io.File val outputStream = ByteArrayOutputStream() val result = KotlinCompilation().apply { // Source files sources = listOf( SourceFile.kotlin("Main.kt", """ package app fun main() { println("Hello") } """) ) // Kotlin/JVM settings languageVersion = "2.0" apiVersion = "2.0" jvmTarget = "17" // Classpath configuration inheritClassPath = true // Inherit test classpath classpaths = listOf(File("libs/dependency.jar")) // Additional jars // JDK configuration jdkHome = File(System.getProperty("java.home")) // Output and diagnostics verbose = true messageOutputStream = outputStream allWarningsAsErrors = false suppressWarnings = false // Module settings moduleName = "my-module" // Javac arguments for Java compilation step javacArguments = mutableListOf("-Xlint:all") // Additional kotlinc CLI arguments kotlincArguments = listOf("-Xjsr305=strict") // Opt-in annotations optIn = listOf("kotlin.RequiresOptIn", "kotlinx.coroutines.ExperimentalCoroutinesApi") }.compile() // Check compilation messages val messages = outputStream.toString("UTF-8") println("Compilation output: $messages") ``` -------------------------------- ### Configure JVM Arguments for Java 16+ Compatibility (Gradle) Source: https://github.com/zacsweers/kotlin-compile-testing/blob/main/README.md Add these JVM arguments to your test task in build.gradle to resolve Java 16+ access control issues with KAPT. ```Groovy if (JavaVersion.current() >= JavaVersion.VERSION_16) { test { jvmArgs( "--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED") } } ``` -------------------------------- ### Create Kotlin Source File Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt Use `SourceFile.kotlin` to create Kotlin source files for compilation. The file name must end with `.kt`. Automatic indent trimming is enabled by default but can be disabled. ```kotlin import com.tschuchort.compiletesting.SourceFile // Create a simple Kotlin source file val kotlinSource = SourceFile.kotlin( "MyClass.kt", """ package com.example class MyClass { fun greet(): String = "Hello, World!" } """) // Create Kotlin source with package structure in path val packagedSource = SourceFile.kotlin( "com/example/domain/User.kt", """ package com.example.domain data class User(val id: Long, val name: String) """) // Disable automatic indent trimming val rawSource = SourceFile.kotlin( "Formatted.kt", "class Formatted {}", trimIndent = false ) ``` -------------------------------- ### Configure Compilation Parameters Source: https://github.com/zacsweers/kotlin-compile-testing/blob/main/README.md Use KotlinCompilation to set source files, annotation processors, compiler plugins, and classpath inheritance. ```Kotlin val result = KotlinCompilation().apply { sources = listOf(kotlinSource, javaSource) // pass your own instance of an annotation processor annotationProcessors = listOf(MyAnnotationProcessor()) // pass your own instance of a compiler plugin compilerPlugins = listOf(MyComponentRegistrar()) commandLineProcessors = listOf(MyCommandlineProcessor()) inheritClassPath = true messageOutputStream = System.out // see diagnostics in real time }.compile() ``` -------------------------------- ### Compile Kotlin and Java Sources Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt The `KotlinCompilation` class is the main entry point for compiling sources. Configure `sources`, `inheritClassPath`, and other options before calling `compile()`. The result contains the exit code, messages, and compiled classes. ```kotlin import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import org.assertj.core.api.Assertions.assertThat // Basic compilation val result = KotlinCompilation().apply { sources = listOf( SourceFile.kotlin("Example.kt", """ class Example { fun compute(): Int = 42 } """) ) }.compile() assertThat(result.exitCode).isEqualTo(KotlinCompilation.ExitCode.OK) // Compile mixed Kotlin and Java sources val mixedResult = KotlinCompilation().apply { sources = listOf( SourceFile.kotlin("KotlinClass.kt", """ package com.example class KotlinClass { fun process() = JavaHelper.help() } """), SourceFile.java("JavaHelper.java", """ package com.example; public class JavaHelper { public static String help() { return "helped"; } } """ ) ) inheritClassPath = true }.compile() assertThat(mixedResult.exitCode).isEqualTo(KotlinCompilation.ExitCode.OK) ``` -------------------------------- ### Configure Annotation Processing with KAPT Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt Shows how to define a custom annotation processor and register it within the KotlinCompilation configuration. ```kotlin import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import javax.annotation.processing.AbstractProcessor import javax.annotation.processing.RoundEnvironment import javax.lang.model.element.TypeElement import javax.tools.Diagnostic import org.assertj.core.api.Assertions.assertThat // Define a simple annotation processor class LoggingProcessor : AbstractProcessor() { override fun getSupportedAnnotationTypes() = setOf("com.example.Logged") override fun process( annotations: MutableSet, roundEnv: RoundEnvironment ): Boolean { for (element in roundEnv.getElementsAnnotatedWith( processingEnv.elementUtils.getTypeElement("com.example.Logged") )) { processingEnv.messager.printMessage( Diagnostic.Kind.NOTE, "Processing: ${element.simpleName}" ) } return false } } // Compile with annotation processor val result = KotlinCompilation().apply { sources = listOf( SourceFile.kotlin("Logged.kt", """ package com.example annotation class Logged """), SourceFile.kotlin("Service.kt", """ package com.example @Logged class UserService { fun getUser(id: Long) = "User-${'$'}id" } """) ) annotationProcessors = listOf(LoggingProcessor()) inheritClassPath = true }.compile() assertThat(result.exitCode).isEqualTo(KotlinCompilation.ExitCode.OK) assertThat(result.messages).contains("Processing: UserService") // Access generated sources val generatedSources = result.sourcesGeneratedByAnnotationProcessor ``` -------------------------------- ### Add Dependency to Build Gradle Source: https://github.com/zacsweers/kotlin-compile-testing/blob/main/README.md Include the library in your project by adding the dependency to your build.gradle file. ```Groovy dependencies { // ... testImplementation("dev.zacsweers.kctfork:core:>") } ``` -------------------------------- ### Configure JVM Arguments for Java 16+ Compatibility (Kotlin DSL) Source: https://github.com/zacsweers/kotlin-compile-testing/blob/main/README.md Use this Kotlin DSL configuration to add necessary JVM arguments for Java 16+ compatibility in your test tasks. ```Kotlin if (JavaVersion.current() >= JavaVersion.VERSION_16) { tasks.withType().configureEach { jvmArgs( "--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", "--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED") } } ``` -------------------------------- ### Migrate Component Registrars Source: https://github.com/zacsweers/kotlin-compile-testing/blob/main/CHANGELOG.md Update from the deprecated compilerPlugins property to componentRegistrars. ```diff KotlinCompilation().apply { - compilerPlugins = listOf(MyComponentRegistrar()) + componentRegistrars = listOf(MyComponentRegistrar()) } ``` -------------------------------- ### Access JvmCompilationResult properties Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt Demonstrates how to inspect compilation exit codes, compiler messages, and load generated classes using the classLoader. ```kotlin import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import org.assertj.core.api.Assertions.assertThat val source = SourceFile.kotlin("Calculator.kt", """ package math class Calculator { fun add(a: Int, b: Int): Int = a + b fun multiply(a: Int, b: Int): Int = a * b } """) val result = KotlinCompilation().apply { sources = listOf(source) inheritClassPath = true }.compile() // Check exit code assertThat(result.exitCode).isEqualTo(KotlinCompilation.ExitCode.OK) // Access compiler messages println(result.messages) // Load compiled class via classLoader val calculatorClass = result.classLoader.loadClass("math.Calculator") val instance = calculatorClass.getDeclaredConstructor().newInstance() // Invoke methods via reflection val addMethod = calculatorClass.getMethod("add", Int::class.java, Int::class.java) val sum = addMethod.invoke(instance, 5, 3) assertThat(sum).isEqualTo(8) // Check generated files assertThat(result.compiledClassAndResourceFiles.map { it.name }) .contains("Calculator.class") // Access output directory val outputDir = result.outputDirectory assertThat(outputDir.resolve("math/Calculator.class")).exists() ``` -------------------------------- ### Multi-Step Compilation with addPreviousResultToClasspath Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt Chain multiple compilations where the output of one is used as input for the next. This is useful for testing code that depends on previously compiled artifacts. Ensure `inheritClassPath` is true for both compilations. ```kotlin import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import com.tschuchort.compiletesting.addPreviousResultToClasspath import org.assertj.core.api.Assertions.assertThat // Step 1: Compile base interface val baseResult = KotlinCompilation().apply { sources = listOf( SourceFile.kotlin("Base.kt", """ package base interface Repository { fun findById(id: Long): T? fun save(entity: T) } """) ) inheritClassPath = true }.compile() assertThat(baseResult.exitCode).isEqualTo(KotlinCompilation.ExitCode.OK) // Step 2: Compile implementation that depends on base val implResult = KotlinCompilation().apply { sources = listOf( SourceFile.kotlin("UserRepository.kt", """ package impl import base.Repository data class User(val id: Long, val name: String) class UserRepository : Repository { private val storage = mutableMapOf() override fun findById(id: Long): User? = storage[id] override fun save(entity: User) { storage[entity.id] = entity } } """) ) inheritClassPath = true } .addPreviousResultToClasspath(baseResult) // Add base compilation output .compile() assertThat(implResult.exitCode).isEqualTo(KotlinCompilation.ExitCode.OK) // Load and test the implementation val repoClass = implResult.classLoader.loadClass("impl.UserRepository") val userClass = implResult.classLoader.loadClass("impl.User") ``` -------------------------------- ### Configure Kotlin Compilation with KSP Processors Source: https://github.com/zacsweers/kotlin-compile-testing/blob/main/README.md Use this Kotlin code to set up a compilation task with custom KSP symbol processor providers. ```Kotlin class MySymbolProcessorProvider : SymbolProcessorProvider { // implementation of the SymbolProcessorProvider from the KSP API } val compilation = KotlinCompilation().apply { sources = listOf(source) symbolProcessorProviders = listOf(MySymbolProcessorProvider()) } val result = compilation.compile() ``` -------------------------------- ### Register Custom Compiler Plugins Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt Register custom compiler plugins and command line processors using `compilerPluginRegistrars` and `commandLineProcessors`. This allows modification of compilation behavior or addition of custom phases. ```kotlin import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import com.tschuchort.compiletesting.PluginOption import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import org.jetbrains.kotlin.compiler.plugin.CliOption import org.jetbrains.kotlin.config.CompilerConfiguration import org.assertj.core.api.Assertions.assertThat @OptIn(ExperimentalCompilerApi::class) class MyCommandLineProcessor : CommandLineProcessor { override val pluginId = "com.example.myplugin" override val pluginOptions = listOf( CliOption("enabled", "", "Enable the plugin") ) } @OptIn(ExperimentalCompilerApi::class) class MyCompilerPluginRegistrar : CompilerPluginRegistrar() { override val supportsK2 = true override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) { // Register compiler extensions here println("Plugin registered!") } } val result = KotlinCompilation().apply { sources = listOf( SourceFile.kotlin("App.kt", """ class App { fun run() = "Running" } """) ) compilerPluginRegistrars = listOf(MyCompilerPluginRegistrar()) commandLineProcessors = listOf(MyCommandLineProcessor()) pluginOptions = listOf( PluginOption("com.example.myplugin", "enabled", "true") ) inheritClassPath = true }.compile() assertThat(result.exitCode).isEqualTo(KotlinCompilation.ExitCode.OK) ``` -------------------------------- ### Add KSP Dependency for Kotlin Compile Testing Source: https://github.com/zacsweers/kotlin-compile-testing/blob/main/README.md Include this dependency in your build.gradle file to enable KSP processor testing. ```Groovy dependencies { testImplementation("dev.zacsweers.kctfork:ksp:>") } ``` -------------------------------- ### Assert Compilation Results Source: https://github.com/zacsweers/kotlin-compile-testing/blob/main/README.md Verify compilation exit codes, inspect diagnostic messages, and use reflection to validate generated classes. ```Kotlin assertThat(result.exitCode).isEqualTo(ExitCode.OK) // Test diagnostic output of compiler assertThat(result.messages).contains("My annotation processor was called") // Load compiled classes and inspect generated code through reflection val kClazz = result.classLoader.loadClass("KClass") assertThat(kClazz).hasDeclaredMethods("foo") ``` -------------------------------- ### Register Compiler Plugin Registrar Source: https://github.com/zacsweers/kotlin-compile-testing/blob/main/CHANGELOG.md Use the compilerPluginRegistrars property to add instances of the new entrypoint API for compiler plugins. ```kotlin KotlinCompilation().apply { compilerPluginRegistrars = listOf(MyCompilerPluginRegistrar()) } ``` -------------------------------- ### Kotlin/JS Compilation with IR Backend Source: https://context7.com/zacsweers/kotlin-compile-testing/llms.txt Compile Kotlin code to JavaScript using the Kotlin/JS compiler with the IR backend. Configure options like `irProduceJs`, `irDce`, `moduleName`, and `generateDts` for desired output. ```kotlin import com.tschuchort.compiletesting.KotlinJsCompilation import com.tschuchort.compiletesting.SourceFile import org.assertj.core.api.Assertions.assertThat val result = KotlinJsCompilation().apply { sources = listOf( SourceFile.kotlin("App.kt", """ fun greet(name: String): String { return "Hello, ${'$'}name!" } fun main() { console.log(greet("World")) } """) ) // IR backend options irProduceJs = true // Generate JS files irProduceKlibFile = false // Don't produce klib irDce = true // Enable dead code elimination // Module configuration moduleName = "my-app" irModuleName = "my-app" // TypeScript declarations generateDts = true inheritClassPath = true }.compile() assertThat(result.exitCode).isEqualTo(KotlinJsCompilation.ExitCode.OK) // Access generated JS files val jsFiles = result.jsFiles jsFiles.forEach { file -> println("Generated: ${file.name}") if (file.extension == "js") { println(file.readText().take(500)) } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.