zak.taccardi
07/18/2024, 2:20 AMbackgroundScoperunTest { }runTest { }zak.taccardi
07/18/2024, 2:22 AMbackgroundScopeTestScopeUnconfinedTestDispatcherassertFailsWith(..)zak.taccardi
07/18/2024, 3:51 AMrunTest { }assertFailsWith<Exception>{ }// this works
@Test
fun currentSolution() {
    assertFailsWith<IllegalStateException> {
        executeTest {
            // executed on a background scope
            whenExceptionIsIntentionallyThrown()
        }
    }
}// does not work
@Test
fun doesNotCatchException() = executeTest {
    // executed on a background scope
    whenExceptionIsIntentionallyThrown()
    
    assertFailsWith<IllegalStateException> {
        thenIllegalStateExceptionWasThrown()
    }
}backgroundScoperunTest { }CLOVIS
07/19/2024, 8:21 AMzak.taccardi
07/19/2024, 8:51 PMThe background scope is meant to model tasks that are independent of the system-under-testwhat do you mean by this? we have a lot of ongoing actor coroutines in our codebase that build ongoing state. we don’t care about manually closing these. In production,
scope.cancel()backgroundScopeCLOVIS
07/21/2024, 12:23 PM