Skip to content

Commit c7808cb

Browse files
committed
Kotlin 1.5 workaround
1 parent 0ff1625 commit c7808cb

File tree

1 file changed

+6
-1
lines changed
  • kotest-framework/kotest-framework-engine/src/commonMain/kotlin/io/kotest/engine/test

1 file changed

+6
-1
lines changed

kotest-framework/kotest-framework-engine/src/commonMain/kotlin/io/kotest/engine/test/TestCaseExecutor.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import io.kotest.engine.test.interceptors.blockedThreadTimeoutInterceptor
2828
import io.kotest.engine.test.interceptors.coroutineDispatcherFactoryInterceptor
2929
import io.kotest.engine.test.interceptors.coroutineErrorCollectorInterceptor
3030
import io.kotest.mpp.Logger
31+
import kotlin.time.Duration
3132
import kotlin.time.TimeSource
3233

3334
/**
@@ -71,7 +72,11 @@ class TestCaseExecutor(
7172
val innerExecute: suspend (TestCase, TestScope) -> TestResult = { tc, scope ->
7273
logger.log { Pair(testCase.name.testName, "Executing test") }
7374
tc.test(scope)
74-
TestResult.Success(timeMark.elapsedNow())
75+
try {
76+
TestResult.Success(timeMark.elapsedNow())
77+
} catch (e: Exception) {
78+
TestResult.Success(Duration.ZERO) // kotlin 1.5 workaround
79+
}
7580
}
7681

7782
return interceptors.foldRight(innerExecute) { ext, fn ->

0 commit comments

Comments
 (0)