From 346ea5243e1a7de64b1fd9c60527903b245b2938 Mon Sep 17 00:00:00 2001 From: "Pouria.Derakhshanfar" Date: Thu, 17 Oct 2024 12:54:22 +0200 Subject: [PATCH] Fix the case that all compilation errors lead to the plugin error --- .../research/testspark/core/test/java/JavaTestCompiler.kt | 2 +- .../research/testspark/core/test/kotlin/KotlinTestCompiler.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/java/JavaTestCompiler.kt b/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/java/JavaTestCompiler.kt index 4486eac52..fb2bd055c 100644 --- a/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/java/JavaTestCompiler.kt +++ b/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/java/JavaTestCompiler.kt @@ -59,7 +59,7 @@ class JavaTestCompiler( logger.info { "Exit code: '${executionResult.exitCode}'; Execution message: '${executionResult.executionMessage}'" } val classFilePath = path.replace(".java", ".class") - if (!File(classFilePath).exists()) { + if (executionResult.exitCode == 0 && !File(classFilePath).exists()) { throw ClassFileNotFoundException("Expected class file at $classFilePath after the compilation of file $path, but it does not exist.") } return executionResult diff --git a/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/kotlin/KotlinTestCompiler.kt b/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/kotlin/KotlinTestCompiler.kt index e1487ebba..6d4c9dfbc 100644 --- a/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/kotlin/KotlinTestCompiler.kt +++ b/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/kotlin/KotlinTestCompiler.kt @@ -75,7 +75,7 @@ class KotlinTestCompiler( logger.info { "Exit code: '${executionResult.exitCode}'; Execution message: '${executionResult.executionMessage}'" } val classFilePath = path.removeSuffix(".kt") + ".class" - if (!File(classFilePath).exists()) { + if (executionResult.exitCode == 0 && !File(classFilePath).exists()) { throw ClassFileNotFoundException("Expected class file at $classFilePath after the compilation of file $path, but it does not exist.") } return executionResult