Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kotlinx-coroutines-test:1.6.1 - stateIn and sharedIn (that are not started while subscribed) are not practical to test with runTest #3323

Closed
AlexDochioiu opened this issue Jun 16, 2022 · 1 comment

Comments

@AlexDochioiu
Copy link

Background info: runTest won't finish unless all the coroutines launched inside also finished. This is what I'd expect for most cases but it becomes problematic if I want something along the lines of:

val uiState = myFlow
        .stateIn(viewModelScope, SharingStarted.Eagerly, UiStates.Empty)

The problem is that runTest will hang and time out because of the job started by stateIn/shareIn which is kept active until viewModelScope is canceled.

@dkhalanskyjb
Copy link
Collaborator

Duplicate of #3287.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants