Hi,
When trying to get a sub injectable (for example Component) it returns null.
For example:
// DatabaseModule
@Module({
modules: [],
components: [
SubService
]
})
export class AppModule {
}
// App Module
@Module({
modules: [
DatabaseModule
]
})
export class AppModule {
}
And then when trying to user createTestingModule:
const module = await Test.createTestingModule({
modules: [AppModule]
}).compile();
const subService = appModule.get<SubService>(SubService);
concole.log(subModule) // null
I found this workaround:
const dbModule = appModule.select(DatabaseModule);
const subService = dbModule.get<SubService>(SubService);
concole.log(subService) // instance of SubService
So should the get method return also nested components of other dependent modules? If so, this is a bug.
Hey @vlio20!
Nope. That's exactly why the select() method exists. There's a note about it here 馃檪
the including imported ones is a bit misleading (maybe only for me)
True, right. Thanks @vlio20, will change this 馃檪
Fixed, will be available in the next update. Thanks again @vlio20
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.