Skip to content

Mention testScope.backgroundScope in UncompletedCoroutinesError #4182

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

Closed
ZakTaccardi opened this issue Jul 18, 2024 · 0 comments
Closed

Mention testScope.backgroundScope in UncompletedCoroutinesError #4182

ZakTaccardi opened this issue Jul 18, 2024 · 0 comments

Comments

@ZakTaccardi
Copy link

Current behavior:

kotlinx.coroutines.test.UncompletedCoroutinesError: After waiting for 10s, the test coroutine is not completing, there were active child jobs

A less experienced dev may not know what to do here. a better error message might be:

kotlinx.coroutines.test.UncompletedCoroutinesError: After waiting for 10s, the test coroutine is not completing, there were active child jobs. If active child jobs are expected, consider using `testScope.backgroundScope`

Mentioning backgroundScope (docs) here would be very useful

dkhalanskyjb added a commit that referenced this issue Jul 18, 2024
The new message is added when the test body finishes in time,
but the child coroutines don't.

Fixes #4182
dkhalanskyjb added a commit that referenced this issue Jul 18, 2024
* Clearly separate the cases when the test body finished and
  was just waiting for the children from the cases where
  the test body itself kept running;
* When the test only awaits the child coroutines, mention
  `TestScope.backgroundScope`

Fixes #4182
dkhalanskyjb added a commit that referenced this issue Jul 18, 2024
* Clearly separate the cases when the test body finished and
  was just waiting for the children from the cases where
  the test body itself kept running;
* When the test only awaits the child coroutines, mention
  `TestScope.backgroundScope`

Fixes #4182
dkhalanskyjb added a commit that referenced this issue Jul 18, 2024
* Clearly separate the cases when the test body finished and
  was just waiting for the children from the cases where
  the test body itself kept running;
* When the test only awaits the child coroutines, mention
  `TestScope.backgroundScope`

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

No branches or pull requests

2 participants