Open javiercamarenatriguero opened 2 months ago
Can you detail it a bit more?
Thanks @arnaudgiuliani ! Sure, The issue just affects when the koin-androidx-compose
is upgraded from v3.5.0 -> v3.5.3/4. The code contains some Automation Test in Espresso, and for some reason the second Test Case of the same Test Class fails when the ViewModelFactory tries to get the instance of the ViewModel. In order to provide more information, this is the KoinTestRule
used on the Test Class (based on tutorials):
class KoinTestRule(
private val modules: List<Module> = emptyList()
) : TestWatcher() {
private val modulesByDefault = listOf(dataModule, useCaseModule, viewModelModule, appModule)
override fun starting(description: Description) {
startKoin {
androidContext(InstrumentationRegistry.getInstrumentation().targetContext.applicationContext)
modules(modulesByDefault + modules)
}
}
override fun finished(description: Description) {
stopKoin()
}
}
And this is the invocation on the Test Class:
private val instrumentedTestModule = module {
factory { getMockDataLocalSource() }
factory { getMockQuestions(questionJson) }
...
}
override val koinTestRule: KoinTestRule
get() = KoinTestRule(
modules = listOf(instrumentedTestModule)
)
The first TestCase works fine, but the second one fails on this. It happens to all the Test Classes. It was working fine until now. Thanks in advance
@arnaudgiuliani Do you have any updates regarding this issue? Our tests are also affected by the same issue, therefore we're currently not able to update the koin version.
Hi @arnaudgiuliani, any update about this issue? Thanks in advance
weird, seems that VM factory is invoked after scope closing 🤔
can anyone help by providing a test project for that? @kasim-canol-sz @javiercamarenatriguero
Describe the bug I recently upgraded to koin-androidx-compose:3.5.4 from koin-androidx-compose:3.5.0 and the Automation Test stat failing because of this error:
Tested it just affect to
koin-android-compose
library as the rest of koin libraries are not affecting the Android Test results. To Reproduce Steps to reproduce the behavior:Expected behavior It should not fail as v3.5.0 version.
Koin module and version:
koin-androidx-compose:3.5.3
&koin-androidx-compose:3.5.4