From 4f22d6ee1650952f4f5484c8adebaa285ca0ebc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Fri, 27 Jun 2025 18:05:37 +0200 Subject: [PATCH] feat(suite): Warn users that exceptions are printed after finalizers --- suite/src/commonMain/kotlin/RunTest.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/suite/src/commonMain/kotlin/RunTest.kt b/suite/src/commonMain/kotlin/RunTest.kt index 742aa23..ec0172a 100644 --- a/suite/src/commonMain/kotlin/RunTest.kt +++ b/suite/src/commonMain/kotlin/RunTest.kt @@ -57,6 +57,10 @@ suspend fun TestScope.runTestDslSuspend(name: String, config: TestConfig, block: try { test.block() successful = true + } catch (e: Throwable) { + println() + println("An ${e::class.simpleName ?: e::class} was thrown during the test. The details are displayed at the end of the test, possibly after the finalizers.") + throw e } finally { with(test.environment.finalizers) { test.executeAllFinalizers(successful = successful) } } -- 2.54.0