I'm quite new on nestjs
, met an issue regarding how to override the load
function of ConfigModule
, hope someone can help me out, thanks in advance!
My e2e testing:
const moduleForTesting = await Test.createTestingModule({imports: [AppModule]});
My App Module:
import config from './config/index'
@Module({
imports: [ConfigModule.forRoot({isGlobal: true, load: [config]})]
})
My config/index
file:
export default async () => {
someConfigs: ...
}
Now I want the e2e testings use another configurations, but I don't know how to override the AppModule, nor the load
function:
// AppModule
import config from './config/index' // This is ok for production, but need to be overridden in testing
...
imports: [ConfigModule.forRoot({isGlobal: true, load: [config]})]