You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CoroutineLaunchedInTestWithoutRunTest rule does not account for Flow usage of coroutines, however, I would expect this to be true. It works otherwise on .launch.
Observed Behavior
Rule catches .launch but does not detect and flag flowOf().launchIn() outside of runTest
Steps to Reproduce
Run rule on following test:
class TestCoroutineRunTest {
@Test
fun testFlowNoRunTest() {
flowOf("foo", "bar").launchIn(GlobalScope)
}
}
Observe no rule violation.
Context
We have heavy use of Flow (in feature code under test), as well as direct usage in tests, that is causing flakeyness.
Your Environment
This was tested with the detekt.jar which we have wired up with Buck and Bazel, using type resolution.
Detekt 1.23.3 with backported rule.
Kotlin 1.9.20
The text was updated successfully, but these errors were encountered:
Thanks for reporting this!
I removed the bug label as this finding rather shows a current limitation of this rule. The rule in the current detekt version provides a more or less naive implementation without type and symbol solving, which this rule needs to extend the analyzed scope.
Expected Behavior
The CoroutineLaunchedInTestWithoutRunTest rule does not account for Flow usage of coroutines, however, I would expect this to be true. It works otherwise on .launch.
Observed Behavior
Rule catches .launch but does not detect and flag flowOf().launchIn() outside of runTest
Steps to Reproduce
Run rule on following test:
Observe no rule violation.
Context
We have heavy use of Flow (in feature code under test), as well as direct usage in tests, that is causing flakeyness.
Your Environment
This was tested with the detekt.jar which we have wired up with Buck and Bazel, using type resolution.
Detekt 1.23.3 with backported rule.
Kotlin 1.9.20
The text was updated successfully, but these errors were encountered: