File tree 1 file changed +7
-5
lines changed
kotlinx-coroutines-test/common/src
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -45,11 +45,13 @@ private class TestCoroutineScopeImpl(
45
45
private val initialJobs = coroutineContext.activeJobs()
46
46
47
47
override fun cleanupTestCoroutines () {
48
- coroutineContext.uncaughtExceptionCaptor.cleanupTestCoroutinesCaptor()
49
- coroutineContext.delayController?.cleanupTestCoroutines()
50
- val jobs = coroutineContext.activeJobs()
51
- if ((jobs - initialJobs).isNotEmpty()) {
52
- val exception = UncompletedCoroutinesError (" Test finished with active jobs: $jobs " )
48
+ try {
49
+ coroutineContext.uncaughtExceptionCaptor.cleanupTestCoroutinesCaptor()
50
+ coroutineContext.delayController?.cleanupTestCoroutines()
51
+ val jobs = coroutineContext.activeJobs()
52
+ if ((jobs - initialJobs).isNotEmpty())
53
+ throw UncompletedCoroutinesError (" Test finished with active jobs: $jobs " )
54
+ } catch (exception: Throwable ) {
53
55
ownJob?.completeExceptionally(exception)
54
56
throw exception
55
57
}
You can’t perform that action at this time.
0 commit comments