-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I can't seem to figure out how to get this to work well in testing. This is how I've figured out how to get it to work
beforeAll(async () => {
module = await Test.createTestingModule({
imports: [
MongoRepositoryLocalModule,
TypeOrmTestModule,
StorefrontModule,
],
})
.setLogger(new Log4jsLogger(getLogger()))
.compile();
});Applying the module directly in createTestingModule did nothing.
we have this LoggerModule that I added it to
import { Global, Module } from '@nestjs/common';
import { Log4jsModule } from '@nestx-log4js/core';
import { LoggerFactory } from './logger.factory';
@Global()
@Module({
imports: [Log4jsModule.forRoot()],
providers: [
{
provide: LoggerFactory,
useFactory: () => new LoggerFactory(),
},
],
exports: [LoggerFactory],
})
export class LoggerModule {}which is imported by StorefrontModule
@Module({
imports: [
TypeOrmModule.forFeature([StorefrontProductAggregate]),
LoggerModule,
],
providers: [FixtureService, StorefrontProductRepository],
exports: [StorefrontProductRepository],
})
export class StorefrontModule {}but still nothing. setting the logger for the app is the only way I've been able to get it to work there too, but that's really late bound. There's got to be a better way. We don't seem to be overriding the base logger either.
Metadata
Metadata
Assignees
Labels
No labels