Skip to content

Commit 8df6f5a

Browse files
committed
Fix race condition in testUpstreamFailedImmediatelyWithInitialValue
1 parent 22c4301 commit 8df6f5a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kotlinx-coroutines-core/common/test/flow/sharing/StateInTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ class StateInTest : TestBase() {
7777
}
7878

7979
@Test
80-
fun testUpstreamFailedIMmediatelyWithInitialValue() = runTest {
80+
fun testUpstreamFailedImmediatelyWithInitialValue() = runTest {
8181
val ceh = CoroutineExceptionHandler { _, _ -> expect(2) }
8282
val flow = flow<Int> {
8383
expect(1)
8484
throw TestException()
8585
}
86-
assertFailsWith<TestException> { flow.stateIn(CoroutineScope(ceh)) }
86+
assertFailsWith<TestException> { flow.stateIn(CoroutineScope(currentCoroutineContext() + Job() + ceh)) }
8787
finish(3)
8888
}
8989
}

0 commit comments

Comments
 (0)