Skip to content

Commit

Permalink
Fix JS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zhelenskiy committed Dec 19, 2023
1 parent 9102345 commit 8c471fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fun <T> CLICompiler<*>.tryCompilation(inputDirectory: Path, inputFiles: List<Pat
val messageSeverity: ProjectSeveriry = when (severity) {
EXCEPTION, ERROR -> ProjectSeveriry.ERROR
STRONG_WARNING, WARNING -> ProjectSeveriry.WARNING
INFO, LOGGING, OUTPUT -> ProjectSeveriry.INFO
INFO, LOGGING, OUTPUT -> return ""
}
val errorFilePath = location?.path?.let(::Path)?.outputFilePathString() ?: defaultFileName

Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/com/compiler/server/model/ExecutionResult.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ abstract class TranslationResultWithJsCode(
data class TranslationJSResult(
override val jsCode: String? = null,
override var exception: ExceptionDescriptor? = null,
@field:JsonProperty("errors")
override var compilerDiagnostics: CompilerDiagnostics = CompilerDiagnostics()
) : TranslationResultWithJsCode(jsCode, compilerDiagnostics, exception)

Expand All @@ -69,13 +70,15 @@ data class TranslationWasmResult(
val wasm: ByteArray,
val wat: String?,
override var exception: ExceptionDescriptor? = null,
@field:JsonProperty("errors")
override var compilerDiagnostics: CompilerDiagnostics = CompilerDiagnostics()
) : TranslationResultWithJsCode(jsCode, compilerDiagnostics, exception)

@JsonInclude(JsonInclude.Include.NON_EMPTY)
class JunitExecutionResult(
val testResults: Map<String, List<TestDescription>> = emptyMap(),
override var exception: ExceptionDescriptor? = null,
@field:JsonProperty("errors")
override var compilerDiagnostics: CompilerDiagnostics = CompilerDiagnostics()
) : ExecutionResult(compilerDiagnostics, exception)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ class KotlinProjectExecutor(
}
}
}

private fun CompilerDiagnostics.withoutInfoDiagnostics() = CompilerDiagnostics(
map.mapValues { (_, l) -> l.filter { it.severity != ProjectSeveriry.INFO } }.filterValues { it.isNotEmpty() }
)

fun highlight(project: Project): CompilerDiagnostics = try {
when (project.confType) {
Expand All @@ -77,7 +73,7 @@ class KotlinProjectExecutor(
} catch (e: Exception) {
log.warn("Exception in getting highlight. Project: $project", e)
CompilerDiagnostics(emptyMap())
}.withoutInfoDiagnostics()
}

fun getVersion() = version

Expand Down

0 comments on commit 8c471fd

Please sign in to comment.