CLOVIS
10/01/2025, 12:51 PMDmitry Khalanskiy [JB]
10/06/2025, 8:16 AMCLOVIS
10/06/2025, 9:33 AMIs this the problematic behavior?Yes. I have my own test framework which uses
TestScope internally, and I'd like to tweak the way this is printed. For example, to differentiate between foreground and background jobs. I agree it's a very specific use-case, and the current behavior is a good default.Dmitry Khalanskiy [JB]
10/06/2025, 11:41 AMDebugProbes API, there's no easy way to filter between background and foreground jobs (in the test framework sense, that is, backgroundScope), which I think is a great idea, well worth doing in kotlinx-coroutines-test itself.
If you file an issue, we can consider adding an escape hatch, though I'm hoping that we'll be able to improve the defaults instead.CLOVIS
10/06/2025, 12:26 PMDebugProbes API, there's no easy way to filter between background and foreground jobs
Is that so? DebugProbes.printScope() seems to me that it would be useful here, as the foreground and background jobs are different scopes, but I haven't tried.
At the moment I have an issue that backgroundScope doesn't work in my framework (it behaves in exactly the same way as the foreground scope), even though it's just an accessor for the coroutines' implementation. I'm trying to understand what's going on there, and then I'll file a more detailed issue with the dumping use-case.Dmitry Khalanskiy [JB]
10/06/2025, 12:29 PMIs that so?seems to me that it would be useful hereDebugProbes.printScope()
backgroundScope is a child of TestScope, so printing TestScope will also print the background jobs. Also, this approach will miss the coroutines that aren't (transitively) children of TestScope.CLOVIS
10/06/2025, 12:34 PMAlso, this approach will miss the coroutines that aren't (transitively) children ofHow can you differentiate between coroutines that aren't children of that TestScope, and coroutines from other tests?.TestScope
Dmitry Khalanskiy [JB]
10/06/2025, 12:37 PMCLOVIS
10/06/2025, 1:25 PMDmitry Khalanskiy [JB]
10/06/2025, 1:28 PMrunTest is our only entry reliable entry point. Maybe this would be possible with a tighter platform test framework integration (for example, if we provided JUnit rules).Oliver.O
10/09/2025, 8:01 PM